From 0eca2c6fefbe776796fa79af36dd38b55d569ef6 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 11 Jan 2018 07:28:12 -0600 Subject: [PATCH 001/228] Update README files --- README.txt | 11 +++++++++-- configs/flipnclick-sam3x/README.txt | 12 ++++++++---- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/README.txt b/README.txt index adfead1084..4dfd513a7f 100644 --- a/README.txt +++ b/README.txt @@ -1040,6 +1040,14 @@ NuttX Configuration Tool under DOS that can be used: http://uvc.de/posts/linux-kernel-configuration-tool-mconf-under-windows.html + The configuration steps most recent versions of NuttX require the + kconfig-tweak tool that is not not available in the the above. However, + there has been an update to this Kconfig Windows tools that does include + kconfig-tweak: http://reclonelabs.com/more-kconfig-awesomeness-for-windows/ + + Source code is available here: https://github.com/reclone/kconfig-frontends-win32 + and https://github.com/reclone/kconfig-frontends-win32/releases + It is also possible to use the version of kconfig-frontends built under Cygwin outside of the Cygwin "sandbox" in a native Windows environment: @@ -1260,7 +1268,7 @@ Build Targets and Options Perform the distclean operation only in the user application directory. The apps/.config file is preserved so that this is not a "full" distclean - but more of a configuration "reset." + but more of a configuration "reset" for the application directory. export @@ -1318,7 +1326,6 @@ Native Windows Build The windows native build logic initiated if CONFIG_WINDOWS_NATIVE=y is defined in the NuttX configuration file: - This build: - Uses all Windows style paths diff --git a/configs/flipnclick-sam3x/README.txt b/configs/flipnclick-sam3x/README.txt index 38c319414f..6cbf47b569 100644 --- a/configs/flipnclick-sam3x/README.txt +++ b/configs/flipnclick-sam3x/README.txt @@ -309,7 +309,7 @@ Loading Code PIN SIGNAL JTAG STANDARD NOTES --- -------------- ----------------- -------------------------------- - 1 3.3V VTref + 1 VCC-3.3V VTref 2 JTAG_TMS SWDIO/TMS SAM3X pin 31, Pulled up on board 3 GND GND 4 JTAG_TCK SWDCLK/TCK SAM3X pin 28, Pulled up on board @@ -318,12 +318,16 @@ Loading Code 7 N/C Key 8 JTAG_TDI NC/EXTb/TDI SAM3X pin 29, Pulled up on board 9 GND GNDDetect - 10 MASTER-RESET nReset + 10 MRST nReset - NOTE: The 10-pin JTAG connector is not populated on the Flip&Click SAM3X. + NOTE: The 10-pin JTAG connector is not populated on the Flip&Click + SAM3X. This is the part number for the SMD connector recommended by + ARM.com: Samtec FTSH-105-01-L-DV-K. For example: + + https://www.digikey.com/product-detail/en/samtec-inc/FTSH-105-01-L-DV-K/SAM8799-ND/1875039 You should be able to use a 10- to 20-pin adapter to connect a SAM-ICE - debugger to the Flip&Click SAM3X. I have this Olimex adapter: + or J-Link debugger to the Flip&Click SAM3X. I have this Olimex adapter: https://www.olimex.com/Products/ARM/JTAG/ARM-JTAG-20-10/ . But so far I have been unable to get the get the SAM-ICE to communicate with the Flip&Click. -- GitLab From 537c9a27d1e11ae664aefe210a0a2cff68871669 Mon Sep 17 00:00:00 2001 From: Matt Thompson Date: Thu, 11 Jan 2018 07:34:56 -0600 Subject: [PATCH 002/228] arch/arm/src/samdl: In sam_spibus_initialize(), the pinmux configuration was smashing the previous CTRLA register configuration. There are also some typos in samd_spi.h --- arch/arm/src/samdl/chip/samd_spi.h | 4 ++-- arch/arm/src/samdl/sam_spi.c | 12 +++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/arch/arm/src/samdl/chip/samd_spi.h b/arch/arm/src/samdl/chip/samd_spi.h index 8bdcc9e21e..b045c32c40 100644 --- a/arch/arm/src/samdl/chip/samd_spi.h +++ b/arch/arm/src/samdl/chip/samd_spi.h @@ -247,8 +247,8 @@ #endif #ifdef CONFIG_ARCH_FAMILY_SAMD21 -# define SPI_INT_ SSL (1 << 3) /* Bit 3: Slave select low interrupt */ -# define SPI_INT_ ERROR (1 << 7) /* Bit 7: Error interrupt */ +# define SPI_INT_SSL (1 << 3) /* Bit 3: Slave select low interrupt */ +# define SPI_INT_ERROR (1 << 7) /* Bit 7: Error interrupt */ # define SPI_INT_ALL (0x8f) #endif diff --git a/arch/arm/src/samdl/sam_spi.c b/arch/arm/src/samdl/sam_spi.c index 1f945b7659..833e4e3ff5 100644 --- a/arch/arm/src/samdl/sam_spi.c +++ b/arch/arm/src/samdl/sam_spi.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/samdl/sam_spi.c * - * Copyright (C) 2014-2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2014-2018 Gregory Nutt. All rights reserved. * Authors: Gregory Nutt * * References: @@ -1421,7 +1421,7 @@ struct spi_dev_s *sam_spibus_initialize(int port) /* Set the SERCOM in SPI master mode (no address) */ regval = spi_getreg32(priv, SAM_SPI_CTRLA_OFFSET); - regval &= ~SPI_CTRLA_MODE_MASK; + regval &= ~(SPI_CTRLA_MODE_MASK | SPI_CTRLA_FORM_MASK); regval |= (SPI_CTRLA_MODE_MASTER | SPI_CTRLA_FORM_SPI); spi_putreg32(priv, regval, SAM_SPI_CTRLA_OFFSET); @@ -1435,11 +1435,13 @@ struct spi_dev_s *sam_spibus_initialize(int port) (void)spi_setfrequency((struct spi_dev_s *)priv, 400000); - /* Set MSB first data order and the configured pad mux setting, - * Note that SPI mode 0 is assumed initially (CPOL=0 and CPHA=0). + /* Set MSB first data order and the configured pad mux setting. + * SPI mode 0 is assumed initially (CPOL=0 and CPHA=0). */ - regval = (SPI_CTRLA_MSBFIRST | priv->muxconfig); + regval &= ~(SPI_CTRLA_DOPO_MASK | SPI_CTRLA_DIPO_MASK); + regval &= ~(SPI_CTRLA_CPHA | SPI_CTRLA_CPOL); + regval |= (SPI_CTRLA_MSBFIRST | priv->muxconfig); spi_putreg32(priv, regval, SAM_SPI_CTRLA_OFFSET); /* Enable the receiver. Note that 8-bit data width is assumed initially */ -- GitLab From f5cac7c45a0ee66bfde9f0c7934b458b827a3b02 Mon Sep 17 00:00:00 2001 From: Matt Thompson Date: Thu, 11 Jan 2018 13:00:08 -0800 Subject: [PATCH 003/228] SAMDL fix g_spi2ops and g_spi2dev using incorrect values --- arch/arm/src/samdl/sam_spi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm/src/samdl/sam_spi.c b/arch/arm/src/samdl/sam_spi.c index 833e4e3ff5..0596d9e84c 100644 --- a/arch/arm/src/samdl/sam_spi.c +++ b/arch/arm/src/samdl/sam_spi.c @@ -292,13 +292,13 @@ static struct sam_spidev_s g_spi1dev = static const struct spi_ops_s g_spi2ops = { .lock = spi_lock, - .select = sam_spi0select, + .select = sam_spi2select, .setfrequency = spi_setfrequency, .setmode = spi_setmode, .setbits = spi_setbits, - .status = sam_spi0status, + .status = sam_spi2status, #ifdef CONFIG_SPI_CMDDATA - .cmddata = sam_spi0cmddata, + .cmddata = sam_spi2cmddata, #endif .send = spi_send, #ifdef CONFIG_SPI_EXCHANGE @@ -314,7 +314,7 @@ static const struct spi_ops_s g_spi2ops = static struct sam_spidev_s g_spi2dev = { - .ops = &g_spi1ops, + .ops = &g_spi2ops, .sercom = 2, #if 0 /* Not used */ .irq = SAM_IRQ_SERCOM2, -- GitLab From 4758aa5bc468331e417ae338be381f811b3dcbae Mon Sep 17 00:00:00 2001 From: Matt Thompson Date: Thu, 11 Jan 2018 21:00:33 -0800 Subject: [PATCH 004/228] SAMD External Interrupt Controller (EIC) support --- arch/arm/include/samdl/samd21_irq.h | 4 +- arch/arm/src/samdl/Kconfig | 4 + arch/arm/src/samdl/Make.defs | 4 + arch/arm/src/samdl/chip/samd_eic.h | 191 +++++++++++++++++++++++++ arch/arm/src/samdl/sam_eic.c | 211 ++++++++++++++++++++++++++++ arch/arm/src/samdl/sam_eic.h | 109 ++++++++++++++ arch/arm/src/samdl/sam_port.c | 26 +++- 7 files changed, 545 insertions(+), 4 deletions(-) create mode 100644 arch/arm/src/samdl/chip/samd_eic.h create mode 100644 arch/arm/src/samdl/sam_eic.c create mode 100644 arch/arm/src/samdl/sam_eic.h diff --git a/arch/arm/include/samdl/samd21_irq.h b/arch/arm/include/samdl/samd21_irq.h index e0b26bf962..8c44ed256d 100644 --- a/arch/arm/include/samdl/samd21_irq.h +++ b/arch/arm/include/samdl/samd21_irq.h @@ -86,9 +86,9 @@ #define SAM_IRQ_NINTS (28) /* Total number of interrupts */ #define SAM_IRQ_NIRQS (SAM_IRQ_INTERRUPT+28) /* The number of real interrupts */ -/* GPIO interrupts. Up to 16 pins may be configured to support interrupts */ +/* EIC interrupts. Up to 16 pins may be configured to support interrupts */ -#ifdef CONFIG_SAMDL_GPIOIRQ +#ifdef CONFIG_SAMDL_EIC # define SAM_IRQ_EXTINT0 (SAM_IRQ_NIRQS+0) /* External interrupt 0 */ # define SAM_IRQ_EXTINT1 (SAM_IRQ_NIRQS+1) /* External interrupt 1 */ # define SAM_IRQ_EXTINT2 (SAM_IRQ_NIRQS+2) /* External interrupt 2 */ diff --git a/arch/arm/src/samdl/Kconfig b/arch/arm/src/samdl/Kconfig index ec8507a048..9813e7192d 100644 --- a/arch/arm/src/samdl/Kconfig +++ b/arch/arm/src/samdl/Kconfig @@ -572,6 +572,10 @@ config SAMDL_USB default n depends on SAMDL_HAVE_USB +config SAMDL_EIC + bool "External Interrupt Controller" + default n + config SAMDL_WDT bool "Watchdog Timer" default n diff --git a/arch/arm/src/samdl/Make.defs b/arch/arm/src/samdl/Make.defs index 71b156c6c7..1ce9c0e5b8 100644 --- a/arch/arm/src/samdl/Make.defs +++ b/arch/arm/src/samdl/Make.defs @@ -102,3 +102,7 @@ endif ifeq ($(CONFIG_SAMDL_USB),y) CHIP_CSRCS += sam_usb.c endif + +ifeq ($(CONFIG_SAMDL_EIC),y) +CHIP_CSRCS += sam_eic.c +endif diff --git a/arch/arm/src/samdl/chip/samd_eic.h b/arch/arm/src/samdl/chip/samd_eic.h new file mode 100644 index 0000000000..9bbd0dc4fe --- /dev/null +++ b/arch/arm/src/samdl/chip/samd_eic.h @@ -0,0 +1,191 @@ +/******************************************************************************************** + * arch/arm/src/samdl/chip/samd_eic.h + * + * Copyright (C) 2018 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * Matt Thompson + * + * References: + * "Microchip SAMD21 datasheet" + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ********************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_SAMDL_CHIP_SAMD_EIC_H +#define __ARCH_ARM_SRC_SAMDL_CHIP_SAMD_EIC_H + +/******************************************************************************************** + * Included Files + ********************************************************************************************/ + +#include + +#include "chip.h" + +#ifdef CONFIG_ARCH_FAMILY_SAMD21 + +/******************************************************************************************** + * Pre-processor Definitions + ********************************************************************************************/ +/* EIC register offsets *********************************************************************/ + +#define SAM_EIC_CTRLA_OFFSET 0x0000 /* Control A register */ +#define SAM_EIC_STATUS_OFFSET 0x0001 /* Status register */ +#define SAM_EIC_NMICTRL_OFFSET 0x0002 /* Non-maskable interrupt control register */ +#define SAM_EIC_NMIFLAG_OFFSET 0x0003 /* Non-maskable interrupt flag register */ +#define SAM_EIC_EVCTRL_OFFSET 0x0004 /* Event control register */ +#define SAM_EIC_INTENCLR_OFFSET 0x0008 /* Interrupt enable clear register */ +#define SAM_EIC_INTENSET_OFFSET 0x000c /* Interrupt enable set register */ +#define SAM_EIC_INTFLAG_OFFSET 0x0010 /* Interrupt flag and status clear register */ +#define SAM_EIC_WAKEUP_OFFSET 0x0014 /* Wakeup register */ +#define SAM_EIC_CONFIG0_OFFSET 0x0018 /* Configuration 0 register */ +#define SAM_EIC_CONFIG1_OFFSET 0x001c /* Configuration 1 register */ +#define SAM_EIC_CONFIG2_OFFSET 0x0020 /* Configuration 2 register */ + +/* EIC register addresses *******************************************************************/ + +#define SAM_EIC_CTRLA (SAM_EIC_BASE+SAM_EIC_CTRLA_OFFSET) +#define SAM_EIC_STATUS (SAM_EIC_BASE+SAM_EIC_STATUS_OFFSET) +#define SAM_EIC_NMICTRL (SAM_EIC_BASE+SAM_EIC_NMICTRL_OFFSET) +#define SAM_EIC_NMIFLAG (SAM_EIC_BASE+SAM_EIC_NMIFLAG_OFFSET) +#define SAM_EIC_EVCTRL (SAM_EIC_BASE+SAM_EIC_EVCTRL_OFFSET) +#define SAM_EIC_INTENCLR (SAM_EIC_BASE+SAM_EIC_INTENCLR_OFFSET) +#define SAM_EIC_INTENSET (SAM_EIC_BASE+SAM_EIC_INTENSET_OFFSET) +#define SAM_EIC_INTFLAG (SAM_EIC_BASE+SAM_EIC_INTFLAG_OFFSET) +#define SAM_EIC_WAKEUP (SAM_EIC_BASE+SAM_EIC_WAKEUP_OFFSET) +#define SAM_EIC_CONFIG0 (SAM_EIC_BASE+SAM_EIC_CONFIG0_OFFSET) +#define SAM_EIC_CONFIG1 (SAM_EIC_BASE+SAM_EIC_CONFIG1_OFFSET) +#define SAM_EIC_CONFIG2 (SAM_EIC_BASE+SAM_EIC_CONFIG2_OFFSET) + +/* EIC register bit definitions *************************************************************/ + +/* Control A register */ + +#define EIC_CTRLA_SWRST (1 << 0) /* Bit 0: Software reset */ +#define EIC_CTRLA_ENABLE (1 << 1) /* Bit 1: Enable */ + +/* Status register */ + +#define EIC_STATUS_SYNCBUSY (1 << 7) /* Bit 7: Syncronization busy */ + +/* Non-maskable interrupt control register */ + +#define EIC_NMICTRL_NMISENSE_SHIFT (0) /* Bits 0-2: Non-maskable interrupt sense */ +#define EIC_NMICTRL_NMISENSE_MASK (7 << EIC_NVMICTRL_NMISENSE_SHIFT) +# define EIC_NMICTRL_NMISENSE_NONE (0 << EIC_NVMICTRL_NMISENSE_SHIFT) /* No detection */ +# define EIC_NMICTRL_NMISENSE_RISE (1 << EIC_NVMICTRL_NMISENSE_SHIFT) /* Rising edge detection */ +# define EIC_NMICTRL_NMISENSE_FALL (2 << EIC_NVMICTRL_NMISENSE_SHIFT) /* Falling edge detection */ +# define EIC_NMICTRL_NMISENSE_BOTH (3 << EIC_NVMICTRL_NMISENSE_SHIFT) /* Both edge detection */ +# define EIC_NMICTRL_NMISENSE_HIGH (4 << EIC_NVMICTRL_NMISENSE_SHIFT) /* High level detection */ +# define EIC_NMICTRL_NMISENSE_LOW (5 << EIC_NVMICTRL_NMISENSE_SHIFT) /* Low level detection */ +#define EIC_NMICTRL_NMIFLTEN (1 << 3) /* Bit 3: Non-maskable interrupt filter enable */ + +/* Non-maskable interrupt flas status and clear register */ + +#define EIC_NMIFLAG_NMI (1 << 0) /* Non-maskable interrupt */ + +/* Event control, Interrupt enable clear, interrupt enable set register, interrupt flag + * status and clear, and external interrupt wakeup registers. + */ + +#define EIC_EXTINT_SHIFT (0) /* Bits 0-15: External interrupt n */ +#define EIC_EXTINT_MASK (0x3ffff << EIC_EXTINT_SHIFT) +//# define EIC_EXTINT(n) ((uint32_t)(n) << EIC_EXTINT_SHIFT) +# define EIC_EXTINT(n) (1 << (n)) +# define EIC_EXTINT_0 (1 << 0) /* Bit 0: External interrupt 0 */ +# define EIC_EXTINT_1 (1 << 1) /* Bit 1: External interrupt 1 */ +# define EIC_EXTINT_2 (1 << 2) /* Bit 2: External interrupt 2 */ +# define EIC_EXTINT_3 (1 << 3) /* Bit 3: External interrupt 3 */ +# define EIC_EXTINT_4 (1 << 4) /* Bit 4: External interrupt 4 */ +# define EIC_EXTINT_5 (1 << 5) /* Bit 5: External interrupt 5 */ +# define EIC_EXTINT_6 (1 << 6) /* Bit 6: External interrupt 6 */ +# define EIC_EXTINT_7 (1 << 7) /* Bit 7: External interrupt 7 */ +# define EIC_EXTINT_8 (1 << 8) /* Bit 8: External interrupt 8 */ +# define EIC_EXTINT_9 (1 << 9) /* Bit 9: External interrupt 9 */ +# define EIC_EXTINT_10 (1 << 10) /* Bit 10: External interrupt 10 */ +# define EIC_EXTINT_11 (1 << 11) /* Bit 11: External interrupt 11 */ +# define EIC_EXTINT_12 (1 << 12) /* Bit 12: External interrupt 12 */ +# define EIC_EXTINT_13 (1 << 13) /* Bit 13: External interrupt 13 */ +# define EIC_EXTINT_14 (1 << 14) /* Bit 14: External interrupt 14 */ +# define EIC_EXTINT_15 (1 << 15) /* Bit 15: External interrupt 15 */ +# define EIC_EXTINT_16 (1 << 16) /* Bit 16: External interrupt 16 */ +# define EIC_EXTINT_17 (1 << 17) /* Bit 17: External interrupt 17 */ + +#define EIC_EXTINT_ALL EIC_EXTINT_MASK + +/* Configuration 0 register */ + +#define EIC_CONFIG0_FILTEN(n) (0x8 << ((n) << 2)) /* Filter n enable, n=0-7 */ +#define EIC_CONFIG0_SENSE_SHIFT(n) ((n) << 2) /* Filter n input sense, n=0-7 */ +#define EIC_CONFIG0_SENSE_MASK(n) (7 << EIC_CONFIG0_SENSE_SHIFT(n)) +# define EIC_CONFIG0_SENSE_NONE(n) (0 << EIC_CONFIG0_SENSE_SHIFT(n)) /* No detection */ +# define EIC_CONFIG0_SENSE_RISE(n) (1 << EIC_CONFIG0_SENSE_SHIFT(n)) /* Rising edge detection */ +# define EIC_CONFIG0_SENSE_FALL(n) (2 << EIC_CONFIG0_SENSE_SHIFT(n)) /* Falling edge detection */ +# define EIC_CONFIG0_SENSE_BOTH(n) (3 << EIC_CONFIG0_SENSE_SHIFT(n)) /* Both edge detection */ +# define EIC_CONFIG0_SENSE_HIGH(n) (4 << EIC_CONFIG0_SENSE_SHIFT(n)) /* High level detection */ +# define EIC_CONFIG0_SENSE_LOW(n) (5 << EIC_CONFIG0_SENSE_SHIFT(n)) /* Low level detection */ + +/* Configuration 1 register */ + +#define EIC_CONFIG1_FILTEN(n) (0x8 << (((n) - 8) << 2)) /* Filter n enable, n=8-15 */ +#define EIC_CONFIG1_SENSE_SHIFT(n) (((n) - 8) << 2) /* Filter n input sense, n=8-17 */ +#define EIC_CONFIG1_SENSE_MASK(n) (7 << EIC_CONFIG1_SENSE_SHIFT(n)) +# define EIC_CONFIG1_SENSE_NONE(n) (0 << EIC_CONFIG1_SENSE_SHIFT(n)) /* No detection */ +# define EIC_CONFIG1_SENSE_RISE(n) (1 << EIC_CONFIG1_SENSE_SHIFT(n)) /* Rising edge detection */ +# define EIC_CONFIG1_SENSE_FALL(n) (2 << EIC_CONFIG1_SENSE_SHIFT(n)) /* Falling edge detection */ +# define EIC_CONFIG1_SENSE_BOTH(n) (3 << EIC_CONFIG1_SENSE_SHIFT(n)) /* Both edge detection */ +# define EIC_CONFIG1_SENSE_HIGH(n) (4 << EIC_CONFIG1_SENSE_SHIFT(n)) /* High level detection */ +# define EIC_CONFIG1_SENSE_LOW(n) (5 << EIC_CONFIG1_SENSE_SHIFT(n)) /* Low level detection */ + +/* Configuration 2 register */ + +#define EIC_CONFIG2_FILTEN(n) (0x8 << (((n) - 16) << 2)) /* Filter n enable, n=16-23 */ +#define EIC_CONFIG2_SENSE_SHIFT(n) (((n) - 16) << 2) /* Filter n input sense, n=16-23 */ +#define EIC_CONFIG2_SENSE_MASK(n) (7 << EIC_CONFIG2_SENSE_SHIFT(n)) +# define EIC_CONFIG2_SENSE_NONE(n) (0 << EIC_CONFIG2_SENSE_SHIFT(n)) /* No detection */ +# define EIC_CONFIG2_SENSE_RISE(n) (1 << EIC_CONFIG2_SENSE_SHIFT(n)) /* Rising edge detection */ +# define EIC_CONFIG2_SENSE_FALL(n) (2 << EIC_CONFIG2_SENSE_SHIFT(n)) /* Falling edge detection */ +# define EIC_CONFIG2_SENSE_BOTH(n) (3 << EIC_CONFIG2_SENSE_SHIFT(n)) /* Both edge detection */ +# define EIC_CONFIG2_SENSE_HIGH(n) (4 << EIC_CONFIG2_SENSE_SHIFT(n)) /* High level detection */ +# define EIC_CONFIG2_SENSE_LOW(n) (5 << EIC_CONFIG2_SENSE_SHIFT(n)) /* Low level detection */ + +/******************************************************************************************** + * Public Types + ********************************************************************************************/ + +/******************************************************************************************** + * Public Data + ********************************************************************************************/ + +/******************************************************************************************** + * Public Functions + ********************************************************************************************/ + +#endif /* CONFIG_ARCH_FAMILY_SAMD21 */ +#endif /* __ARCH_ARM_SRC_SAMDL_CHIP_SAMD_EIC_H */ diff --git a/arch/arm/src/samdl/sam_eic.c b/arch/arm/src/samdl/sam_eic.c new file mode 100644 index 0000000000..e666154838 --- /dev/null +++ b/arch/arm/src/samdl/sam_eic.c @@ -0,0 +1,211 @@ +/**************************************************************************** + * arch/arm/src/samdl/sam_eic.c + * + * Copyright (C) 2018 Gregory Nutt. All rights reserved. + * Author: Matt Thompson + * + * References: + * 1. "Microchip SAM D21E / SAM D21G / SAM D21J Datasheet" + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +#include "up_arch.h" + +#include "sam_config.h" + +#include "sam_pm.h" +#include "sam_gclk.h" +#include "sam_periphclks.h" +#include "sam_eic.h" +#include "sam_port.h" + +#include +#include +#include + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +static int sam_eic_isr(int irq, FAR void *context, FAR void *arg) +{ + uint32_t intflag; + int bit; + + /* Get the pending interrupt flag register */ + + intflag = getreg32(SAM_EIC_INTFLAG); + + /* Dispatch the IRQ to the SAM_IRQ_EXTINTn handlers */ + + for(bit=0;bit> bit & 0x1) + { + irq_dispatch(SAM_IRQ_EXTINT0 + bit, context); + } + } + + /* Clear the pending interrupt flags */ + + putreg32(EIC_EXTINT_ALL, SAM_EIC_INTFLAG); + + return 0; +} + +static void sam_eic_syncwait(void) +{ + while ((getreg8(SAM_EIC_STATUS) & EIC_STATUS_SYNCBUSY) != 0); +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +void sam_eic_dumpregs(void) +{ + irqinfo("EIC:\n"); + irqinfo(" CTRLA: %02x\n", getreg8(SAM_EIC_CTRLA)); + irqinfo(" STATUS: %02x\n", getreg8(SAM_EIC_STATUS)); + irqinfo(" NMICTRL: %02x\n", getreg8(SAM_EIC_NMICTRL)); + irqinfo(" NMIFLAG: %02x\n", getreg8(SAM_EIC_NMIFLAG)); + irqinfo(" EVCTRL: %08x\n", getreg32(SAM_EIC_EVCTRL)); + irqinfo(" INTENCLR: %08x\n", getreg32(SAM_EIC_INTENCLR)); + irqinfo(" INTENSET: %08x\n", getreg32(SAM_EIC_INTENSET)); + irqinfo(" INTFLAG: %08x\n", getreg32(SAM_EIC_INTFLAG)); + irqinfo(" WAKEUP: %08x\n", getreg32(SAM_EIC_WAKEUP)); + irqinfo(" CONFIG0: %08x\n", getreg32(SAM_EIC_CONFIG0)); + irqinfo(" CONFIG1: %08x\n", getreg32(SAM_EIC_CONFIG1)); + irqinfo(" CONFIG2: %08x\n", getreg32(SAM_EIC_CONFIG2)); +} + +/**************************************************************************** + * Name: sam_eic_initialize + * + * Description: + * Configure the external interrupt controller. + * + ****************************************************************************/ + +int sam_eic_initialize(uint8_t gclkgen) +{ + uint16_t regval; + + sam_eic_enableperiph(); + + regval = GCLK_CLKCTRL_ID_EIC | GCLK_CLKCTRL_GEN(gclkgen) | GCLK_CLKCTRL_CLKEN; + putreg16(regval, SAM_GCLK_CLKCTRL); + + putreg8(EIC_CTRLA_ENABLE, SAM_EIC_CTRLA); + sam_eic_syncwait(); + + irq_attach(SAM_IRQ_EIC, sam_eic_isr, NULL); + + sam_eic_dumpregs(); + + up_enable_irq(SAM_IRQ_EIC); + + return OK; +} + +int sam_eic_irq_enable(int irq) +{ + uint32_t config; + int eirq = irq - SAM_IRQ_EXTINT0; + + config = getreg32(SAM_EIC_CONFIG0); + config |= EIC_CONFIG0_FILTEN(eirq) | EIC_CONFIG0_SENSE_FALL(eirq); + putreg32(config, SAM_EIC_CONFIG0); + + putreg32(EIC_EXTINT(eirq), SAM_EIC_INTENSET); + sam_eic_dumpregs(); + return OK; +} + +int sam_eic_config(uint8_t eirq, port_pinset_t pinset) +{ + uint32_t reg; + uint32_t val; + uint32_t config; + + /* Determine which of the CONFIG[0:2] registers to write to */ + + if(eirq < 8) + { + reg = SAM_EIC_CONFIG0; + + val = EIC_CONFIG0_SENSE_BOTH(eirq); + if(pinset & PORT_INT_RISING) + val = EIC_CONFIG0_SENSE_RISE(eirq); + if(pinset & PORT_INT_FALLING) + val = EIC_CONFIG0_SENSE_FALL(eirq); + val |= EIC_CONFIG0_FILTEN(eirq); + } + else if(eirq < 16) + { + reg = SAM_EIC_CONFIG1; + val = EIC_CONFIG1_FILTEN(eirq) | EIC_CONFIG1_SENSE_FALL(eirq); + } + else + { + reg = SAM_EIC_CONFIG2; + val = EIC_CONFIG2_FILTEN(eirq) | EIC_CONFIG2_SENSE_FALL(eirq); + } + + /* Write the new config to the CONFIGn register */ + + config = getreg32(reg); + config |= val; + putreg32(config, reg); + + /* Enable interrupt generation for this pin */ + + putreg32(EIC_EXTINT(eirq), SAM_EIC_INTENSET); + + sam_eic_dumpregs(); + + return OK; +} diff --git a/arch/arm/src/samdl/sam_eic.h b/arch/arm/src/samdl/sam_eic.h new file mode 100644 index 0000000000..b149d182ea --- /dev/null +++ b/arch/arm/src/samdl/sam_eic.h @@ -0,0 +1,109 @@ +/**************************************************************************** + * arch/arm/src/samdl/sam_eic.h + * + * Copyright (C) 2018 Gregory Nutt. All rights reserved. + * Author: Matt Thompson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __ARCH_ARM_SRC_SAMDL_SAM_EIC_H +#define __ARCH_ARM_SRC_SAMDL_SAM_EIC_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +#include "sam_config.h" +#include "sam_port.h" + +#if defined(CONFIG_ARCH_FAMILY_SAMD20) || defined(CONFIG_ARCH_FAMILY_SAMD21) +# include "chip/samd_eic.h" +#elif defined(CONFIG_ARCH_FAMILY_SAML21) +# include "chip/saml_eic.h" +#else +# error Unrecognized SAMD/L architecture +#endif + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/**************************************************************************** + * Inline Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Name: sam_eic_configure + * + * Description: + * Configure the EIC + * + * Input Parameters: + * gclkgen - GCLK Generator + * + * Returned Value: + * None + * + ****************************************************************************/ + +int sam_eic_initialize(uint8_t gclkgen); +int sam_eic_config(uint8_t eirq, port_pinset_t pinset); + +#undef EXTERN +#if defined(__cplusplus) +} +#endif +#endif /* __ARCH_ARM_SRC_SAMDL_SAM_EIC_H */ diff --git a/arch/arm/src/samdl/sam_port.c b/arch/arm/src/samdl/sam_port.c index b757de5c58..534ecef49c 100644 --- a/arch/arm/src/samdl/sam_port.c +++ b/arch/arm/src/samdl/sam_port.c @@ -57,6 +57,7 @@ #include "chip.h" #include "sam_port.h" +#include "sam_eic.h" /**************************************************************************** * Private Data @@ -189,7 +190,27 @@ static inline void sam_configinput(uintptr_t base, port_pinset_t pinset) static inline void sam_configinterrupt(uintptr_t base, port_pinset_t pinset) { -#warning Missing logic + uint32_t func; + uint32_t regval; + int pin; + + pin = (pinset & PORT_PIN_MASK) >> PORT_PIN_SHIFT; + + regval = (PORT_WRCONFIG_WRPINCFG | PORT_WRCONFIG_WRPMUX | PORT_WRCONFIG_PMUXEN | PORT_WRCONFIG_INEN); + regval |= PORT_WRCONFIG_PINMASK(pin); + + func = (pinset & PORT_FUNC_MASK) >> PORT_FUNC_SHIFT; + regval |= (func << PORT_WRCONFIG_PMUX_SHIFT); + + putreg32(regval, base + SAM_PORT_WRCONFIG_OFFSET); + + /* Configure the interrupt edge sensitivity in CONFIGn register of the EIC */ + + sam_eic_config(pin, pinset); + +#ifdef CONFIG_DEBUG_GPIO_INFO + sam_dumpport(pinset, "extint"); +#endif } /**************************************************************************** @@ -531,7 +552,8 @@ int sam_dumpport(uint32_t pinset, const char *msg) /* Get the base address associated with the PIO port */ - pin = sam_portpin(pinset); + //pin = sam_portpin(pinset); + pin = (pinset & PORT_PIN_MASK) >> PORT_PIN_SHIFT; port = (pinset & PORT_MASK) >> PORT_SHIFT; base = SAM_PORTN_BASE(port); -- GitLab From 7ded6d5fd7b53f67e9f7f20e660194976f988775 Mon Sep 17 00:00:00 2001 From: Matt Thompson Date: Thu, 11 Jan 2018 21:12:40 -0800 Subject: [PATCH 005/228] removed comment --- arch/arm/src/samdl/sam_port.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/arm/src/samdl/sam_port.c b/arch/arm/src/samdl/sam_port.c index 534ecef49c..19be6f030f 100644 --- a/arch/arm/src/samdl/sam_port.c +++ b/arch/arm/src/samdl/sam_port.c @@ -552,7 +552,6 @@ int sam_dumpport(uint32_t pinset, const char *msg) /* Get the base address associated with the PIO port */ - //pin = sam_portpin(pinset); pin = (pinset & PORT_PIN_MASK) >> PORT_PIN_SHIFT; port = (pinset & PORT_MASK) >> PORT_SHIFT; base = SAM_PORTN_BASE(port); -- GitLab From 48355b32dc00be0a3e8b75cff148ac0a72fc0ff4 Mon Sep 17 00:00:00 2001 From: Matt Thompson Date: Fri, 12 Jan 2018 13:11:58 +0000 Subject: [PATCH 006/228] Merged in extent3d/nuttx (pull request #568) SAMD External Interrupt Controller (EIC) support * SAMD External Interrupt Controller (EIC) support * removed comment Approved-by: Gregory Nutt --- arch/arm/include/samdl/samd21_irq.h | 4 +- arch/arm/src/samdl/Kconfig | 4 + arch/arm/src/samdl/Make.defs | 4 + arch/arm/src/samdl/chip/samd_eic.h | 191 +++++++++++++++++++++++++ arch/arm/src/samdl/sam_eic.c | 211 ++++++++++++++++++++++++++++ arch/arm/src/samdl/sam_eic.h | 109 ++++++++++++++ arch/arm/src/samdl/sam_port.c | 25 +++- 7 files changed, 544 insertions(+), 4 deletions(-) create mode 100644 arch/arm/src/samdl/chip/samd_eic.h create mode 100644 arch/arm/src/samdl/sam_eic.c create mode 100644 arch/arm/src/samdl/sam_eic.h diff --git a/arch/arm/include/samdl/samd21_irq.h b/arch/arm/include/samdl/samd21_irq.h index e0b26bf962..8c44ed256d 100644 --- a/arch/arm/include/samdl/samd21_irq.h +++ b/arch/arm/include/samdl/samd21_irq.h @@ -86,9 +86,9 @@ #define SAM_IRQ_NINTS (28) /* Total number of interrupts */ #define SAM_IRQ_NIRQS (SAM_IRQ_INTERRUPT+28) /* The number of real interrupts */ -/* GPIO interrupts. Up to 16 pins may be configured to support interrupts */ +/* EIC interrupts. Up to 16 pins may be configured to support interrupts */ -#ifdef CONFIG_SAMDL_GPIOIRQ +#ifdef CONFIG_SAMDL_EIC # define SAM_IRQ_EXTINT0 (SAM_IRQ_NIRQS+0) /* External interrupt 0 */ # define SAM_IRQ_EXTINT1 (SAM_IRQ_NIRQS+1) /* External interrupt 1 */ # define SAM_IRQ_EXTINT2 (SAM_IRQ_NIRQS+2) /* External interrupt 2 */ diff --git a/arch/arm/src/samdl/Kconfig b/arch/arm/src/samdl/Kconfig index ec8507a048..9813e7192d 100644 --- a/arch/arm/src/samdl/Kconfig +++ b/arch/arm/src/samdl/Kconfig @@ -572,6 +572,10 @@ config SAMDL_USB default n depends on SAMDL_HAVE_USB +config SAMDL_EIC + bool "External Interrupt Controller" + default n + config SAMDL_WDT bool "Watchdog Timer" default n diff --git a/arch/arm/src/samdl/Make.defs b/arch/arm/src/samdl/Make.defs index 71b156c6c7..1ce9c0e5b8 100644 --- a/arch/arm/src/samdl/Make.defs +++ b/arch/arm/src/samdl/Make.defs @@ -102,3 +102,7 @@ endif ifeq ($(CONFIG_SAMDL_USB),y) CHIP_CSRCS += sam_usb.c endif + +ifeq ($(CONFIG_SAMDL_EIC),y) +CHIP_CSRCS += sam_eic.c +endif diff --git a/arch/arm/src/samdl/chip/samd_eic.h b/arch/arm/src/samdl/chip/samd_eic.h new file mode 100644 index 0000000000..9bbd0dc4fe --- /dev/null +++ b/arch/arm/src/samdl/chip/samd_eic.h @@ -0,0 +1,191 @@ +/******************************************************************************************** + * arch/arm/src/samdl/chip/samd_eic.h + * + * Copyright (C) 2018 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * Matt Thompson + * + * References: + * "Microchip SAMD21 datasheet" + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ********************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_SAMDL_CHIP_SAMD_EIC_H +#define __ARCH_ARM_SRC_SAMDL_CHIP_SAMD_EIC_H + +/******************************************************************************************** + * Included Files + ********************************************************************************************/ + +#include + +#include "chip.h" + +#ifdef CONFIG_ARCH_FAMILY_SAMD21 + +/******************************************************************************************** + * Pre-processor Definitions + ********************************************************************************************/ +/* EIC register offsets *********************************************************************/ + +#define SAM_EIC_CTRLA_OFFSET 0x0000 /* Control A register */ +#define SAM_EIC_STATUS_OFFSET 0x0001 /* Status register */ +#define SAM_EIC_NMICTRL_OFFSET 0x0002 /* Non-maskable interrupt control register */ +#define SAM_EIC_NMIFLAG_OFFSET 0x0003 /* Non-maskable interrupt flag register */ +#define SAM_EIC_EVCTRL_OFFSET 0x0004 /* Event control register */ +#define SAM_EIC_INTENCLR_OFFSET 0x0008 /* Interrupt enable clear register */ +#define SAM_EIC_INTENSET_OFFSET 0x000c /* Interrupt enable set register */ +#define SAM_EIC_INTFLAG_OFFSET 0x0010 /* Interrupt flag and status clear register */ +#define SAM_EIC_WAKEUP_OFFSET 0x0014 /* Wakeup register */ +#define SAM_EIC_CONFIG0_OFFSET 0x0018 /* Configuration 0 register */ +#define SAM_EIC_CONFIG1_OFFSET 0x001c /* Configuration 1 register */ +#define SAM_EIC_CONFIG2_OFFSET 0x0020 /* Configuration 2 register */ + +/* EIC register addresses *******************************************************************/ + +#define SAM_EIC_CTRLA (SAM_EIC_BASE+SAM_EIC_CTRLA_OFFSET) +#define SAM_EIC_STATUS (SAM_EIC_BASE+SAM_EIC_STATUS_OFFSET) +#define SAM_EIC_NMICTRL (SAM_EIC_BASE+SAM_EIC_NMICTRL_OFFSET) +#define SAM_EIC_NMIFLAG (SAM_EIC_BASE+SAM_EIC_NMIFLAG_OFFSET) +#define SAM_EIC_EVCTRL (SAM_EIC_BASE+SAM_EIC_EVCTRL_OFFSET) +#define SAM_EIC_INTENCLR (SAM_EIC_BASE+SAM_EIC_INTENCLR_OFFSET) +#define SAM_EIC_INTENSET (SAM_EIC_BASE+SAM_EIC_INTENSET_OFFSET) +#define SAM_EIC_INTFLAG (SAM_EIC_BASE+SAM_EIC_INTFLAG_OFFSET) +#define SAM_EIC_WAKEUP (SAM_EIC_BASE+SAM_EIC_WAKEUP_OFFSET) +#define SAM_EIC_CONFIG0 (SAM_EIC_BASE+SAM_EIC_CONFIG0_OFFSET) +#define SAM_EIC_CONFIG1 (SAM_EIC_BASE+SAM_EIC_CONFIG1_OFFSET) +#define SAM_EIC_CONFIG2 (SAM_EIC_BASE+SAM_EIC_CONFIG2_OFFSET) + +/* EIC register bit definitions *************************************************************/ + +/* Control A register */ + +#define EIC_CTRLA_SWRST (1 << 0) /* Bit 0: Software reset */ +#define EIC_CTRLA_ENABLE (1 << 1) /* Bit 1: Enable */ + +/* Status register */ + +#define EIC_STATUS_SYNCBUSY (1 << 7) /* Bit 7: Syncronization busy */ + +/* Non-maskable interrupt control register */ + +#define EIC_NMICTRL_NMISENSE_SHIFT (0) /* Bits 0-2: Non-maskable interrupt sense */ +#define EIC_NMICTRL_NMISENSE_MASK (7 << EIC_NVMICTRL_NMISENSE_SHIFT) +# define EIC_NMICTRL_NMISENSE_NONE (0 << EIC_NVMICTRL_NMISENSE_SHIFT) /* No detection */ +# define EIC_NMICTRL_NMISENSE_RISE (1 << EIC_NVMICTRL_NMISENSE_SHIFT) /* Rising edge detection */ +# define EIC_NMICTRL_NMISENSE_FALL (2 << EIC_NVMICTRL_NMISENSE_SHIFT) /* Falling edge detection */ +# define EIC_NMICTRL_NMISENSE_BOTH (3 << EIC_NVMICTRL_NMISENSE_SHIFT) /* Both edge detection */ +# define EIC_NMICTRL_NMISENSE_HIGH (4 << EIC_NVMICTRL_NMISENSE_SHIFT) /* High level detection */ +# define EIC_NMICTRL_NMISENSE_LOW (5 << EIC_NVMICTRL_NMISENSE_SHIFT) /* Low level detection */ +#define EIC_NMICTRL_NMIFLTEN (1 << 3) /* Bit 3: Non-maskable interrupt filter enable */ + +/* Non-maskable interrupt flas status and clear register */ + +#define EIC_NMIFLAG_NMI (1 << 0) /* Non-maskable interrupt */ + +/* Event control, Interrupt enable clear, interrupt enable set register, interrupt flag + * status and clear, and external interrupt wakeup registers. + */ + +#define EIC_EXTINT_SHIFT (0) /* Bits 0-15: External interrupt n */ +#define EIC_EXTINT_MASK (0x3ffff << EIC_EXTINT_SHIFT) +//# define EIC_EXTINT(n) ((uint32_t)(n) << EIC_EXTINT_SHIFT) +# define EIC_EXTINT(n) (1 << (n)) +# define EIC_EXTINT_0 (1 << 0) /* Bit 0: External interrupt 0 */ +# define EIC_EXTINT_1 (1 << 1) /* Bit 1: External interrupt 1 */ +# define EIC_EXTINT_2 (1 << 2) /* Bit 2: External interrupt 2 */ +# define EIC_EXTINT_3 (1 << 3) /* Bit 3: External interrupt 3 */ +# define EIC_EXTINT_4 (1 << 4) /* Bit 4: External interrupt 4 */ +# define EIC_EXTINT_5 (1 << 5) /* Bit 5: External interrupt 5 */ +# define EIC_EXTINT_6 (1 << 6) /* Bit 6: External interrupt 6 */ +# define EIC_EXTINT_7 (1 << 7) /* Bit 7: External interrupt 7 */ +# define EIC_EXTINT_8 (1 << 8) /* Bit 8: External interrupt 8 */ +# define EIC_EXTINT_9 (1 << 9) /* Bit 9: External interrupt 9 */ +# define EIC_EXTINT_10 (1 << 10) /* Bit 10: External interrupt 10 */ +# define EIC_EXTINT_11 (1 << 11) /* Bit 11: External interrupt 11 */ +# define EIC_EXTINT_12 (1 << 12) /* Bit 12: External interrupt 12 */ +# define EIC_EXTINT_13 (1 << 13) /* Bit 13: External interrupt 13 */ +# define EIC_EXTINT_14 (1 << 14) /* Bit 14: External interrupt 14 */ +# define EIC_EXTINT_15 (1 << 15) /* Bit 15: External interrupt 15 */ +# define EIC_EXTINT_16 (1 << 16) /* Bit 16: External interrupt 16 */ +# define EIC_EXTINT_17 (1 << 17) /* Bit 17: External interrupt 17 */ + +#define EIC_EXTINT_ALL EIC_EXTINT_MASK + +/* Configuration 0 register */ + +#define EIC_CONFIG0_FILTEN(n) (0x8 << ((n) << 2)) /* Filter n enable, n=0-7 */ +#define EIC_CONFIG0_SENSE_SHIFT(n) ((n) << 2) /* Filter n input sense, n=0-7 */ +#define EIC_CONFIG0_SENSE_MASK(n) (7 << EIC_CONFIG0_SENSE_SHIFT(n)) +# define EIC_CONFIG0_SENSE_NONE(n) (0 << EIC_CONFIG0_SENSE_SHIFT(n)) /* No detection */ +# define EIC_CONFIG0_SENSE_RISE(n) (1 << EIC_CONFIG0_SENSE_SHIFT(n)) /* Rising edge detection */ +# define EIC_CONFIG0_SENSE_FALL(n) (2 << EIC_CONFIG0_SENSE_SHIFT(n)) /* Falling edge detection */ +# define EIC_CONFIG0_SENSE_BOTH(n) (3 << EIC_CONFIG0_SENSE_SHIFT(n)) /* Both edge detection */ +# define EIC_CONFIG0_SENSE_HIGH(n) (4 << EIC_CONFIG0_SENSE_SHIFT(n)) /* High level detection */ +# define EIC_CONFIG0_SENSE_LOW(n) (5 << EIC_CONFIG0_SENSE_SHIFT(n)) /* Low level detection */ + +/* Configuration 1 register */ + +#define EIC_CONFIG1_FILTEN(n) (0x8 << (((n) - 8) << 2)) /* Filter n enable, n=8-15 */ +#define EIC_CONFIG1_SENSE_SHIFT(n) (((n) - 8) << 2) /* Filter n input sense, n=8-17 */ +#define EIC_CONFIG1_SENSE_MASK(n) (7 << EIC_CONFIG1_SENSE_SHIFT(n)) +# define EIC_CONFIG1_SENSE_NONE(n) (0 << EIC_CONFIG1_SENSE_SHIFT(n)) /* No detection */ +# define EIC_CONFIG1_SENSE_RISE(n) (1 << EIC_CONFIG1_SENSE_SHIFT(n)) /* Rising edge detection */ +# define EIC_CONFIG1_SENSE_FALL(n) (2 << EIC_CONFIG1_SENSE_SHIFT(n)) /* Falling edge detection */ +# define EIC_CONFIG1_SENSE_BOTH(n) (3 << EIC_CONFIG1_SENSE_SHIFT(n)) /* Both edge detection */ +# define EIC_CONFIG1_SENSE_HIGH(n) (4 << EIC_CONFIG1_SENSE_SHIFT(n)) /* High level detection */ +# define EIC_CONFIG1_SENSE_LOW(n) (5 << EIC_CONFIG1_SENSE_SHIFT(n)) /* Low level detection */ + +/* Configuration 2 register */ + +#define EIC_CONFIG2_FILTEN(n) (0x8 << (((n) - 16) << 2)) /* Filter n enable, n=16-23 */ +#define EIC_CONFIG2_SENSE_SHIFT(n) (((n) - 16) << 2) /* Filter n input sense, n=16-23 */ +#define EIC_CONFIG2_SENSE_MASK(n) (7 << EIC_CONFIG2_SENSE_SHIFT(n)) +# define EIC_CONFIG2_SENSE_NONE(n) (0 << EIC_CONFIG2_SENSE_SHIFT(n)) /* No detection */ +# define EIC_CONFIG2_SENSE_RISE(n) (1 << EIC_CONFIG2_SENSE_SHIFT(n)) /* Rising edge detection */ +# define EIC_CONFIG2_SENSE_FALL(n) (2 << EIC_CONFIG2_SENSE_SHIFT(n)) /* Falling edge detection */ +# define EIC_CONFIG2_SENSE_BOTH(n) (3 << EIC_CONFIG2_SENSE_SHIFT(n)) /* Both edge detection */ +# define EIC_CONFIG2_SENSE_HIGH(n) (4 << EIC_CONFIG2_SENSE_SHIFT(n)) /* High level detection */ +# define EIC_CONFIG2_SENSE_LOW(n) (5 << EIC_CONFIG2_SENSE_SHIFT(n)) /* Low level detection */ + +/******************************************************************************************** + * Public Types + ********************************************************************************************/ + +/******************************************************************************************** + * Public Data + ********************************************************************************************/ + +/******************************************************************************************** + * Public Functions + ********************************************************************************************/ + +#endif /* CONFIG_ARCH_FAMILY_SAMD21 */ +#endif /* __ARCH_ARM_SRC_SAMDL_CHIP_SAMD_EIC_H */ diff --git a/arch/arm/src/samdl/sam_eic.c b/arch/arm/src/samdl/sam_eic.c new file mode 100644 index 0000000000..e666154838 --- /dev/null +++ b/arch/arm/src/samdl/sam_eic.c @@ -0,0 +1,211 @@ +/**************************************************************************** + * arch/arm/src/samdl/sam_eic.c + * + * Copyright (C) 2018 Gregory Nutt. All rights reserved. + * Author: Matt Thompson + * + * References: + * 1. "Microchip SAM D21E / SAM D21G / SAM D21J Datasheet" + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +#include "up_arch.h" + +#include "sam_config.h" + +#include "sam_pm.h" +#include "sam_gclk.h" +#include "sam_periphclks.h" +#include "sam_eic.h" +#include "sam_port.h" + +#include +#include +#include + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +static int sam_eic_isr(int irq, FAR void *context, FAR void *arg) +{ + uint32_t intflag; + int bit; + + /* Get the pending interrupt flag register */ + + intflag = getreg32(SAM_EIC_INTFLAG); + + /* Dispatch the IRQ to the SAM_IRQ_EXTINTn handlers */ + + for(bit=0;bit> bit & 0x1) + { + irq_dispatch(SAM_IRQ_EXTINT0 + bit, context); + } + } + + /* Clear the pending interrupt flags */ + + putreg32(EIC_EXTINT_ALL, SAM_EIC_INTFLAG); + + return 0; +} + +static void sam_eic_syncwait(void) +{ + while ((getreg8(SAM_EIC_STATUS) & EIC_STATUS_SYNCBUSY) != 0); +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +void sam_eic_dumpregs(void) +{ + irqinfo("EIC:\n"); + irqinfo(" CTRLA: %02x\n", getreg8(SAM_EIC_CTRLA)); + irqinfo(" STATUS: %02x\n", getreg8(SAM_EIC_STATUS)); + irqinfo(" NMICTRL: %02x\n", getreg8(SAM_EIC_NMICTRL)); + irqinfo(" NMIFLAG: %02x\n", getreg8(SAM_EIC_NMIFLAG)); + irqinfo(" EVCTRL: %08x\n", getreg32(SAM_EIC_EVCTRL)); + irqinfo(" INTENCLR: %08x\n", getreg32(SAM_EIC_INTENCLR)); + irqinfo(" INTENSET: %08x\n", getreg32(SAM_EIC_INTENSET)); + irqinfo(" INTFLAG: %08x\n", getreg32(SAM_EIC_INTFLAG)); + irqinfo(" WAKEUP: %08x\n", getreg32(SAM_EIC_WAKEUP)); + irqinfo(" CONFIG0: %08x\n", getreg32(SAM_EIC_CONFIG0)); + irqinfo(" CONFIG1: %08x\n", getreg32(SAM_EIC_CONFIG1)); + irqinfo(" CONFIG2: %08x\n", getreg32(SAM_EIC_CONFIG2)); +} + +/**************************************************************************** + * Name: sam_eic_initialize + * + * Description: + * Configure the external interrupt controller. + * + ****************************************************************************/ + +int sam_eic_initialize(uint8_t gclkgen) +{ + uint16_t regval; + + sam_eic_enableperiph(); + + regval = GCLK_CLKCTRL_ID_EIC | GCLK_CLKCTRL_GEN(gclkgen) | GCLK_CLKCTRL_CLKEN; + putreg16(regval, SAM_GCLK_CLKCTRL); + + putreg8(EIC_CTRLA_ENABLE, SAM_EIC_CTRLA); + sam_eic_syncwait(); + + irq_attach(SAM_IRQ_EIC, sam_eic_isr, NULL); + + sam_eic_dumpregs(); + + up_enable_irq(SAM_IRQ_EIC); + + return OK; +} + +int sam_eic_irq_enable(int irq) +{ + uint32_t config; + int eirq = irq - SAM_IRQ_EXTINT0; + + config = getreg32(SAM_EIC_CONFIG0); + config |= EIC_CONFIG0_FILTEN(eirq) | EIC_CONFIG0_SENSE_FALL(eirq); + putreg32(config, SAM_EIC_CONFIG0); + + putreg32(EIC_EXTINT(eirq), SAM_EIC_INTENSET); + sam_eic_dumpregs(); + return OK; +} + +int sam_eic_config(uint8_t eirq, port_pinset_t pinset) +{ + uint32_t reg; + uint32_t val; + uint32_t config; + + /* Determine which of the CONFIG[0:2] registers to write to */ + + if(eirq < 8) + { + reg = SAM_EIC_CONFIG0; + + val = EIC_CONFIG0_SENSE_BOTH(eirq); + if(pinset & PORT_INT_RISING) + val = EIC_CONFIG0_SENSE_RISE(eirq); + if(pinset & PORT_INT_FALLING) + val = EIC_CONFIG0_SENSE_FALL(eirq); + val |= EIC_CONFIG0_FILTEN(eirq); + } + else if(eirq < 16) + { + reg = SAM_EIC_CONFIG1; + val = EIC_CONFIG1_FILTEN(eirq) | EIC_CONFIG1_SENSE_FALL(eirq); + } + else + { + reg = SAM_EIC_CONFIG2; + val = EIC_CONFIG2_FILTEN(eirq) | EIC_CONFIG2_SENSE_FALL(eirq); + } + + /* Write the new config to the CONFIGn register */ + + config = getreg32(reg); + config |= val; + putreg32(config, reg); + + /* Enable interrupt generation for this pin */ + + putreg32(EIC_EXTINT(eirq), SAM_EIC_INTENSET); + + sam_eic_dumpregs(); + + return OK; +} diff --git a/arch/arm/src/samdl/sam_eic.h b/arch/arm/src/samdl/sam_eic.h new file mode 100644 index 0000000000..b149d182ea --- /dev/null +++ b/arch/arm/src/samdl/sam_eic.h @@ -0,0 +1,109 @@ +/**************************************************************************** + * arch/arm/src/samdl/sam_eic.h + * + * Copyright (C) 2018 Gregory Nutt. All rights reserved. + * Author: Matt Thompson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __ARCH_ARM_SRC_SAMDL_SAM_EIC_H +#define __ARCH_ARM_SRC_SAMDL_SAM_EIC_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +#include "sam_config.h" +#include "sam_port.h" + +#if defined(CONFIG_ARCH_FAMILY_SAMD20) || defined(CONFIG_ARCH_FAMILY_SAMD21) +# include "chip/samd_eic.h" +#elif defined(CONFIG_ARCH_FAMILY_SAML21) +# include "chip/saml_eic.h" +#else +# error Unrecognized SAMD/L architecture +#endif + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/**************************************************************************** + * Inline Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Name: sam_eic_configure + * + * Description: + * Configure the EIC + * + * Input Parameters: + * gclkgen - GCLK Generator + * + * Returned Value: + * None + * + ****************************************************************************/ + +int sam_eic_initialize(uint8_t gclkgen); +int sam_eic_config(uint8_t eirq, port_pinset_t pinset); + +#undef EXTERN +#if defined(__cplusplus) +} +#endif +#endif /* __ARCH_ARM_SRC_SAMDL_SAM_EIC_H */ diff --git a/arch/arm/src/samdl/sam_port.c b/arch/arm/src/samdl/sam_port.c index b757de5c58..19be6f030f 100644 --- a/arch/arm/src/samdl/sam_port.c +++ b/arch/arm/src/samdl/sam_port.c @@ -57,6 +57,7 @@ #include "chip.h" #include "sam_port.h" +#include "sam_eic.h" /**************************************************************************** * Private Data @@ -189,7 +190,27 @@ static inline void sam_configinput(uintptr_t base, port_pinset_t pinset) static inline void sam_configinterrupt(uintptr_t base, port_pinset_t pinset) { -#warning Missing logic + uint32_t func; + uint32_t regval; + int pin; + + pin = (pinset & PORT_PIN_MASK) >> PORT_PIN_SHIFT; + + regval = (PORT_WRCONFIG_WRPINCFG | PORT_WRCONFIG_WRPMUX | PORT_WRCONFIG_PMUXEN | PORT_WRCONFIG_INEN); + regval |= PORT_WRCONFIG_PINMASK(pin); + + func = (pinset & PORT_FUNC_MASK) >> PORT_FUNC_SHIFT; + regval |= (func << PORT_WRCONFIG_PMUX_SHIFT); + + putreg32(regval, base + SAM_PORT_WRCONFIG_OFFSET); + + /* Configure the interrupt edge sensitivity in CONFIGn register of the EIC */ + + sam_eic_config(pin, pinset); + +#ifdef CONFIG_DEBUG_GPIO_INFO + sam_dumpport(pinset, "extint"); +#endif } /**************************************************************************** @@ -531,7 +552,7 @@ int sam_dumpport(uint32_t pinset, const char *msg) /* Get the base address associated with the PIO port */ - pin = sam_portpin(pinset); + pin = (pinset & PORT_PIN_MASK) >> PORT_PIN_SHIFT; port = (pinset & PORT_MASK) >> PORT_SHIFT; base = SAM_PORTN_BASE(port); -- GitLab From 9f80e4ccf16f4f0a84eca921043bb21e0a6e2338 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 12 Jan 2018 08:34:19 -0600 Subject: [PATCH 007/228] sched/: Various fixes for typos, improved parameter verification. --- sched/pthread/pthread_setschedparam.c | 7 ++----- sched/sched/sched.h | 6 +++++- sched/semaphore/sem_recover.c | 2 +- sched/task/task_create.c | 4 ++-- sched/task/task_setcanceltype.c | 2 +- sched/wdog/wd_delete.c | 14 ++++++++++---- 6 files changed, 21 insertions(+), 14 deletions(-) diff --git a/sched/pthread/pthread_setschedparam.c b/sched/pthread/pthread_setschedparam.c index 3c04cfb023..f5ce5c5391 100644 --- a/sched/pthread/pthread_setschedparam.c +++ b/sched/pthread/pthread_setschedparam.c @@ -1,7 +1,8 @@ /**************************************************************************** * sched/pthread/pthread_setschedparam.c * - * Copyright (C) 2007, 2008, 2012, 2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008, 2012, 2015, 2018 Gregory Nutt. All rights + * reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -105,10 +106,6 @@ int pthread_setschedparam(pthread_t thread, int policy, sinfo("thread ID=%d policy=%d param=0x%p\n", thread, policy, param); - /* Set the errno to some non-zero value (failsafe) */ - - set_errno(EINVAL); - /* Let sched_setscheduler do all of the work */ ret = sched_setscheduler((pid_t)thread, policy, param); diff --git a/sched/sched/sched.h b/sched/sched/sched.h index eea2a3b1c2..d083dc6a59 100644 --- a/sched/sched/sched.h +++ b/sched/sched/sched.h @@ -1,7 +1,7 @@ /**************************************************************************** * sched/sched/sched.h * - * Copyright (C) 2007-2014, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2014, 2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -63,6 +63,10 @@ * tasks built into the design). */ +#if CONFIG_MAX_TASKS & (CONFIG_MAX_TASKS - 1) +# error CONFIG_MAX_TASKS must be power of 2 +#endif + #define MAX_TASKS_MASK (CONFIG_MAX_TASKS-1) #define PIDHASH(pid) ((pid) & MAX_TASKS_MASK) diff --git a/sched/semaphore/sem_recover.c b/sched/semaphore/sem_recover.c index bccb904e07..6305f0d35e 100644 --- a/sched/semaphore/sem_recover.c +++ b/sched/semaphore/sem_recover.c @@ -105,7 +105,7 @@ void nxsem_recover(FAR struct tcb_s *tcb) nxsem_canceled(tcb, sem); /* And increment the count on the semaphore. This releases the count - * that was taken by sem_post(). This count decremented the semaphore + * that was taken by sem_wait(). This count decremented the semaphore * count to negative and caused the thread to be blocked in the first * place. */ diff --git a/sched/task/task_create.c b/sched/task/task_create.c index a1d07e1d8e..2cc8c1a911 100644 --- a/sched/task/task_create.c +++ b/sched/task/task_create.c @@ -103,11 +103,11 @@ static int thread_create(FAR const char *name, uint8_t ttype, int priority, goto errout; } +#ifdef HAVE_TASK_GROUP /* Allocate a new task group with privileges appropriate for the parent * thread type. */ -#ifdef HAVE_TASK_GROUP ret = group_allocate(tcb, ttype); if (ret < 0) { @@ -157,9 +157,9 @@ static int thread_create(FAR const char *name, uint8_t ttype, int priority, (void)task_argsetup(tcb, name, argv); +#ifdef HAVE_TASK_GROUP /* Now we have enough in place that we can join the group */ -#ifdef HAVE_TASK_GROUP ret = group_initialize(tcb); if (ret < 0) { diff --git a/sched/task/task_setcanceltype.c b/sched/task/task_setcanceltype.c index b7536f4625..3c08c5d320 100644 --- a/sched/task/task_setcanceltype.c +++ b/sched/task/task_setcanceltype.c @@ -52,7 +52,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: task_setcancelstate + * Name: task_setcanceltype * * Description: * The task_setcanceltype() function atomically both sets the calling diff --git a/sched/wdog/wd_delete.c b/sched/wdog/wd_delete.c index a497c1146e..7b56bede46 100644 --- a/sched/wdog/wd_delete.c +++ b/sched/wdog/wd_delete.c @@ -1,7 +1,8 @@ /**************************************************************************** * sched/wdog/wd_delete.c * - * Copyright (C) 2007-2009, 2014, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2014, 2016, 2018 Gregory Nutt. All rights + * reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -113,9 +114,7 @@ int wd_delete(WDOG_ID wdog) sched_kfree(wdog); } - /* This was a pre-allocated timer. This function should not be called for - * statically allocated timers. - */ + /* Check if this is pre-allocated timer. */ else if (!WDOG_ISSTATIC(wdog)) { @@ -129,6 +128,13 @@ int wd_delete(WDOG_ID wdog) leave_critical_section(flags); } + /* This function should not be called for statically allocated timers. */ + + else + { + leave_critical_section(flags); + } + /* Return success */ return OK; -- GitLab From 335d1e00305b5f8799d26f705a94ebf4fcaa985e Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 12 Jan 2018 17:40:04 -0600 Subject: [PATCH 008/228] fs/procfs: Fix an error in a common function that manages read data. --- fs/procfs/fs_procfsutil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/procfs/fs_procfsutil.c b/fs/procfs/fs_procfsutil.c index 7a71ff1854..9dd4f53674 100644 --- a/fs/procfs/fs_procfsutil.c +++ b/fs/procfs/fs_procfsutil.c @@ -124,7 +124,7 @@ size_t procfs_memcpy(FAR const char *src, size_t srclen, /* Handle the remaining offset */ srclen -= lnoffset; - dest += lnoffset; + src += lnoffset; *offset = 0; /* Copy the line into the user destination buffer */ -- GitLab From 008022547376d4f725672a5f45cf1b5548e9f380 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 12 Jan 2018 17:41:09 -0600 Subject: [PATCH 009/228] sched/irq: Add a configuration option to show interrupt information via a procfs file. --- fs/procfs/fs_procfs.c | 13 +- include/nuttx/irq.h | 4 +- sched/Kconfig | 9 + sched/irq/Make.defs | 9 +- sched/irq/irq.h | 53 ++++- sched/irq/irq_attach.c | 12 +- sched/irq/irq_dispatch.c | 32 ++- sched/irq/irq_foreach.c | 118 ++++++++++ sched/irq/irq_initialize.c | 11 +- sched/irq/irq_procfs.c | 443 +++++++++++++++++++++++++++++++++++++ 10 files changed, 690 insertions(+), 14 deletions(-) create mode 100644 sched/irq/irq_foreach.c create mode 100644 sched/irq/irq_procfs.c diff --git a/fs/procfs/fs_procfs.c b/fs/procfs/fs_procfs.c index e269d873e3..5b5801aa91 100644 --- a/fs/procfs/fs_procfs.c +++ b/fs/procfs/fs_procfs.c @@ -77,6 +77,7 @@ ****************************************************************************/ extern const struct procfs_operations proc_operations; +extern const struct procfs_operations irq_operations; extern const struct procfs_operations cpuload_operations; extern const struct procfs_operations meminfo_operations; extern const struct procfs_operations module_operations; @@ -124,8 +125,12 @@ static const struct procfs_entry_s g_procfs_entries[] = { "cpuload", &cpuload_operations, PROCFS_FILE_TYPE }, #endif +#ifdef CONFIG_SCHED_IRQMONITOR + { "irqs", &irq_operations, PROCFS_FILE_TYPE }, +#endif + #ifndef CONFIG_FS_PROCFS_EXCLUDE_MEMINFO - { "meminfo", &meminfo_operations, PROCFS_FILE_TYPE }, + { "meminfo", &meminfo_operations, PROCFS_FILE_TYPE }, #endif #if defined(CONFIG_MODULE) && !defined(CONFIG_FS_PROCFS_EXCLUDE_MODULE) @@ -133,15 +138,15 @@ static const struct procfs_entry_s g_procfs_entries[] = #endif #ifndef CONFIG_FS_PROCFS_EXCLUDE_BLOCKS - { "fs/blocks", &mount_procfsoperations, PROCFS_FILE_TYPE }, + { "fs/blocks", &mount_procfsoperations, PROCFS_FILE_TYPE }, #endif #ifndef CONFIG_FS_PROCFS_EXCLUDE_MOUNT - { "fs/mount", &mount_procfsoperations, PROCFS_FILE_TYPE }, + { "fs/mount", &mount_procfsoperations, PROCFS_FILE_TYPE }, #endif #ifndef CONFIG_FS_PROCFS_EXCLUDE_USAGE - { "fs/usage", &mount_procfsoperations, PROCFS_FILE_TYPE }, + { "fs/usage", &mount_procfsoperations, PROCFS_FILE_TYPE }, #endif #if defined(CONFIG_FS_SMARTFS) && !defined(CONFIG_FS_PROCFS_EXCLUDE_SMARTFS) diff --git a/include/nuttx/irq.h b/include/nuttx/irq.h index 8f4ed3824f..e5674d81c0 100644 --- a/include/nuttx/irq.h +++ b/include/nuttx/irq.h @@ -114,8 +114,8 @@ typedef uint32_t irq_mapped_t; /* This struct defines the form of an interrupt service routine */ -typedef int (*xcpt_t)(int irq, FAR void *context, FAR void *arg); -#endif +typedef CODE int (*xcpt_t)(int irq, FAR void *context, FAR void *arg); +#endif /* __ASSEMBLY__ */ /* Now include architecture-specific types */ diff --git a/sched/Kconfig b/sched/Kconfig index 6a50b93fe8..64af6daf10 100644 --- a/sched/Kconfig +++ b/sched/Kconfig @@ -623,6 +623,15 @@ endmenu # Pthread Options menu "Performance Monitoring" +config SCHED_IRQMONITOR + bool "Enable IRQ monitoring" + default n + depends on FS_PROCFS + ---help--- + Enabling counting of interrupts from all interrupt sources. These + counts will be available in the mounted procfs file systems at the + top-level file, "irqs". + config SCHED_CPULOAD bool "Enable CPU load monitoring" default n diff --git a/sched/irq/Make.defs b/sched/irq/Make.defs index 72636e3ea2..8ae2fde5c3 100644 --- a/sched/irq/Make.defs +++ b/sched/irq/Make.defs @@ -1,7 +1,7 @@ ############################################################################ # sched/irq/Make.defs # -# Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved. +# Copyright (C) 2014, 2016, 2018 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -44,6 +44,13 @@ else ifeq ($(CONFIG_SCHED_INSTRUMENTATION_CSECTION),y) CSRCS += irq_csection.c endif +ifeq ($(CONFIG_SCHED_IRQMONITOR),y) +CSRCS += irq_foreach.c +ifeq ($(CONFIG_FS_PROCFS),y) +CSRCS += irq_procfs.c +endif +endif + # Include irq build support DEPPATH += --dep-path irq diff --git a/sched/irq/irq.h b/sched/irq/irq.h index ffb6e9859a..ac38158f3c 100644 --- a/sched/irq/irq.h +++ b/sched/irq/irq.h @@ -1,7 +1,8 @@ /**************************************************************************** * sched/irq/irq.h * - * Copyright (C) 2007, 2008, 2013-2014, 2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008, 2013-2014, 2017-2018 Gregory Nutt. All rights + * reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -71,10 +72,26 @@ struct irq_info_s { - xcpt_t handler; /* Address of the interrupt handler */ - FAR void *arg; /* The argument provided to the interrupt handler. */ + xcpt_t handler; /* Address of the interrupt handler */ + FAR void *arg; /* The argument provided to the interrupt handler. */ +#ifdef CONFIG_SCHED_IRQMONITOR + systime_t start; /* Time interrupt attached */ +#ifdef CONFIG_HAVE_LONG_LONG + uint64_t count; /* Number of interrupts on this IRQ */ +#else + uint32_t mscount; /* Number of interrupts on this IRQ (MS) */ + uint32_t lscount; /* Number of interrupts on this IRQ (LS) */ +#endif +#endif }; +#ifdef CONFIG_SCHED_IRQMONITOR +/* This is the type of the callback from irq_foreach(). */ + +typedef CODE int (*irq_foreach_t)(int irq, FAR struct irq_info_s *info, + FAR void *arg); +#endif + /**************************************************************************** * Public Data ****************************************************************************/ @@ -180,6 +197,36 @@ int irq_unexpected_isr(int irq, FAR void *context, FAR void *arg); bool irq_cpu_locked(int cpu); #endif +/**************************************************************************** + * Name: irq_foreach + * + * Description: + * This function traverses the internal list of interrupts and provides + * information about each attached interrupt. + * + * Some caution may be necessary: If interrupts are disabled then the + * counts may change during the traversal. If pre-emption is enabled, then + * the traversed sequence may be widely separated in time. + * + * Input Parameters: + * callback - This function will be called for each attached interrupt + * along with the IRQ number, an instance of struct irq_info_s, + * and the caller provided argument + * args - This is an opaque argument provided with each call to the + * callback function. + * + * Returned Value: + * Zero (OK) is returned after callback has been invoked for all of + * the attached interrupts. The callback function may terminate the + * traversal at any time by returning a non-zero value. In that case, + * irq_foreach will return that non-zero value. + * + ****************************************************************************/ + +#ifdef CONFIG_SCHED_IRQMONITOR +int irq_foreach(irq_foreach_t callback, FAR void *arg); +#endif + #undef EXTERN #ifdef __cplusplus } diff --git a/sched/irq/irq_attach.c b/sched/irq/irq_attach.c index a55ba758e6..da03f09427 100644 --- a/sched/irq/irq_attach.c +++ b/sched/irq/irq_attach.c @@ -1,7 +1,8 @@ /**************************************************************************** * sched/irq/irq_attach.c * - * Copyright (C) 2007-2008, 2010, 2012, 2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2008, 2010, 2012, 2017-2018 Gregory Nutt. All rights + * reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -115,6 +116,15 @@ int irq_attach(int irq, xcpt_t isr, FAR void *arg) g_irqvector[ndx].handler = isr; g_irqvector[ndx].arg = arg; +#ifdef CONFIG_SCHED_IRQMONITOR + g_irqvector[ndx].start = clock_systimer(); +#ifdef CONFIG_HAVE_LONG_LONG + g_irqvector[ndx].count = 0; +#else + g_irqvector[ndx].mscount = 0; + g_irqvector[ndx].lscount = 0; +#endif +#endif leave_critical_section(flags); ret = OK; diff --git a/sched/irq/irq_dispatch.c b/sched/irq/irq_dispatch.c index b311e8a2c1..ef78824213 100644 --- a/sched/irq/irq_dispatch.c +++ b/sched/irq/irq_dispatch.c @@ -1,7 +1,7 @@ /**************************************************************************** * sched/irq/irq_dispatch.c * - * Copyright (C) 2007, 2008, 2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008, 2017-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -46,6 +46,33 @@ #include "irq/irq.h" +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#ifdef CONFIG_SCHED_IRQMONITOR +# ifdef CONFIG_HAVE_LONG_LONG +# define INCR_COUNT(ndx) \ + do \ + { \ + g_irqvector[ndx].count++; \ + } \ + while (0) +# else +# define INCR_COUNT(ndx) \ + do \ + { \ + if (++g_irqvector[ndx].lscount == 0) \ + { \ + g_irqvector[ndx].mscount++; \ + } \ + } \ + while (0) +# endif +#else +# define INCR_COUNT(ndx) +#endif + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -86,13 +113,14 @@ void irq_dispatch(int irq, FAR void *context) { vector = g_irqvector[ndx].handler; arg = g_irqvector[ndx].arg; + INCR_COUNT(ndx); } #else vector = g_irqvector[irq].handler; arg = g_irqvector[irq].arg; + INCR_COUNT(irq); #endif } - #else vector = irq_unexpected_isr; arg = NULL; diff --git a/sched/irq/irq_foreach.c b/sched/irq/irq_foreach.c new file mode 100644 index 0000000000..731fcf706f --- /dev/null +++ b/sched/irq/irq_foreach.c @@ -0,0 +1,118 @@ +/**************************************************************************** + * sched/irq/irq_foreach.c + * + * Copyright (C) 2018 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +#include + +#include "irq/irq.h" + +#ifdef CONFIG_SCHED_IRQMONITOR + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* This is the number of entries in the interrupt vector table */ + +#ifdef CONFIG_ARCH_MINIMAL_VECTORTABLE +# define TAB_SIZE CONFIG_ARCH_NUSER_INTERRUPTS +#else +# define TAB_SIZE NR_IRQS +#endif + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: irq_foreach + * + * Description: + * This function traverses the internal list of interrupts and provides + * information about each attached interrupt. + * + * Some caution may be necessary: If interrupts are disabled then the + * counts may change during the traversal. If pre-emption is enabled, then + * the traversed sequence may be widely separated in time. + * + * Input Parameters: + * callback - This function will be called for each attached interrupt + * along with the IRQ number, an instance of struct irq_info_s, + * and the caller provided argument + * args - This is an opaque argument provided with each call to the + * callback function. + * + * Returned Value: + * Zero (OK) is returned after callback has been invoked for all of + * the attached interrupts. The callback function may terminate the + * traversal at any time by returning a non-zero value. In that case, + * irq_foreach will return that non-zero value. + * + ****************************************************************************/ + +int irq_foreach(irq_foreach_t callback, FAR void *arg) +{ + int irq; + int ret; + + DEBUGASSERT(callback != NULL); + + /* Visit each interrupt in the interrupt table */ + + for (irq = 0; irq < TAB_SIZE; irq++) + { + if (g_irqvector[irq].handler != NULL && + g_irqvector[irq].handler != irq_unexpected_isr) + { + ret = callback(irq, &g_irqvector[irq], arg); + if (ret != 0) + { + return ret; + } + } + } + + return OK; +} + +#endif /* CONFIG_SCHED_IRQMONITOR */ diff --git a/sched/irq/irq_initialize.c b/sched/irq/irq_initialize.c index 18bbafc4b3..b2355f9a90 100644 --- a/sched/irq/irq_initialize.c +++ b/sched/irq/irq_initialize.c @@ -1,7 +1,7 @@ /**************************************************************************** * sched/irq/irq_initialize.c * - * Copyright (C) 2007-2008, 2010 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2008, 2010, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -89,5 +89,14 @@ void irq_initialize(void) { g_irqvector[i].handler = irq_unexpected_isr; g_irqvector[i].arg = NULL; +#ifdef CONFIG_SCHED_IRQMONITOR + g_irqvector[i].start = 0; +#ifdef CONFIG_HAVE_LONG_LONG + g_irqvector[i].count = 0; +#else + g_irqvector[i].mscount = 0; + g_irqvector[i].lscount = 0; +#endif +#endif } } diff --git a/sched/irq/irq_procfs.c b/sched/irq/irq_procfs.c new file mode 100644 index 0000000000..bbfb76df17 --- /dev/null +++ b/sched/irq/irq_procfs.c @@ -0,0 +1,443 @@ +/**************************************************************************** + * sched/irq/irq_procfs.c + * + * Copyright (C) 2018 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "irq/irq.h" + +#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_PROCFS) +#ifdef CONFIG_SCHED_IRQMONITOR + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ +/* Output format: + * + * 11111111112222222222333333333344 + * 12345678901234567890123456789012345678901 + * + * IRQ HANDLER ARGUMENT COUNT RATE + * DDD XXXXXXXX XXXXXXXX DDDDDDDDDD DDDD.DDD + * + * NOTE: This assumes that an address can be represented in 32-bits. In + * the typical configuration where CONFIG_HAVE_LONG_LONG=y, the COUNT field + * may not be wide enough. + */ + +#define HDR_FMT "IRQ HANDLER ARGUMENT COUNT RATE\n" +#define IRQ_FMT "%3u %08lx %08lx %10lu %4lu.%03lu\n" + +/* Determines the size of an intermediate buffer that must be large enough + * to handle the longest line generated by this logic (plus a couple of + * bytes). + */ + +#define IRQ_LINELEN 44 + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/* This structure describes one open "file" */ + +struct irq_file_s +{ + struct procfs_file_s base; /* Base open file structure */ + FAR char *buffer; /* User provided buffer */ + size_t remaining; /* Number of available characters in buffer */ + size_t ncopied; /* Number of characters in buffer */ + off_t offset; /* Current file offset */ + char line[IRQ_LINELEN]; /* Pre-allocated buffer for formatted lines */ +}; + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +/* irq_foreach() callback function */ + +static int irq_callback(int irq, FAR struct irq_info_s *info, + FAR void *arg); + +/* File system methods */ + +static int irq_open(FAR struct file *filep, FAR const char *relpath, + int oflags, mode_t mode); +static int irq_close(FAR struct file *filep); +static ssize_t irq_read(FAR struct file *filep, FAR char *buffer, + size_t buflen); +static int irq_dup(FAR const struct file *oldp, + FAR struct file *newp); +static int irq_stat(FAR const char *relpath, FAR struct stat *buf); + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/* See fs_mount.c -- this structure is explicitly extern'ed there. + * We use the old-fashioned kind of initializers so that this will compile + * with any compiler. + */ + +const struct procfs_operations irq_operations = +{ + irq_open, /* open */ + irq_close, /* close */ + irq_read, /* read */ + NULL, /* write */ + + irq_dup, /* dup */ + + NULL, /* opendir */ + NULL, /* closedir */ + NULL, /* readdir */ + NULL, /* rewinddir */ + + irq_stat /* stat */ +}; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: irq_callback + ****************************************************************************/ + +static int irq_callback(int irq, FAR struct irq_info_s *info, + FAR void *arg) +{ + FAR struct irq_file_s *irqfile = (FAR struct irq_file_s *)arg; + struct irq_info_s copy; + irqstate_t flags; + systime_t elapsed; + systime_t now; + size_t linesize; + size_t copysize; + unsigned long intpart; + unsigned long fracpart; + unsigned long count; + + DEBUGASSERT(irqfile != NULL); + + /* Take a snapshot and reset the counts */ + + flags = enter_critical_section(); + memcpy(©, info, sizeof(struct irq_info_s)); + now = clock_systimer(); + info->start = now; +#ifdef CONFIG_HAVE_LONG_LONG + info->count = 0; +#else + info->mscount = 0; + info->lscount = 0; +#endif + leave_critical_section(flags); + + /* Don't bother if count == 0 */ + + if (copy.count == 0) + { + return 0; + } + + /* Calculate the interrupt rate from the interrupt count and the elapsed + * time. + * + * REVISIT: If these counts have not been samples and reset in a long time + * then the following will likely overflow. + */ + + elapsed = now - copy.start; + +#ifdef CONFIG_HAVE_LONG_LONG + /* elapsed = - , units=clock ticks + * rate = * TICKS_PER_SEC / elapsed + */ + + intpart = (unsigned int)((copy.count * TICK_PER_SEC) / elapsed); + if (intpart >= 10000) + { + intpart = 9999; + fracpart = 999; + } + else + { + uint64_t intcount = (uint64_t)intpart * elapsed / TICK_PER_SEC; + fracpart = (unsigned int) + (((copy.count - intcount) * TICK_PER_SEC * 1000) / elapsed); + } + + /* Make sure that the count is representable with snprintf format */ + + if (copy.count > ULONG_MAX) + { + count = ULONG_MAX; + } + else + { + count = (unsigned long)copy.count; + } + +#else +# error Missing logic +#endif + + /* Output information about this interrupt */ + + linesize = snprintf(irqfile->line, IRQ_LINELEN, IRQ_FMT, + (unsigned int)irq, + (unsigned long)((uintptr_t)copy.handler), + (unsigned long)((uintptr_t)copy.arg), + count, intpart, fracpart); + + copysize = procfs_memcpy(irqfile->line, linesize, irqfile->buffer, + irqfile->remaining, &irqfile->offset); + + irqfile->ncopied += copysize; + irqfile->buffer += copysize; + irqfile->remaining -= copysize; + + /* Return a non-zero value to stop the traversal if the user-provided + * buffer is full. + */ + + if (irqfile->remaining > 0) + { + return 0; + } + else + { + return 1; + } +} + +/**************************************************************************** + * Name: irq_open + ****************************************************************************/ + +static int irq_open(FAR struct file *filep, FAR const char *relpath, + int oflags, mode_t mode) +{ + FAR struct irq_file_s *irqfile; + + finfo("Open '%s'\n", relpath); + + /* PROCFS is read-only. Any attempt to open with any kind of write + * access is not permitted. + * + * REVISIT: Write-able proc files could be quite useful. + */ + + if ((oflags & O_WRONLY) != 0 || (oflags & O_RDONLY) == 0) + { + ferr("ERROR: Only O_RDONLY supported\n"); + return -EACCES; + } + + /* "irqs" is the only acceptable value for the relpath */ + + if (strcmp(relpath, "irqs") != 0) + { + ferr("ERROR: relpath is '%s'\n", relpath); + return -ENOENT; + } + + /* Allocate a container to hold the file attributes */ + + irqfile = (FAR struct irq_file_s *)kmm_zalloc(sizeof(struct irq_file_s)); + if (!irqfile) + { + ferr("ERROR: Failed to allocate file attributes\n"); + return -ENOMEM; + } + + /* Save the attributes as the open-specific state in filep->f_priv */ + + filep->f_priv = (FAR void *)irqfile; + return OK; +} + +/**************************************************************************** + * Name: irq_close + ****************************************************************************/ + +static int irq_close(FAR struct file *filep) +{ + FAR struct irq_file_s *irqfile; + + /* Recover our private data from the struct file instance */ + + irqfile = (FAR struct irq_file_s *)filep->f_priv; + DEBUGASSERT(irqfile); + + /* Release the file attributes structure */ + + kmm_free(irqfile); + filep->f_priv = NULL; + return OK; +} + +/**************************************************************************** + * Name: irq_read + ****************************************************************************/ + +static ssize_t irq_read(FAR struct file *filep, FAR char *buffer, + size_t buflen) +{ + FAR struct irq_file_s *irqfile; + size_t linesize; + size_t copysize; + + finfo("buffer=%p buflen=%d\n", buffer, (int)buflen); + + /* Recover our private data from the struct file instance */ + + irqfile = (FAR struct irq_file_s *)filep->f_priv; + DEBUGASSERT(irqfile); + + /* Save the file offset and the user buffer information */ + + irqfile->offset = filep->f_pos; + irqfile->buffer = buffer; + irqfile->remaining = buflen; + + /* The first line to output is the header */ + + linesize = snprintf(irqfile->line, IRQ_LINELEN, HDR_FMT); + + copysize = procfs_memcpy(irqfile->line, linesize, irqfile->buffer, + irqfile->remaining, &irqfile->offset); + + irqfile->ncopied = copysize; + irqfile->buffer += copysize; + irqfile->remaining -= copysize; + + /* Now traverse the list of attached interrupts, generating output for + * each. + */ + + (void)irq_foreach(irq_callback, (FAR void *)irqfile); + + /* Update the file position */ + + filep->f_pos += irqfile->ncopied; + return irqfile->ncopied; +} + +/**************************************************************************** + * Name: irq_dup + * + * Description: + * Duplicate open file data in the new file structure. + * + ****************************************************************************/ + +static int irq_dup(FAR const struct file *oldp, FAR struct file *newp) +{ + FAR struct irq_file_s *oldattr; + FAR struct irq_file_s *newattr; + + finfo("Dup %p->%p\n", oldp, newp); + + /* Recover our private data from the old struct file instance */ + + oldattr = (FAR struct irq_file_s *)oldp->f_priv; + DEBUGASSERT(oldattr); + + /* Allocate a new container to hold the task and attribute selection */ + + newattr = (FAR struct irq_file_s *)kmm_malloc(sizeof(struct irq_file_s)); + if (!newattr) + { + ferr("ERROR: Failed to allocate file attributes\n"); + return -ENOMEM; + } + + /* The copy the file attributes from the old attributes to the new */ + + memcpy(newattr, oldattr, sizeof(struct irq_file_s)); + + /* Save the new attributes in the new file structure */ + + newp->f_priv = (FAR void *)newattr; + return OK; +} + +/**************************************************************************** + * Name: irq_stat + * + * Description: Return information about a file or directory + * + ****************************************************************************/ + +static int irq_stat(const char *relpath, struct stat *buf) +{ + /* "irqs" is the only acceptable value for the relpath */ + + if (strcmp(relpath, "irqs") != 0) + { + ferr("ERROR: relpath is '%s'\n", relpath); + return -ENOENT; + } + + /* "irqs" is the name for a read-only file */ + + memset(buf, 0, sizeof(struct stat)); + buf->st_mode = S_IFREG | S_IROTH | S_IRGRP | S_IRUSR; + return OK; +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +#endif /* CONFIG_SCHED_IRQMONITOR */ +#endif /* !CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_PROCFS */ -- GitLab From de8f3ebedbcd5138bceddefebf72cff644a33a48 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 12 Jan 2018 17:59:13 -0600 Subject: [PATCH 010/228] Documentation: Update NSH documention to discuss the irqinfo command. --- Documentation/NuttShell.html | 217 +++++++++++++++++++++-------------- 1 file changed, 128 insertions(+), 89 deletions(-) diff --git a/Documentation/NuttShell.html b/Documentation/NuttShell.html index c23950484c..6095357a5c 100644 --- a/Documentation/NuttShell.html +++ b/Documentation/NuttShell.html @@ -8,7 +8,7 @@

NuttShell (NSH)

-

Last Updated: January 10, 2018

+

Last Updated: January 12, 2018

@@ -251,259 +251,265 @@
- 2.28 Send a signal to a task (kill) + 2.28 Show Interrupt Status (irqinfo)
- 2.29 Setup/teardown the Loop Device (losetup) + 2.29 Send a signal to a task (kill)
- 2.30 List to a File or Directory (ln) + 2.30 Setup/teardown the Loop Device (losetup)
- 2.31 List Directory Contents (ls) + 2.31 List to a File or Directory (ln)
- 2.32 Show information about installed OS modules (lsmod) + 2.32 List Directory Contents (ls)
- 2.33 Calculate MD5 (md5) + 2.33 Show information about installed OS modules (lsmod)
- 2.34 Access Memory (mb, mh, and mw) + 2.34 Calculate MD5 (md5)
- 2.35 Show Current Tasks and Threads (ps) + 2.35 Access Memory (mb, mh, and mw)
- 2.36 Create a Directory (mkdir) + 2.36 Show Current Tasks and Threads (ps)
- 2.37 Create a FAT File System (mkfatfs) + 2.37 Create a Directory (mkdir)
- 2.38 Create a FIFO (mkfifo) + 2.38 Create a FAT File System (mkfatfs)
- 2.39 Create a RAMDISK (mkrd) + 2.39 Create a FIFO (mkfifo)
- 2.40 Mount a File System (mount) + 2.40 Create a RAMDISK (mkrd)
- 2.41 Rename a File (mv) + 2.41 Mount a File System (mount)
- 2.42 Mount an NFS File System (nfsmount) + 2.42 Rename a File (mv)
- 2.43 Lookup a network address (nslookup) + 2.43 Mount an NFS File System (nfsmount)
- 2.44 Change a User's Password (passwd) + 2.44 Lookup a network address (nslookup)
- 2.45 Shut the system down (poweroff) + 2.45 Change a User's Password (passwd)
- 2.46 Send File Via TFTP (put) + 2.46 Shut the system down (poweroff)
- 2.47 Show Current Working Directory (pwd) + 2.47 Send File Via TFTP (put)
- 2.48 Show target of a link (readlink) + 2.48 Show Current Working Directory (pwd)
- 2.49 Reset and reboot the system (reboot) + 2.49 Show target of a link (readlink)
- 2.50 Remove a File (rm) + 2.50 Reset and reboot the system (reboot)
- 2.51 Remove a Directory (rmdir) + 2.51 Remove a File (rm)
- 2.52 Remove on OS Module (rmmod) + 2.52 Remove a Directory (rmdir)
- 2.53 Show routing table (route) + 2.53 Remove on OS Module (rmmod)
- 2.54 Set an Environment Variable (set) + 2.54 Show routing table (route)
- 2.55 Execute an NSH Script (sh) + 2.55 Set an Environment Variable (set)
- 2.56 Shut the system down (shutdown) + 2.56 Execute an NSH Script (sh)
- 2.57 Wait for Seconds (sleep) + 2.57 Shut the system down (shutdown)
- 2.58 Start the Telnet Daemon (telnetd) + 2.58 Wait for Seconds (sleep)
- 2.59 Time execution of another command (time) + 2.59 Start the Telnet Daemon (telnetd)
- 2.60 Set the Size of a File (truncate) + 2.60 Time execution of another command (time)
- 2.61 Unmount a File System (umount) + 2.61 Set the Size of a File (truncate)
- 2.62 Print system information (uname) + 2.62 Unmount a File System (umount)
- 2.63 Unset an Environment Variable (unset) + 2.63 Print system information (uname)
- 2.64 URL Decode (urldecode) + 2.64 Unset an Environment Variable (unset)
- 2.65 URL Encode (urlencode) + 2.65 URL Decode (urldecode)
- 2.66 Add a New User (useradd) + 2.66 URL Encode (urlencode)
- 2.67 Delete a user (userdel) + 2.67 Add a New User (useradd)
- 2.68 Wait for Microseconds (usleep) + 2.68 Delete a user (userdel)
- 2.69 Get File Via HTTP (wget) + 2.69 Wait for Microseconds (usleep)
- 2.70 Hexadecimal Dump of Memory (xd) + 2.70 Get File Via HTTP (wget) + + + +
+ + 2.71 Hexadecimal Dump of Memory (xd) @@ -1941,7 +1947,34 @@ mydriver 20404659 20404625 0 20404580 552 204047a8 0 + +
-

2.28 Send a signal to a task (kill)

+

2.28 Show Interrupt Status (irqinfo)

+
+ +

Command Syntax:

+
    +irqinfo
    +
+

+ Synopsis. + Show the current count of interrupts taken on all attached interrupts. +

+

+ Example:. +

+
    +nsh> irqinfo
    +IRQ HANDLER  ARGUMENT    COUNT    RATE
    +  3 00001b3d 00000000        156   19.122
    + 15 0000800d 00000000        817  100.000
    + 30 00000fd5 20000018         20    2.490
    +
+ + + +
+

2.29 Send a signal to a task (kill)

@@ -1983,7 +2016,7 @@ nsh>
-

2.29 Setup/teardown the Loop Device (losetup)

+

2.30 Setup/teardown the Loop Device (losetup)

@@ -2036,7 +2069,7 @@ losetup d <dev-path>
-

2.30 Link to a File or Directory (ln)

+

2.31 Link to a File or Directory (ln)

@@ -2061,7 +2094,7 @@ ln [-s] <target> <link>
-

2.31 List Directory Contents (ls)

+

2.32 List Directory Contents (ls)

@@ -2099,7 +2132,7 @@ ls [-lRs] <dir-path>
-

2.32 Show information about installed OS modules (lsmod)

+

2.33 Show information about installed OS modules (lsmod)

@@ -2132,7 +2165,7 @@ mydriver 20404659 20404625 0 20404580 552 204047a8 0
-

2.33 Calculate MD5 (md5)

+

2.34 Calculate MD5 (md5)

@@ -2149,7 +2182,7 @@ md5 [-f] <string or filepath>
-

2.34 Access Memory (mb, mh, and mw)

+

2.35 Access Memory (mb, mh, and mw)

@@ -2202,7 +2235,7 @@ nsh>
-

2.35 Show Current Tasks and Threads (ps)

+

2.36 Show Current Tasks and Threads (ps)

@@ -2236,7 +2269,7 @@ nsh> mount -t procfs /proc
-

2.36 Create a Directory (mkdir)

+

2.37 Create a Directory (mkdir)

@@ -2271,7 +2304,7 @@ nsh>
-

2.37 Create a FAT File System (mkfatfs)

+

2.38 Create a FAT File System (mkfatfs)

@@ -2296,7 +2329,7 @@ mkfatfs [-F <fatsize>] <block-driver>
-

2.38 Create a FIFO (mkfifo)

+

2.39 Create a FIFO (mkfifo)

@@ -2334,7 +2367,7 @@ nsh>
-

2.39 Create a RAMDISK (mkrd)

+

2.40 Create a RAMDISK (mkrd)

@@ -2385,7 +2418,7 @@ nsh>
-

2.40 Mount a File System (mount)

+

2.41 Mount a File System (mount)

@@ -2464,7 +2497,7 @@ nsh> mount
-

2.41 Rename a File (mv)

+

2.42 Rename a File (mv)

@@ -2482,7 +2515,7 @@ mv <old-path> <new-path>
-

2.42 Mount an NFS file system (nfsmount)

+

2.43 Mount an NFS file system (nfsmount)

@@ -2501,7 +2534,7 @@ nfsmount <server-address> <mount-point> <remote-path>
-

2.43 Lookup a network address (nslookup)

+

2.44 Lookup a network address (nslookup)

@@ -2518,7 +2551,7 @@ nslookup <host-name>
-

2.44 Change a User's Password (passwd)

+

2.45 Change a User's Password (passwd)

@@ -2535,7 +2568,7 @@ passwd <username> <password>
-

2.45 Shut the system down (poweroff)

+

2.46 Shut the system down (poweroff)

@@ -2557,7 +2590,7 @@ poweroff
-

2.46 Send File Via TFTP (put)

+

2.47 Send File Via TFTP (put)

@@ -2592,7 +2625,7 @@ put [-b|-n] [-f <remote-path>] -h <ip-address> <local-path>
-

2.47 Show Current Working Directory (pwd)

+

2.48 Show Current Working Directory (pwd)

@@ -2622,7 +2655,7 @@ nsh>
-

2.48 Show target of a link (readlink)

+

2.49 Show target of a link (readlink)

@@ -2639,7 +2672,7 @@ readlink <link>
-

2.49 Reboot the system (reboot)

+

2.50 Reboot the system (reboot)

@@ -2660,7 +2693,7 @@ reboot
-

2.50 Remove a File (rm)

+

2.51 Remove a File (rm)

@@ -2694,7 +2727,7 @@ nsh>
-

2.51 Remove a Directory (rmdir)

+

2.52 Remove a Directory (rmdir)

@@ -2729,7 +2762,7 @@ nsh>
-

2.52 Remove on OS Module (rmmod)

+

2.53 Remove on OS Module (rmmod)

@@ -2757,7 +2790,7 @@ nsh>
-

2.53 Show routing table (route)

+

2.54 Show routing table (route)

@@ -2777,7 +2810,7 @@ route ipv4|ipv6
-

2.54 Set an Environment Variable (set)

+

2.55 Set an Environment Variable (set)

@@ -2846,7 +2879,7 @@ nsh>
-

2.55 Execute an NSH Script (sh)

+

2.56 Execute an NSH Script (sh)

@@ -2864,7 +2897,7 @@ sh <script-path>
-

2.56 Shut the system down (shutdown)

+

2.57 Shut the system down (shutdown)

@@ -2885,7 +2918,7 @@ shutdown [--reboot]
-

2.57 Wait for Seconds (sleep)

+

2.58 Wait for Seconds (sleep)

@@ -2902,7 +2935,7 @@ sleep <sec>
-

2.58 Time Start the Telnet Daemon (telnetd)

+

2.59 Time Start the Telnet Daemon (telnetd)

@@ -2928,7 +2961,7 @@ telnetd
-

2.59 Time execution of another command (time)

+

2.60 Time execution of another command (time)

@@ -2986,7 +3019,7 @@ nsh>
-

2.60 Set the Size of a File (truncate)

+

2.61 Set the Size of a File (truncate)

@@ -3014,7 +3047,7 @@ truncate -s <length> <file-path>
-

2.61 Unmount a File System (umount)

+

2.62 Unmount a File System (umount)

@@ -3044,7 +3077,7 @@ nsh>
-

2.62 Print system information (uname)

+

2.63 Print system information (uname)

@@ -3111,7 +3144,7 @@ uname [-a | -imnoprsv]
-

2.63 Unset an Environment Variable (unset)

+

2.64 Unset an Environment Variable (unset)

@@ -3137,7 +3170,7 @@ nsh>
-

2.64 URL Decode (urldecode)

+

2.65 URL Decode (urldecode)

@@ -3154,7 +3187,7 @@ urldecode [-f] <string or filepath>
-

2.65 URL Encode (urlencode)

+

2.66 URL Encode (urlencode)

@@ -3171,7 +3204,7 @@ urlencode [-f] <string or filepath>
-

2.66 Add a New User (useradd)

+

2.67 Add a New User (useradd)

@@ -3188,7 +3221,7 @@ useradd <username> <password>
-

2.67 Delete a user (userdel)

+

2.68 Delete a user (userdel)

@@ -3205,7 +3238,7 @@ userdel <username>
-

2.68 Wait for Microseconds (usleep)

+

2.69 Wait for Microseconds (usleep)

@@ -3222,7 +3255,7 @@ usleep <usec>
-

2.69 Get File Via HTTP (wget)

+

2.70 Get File Via HTTP (wget)

@@ -3249,7 +3282,7 @@ wget [-o <local-path>] <url>
-

2.70 Hexadecimal Dump of Memory (xd)

+

2.71 Hexadecimal Dump of Memory (xd)

@@ -3506,6 +3539,11 @@ nsh> CONFIG_MODULE CONFIG_NSH_DISABLE_MODCMDS + + irqinfo + !CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_PROCFS && CONFIG_SCHED_IRQMONITOR +
+ kill !CONFIG_DISABLE_SIGNALS @@ -5486,10 +5524,10 @@ xxd -i romfs_img >nsh_romfsimg.h
  • CONFIG_NSH_ROMFSMOUNTPT
  • CONFIG_NSH_ROMFSSECTSIZE
  • CONFIG_NSH_STRERROR
  • +
  • CONFIG_NSH_TELNET
    • -
    • NSH library (nshlib)
    • NSH library (nshlib)
    • nsh_consolemain()
    • nsh_initialize()
    • -- GitLab From fdf4e40b6a5adce1e7d5f27f844c19cb2755052c Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 13 Jan 2018 08:34:58 -0600 Subject: [PATCH 011/228] configs/lpcxpresso-lpc54628: Correct SRAM base address in all configurations. --- configs/lpcxpresso-lpc54628/fb/defconfig | 2 +- configs/lpcxpresso-lpc54628/netnsh/defconfig | 2 +- configs/lpcxpresso-lpc54628/nsh/defconfig | 2 +- configs/lpcxpresso-lpc54628/nxwm/defconfig | 2 +- configs/lpcxpresso-lpc54628/scripts/flash.ld | 2 +- sched/init/os_start.c | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/configs/lpcxpresso-lpc54628/fb/defconfig b/configs/lpcxpresso-lpc54628/fb/defconfig index 2234418cfc..2dc326a079 100644 --- a/configs/lpcxpresso-lpc54628/fb/defconfig +++ b/configs/lpcxpresso-lpc54628/fb/defconfig @@ -64,7 +64,7 @@ CONFIG_PREALLOC_MQ_MSGS=4 CONFIG_PREALLOC_TIMERS=4 CONFIG_PREALLOC_WDOGS=4 CONFIG_RAM_SIZE=163840 -CONFIG_RAM_START=0x10000000 +CONFIG_RAM_START=0x20000000 CONFIG_RAW_BINARY=y CONFIG_RR_INTERVAL=200 CONFIG_SCHED_HPWORK=y diff --git a/configs/lpcxpresso-lpc54628/netnsh/defconfig b/configs/lpcxpresso-lpc54628/netnsh/defconfig index 89836e6010..b84ff13d81 100644 --- a/configs/lpcxpresso-lpc54628/netnsh/defconfig +++ b/configs/lpcxpresso-lpc54628/netnsh/defconfig @@ -55,7 +55,7 @@ CONFIG_PREALLOC_MQ_MSGS=4 CONFIG_PREALLOC_TIMERS=4 CONFIG_PREALLOC_WDOGS=4 CONFIG_RAM_SIZE=163840 -CONFIG_RAM_START=0x10000000 +CONFIG_RAM_START=0x20000000 CONFIG_RAW_BINARY=y CONFIG_RR_INTERVAL=200 CONFIG_SCHED_HPWORK=y diff --git a/configs/lpcxpresso-lpc54628/nsh/defconfig b/configs/lpcxpresso-lpc54628/nsh/defconfig index 70d2e78068..bdcaa769d3 100644 --- a/configs/lpcxpresso-lpc54628/nsh/defconfig +++ b/configs/lpcxpresso-lpc54628/nsh/defconfig @@ -42,7 +42,7 @@ CONFIG_PREALLOC_MQ_MSGS=4 CONFIG_PREALLOC_TIMERS=4 CONFIG_PREALLOC_WDOGS=4 CONFIG_RAM_SIZE=163840 -CONFIG_RAM_START=0x10000000 +CONFIG_RAM_START=0x20000000 CONFIG_RAW_BINARY=y CONFIG_RR_INTERVAL=200 CONFIG_RTC_ALARM=y diff --git a/configs/lpcxpresso-lpc54628/nxwm/defconfig b/configs/lpcxpresso-lpc54628/nxwm/defconfig index 4c2f839ee1..5bc987dbb5 100644 --- a/configs/lpcxpresso-lpc54628/nxwm/defconfig +++ b/configs/lpcxpresso-lpc54628/nxwm/defconfig @@ -87,7 +87,7 @@ CONFIG_NXWM=y CONFIG_PREALLOC_TIMERS=4 CONFIG_PREALLOC_WDOGS=8 CONFIG_RAM_SIZE=163840 -CONFIG_RAM_START=0x10000000 +CONFIG_RAM_START=0x20000000 CONFIG_RAW_BINARY=y CONFIG_RR_INTERVAL=200 CONFIG_SCHED_HPWORK=y diff --git a/configs/lpcxpresso-lpc54628/scripts/flash.ld b/configs/lpcxpresso-lpc54628/scripts/flash.ld index fc09e2fffc..42a0396af8 100644 --- a/configs/lpcxpresso-lpc54628/scripts/flash.ld +++ b/configs/lpcxpresso-lpc54628/scripts/flash.ld @@ -33,7 +33,7 @@ * ****************************************************************************/ -/* The LPC54628 on the LPCXPressio has 512Kb of FLASH at address 0x0000:0000. +/* The LPC54628 on the LPCXPresso has 512Kb of FLASH at address 0x0000:0000. * The Main SRAM is comprised of up to a total 160 KB of contiguous, on-chip * static RAM memory beginning at address 0x2000:0000 (this is in addition * to SRAMX aso the total device SRAM can be up to 200 KB). diff --git a/sched/init/os_start.c b/sched/init/os_start.c index 80fc944956..93f5cf0f1e 100644 --- a/sched/init/os_start.c +++ b/sched/init/os_start.c @@ -229,7 +229,7 @@ struct pidhash_s g_pidhash[CONFIG_MAX_TASKS]; /* This is a table of task lists. This table is indexed by the task stat * enumeration type (tstate_t) and provides a pointer to the associated * static task list (if there is one) as well as a a set of attribute flags - * indicating properities of the list, for example, if the list is an + * indicating properties of the list, for example, if the list is an * ordered list or not. */ @@ -311,7 +311,7 @@ uint8_t g_os_initstate; /* See enum os_initstate_e */ /**************************************************************************** * Private Data ****************************************************************************/ -/* This is an arry of task control block (TCB) for the IDLE thread of each +/* This is an array of task control block (TCB) for the IDLE thread of each * CPU. For the non-SMP case, this is a a single TCB; For the SMP case, * there is one TCB per CPU. NOTE: The system boots on CPU0 into the IDLE * task. The IDLE task later starts the other CPUs and spawns the user -- GitLab From 134bac381093d1b8ab82de3dd7ba717e7bd14abb Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 13 Jan 2018 15:38:55 -0600 Subject: [PATCH 012/228] arch/arm/src/lpc54xx: Add configuration logic to the empty SPI driver. Still missing all data tranfer logic. --- arch/arm/src/lpc54xx/chip/lpc54_spi.h | 83 +++- arch/arm/src/lpc54xx/lpc54_spi_master.c | 564 +++++++++++++++++++----- arch/arm/src/lpc54xx/lpc54_spi_master.h | 141 +++++- sched/init/os_start.c | 4 +- 4 files changed, 645 insertions(+), 147 deletions(-) diff --git a/arch/arm/src/lpc54xx/chip/lpc54_spi.h b/arch/arm/src/lpc54xx/chip/lpc54_spi.h index 9ab286e18a..01e3a5830d 100644 --- a/arch/arm/src/lpc54xx/chip/lpc54_spi.h +++ b/arch/arm/src/lpc54xx/chip/lpc54_spi.h @@ -260,33 +260,104 @@ /* Register bit definitions *************************************************************************/ /* SPI Configuration register */ -#define SPI_CFG_ + +#define SPI_CFG_ENABLE (1 << 0) /* Bit 0: SPI enable */ +#define SPI_CFG_MASTER (1 << 2) /* Bit 2: Master mode select */ +#define SPI_CFG_LSBF (1 << 3) /* Bit 3: LSB First mode enable */ +#define SPI_CFG_CPHA (1 << 4) /* Bit 4: Clock Phase select */ +#define SPI_CFG_CPOL (1 << 5) /* Bit 5: Clock Polarity select */ +#define SPI_CFG_LOOP (1 << 7) /* Bit 7: Loopback mode enable */ +#define SPI_CFG_SPOL0 (1 << 8) /* Bit 8: SSEL0 Polarity select */ +#define SPI_CFG_SPOL1 (1 << 9) /* Bit 9: SSEL1 Polarity select */ +#define SPI_CFG_SPOL2 (1 << 10) /* Bit 10: SSEL2 Polarity select */ +#define SPI_CFG_SPOL3 (1 << 11) /* Bit 11: SSEL3 Polarity select */ + /* SPI Delay register */ -#define SPI_DLY_ + +#define SPI_DLY_PRE_DELAY_SHIFT (0) /* Bits 0-3: Time between SSEL assertion and data transfer */ +#define SPI_DLY_PRE_DELAY_MASK (15 << SPI_DLY_PRE_DELAY_SHIFT) +# define SPI_DLY_PRE_DELAY(n) ((uint32_t)(n) << SPI_DLY_PRE_DELAY_SHIFT) +#define SPI_DLY_POST_DELAY_SHIFT (4) /* Bits 4-7: Time between tdata transfer and SSEL deassertion */ +#define SPI_DLY_POST_DELAY_MASK (15 << SPI_DLY_POST_DELAY_SHIFT) +# define SPI_DLY_POST_DELAY(n) ((uint32_t)(n) << SPI_DLY_POST_DELAY_SHIFT) +#define SPI_DLY_FRAME_DELAY_SHIFT (8) /* Bits 8-11: Minimum amount of time between frames */ +#define SPI_DLY_FRAME_DELAY_MASK (15 << SPI_DLY_FRAME_DELAY_SHIFT) +# define SPI_DLY_FRAME_DELAY(n) ((uint32_t)(n) << SPI_DLY_FRAME_DELAY_SHIFT) +#define SPI_DLY_TRANSFER_DELAY_SHIFT (12) /* Bits 12-15: Time SSEL deasserted between transfers */ +#define SPI_DLY_TRANSFER_DELAY_MASK (15 << SPI_DLY_TRANSFER_DELAY_SHIFT) +# define SPI_DLY_TRANSFER_DELAY(n) ((uint32_t)(n) << SPI_DLY_TRANSFER_DELAY_SHIFT) + /* SPI Status register */ #define SPI_STAT_ /* SPI Interrupt Enable read and set */ #define SPI_INTENSET_ /* SPI Interrupt Enable Clear */ #define SPI_INTENCLR_ + /* SPI clock Divider */ -#define SPI_DIV_ + +#define SPI_DIV_SHIFT (0) /* Bits 0-15: Rate divider value */ +#define SPI_DIV_MASK (0xffff << SPI_DIV_SHIFT) +# define SPI_DIV(n) ((uint32_t)((n)-1) << SPI_DIV_SHIFT) + /* SPI Interrupt Status */ #define SPI_INTSTAT_ + /* FIFO configuration and enable register */ -#define SPI_FIFOCFG_ + +#define SPI_FIFOCFG_ENABLETX (1 << 0) /* Bit 0: Enable the transmit FIFO) */ +#define SPI_FIFOCFG_ENABLERX (1 << 1) /* Bit 1: Enable the receive FIFO) */ +#define SPI_FIFOCFG_SIZE_SHIFT (4) /* Bits 4-5: FIFO size configuration (read-only) */ +#define SPI_FIFOCFG_SIZE_MASK (3 << SPI_FIFOCFG_SIZE_SHIFT) +# define SPI_FIFOCFG_SIZE_8x16 (1 << SPI_FIFOCFG_SIZE_SHIFT) /* FIFO is configured as 8 entries of 16 bits */ +#define SPI_FIFOCFG_DMATX (1 << 12) /* Bit 12: DMA configuration for transmit */ +#define SPI_FIFOCFG_DMARX (1 << 13) /* Bit 13: DMA configuration for receive */ +#define SPI_FIFOCFG_WAKETX (1 << 14) /* Bit 14: Wake-up for transmit FIFO level */ +#define SPI_FIFOCFG_WAKERX (1 << 15) /* Bit 15: Wake-up for receive FIFO level */ +#define SPI_FIFOCFG_EMPTYTX (1 << 16) /* Bit 16: Empty command for the transmit FIFO) */ +#define SPI_FIFOCFG_EMPTYRX (1 << 17) /* Bit 17: Empty command for the receive FIFO) */ + /* FIFO status register */ #define SPI_FIFOSTAT_ + /* FIFO trigger level settings for interrupt and DMA request */ -#define SPI_FIFOTRIG_ + +#define SPI_FIFOTRIG_TXLVLENA (1 << 0) /* Bit 0 Transmit FIFO level trigger enable */ +#define SPI_FIFOTRIG_RXLVLENA (1 << 1) /* Bit 1 Receive FIFO level trigger enable */ +#define SPI_FIFOTRIG_TXLVL_SHIFT (8) /* Bits 8-11: Transmit FIFO level trigger point */ +#define SPI_FIFOTRIG_TXLVL_MASK (15 << SPI_FIFOTRIG_TXLVL_SHIFT) +# define SPI_FIFOTRIG_TXLVL(n) ((uint32_t)(n) << SPI_FIFOTRIG_TXLVL_SHIFT) +# define SPI_FIFOTRIG_TXLVL_EMPTY (0 << SPI_FIFOTRIG_TXLVL_SHIFT) +# define SPI_FIFOTRIG_TXLVL_NOTFULL (7 << SPI_FIFOTRIG_TXLVL_SHIFT) +#define SPI_FIFOTRIG_RXLVL_SHIFT (16) /* Bits 16-19: Receive FIFO level trigger point */ +#define SPI_FIFOTRIG_RXLVL_MASK (15 << SPI_FIFOTRIG_RXLVL_SHIFT) +# define SPI_FIFOTRIG_RXLVL(n) ((uint32_t)((n)-1) << SPI_FIFOTRIG_RXLVL_SHIFT) +# define SPI_FIFOTRIG_RXLVL_NOTEMPTY (0 << SPI_FIFOTRIG_RXLVL_SHIFT) +# define SPI_FIFOTRIG_RXLVL_FULL (7 << SPI_FIFOTRIG_RXLVL_SHIFT) + /* FIFO interrupt enable set (enable) and read register */ #define SPI_FIFOINTENSET_ /* FIFO interrupt enable clear (disable) and read register */ #define SPI_FIFOINTENCLR_ /* FIFO interrupt status register */ #define SPI_FIFOINTSTAT_ + /* FIFO write data */ -#define SPI_FIFOWR_ + +#define SPI_FIFOWR_TXDATA_SHIFT (0) /* Bits 0-15: Transmit data to the FIFO */ +#define SPI_FIFOWR_TXDATA_MASK (0xffff << SPI_FIFOWR_TXDATA_SHIFT) +# define SPI_FIFOWR_TXDATA(n) ((uint32_t)(n) << SPI_FIFOWR_TXDATA_SHIFT) +#define SPI_FIFOWR_TXSSEL0_N (1 << 16) /* Bit 16: Transmit Slave Select */ +#define SPI_FIFOWR_TXSSEL1_N (1 << 17) /* Bit 17: Transmit Slave Select */ +#define SPI_FIFOWR_TXSSEL2_N (1 << 18) /* Bit 18: Transmit Slave Select */ +#define SPI_FIFOWR_TXSSEL3_N (1 << 19) /* Bit 19: Transmit Slave Select */ +#define SPI_FIFOWR_EOT (1 << 20) /* Bit 20: End of Transfer */ +#define SPI_FIFOWR_EOF (1 << 21) /* Bit 21: End of Frame */ +#define SPI_FIFOWR_RXIGNORE (1 << 22) /* Bit 22: Receive Ignore */ +#define SPI_FIFOWR_LEN_SHIFT (24) /* Bits 24-27: Data Length */ +#define SPI_FIFOWR_LEN_MASK (15 << SPI_FIFOWR_LEN_SHIFT) +# define SPI_FIFOWR_LEN(n) ((uint32_t)((n)-1) << SPI_FIFOWR_LEN_SHIFT) + /* FIFO read data */ #define SPI_FIFORD_ /* FIFO data read with no FIFO pop */ diff --git a/arch/arm/src/lpc54xx/lpc54_spi_master.c b/arch/arm/src/lpc54xx/lpc54_spi_master.c index 665c1a4242..6189dc9135 100644 --- a/arch/arm/src/lpc54xx/lpc54_spi_master.c +++ b/arch/arm/src/lpc54xx/lpc54_spi_master.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/lpc54xx/lpc54_spi.c * - * Copyright (C) 2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2017-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -67,11 +67,13 @@ * Pre-processor Definitions ****************************************************************************/ +#define SPI_DUMMYDATA 0xff + /**************************************************************************** * Private Types ****************************************************************************/ -/* This structure descibes the state of the SSP driver */ +/* This structure describes the state of the SSP driver */ struct lpc54_spidev_s { @@ -82,8 +84,8 @@ struct lpc54_spidev_s uint32_t frequency; /* Requested clock frequency */ uint32_t actual; /* Actual clock frequency */ uint16_t irq; /* Flexcomm IRQ number */ - uint8_t nbits; /* Width of word in bits (8 to 16) */ - uint8_t mode; /* Mode 0,1,2,3 */ + uint8_t nbits; /* Width of word in bits (8 to 16) */ + uint8_t mode; /* Mode 0,1,2,3 */ }; /**************************************************************************** @@ -95,8 +97,6 @@ static inline bool lpc54_spi_16bitmode(FAR struct lpc54_spidev_s *priv); /* SPI methods */ static int lpc54_spi_lock(FAR struct spi_dev_s *dev, bool lock); -static void lpc54_spi_select(FAR struct spi_dev_s *dev, uint32_t devid, - bool selected); static uint32_t lpc54_spi_setfrequency(FAR struct spi_dev_s *dev, uint32_t frequency); static void lpc54_spi_setmode(FAR struct spi_dev_s *dev, @@ -122,19 +122,20 @@ static void lpc54_spi_recvblock(FAR struct spi_dev_s *dev, * Private Data ****************************************************************************/ -static const struct spi_ops_s g_spi_ops = +#ifdef CONFIG_LPC54_SPI0_MASTER +static const struct spi_ops_s g_spi0_ops = { .lock = lpc54_spi_lock, - .select = lpc54_spiselect, + .select = lpc54_spi0_select, /* Provided externally */ .setfrequency = lpc54_spi_setfrequency, .setmode = lpc54_spi_setmode, .setbits = lpc54_spi_setbits, #ifdef CONFIG_SPI_HWFEATURES - .hwfeatures = 0, /* Not supported */ + .hwfeatures = NULL, /* Not supported */ #endif - .status = lpc54_spistatus, + .status = lpc54_spi0_status, /* Provided externally */ #ifdef CONFIG_SPI_CMDDATA - .cmddata = lpc54_spicmddata, + .cmddata = lpc54_spi0_cmddata, /* Provided externally */ #endif .send = lpc54_spi_send, #ifdef CONFIG_SPI_EXCHANGE @@ -144,40 +145,300 @@ static const struct spi_ops_s g_spi_ops = .recvblock = lpc54_spi_recvblock, #endif #ifdef CONFIG_SPI_CALLBACK - .registercallback = lpc54_spiregister, /* Provided externally */ + .registercallback = lpc54_spi0_register, /* Provided externally */ #else - .registercallback = 0, /* Not implemented */ + .registercallback = NULL, /* Not implemented */ #endif }; -#ifdef CONFIG_LPC54_I2C0_MASTER static struct lpc54_spidev_s g_spi0_dev; #endif -#ifdef CONFIG_LPC54_I2C1_MASTER + +#ifdef CONFIG_LPC54_SPI1_MASTER +static const struct spi_ops_s g_spi1_ops = +{ + .lock = lpc54_spi_lock, + .select = lpc54_spi1_select, /* Provided externally */ + .setfrequency = lpc54_spi_setfrequency, + .setmode = lpc54_spi_setmode, + .setbits = lpc54_spi_setbits, +#ifdef CONFIG_SPI_HWFEATURES + .hwfeatures = NULL, /* Not supported */ +#endif + .status = lpc54_spi1_status, /* Provided externally */ +#ifdef CONFIG_SPI_CMDDATA + .cmddata = lpc54_spi1_cmddata, /* Provided externally */ +#endif + .send = lpc54_spi_send, +#ifdef CONFIG_SPI_EXCHANGE + .exchange = lpc54_spi_exchange, +#else + .sndblock = lpc54_spi_sndblock, + .recvblock = lpc54_spi_recvblock, +#endif +#ifdef CONFIG_SPI_CALLBACK + .registercallback = lpc54_spi1_register, /* Provided externally */ +#else + .registercallback = NULL, /* Not implemented */ +#endif +}; + static struct lpc54_spidev_s g_spi1_dev; #endif -#ifdef CONFIG_LPC54_I2C2_MASTER + +#ifdef CONFIG_LPC54_SPI2_MASTER +static const struct spi_ops_s g_spi2_ops = +{ + .lock = lpc54_spi_lock, + .select = lpc54_spi2_select, /* Provided externally */ + .setfrequency = lpc54_spi_setfrequency, + .setmode = lpc54_spi_setmode, + .setbits = lpc54_spi_setbits, +#ifdef CONFIG_SPI_HWFEATURES + .hwfeatures = NULL, /* Not supported */ +#endif + .status = lpc54_spi2_status, /* Provided externally */ +#ifdef CONFIG_SPI_CMDDATA + .cmddata = lpc54_spi2_cmddata, /* Provided externally */ +#endif + .send = lpc54_spi_send, +#ifdef CONFIG_SPI_EXCHANGE + .exchange = lpc54_spi_exchange, +#else + .sndblock = lpc54_spi_sndblock, + .recvblock = lpc54_spi_recvblock, +#endif +#ifdef CONFIG_SPI_CALLBACK + .registercallback = lpc54_spi2_register, /* Provided externally */ +#else + .registercallback = NULL, /* Not implemented */ +#endif +}; + static struct lpc54_spidev_s g_spi2_dev; #endif -#ifdef CONFIG_LPC54_I2C3_MASTER + +#ifdef CONFIG_LPC54_SPI3_MASTER +static const struct spi_ops_s g_spi3_ops = +{ + .lock = lpc54_spi_lock, + .select = lpc54_spi3_select, /* Provided externally */ + .setfrequency = lpc54_spi_setfrequency, + .setmode = lpc54_spi_setmode, + .setbits = lpc54_spi_setbits, +#ifdef CONFIG_SPI_HWFEATURES + .hwfeatures = NULL, /* Not supported */ +#endif + .status = lpc54_spi3_status, /* Provided externally */ +#ifdef CONFIG_SPI_CMDDATA + .cmddata = lpc54_spi3_cmddata, /* Provided externally */ +#endif + .send = lpc54_spi_send, +#ifdef CONFIG_SPI_EXCHANGE + .exchange = lpc54_spi_exchange, +#else + .sndblock = lpc54_spi_sndblock, + .recvblock = lpc54_spi_recvblock, +#endif +#ifdef CONFIG_SPI_CALLBACK + .registercallback = lpc54_spi3_register, /* Provided externally */ +#else + .registercallback = NULL, /* Not implemented */ +#endif +}; + static struct lpc54_spidev_s g_spi3_dev; #endif -#ifdef CONFIG_LPC54_I2C4_MASTER + +#ifdef CONFIG_LPC54_SPI4_MASTER +static const struct spi_ops_s g_spi4_ops = +{ + .lock = lpc54_spi_lock, + .select = lpc54_spi4_select, /* Provided externally */ + .setfrequency = lpc54_spi_setfrequency, + .setmode = lpc54_spi_setmode, + .setbits = lpc54_spi_setbits, +#ifdef CONFIG_SPI_HWFEATURES + .hwfeatures = NULL, /* Not supported */ +#endif + .status = lpc54_spi4_status, /* Provided externally */ +#ifdef CONFIG_SPI_CMDDATA + .cmddata = lpc54_spi4_cmddata, /* Provided externally */ +#endif + .send = lpc54_spi_send, +#ifdef CONFIG_SPI_EXCHANGE + .exchange = lpc54_spi_exchange, +#else + .sndblock = lpc54_spi_sndblock, + .recvblock = lpc54_spi_recvblock, +#endif +#ifdef CONFIG_SPI_CALLBACK + .registercallback = lpc54_spi4_register, /* Provided externally */ +#else + .registercallback = NULL, /* Not implemented */ +#endif +}; + static struct lpc54_spidev_s g_spi4_dev; #endif -#ifdef CONFIG_LPC54_I2C5_MASTER + +#ifdef CONFIG_LPC54_SPI5_MASTER +static const struct spi_ops_s g_spi5_ops = +{ + .lock = lpc54_spi_lock, + .select = lpc54_spi5_select, /* Provided externally */ + .setfrequency = lpc54_spi_setfrequency, + .setmode = lpc54_spi_setmode, + .setbits = lpc54_spi_setbits, +#ifdef CONFIG_SPI_HWFEATURES + .hwfeatures = NULL, /* Not supported */ +#endif + .status = lpc54_spi5_status, /* Provided externally */ +#ifdef CONFIG_SPI_CMDDATA + .cmddata = lpc54_spi5_cmddata, /* Provided externally */ +#endif + .send = lpc54_spi_send, +#ifdef CONFIG_SPI_EXCHANGE + .exchange = lpc54_spi_exchange, +#else + .sndblock = lpc54_spi_sndblock, + .recvblock = lpc54_spi_recvblock, +#endif +#ifdef CONFIG_SPI_CALLBACK + .registercallback = lpc54_spi5_register, /* Provided externally */ +#else + .registercallback = NULL, /* Not implemented */ +#endif +}; + static struct lpc54_spidev_s g_spi5_dev; #endif -#ifdef CONFIG_LPC54_I2C6_MASTER + +#ifdef CONFIG_LPC54_SPI6_MASTER +static const struct spi_ops_s g_spi6_ops = +{ + .lock = lpc54_spi_lock, + .select = lpc54_spi6_select, /* Provided externally */ + .setfrequency = lpc54_spi_setfrequency, + .setmode = lpc54_spi_setmode, + .setbits = lpc54_spi_setbits, +#ifdef CONFIG_SPI_HWFEATURES + .hwfeatures = NULL, /* Not supported */ +#endif + .status = lpc54_spi6_status, /* Provided externally */ +#ifdef CONFIG_SPI_CMDDATA + .cmddata = lpc54_spi6_cmddata, /* Provided externally */ +#endif + .send = lpc54_spi_send, +#ifdef CONFIG_SPI_EXCHANGE + .exchange = lpc54_spi_exchange, +#else + .sndblock = lpc54_spi_sndblock, + .recvblock = lpc54_spi_recvblock, +#endif +#ifdef CONFIG_SPI_CALLBACK + .registercallback = lpc54_spi6_register, /* Provided externally */ +#else + .registercallback = NULL, /* Not implemented */ +#endif +}; + static struct lpc54_spidev_s g_spi6_dev; #endif -#ifdef CONFIG_LPC54_I2C7_MASTER + +#ifdef CONFIG_LPC54_SPI7_MASTER +static const struct spi_ops_s g_spi7_ops = +{ + .lock = lpc54_spi_lock, + .select = lpc54_spi7_select, /* Provided externally */ + .setfrequency = lpc54_spi_setfrequency, + .setmode = lpc54_spi_setmode, + .setbits = lpc54_spi_setbits, +#ifdef CONFIG_SPI_HWFEATURES + .hwfeatures = NULL, /* Not supported */ +#endif + .status = lpc54_spi7_status, /* Provided externally */ +#ifdef CONFIG_SPI_CMDDATA + .cmddata = lpc54_spi7_cmddata, /* Provided externally */ +#endif + .send = lpc54_spi_send, +#ifdef CONFIG_SPI_EXCHANGE + .exchange = lpc54_spi_exchange, +#else + .sndblock = lpc54_spi_sndblock, + .recvblock = lpc54_spi_recvblock, +#endif +#ifdef CONFIG_SPI_CALLBACK + .registercallback = lpc54_spi7_register, /* Provided externally */ +#else + .registercallback = NULL, /* Not implemented */ +#endif +}; + static struct lpc54_spidev_s g_spi7_dev; #endif -#ifdef CONFIG_LPC54_I2C8_MASTER + +#ifdef CONFIG_LPC54_SPI8_MASTER +static const struct spi_ops_s g_spi8_ops = +{ + .lock = lpc54_spi_lock, + .select = lpc54_spi8_select, /* Provided externally */ + .setfrequency = lpc54_spi_setfrequency, + .setmode = lpc54_spi_setmode, + .setbits = lpc54_spi_setbits, +#ifdef CONFIG_SPI_HWFEATURES + .hwfeatures = NULL, /* Not supported */ +#endif + .status = lpc54_spi8_status, /* Provided externally */ +#ifdef CONFIG_SPI_CMDDATA + .cmddata = lpc54_spi8_cmddata, /* Provided externally */ +#endif + .send = lpc54_spi_send, +#ifdef CONFIG_SPI_EXCHANGE + .exchange = lpc54_spi_exchange, +#else + .sndblock = lpc54_spi_sndblock, + .recvblock = lpc54_spi_recvblock, +#endif +#ifdef CONFIG_SPI_CALLBACK + .registercallback = lpc54_spi8_register, /* Provided externally */ +#else + .registercallback = NULL, /* Not implemented */ +#endif +}; + static struct lpc54_spidev_s g_spi8_dev; #endif -#ifdef CONFIG_LPC54_I2C9_MASTER + +#ifdef CONFIG_LPC54_SPI9_MASTER +static const struct spi_ops_s g_spi9_ops = +{ + .lock = lpc54_spi_lock, + .select = lpc54_spi9_select, /* Provided externally */ + .setfrequency = lpc54_spi_setfrequency, + .setmode = lpc54_spi_setmode, + .setbits = lpc54_spi_setbits, +#ifdef CONFIG_SPI_HWFEATURES + .hwfeatures = NULL, /* Not supported */ +#endif + .status = lpc54_spi9_status, /* Provided externally */ +#ifdef CONFIG_SPI_CMDDATA + .cmddata = lpc54_spi9_cmddata, /* Provided externally */ +#endif + .send = lpc54_spi_send, +#ifdef CONFIG_SPI_EXCHANGE + .exchange = lpc54_spi_exchange, +#else + .sndblock = lpc54_spi_sndblock, + .recvblock = lpc54_spi_recvblock, +#endif +#ifdef CONFIG_SPI_CALLBACK + .registercallback = lpc54_spi9_register, /* Provided externally */ +#else + .registercallback = NULL, /* Not implemented */ +#endif +}; + static struct lpc54_spidev_s g_spi9_dev; #endif @@ -196,19 +457,19 @@ static struct lpc54_spidev_s g_spi9_dev; static inline void lpc54_spi_putreg(struct lpc54_spidev_s *priv, unsigned int regoffset, uint32_t regval) { - putreg32(value, priv->base + regoffset); + putreg32(regval, priv->base + regoffset); } /**************************************************************************** - * Name: lpc54_spi_gettreg + * Name: lpc54_spi_getreg * * Description: * Read the content of a register at the offset from the Flexcomm base. * ****************************************************************************/ -static inline void lpc54_spi_gettreg(struct lpc54_spidev_s *priv, - unsigned int regoffset) +static inline uint32_t lpc54_spi_getreg(struct lpc54_spidev_s *priv, + unsigned int regoffset) { return getreg32(priv->base + regoffset); } @@ -237,8 +498,8 @@ static inline bool lpc54_spi_16bitmode(FAR struct lpc54_spidev_s *priv) * Name: lpc54_spi_lock * * Description: - * On SPI busses where there are multiple devices, it will be necessary to - * lock SPI to have exclusive access to the busses for a sequence of + * On SPI buses where there are multiple devices, it will be necessary to + * lock SPI to have exclusive access to the buses for a sequence of * transfers. The bus should be locked before the chip is selected. After * locking the SPI bus, the caller should then also call the setfrequency, * setbits, and setmode methods to make sure that the SPI is properly @@ -303,11 +564,15 @@ static uint32_t lpc54_spi_setfrequency(FAR struct spi_dev_s *dev, uint32_t frequency) { FAR struct lpc54_spidev_s *priv = (FAR struct lpc54_spidev_s *)dev; + uint32_t divider; uint32_t actual; + uint32_t regval; - /* Check if the requested frequence is the same as the frequency selection */ + /* Check if the requested frequency is the same as the current frequency + * selection. + */ - DEBUGASSERT(priv && frequency <= priv->fclock / 2); + DEBUGASSERT(priv != NULL && frequency <= priv->fclock / 2); if (priv->frequency == frequency) { @@ -317,7 +582,21 @@ static uint32_t lpc54_spi_setfrequency(FAR struct spi_dev_s *dev, } /* Set the new SPI frequency */ -#warning Missing logic + + divider = priv->fclock / frequency; + if (divider > 0x10000) + { + divider = 0x10000; + } + + regval = lpc54_spi_getreg(priv, LPC54_SPI_DIV_OFFSET); + regval &= ~SPI_DIV_MASK; + regval |= SPI_DIV(divider); + lpc54_spi_putreg(priv, LPC54_SPI_DIV_OFFSET, regval); + + /* Calculate the actual frequency */ + + actual = priv->fclock / divider; /* Save the frequency setting */ @@ -354,24 +633,25 @@ static void lpc54_spi_setmode(FAR struct spi_dev_s *dev, if (mode != priv->mode) { /* Yes... Set the new mode */ -#warning Missing logic + + regval = lpc54_spi_getreg(priv, LPC54_SPI_CFG_OFFSET); + regval &= ~(SPI_CFG_CPHA | SPI_CFG_CPOL); switch (mode) { case SPIDEV_MODE0: /* CPOL=0; CPHA=0 */ -#warning Missing logic break; case SPIDEV_MODE1: /* CPOL=0; CPHA=1 */ -#warning Missing logic + regval |= SPI_CFG_CPHA; break; case SPIDEV_MODE2: /* CPOL=1; CPHA=0 */ -#warning Missing logic + regval |= SPI_CFG_CPOL; break; case SPIDEV_MODE3: /* CPOL=1; CPHA=1 */ -#warning Missing logic + regval |= (SPI_CFG_CPHA | SPI_CFG_CPOL); break; default: @@ -379,9 +659,9 @@ static void lpc54_spi_setmode(FAR struct spi_dev_s *dev, return; } -#warning Missing logic + lpc54_spi_putreg(priv, LPC54_SPI_CFG_OFFSET, regval); - /* Save the mode so that subsequent re-configuratins will be faster */ + /* Save the mode so that subsequent re-configurations will be faster */ priv->mode = mode; } @@ -405,18 +685,14 @@ static void lpc54_spi_setmode(FAR struct spi_dev_s *dev, static void lpc54_spi_setbits(FAR struct spi_dev_s *dev, int nbits) { FAR struct lpc54_spidev_s *priv = (FAR struct lpc54_spidev_s *)dev; - uint32_t regval; - /* Has the number of bits changed? */ + /* The valid range of bit selections is 4 through 16 */ - DEBUGASSERT(priv && nbits > 7 && nbits < 17); + DEBUGASSERT(priv != NULL && nbits >=4 && nbits <= 16); - if (nbits != priv->nbits) + if (nbits >= 4 && nbits <= 16) { - /* Yes... Set the number word width */ -#warning Missing logic - - /* Save the selection so the subsequence re-configurations will be faster */ + /* Save the selection. It will be applied when data is transferred. */ priv->nbits = nbits; } @@ -494,9 +770,9 @@ static void lpc54_spi_exchange_nodma(FAR struct spi_dev_s *dev, { /* 16-bit mode */ - const uint16_t *src = (const uint16_t *)txbuffer; - uint16_t *dest = (uint16_t *)rxbuffer; - uint16_t word; + FAR const uint16_t *src = (FAR const uint16_t *)txbuffer; + FAR uint16_t *dest = (FAR uint16_t *)rxbuffer; + uint16_t word; while (nwords-- > 0) { @@ -513,7 +789,7 @@ static void lpc54_spi_exchange_nodma(FAR struct spi_dev_s *dev, /* Exchange one word */ - word = spi_send(dev, word); + word = lpc54_spi_send(dev, word); /* Is there a buffer to receive the return value? */ @@ -527,9 +803,9 @@ static void lpc54_spi_exchange_nodma(FAR struct spi_dev_s *dev, { /* 8-bit mode */ - const uint8_t *src = (const uint8_t *)txbuffer; - uint8_t *dest = (uint8_t *)rxbuffer; - uint8_t word; + FAR const uint8_t *src = (FAR const uint8_t *)txbuffer; + FAR uint8_t *dest = (FAR uint8_t *)rxbuffer; + uint8_t word; while (nwords-- > 0) { @@ -546,7 +822,7 @@ static void lpc54_spi_exchange_nodma(FAR struct spi_dev_s *dev, /* Exchange one word */ - word = (uint8_t)spi_send(dev, (uint16_t)word); + word = (uint8_t)lpc54_spi_send(dev, (uint16_t)word); /* Is there a buffer to receive the return value? */ @@ -615,8 +891,8 @@ static void lpc54_spi_exchange(FAR struct spi_dev_s *dev, static void lpc54_spi_sndblock(FAR struct spi_dev_s *dev, FAR const void *buffer, size_t nwords) { - spiinfo("txbuffer=%p nwords=%d\n", txbuffer, nwords); - return lpc54_spi_exchange(dev, txbuffer, NULL, nwords); + spiinfo("txbuffer=%p nwords=%d\n", buffer, nwords); + return lpc54_spi_exchange(dev, buffer, NULL, nwords); } /**************************************************************************** @@ -642,8 +918,8 @@ static void lpc54_spi_sndblock(FAR struct spi_dev_s *dev, static void lpc54_spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t nwords) { - spiinfo("rxbuffer=%p nwords=%d\n", rxbuffer, nwords); - return lpc54_spi_exchange(dev, NULL, rxbuffer, nwords); + spiinfo("rxbuffer=%p nwords=%d\n", buffer, nwords); + return lpc54_spi_exchange(dev, NULL, buffer, nwords); } /**************************************************************************** @@ -672,6 +948,7 @@ FAR struct spi_dev_s *lpc54_spibus_initialize(int port) { struct lpc54_spidev_s *priv; irqstate_t flags; + uint32_t regval; flags = enter_critical_section(); @@ -680,7 +957,7 @@ FAR struct spi_dev_s *lpc54_spibus_initialize(int port) * lpc54_lowputc.c. */ -#ifdef CONFIG_LPC54_I2C0_MASTER +#ifdef CONFIG_LPC54_SPI0_MASTER if (port == 0) { /* Attach 12 MHz clock to FLEXCOMM0 */ @@ -698,14 +975,15 @@ FAR struct spi_dev_s *lpc54_spibus_initialize(int port) priv = &g_spi0_dev; priv->base = LPC54_FLEXCOMM0_BASE; - priv->irqid = LPC54_IRQ_FLEXCOMM0; + priv->irq = LPC54_IRQ_FLEXCOMM0; priv->fclock = BOARD_FLEXCOMM0_FCLK; + priv->dev.ops = &g_spi0_ops; /* Configure SPI pins (defined in board.h) */ - lpc54_gpio_config(GPIO_I2C0_SCK); - lpc54_gpio_config(GPIO_I2C0_MOSI); - lpc54_gpio_config(GPIO_I2C0_MISO); + lpc54_gpio_config(GPIO_SPI0_SCK); + lpc54_gpio_config(GPIO_SPI0_MOSI); + lpc54_gpio_config(GPIO_SPI0_MISO); /* Set up the FLEXCOMM0 function clock */ @@ -713,7 +991,7 @@ FAR struct spi_dev_s *lpc54_spibus_initialize(int port) } else #endif -#ifdef CONFIG_LPC54_I2C1_MASTER +#ifdef CONFIG_LPC54_SPI1_MASTER if (port == 1) { /* Attach 12 MHz clock to FLEXCOMM1 */ @@ -731,14 +1009,15 @@ FAR struct spi_dev_s *lpc54_spibus_initialize(int port) priv = &g_spi1_dev; priv->base = LPC54_FLEXCOMM1_BASE; - priv->irqid = LPC54_IRQ_FLEXCOMM1; + priv->irq = LPC54_IRQ_FLEXCOMM1; priv->fclock = BOARD_FLEXCOMM1_FCLK; + priv->dev.ops = &g_spi1_ops; /* Configure SPI pins (defined in board.h) */ - lpc54_gpio_config(GPIO_I2C1_SCK); - lpc54_gpio_config(GPIO_I2C1_MOSI); - lpc54_gpio_config(GPIO_I2C1_MISO); + lpc54_gpio_config(GPIO_SPI1_SCK); + lpc54_gpio_config(GPIO_SPI1_MOSI); + lpc54_gpio_config(GPIO_SPI1_MISO); /* Set up the FLEXCOMM1 function clock */ @@ -746,7 +1025,7 @@ FAR struct spi_dev_s *lpc54_spibus_initialize(int port) } else #endif -#ifdef CONFIG_LPC54_I2C2_MASTER +#ifdef CONFIG_LPC54_SPI2_MASTER if (port == 2) { /* Attach 12 MHz clock to FLEXCOMM2 */ @@ -764,14 +1043,15 @@ FAR struct spi_dev_s *lpc54_spibus_initialize(int port) priv = &g_spi2_dev; priv->base = LPC54_FLEXCOMM2_BASE; - priv->irqid = LPC54_IRQ_FLEXCOMM2; + priv->irq = LPC54_IRQ_FLEXCOMM2; priv->fclock = BOARD_FLEXCOMM2_FCLK; + priv->dev.ops = &g_spi2_ops; /* Configure SPI pins (defined in board.h) */ - lpc54_gpio_config(GPIO_I2C2_SCK); - lpc54_gpio_config(GPIO_I2C2_MOSI); - lpc54_gpio_config(GPIO_I2C2MISO); + lpc54_gpio_config(GPIO_SPI2_SCK); + lpc54_gpio_config(GPIO_SPI2_MOSI); + lpc54_gpio_config(GPIO_SPI2MISO); /* Set up the FLEXCOMM2 function clock */ @@ -779,7 +1059,7 @@ FAR struct spi_dev_s *lpc54_spibus_initialize(int port) } else #endif -#ifdef CONFIG_LPC54_I2C3_MASTER +#ifdef CONFIG_LPC54_SPI3_MASTER if (port == 3) { /* Attach 12 MHz clock to FLEXCOMM3 */ @@ -797,14 +1077,15 @@ FAR struct spi_dev_s *lpc54_spibus_initialize(int port) priv = &g_spi3_dev; priv->base = LPC54_FLEXCOMM3_BASE; - priv->irqid = LPC54_IRQ_FLEXCOMM3; + priv->irq = LPC54_IRQ_FLEXCOMM3; priv->fclock = BOARD_FLEXCOMM3_FCLK; + priv->dev.ops = &g_spi3_ops; /* Configure SPI pins (defined in board.h) */ - lpc54_gpio_config(GPIO_I2C3_SCK); - lpc54_gpio_config(GPIO_I2C3_MOSI); - lpc54_gpio_config(GPIO_I2C3_MISO); + lpc54_gpio_config(GPIO_SPI3_SCK); + lpc54_gpio_config(GPIO_SPI3_MOSI); + lpc54_gpio_config(GPIO_SPI3_MISO); /* Set up the FLEXCOMM3 function clock */ @@ -812,7 +1093,7 @@ FAR struct spi_dev_s *lpc54_spibus_initialize(int port) } else #endif -#ifdef CONFIG_LPC54_I2C4_MASTER +#ifdef CONFIG_LPC54_SPI4_MASTER if (port == 4) { /* Attach 12 MHz clock to FLEXCOMM4 */ @@ -830,14 +1111,15 @@ FAR struct spi_dev_s *lpc54_spibus_initialize(int port) priv = &g_spi4_dev; priv->base = LPC54_FLEXCOMM4_BASE; - priv->irqid = LPC54_IRQ_FLEXCOMM4; + priv->irq = LPC54_IRQ_FLEXCOMM4; priv->fclock = BOARD_FLEXCOMM4_FCLK; + priv->dev.ops = &g_spi4_ops; /* Configure SPI pins (defined in board.h) */ - lpc54_gpio_config(GPIO_I2C4_SCK); - lpc54_gpio_config(GPIO_I2C4_MOSI); - lpc54_gpio_config(GPIO_I2C4_MISO); + lpc54_gpio_config(GPIO_SPI4_SCK); + lpc54_gpio_config(GPIO_SPI4_MOSI); + lpc54_gpio_config(GPIO_SPI4_MISO); /* Set up the FLEXCOMM4 function clock */ @@ -845,7 +1127,7 @@ FAR struct spi_dev_s *lpc54_spibus_initialize(int port) } else #endif -#ifdef CONFIG_LPC54_I2C5_MASTER +#ifdef CONFIG_LPC54_SPI5_MASTER if (port == 5) { /* Attach 12 MHz clock to FLEXCOMM5 */ @@ -863,14 +1145,15 @@ FAR struct spi_dev_s *lpc54_spibus_initialize(int port) priv = &g_spi5_dev; priv->base = LPC54_FLEXCOMM5_BASE; - priv->irqid = LPC54_IRQ_FLEXCOMM5; + priv->irq = LPC54_IRQ_FLEXCOMM5; priv->fclock = BOARD_FLEXCOMM5_FCLK; + priv->dev.ops = &g_spi5_ops; /* Configure SPI pins (defined in board.h) */ - lpc54_gpio_config(GPIO_I2C5_SCK); - lpc54_gpio_config(GPIO_I2C5_MOSI); - lpc54_gpio_config(GPIO_I2C5_MISO); + lpc54_gpio_config(GPIO_SPI5_SCK); + lpc54_gpio_config(GPIO_SPI5_MOSI); + lpc54_gpio_config(GPIO_SPI5_MISO); /* Set up the FLEXCOMM5 function clock */ @@ -878,7 +1161,7 @@ FAR struct spi_dev_s *lpc54_spibus_initialize(int port) } else #endif -#ifdef CONFIG_LPC54_I2C6_MASTER +#ifdef CONFIG_LPC54_SPI6_MASTER if (port == 6) { /* Attach 12 MHz clock to FLEXCOMM6 */ @@ -896,14 +1179,15 @@ FAR struct spi_dev_s *lpc54_spibus_initialize(int port) priv = &g_spi6_dev; priv->base = LPC54_FLEXCOMM6_BASE; - priv->irqid = LPC54_IRQ_FLEXCOMM6; + priv->irq = LPC54_IRQ_FLEXCOMM6; priv->fclock = BOARD_FLEXCOMM6_FCLK; + priv->dev.ops = &g_spi6_ops; /* Configure SPI pins (defined in board.h) */ - lpc54_gpio_config(GPIO_I2C6_SCK); - lpc54_gpio_config(GPIO_I2C6_MOSI); - lpc54_gpio_config(GPIO_I2C6_MISO); + lpc54_gpio_config(GPIO_SPI6_SCK); + lpc54_gpio_config(GPIO_SPI6_MOSI); + lpc54_gpio_config(GPIO_SPI6_MISO); /* Set up the FLEXCOMM6 function clock */ @@ -911,7 +1195,7 @@ FAR struct spi_dev_s *lpc54_spibus_initialize(int port) } else #endif -#ifdef CONFIG_LPC54_I2C7_MASTER +#ifdef CONFIG_LPC54_SPI7_MASTER if (port == 7) { /* Attach 12 MHz clock to FLEXCOMM7 */ @@ -929,14 +1213,15 @@ FAR struct spi_dev_s *lpc54_spibus_initialize(int port) priv = &g_spi7_dev; priv->base = LPC54_FLEXCOMM7_BASE; - priv->irqid = LPC54_IRQ_FLEXCOMM7; + priv->irq = LPC54_IRQ_FLEXCOMM7; priv->fclock = BOARD_FLEXCOMM7_FCLK; + priv->dev.ops = &g_spi7_ops; /* Configure SPI pins (defined in board.h) */ - lpc54_gpio_config(GPIO_I2C7_SCK); - lpc54_gpio_config(GPIO_I2C7_MOSI); - lpc54_gpio_config(GPIO_I2C7_MISO); + lpc54_gpio_config(GPIO_SPI7_SCK); + lpc54_gpio_config(GPIO_SPI7_MOSI); + lpc54_gpio_config(GPIO_SPI7_MISO); /* Set up the FLEXCOMM7 function clock */ @@ -944,7 +1229,7 @@ FAR struct spi_dev_s *lpc54_spibus_initialize(int port) } else #endif -#ifdef CONFIG_LPC54_I2C8_MASTER +#ifdef CONFIG_LPC54_SPI8_MASTER if (port == 8) { /* Attach 12 MHz clock to FLEXCOMM8 */ @@ -962,14 +1247,15 @@ FAR struct spi_dev_s *lpc54_spibus_initialize(int port) priv = &g_spi8_dev; priv->base = LPC54_FLEXCOMM8_BASE; - priv->irqid = LPC54_IRQ_FLEXCOMM8; + priv->irq = LPC54_IRQ_FLEXCOMM8; priv->fclock = BOARD_FLEXCOMM8_FCLK; + priv->dev.ops = &g_spi8_ops; /* Configure SPI pins (defined in board.h) */ - lpc54_gpio_config(GPIO_I2C8_SCK); - lpc54_gpio_config(GPIO_I2C8_MOSI); - lpc54_gpio_config(GPIO_I2C8_MISO); + lpc54_gpio_config(GPIO_SPI8_SCK); + lpc54_gpio_config(GPIO_SPI8_MOSI); + lpc54_gpio_config(GPIO_SPI8_MISO); /* Set up the FLEXCOMM8 function clock */ @@ -977,7 +1263,7 @@ FAR struct spi_dev_s *lpc54_spibus_initialize(int port) } else #endif -#ifdef CONFIG_LPC54_I2C9_MASTER +#ifdef CONFIG_LPC54_SPI9_MASTER if (port == 9) { /* Attach 12 MHz clock to FLEXCOMM9 */ @@ -995,14 +1281,15 @@ FAR struct spi_dev_s *lpc54_spibus_initialize(int port) priv = &g_spi9_dev; priv->base = LPC54_FLEXCOMM9_BASE; - priv->irqid = LPC54_IRQ_FLEXCOMM9; + priv->irq = LPC54_IRQ_FLEXCOMM9; priv->fclock = BOARD_FLEXCOMM9_FCLK; + priv->dev.ops = &g_spi9_ops; /* Configure SPI pins (defined in board.h) */ - lpc54_gpio_config(GPIO_I2C9_SCK); - lpc54_gpio_config(GPIO_I2C9_MOSI); - lpc54_gpio_config(GPIO_I2C9_MISO); + lpc54_gpio_config(GPIO_SPI9_SCK); + lpc54_gpio_config(GPIO_SPI9_MOSI); + lpc54_gpio_config(GPIO_SPI9_MISO); /* Set up the FLEXCOMM9 function clock */ @@ -1016,24 +1303,69 @@ FAR struct spi_dev_s *lpc54_spibus_initialize(int port) leave_critical_section(flags); - /* Enable the SPI peripheral*/ - /* Configure 8-bit SPI mode and master mode */ -#warning Missing logic - /* Set the initial SPI configuration */ priv->frequency = 0; priv->nbits = 8; priv->mode = SPIDEV_MODE0; - priv->dev.ops = &g_spi_ops; + + /* Initialize the SPI semaphore that enforces mutually exclusive access */ + + nxsem_init(&priv->exclsem, 0, 1); + + /* Configure master mode in mode 0: + * + * ENABLE - Disabled for now (0) + * MASTER - Master mode (1) + * LSBF - MSB first (0) + * CPHA/CPOL - Mode 0 (0,0) + * LOOP - Disable loopback mode (0) + * SPOLn - Active low (0,0,0) + */ + + regval = lpc54_spi_getreg(priv, LPC54_SPI_CFG_OFFSET); + regval &= ~(SPI_CFG_ENABLE | SPI_CFG_LSBF | SPI_CFG_CPHA | SPI_CFG_CPOL | + SPI_CFG_LOOP | SPI_CFG_SPOL0 | SPI_CFG_SPOL1 | SPI_CFG_SPOL2 | + SPI_CFG_SPOL3); + regval |= SPI_CFG_MASTER; + lpc54_spi_putreg(priv, LPC54_SPI_CFG_OFFSET, regval); + + /* Enable FIFOs */ + + regval = lpc54_spi_getreg(priv, LPC54_SPI_CFG_OFFSET); + regval |= (SPI_FIFOCFG_EMPTYTX | SPI_FIFOCFG_EMPTYRX); + lpc54_spi_putreg(priv, LPC54_SPI_CFG_OFFSET, regval); + + regval |= (SPI_FIFOCFG_ENABLETX | SPI_FIFOCFG_ENABLERX); + lpc54_spi_putreg(priv, LPC54_SPI_CFG_OFFSET, regval); + + /* Set FIFO trigger levels: Empty for Tx FIFO; 1 word for RxFIFO */ + + regval = lpc54_spi_getreg(priv, LPC54_SPI_CFG_OFFSET); + regval &= ~(SPI_FIFOTRIG_TXLVL_MASK | SPI_FIFOTRIG_RXLVL_MASK); + regval |= (SPI_FIFOTRIG_TXLVL_EMPTY | SPI_FIFOTRIG_RXLVL_NOTEMPTY); + + /* Enable generation of interrupts for selected FIFO trigger levels */ + + regval |= (SPI_FIFOTRIG_TXLVLENA | SPI_FIFOTRIG_RXLVLENA); + lpc54_spi_putreg(priv, LPC54_SPI_CFG_OFFSET, regval); + + /* Set the delay configuration (not used) */ + + regval = (SPI_DLY_PRE_DELAY(0) | SPI_DLY_POST_DELAY(0) | SPI_DLY_FRAME_DELAY(0) | + SPI_DLY_TRANSFER_DELAY(0)); + lpc54_spi_putreg(priv, LPC54_SPI_DLY_OFFSET, regval); /* Select a default frequency of approx. 400KHz */ lpc54_spi_setfrequency((FAR struct spi_dev_s *)priv, 400000); - /* Initialize the SPI semaphore that enforces mutually exclusive access */ + /* Enable the SPI peripheral */ + + regval = lpc54_spi_getreg(priv, LPC54_SPI_CFG_OFFSET); + regval |= SPI_CFG_ENABLE; + lpc54_spi_putreg(priv, LPC54_SPI_CFG_OFFSET, regval); - nxsem_init(&priv->exclsem, 0, 1); return &priv->dev; } diff --git a/arch/arm/src/lpc54xx/lpc54_spi_master.h b/arch/arm/src/lpc54xx/lpc54_spi_master.h index 376c3a6e76..12009872a7 100644 --- a/arch/arm/src/lpc54xx/lpc54_spi_master.h +++ b/arch/arm/src/lpc54xx/lpc54_spi_master.h @@ -109,45 +109,111 @@ extern "C" FAR struct spi_dev_s *lpc54_spibus_initialize(int port); /************************************************************************************ - * Name: lpc54_spiselect, lpc54_spistatus, and lpc54_spicmddata + * Name: lpc54_spiN_select, lpc54_spiN_status, and lpc54_spiN_cmddata * * Description: * These functions must be provided in your board-specific logic. The - * lpc54_spiselect function will perform chip selection and the lpc54_spistatus + * lpc54_spiN_select function will perform chip selection and the lpc54_spiN_status * will perform status operations using GPIOs in the way your board is configured. * * If CONFIG_SPI_CMDDATA is defined in the NuttX configuration, then - * lpc54_spicmddata must also be provided. This functions performs cmd/data + * lpc54_spiN_cmddata must also be provided. This functions performs cmd/data * selection operations using GPIOs in the way your board is configured. * ************************************************************************************/ -void lpc54_spiselect(FAR struct spi_dev_s *dev, uint32_t devid, bool selected); -uint8_t lpc54_spistatus(FAR struct spi_dev_s *dev, uint32_t devid); +#ifdef CONFIG_LPC54_SPI0_MASTER +void lpc54_spi0_select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected); +uint8_t lpc54_spi0_status(FAR struct spi_dev_s *dev, uint32_t devid); #ifdef CONFIG_SPI_CMDDATA -int lpc54_spicmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd); +int lpc54_spi0_cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd); +#endif #endif -/************************************************************************************ - * Name: spi_flush - * - * Description: - * Flush and discard any words left in the RX fifo. This can be called from - * spiselect after a device is deselected (if you worry about such things). - * - * Input Parameters: - * dev - Device-specific state data - * - * Returned Value: - * None - * - ************************************************************************************/ +#ifdef CONFIG_LPC54_SPI1_MASTER +void lpc54_spi1_select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected); +uint8_t lpc54_spi1_status(FAR struct spi_dev_s *dev, uint32_t devid); + +#ifdef CONFIG_SPI_CMDDATA +int lpc54_spi1_cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd); +#endif +#endif + +#ifdef CONFIG_LPC54_SPI2_MASTER +void lpc54_spi2_select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected); +uint8_t lpc54_spi2_status(FAR struct spi_dev_s *dev, uint32_t devid); + +#ifdef CONFIG_SPI_CMDDATA +int lpc54_spi2_cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd); +#endif +#endif + +#ifdef CONFIG_LPC54_SPI3_MASTER +void lpc54_spi3_select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected); +uint8_t lpc54_spi3_status(FAR struct spi_dev_s *dev, uint32_t devid); + +#ifdef CONFIG_SPI_CMDDATA +int lpc54_spi3_cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd); +#endif +#endif -void spi_flush(FAR struct spi_dev_s *dev); +#ifdef CONFIG_LPC54_SPI4_MASTER +void lpc54_spi4_select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected); +uint8_t lpc54_spi4_status(FAR struct spi_dev_s *dev, uint32_t devid); + +#ifdef CONFIG_SPI_CMDDATA +int lpc54_spi4_cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd); +#endif +#endif + +#ifdef CONFIG_LPC54_SPI5_MASTER +void lpc54_spi5_select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected); +uint8_t lpc54_spi5_status(FAR struct spi_dev_s *dev, uint32_t devid); + +#ifdef CONFIG_SPI_CMDDATA +int lpc54_spi5_cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd); +#endif +#endif + +#ifdef CONFIG_LPC54_SPI6_MASTER +void lpc54_spi6_select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected); +uint8_t lpc54_spi6_status(FAR struct spi_dev_s *dev, uint32_t devid); + +#ifdef CONFIG_SPI_CMDDATA +int lpc54_spi6_cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd); +#endif +#endif + +#ifdef CONFIG_LPC54_SPI7_MASTER +void lpc54_spi7_select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected); +uint8_t lpc54_spi7_status(FAR struct spi_dev_s *dev, uint32_t devid); + +#ifdef CONFIG_SPI_CMDDATA +int lpc54_spi7_cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd); +#endif +#endif + +#ifdef CONFIG_LPC54_SPI8_MASTER +void lpc54_spi8_select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected); +uint8_t lpc54_spi8_status(FAR struct spi_dev_s *dev, uint32_t devid); + +#ifdef CONFIG_SPI_CMDDATA +int lpc54_spi8_cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd); +#endif +#endif + +#ifdef CONFIG_LPC54_SPI9_MASTER +void lpc54_spi9_select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected); +uint8_t lpc54_spi9_status(FAR struct spi_dev_s *dev, uint32_t devid); + +#ifdef CONFIG_SPI_CMDDATA +int lpc54_spi9_cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd); +#endif +#endif /************************************************************************************ - * Name: lpc54_spi/spiregister + * Name: lpc54_spiN_register * * Description: * If the board supports a card detect callback to inform the SPI-based MMC/SD @@ -167,7 +233,36 @@ void spi_flush(FAR struct spi_dev_s *dev); ************************************************************************************/ #ifdef CONFIG_SPI_CALLBACK -int lpc54_spiregister(FAR struct spi_dev_s *dev, spi_mediachange_t callback, void *arg); +#ifdef CONFIG_LPC54_SPI0_MASTER +int lpc54_spi0_register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, void *arg); +#endif +#ifdef CONFIG_LPC54_SPI1_MASTER +int lpc54_spi1_register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, void *arg); +#endif +#ifdef CONFIG_LPC54_SPI2_MASTER +int lpc54_spi2_register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, void *arg); +#endif +#ifdef CONFIG_LPC54_SPI3_MASTER +int lpc54_spi3_register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, void *arg); +#endif +#ifdef CONFIG_LPC54_SPI4_MASTER +int lpc54_spi4_register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, void *arg); +#endif +#ifdef CONFIG_LPC54_SPI5_MASTER +int lpc54_spi5_register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, void *arg); +#endif +#ifdef CONFIG_LPC54_SPI6_MASTER +int lpc54_spi6_register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, void *arg); +#endif +#ifdef CONFIG_LPC54_SPI7_MASTER +int lpc54_spi7_register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, void *arg); +#endif +#ifdef CONFIG_LPC54_SPI8_MASTER +int lpc54_spi8_register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, void *arg); +#endif +#ifdef CONFIG_LPC54_SPI9_MASTER +int lpc54_spi9_register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, void *arg); +#endif #endif #undef EXTERN diff --git a/sched/init/os_start.c b/sched/init/os_start.c index 93f5cf0f1e..9033189e63 100644 --- a/sched/init/os_start.c +++ b/sched/init/os_start.c @@ -115,7 +115,7 @@ volatile dq_queue_t g_readytorun; * and * - Tasks/threads that have not been assigned to a CPU. * - * Otherwise, the TCB will be reatined in an assigned task list, + * Otherwise, the TCB will be retained in an assigned task list, * g_assignedtasks. As its name suggests, on 'g_assignedtasks queue for CPU * 'n' would contain only tasks/threads that are assigned to CPU 'n'. Tasks/ * threads would be assigned a particular CPU by one of two mechanisms: @@ -187,7 +187,7 @@ volatile dq_queue_t g_waitingforfill; volatile dq_queue_t g_inactivetasks; -/* These are lists of dayed memory deallocations that need to be handled +/* These are lists of delayed memory deallocations that need to be handled * within the IDLE loop or worker thread. These deallocations get queued * by sched_kufree and sched_kfree() if the OS needs to deallocate memory * while it is within an interrupt handler. -- GitLab From 8f94ce46f9875e127ec17629f10f2bf22341531f Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sun, 14 Jan 2018 12:09:26 -0600 Subject: [PATCH 013/228] arch/arm/src/lpc54xx: The basic SPI driver is code complete but still untested. This driver is 'basic' in that in only supports polled mode operations. --- arch/arm/src/lpc54xx/Kconfig | 18 + arch/arm/src/lpc54xx/chip/lpc54_spi.h | 89 +- arch/arm/src/lpc54xx/lpc54_spi_master.c | 1025 +++++++++++++++++++---- arch/arm/src/lpc54xx/lpc54_spi_master.h | 2 +- configs/lpcxpresso-lpc54628/README.txt | 19 +- include/nuttx/spi/spi.h | 4 +- 6 files changed, 967 insertions(+), 190 deletions(-) diff --git a/arch/arm/src/lpc54xx/Kconfig b/arch/arm/src/lpc54xx/Kconfig index bc77fb0719..947350c773 100644 --- a/arch/arm/src/lpc54xx/Kconfig +++ b/arch/arm/src/lpc54xx/Kconfig @@ -667,6 +667,24 @@ endif # LPC54_EMC_DYNAMIC endmenu # EMC Configuration +menu "SPI Master configuration" + depends on LPC54_HAVE_SPI_MASTER + +config LPC54_SPI_WIDEDATA + bool "Enable wide data" + default n + ---help--- + The LPC54xxx SPI supports data widths from 4 through 16 bits. For + data from 4 through 8 bits; the receive and transmit data is + represented with a uint8_t type. For the wider data, data is + represented with a uint16_t. There is duplication of logic for this + different widths. By default, SPI wide data is disabled since that + is the less frequently used data type and disabling wide data can + result in some size reduction. Select this option if you need wide + SPI data. + +endmenu # SPI Master configuration + menu "Ethernet configuration" depends on LPC54_ETHERNET diff --git a/arch/arm/src/lpc54xx/chip/lpc54_spi.h b/arch/arm/src/lpc54xx/chip/lpc54_spi.h index 01e3a5830d..21071fbb37 100644 --- a/arch/arm/src/lpc54xx/chip/lpc54_spi.h +++ b/arch/arm/src/lpc54xx/chip/lpc54_spi.h @@ -288,11 +288,18 @@ # define SPI_DLY_TRANSFER_DELAY(n) ((uint32_t)(n) << SPI_DLY_TRANSFER_DELAY_SHIFT) /* SPI Status register */ -#define SPI_STAT_ -/* SPI Interrupt Enable read and set */ -#define SPI_INTENSET_ -/* SPI Interrupt Enable Clear */ -#define SPI_INTENCLR_ + +#define SPI_STAT_SSA (1 << 4) /* Bit 4: Slave Select Assert */ +#define SPI_STAT_SSD (1 << 5) /* Bit 5: Slave Select Deassert */ +#define SPI_STAT_STALLED (1 << 6) /* Bit 6: Stalled status flag */ +#define SPI_STAT_ENDTRANSFER (1 << 7) /* Bit 7: End Transfer control bit */ +#define SPI_STAT_MSTIDLE (1 << 8) /* Bit 8: Master idle status flag */ + +/* SPI Interrupt Enable read and set, SPI Interrupt Enable Clear, and SPI Interrupt Status */ + +#define SPI_INT_SSA (1 << 4) /* Bit 4: Slave select assert interrupt */ +#define SPI_INT_SSD (1 << 5) /* Bit 5: Slave select deassert interrupt */ +#define SPI_INT_MSTIDLE (1 << 8) /* Bit 8: Master idle interrupt */ /* SPI clock Divider */ @@ -300,9 +307,6 @@ #define SPI_DIV_MASK (0xffff << SPI_DIV_SHIFT) # define SPI_DIV(n) ((uint32_t)((n)-1) << SPI_DIV_SHIFT) -/* SPI Interrupt Status */ -#define SPI_INTSTAT_ - /* FIFO configuration and enable register */ #define SPI_FIFOCFG_ENABLETX (1 << 0) /* Bit 0: Enable the transmit FIFO) */ @@ -318,12 +322,23 @@ #define SPI_FIFOCFG_EMPTYRX (1 << 17) /* Bit 17: Empty command for the receive FIFO) */ /* FIFO status register */ -#define SPI_FIFOSTAT_ + +#define SPI_FIFOSTAT_TXERR (1 << 0) /* Bit 0: TX FIFO error */ +#define SPI_FIFOSTAT_RXERR (1 << 1) /* Bit 1: RX FIFO error */ +#define SPI_FIFOSTAT_PERINT (1 << 3) /* Bit 3: Peripheral interrupt */ +#define SPI_FIFOSTAT_TXEMPTY (1 << 4) /* Bit 4: Transmit FIFO empty */ +#define SPI_FIFOSTAT_TXNOTFULL (1 << 5) /* Bit 5: Transmit FIFO not full */ +#define SPI_FIFOSTAT_RXNOTEMPTY (1 << 6) /* Bit 6: Receive FIFO not empty */ +#define SPI_FIFOSTAT_RXFULL (1 << 7) /* Bit 7: Receive FIFO full */ +#define SPI_FIFOSTAT_TXLVL_SHIFT (8) /* Bits 8-12: Transmit FIFO current level */ +#define SPI_FIFOSTAT_TXLVL_MASK (31 << SPI_FIFOSTAT_TXLVL_SHIFT) +#define SPI_FIFOSTAT_RXLVL_SHIFT (16) /* Bits 16-20: Receive FIFO current level */ +#define SPI_FIFOSTAT_RXLVL_MASK (31 << SPI_FIFOSTAT_RXLVL_SHIFT) /* FIFO trigger level settings for interrupt and DMA request */ -#define SPI_FIFOTRIG_TXLVLENA (1 << 0) /* Bit 0 Transmit FIFO level trigger enable */ -#define SPI_FIFOTRIG_RXLVLENA (1 << 1) /* Bit 1 Receive FIFO level trigger enable */ +#define SPI_FIFOTRIG_TXLVLENA (1 << 0) /* Bit 0: Transmit FIFO level trigger enable */ +#define SPI_FIFOTRIG_RXLVLENA (1 << 1) /* Bit 1: Receive FIFO level trigger enable */ #define SPI_FIFOTRIG_TXLVL_SHIFT (8) /* Bits 8-11: Transmit FIFO level trigger point */ #define SPI_FIFOTRIG_TXLVL_MASK (15 << SPI_FIFOTRIG_TXLVL_SHIFT) # define SPI_FIFOTRIG_TXLVL(n) ((uint32_t)(n) << SPI_FIFOTRIG_TXLVL_SHIFT) @@ -335,22 +350,28 @@ # define SPI_FIFOTRIG_RXLVL_NOTEMPTY (0 << SPI_FIFOTRIG_RXLVL_SHIFT) # define SPI_FIFOTRIG_RXLVL_FULL (7 << SPI_FIFOTRIG_RXLVL_SHIFT) -/* FIFO interrupt enable set (enable) and read register */ -#define SPI_FIFOINTENSET_ -/* FIFO interrupt enable clear (disable) and read register */ -#define SPI_FIFOINTENCLR_ -/* FIFO interrupt status register */ -#define SPI_FIFOINTSTAT_ +/* FIFO interrupt enable set (enable) and read register, FIFO interrupt enable clear (disable) + * and read register, and FIFO interrupt status register + */ + +#define SPI_FIFOINT_TXERR (1 << 0) /* Bit 0: Transmit error interrupt */ +#define SPI_FIFOINT_RXERR (1 << 1) /* Bit 1: Receive error interrupt */ +#define SPI_FIFOINT_TXLVL (1 << 2) /* Bit 2: Tx FIFO level reached interrupt */ +#define SPI_FIFOINT_RXLVL (1 << 3) /* Bit 3: Rx FIFO level reached interrupt */ +#define SPI_FIFOINTSTAT_PERINT (1 << 4) /* Bit 4: Peripheral interrupt (status only) */ /* FIFO write data */ #define SPI_FIFOWR_TXDATA_SHIFT (0) /* Bits 0-15: Transmit data to the FIFO */ #define SPI_FIFOWR_TXDATA_MASK (0xffff << SPI_FIFOWR_TXDATA_SHIFT) # define SPI_FIFOWR_TXDATA(n) ((uint32_t)(n) << SPI_FIFOWR_TXDATA_SHIFT) -#define SPI_FIFOWR_TXSSEL0_N (1 << 16) /* Bit 16: Transmit Slave Select */ -#define SPI_FIFOWR_TXSSEL1_N (1 << 17) /* Bit 17: Transmit Slave Select */ -#define SPI_FIFOWR_TXSSEL2_N (1 << 18) /* Bit 18: Transmit Slave Select */ -#define SPI_FIFOWR_TXSSEL3_N (1 << 19) /* Bit 19: Transmit Slave Select */ +#define SPI_FIFOWR_TXSSELN_SHIFT (16) /* Bits 16-19: Transmit Slave Selects */ +#define SPI_FIFOWR_TXSSELN_MASK (15 << SPI_FIFOWR_TXSSELN_SHIFT) +# define SPI_FIFOWR_TXSSELN_ALL (15 << SPI_FIFOWR_TXSSELN_SHIFT) +# define SPI_FIFOWR_TXSSEL0N (1 << 16) /* Bit 16: Transmit Slave Select */ +# define SPI_FIFOWR_TXSSEL1N (1 << 17) /* Bit 17: Transmit Slave Select */ +# define SPI_FIFOWR_TXSSEL2N (1 << 18) /* Bit 18: Transmit Slave Select */ +# define SPI_FIFOWR_TXSSEL3N (1 << 19) /* Bit 19: Transmit Slave Select */ #define SPI_FIFOWR_EOT (1 << 20) /* Bit 20: End of Transfer */ #define SPI_FIFOWR_EOF (1 << 21) /* Bit 21: End of Frame */ #define SPI_FIFOWR_RXIGNORE (1 << 22) /* Bit 22: Receive Ignore */ @@ -358,11 +379,27 @@ #define SPI_FIFOWR_LEN_MASK (15 << SPI_FIFOWR_LEN_SHIFT) # define SPI_FIFOWR_LEN(n) ((uint32_t)((n)-1) << SPI_FIFOWR_LEN_SHIFT) -/* FIFO read data */ -#define SPI_FIFORD_ -/* FIFO data read with no FIFO pop */ -#define SPI_FIFORDNOPOP_ +/* FIFO read data and FIFO data read with no FIFO pop */ + +#define SPI_FIFORD_RXDATA_SHIFT (0) /* Bits 0-15: Received data from the FIFO */ +#define SPI_FIFORD_RXDATA_MASK (0xffff << SPI_FIFORD_RXDATA_SHIFT) +#define SPI_FIFORD_RXSSELN_SHIFT (16) /* Bits 16-19: Slave Selects for receive */ +#define SPI_FIFORD_RXSSELN_MASK (15 << SPI_FIFORD_RXSSELN_SHIFT) +# define SPI_FIFORD_RXSSEL0N (1 << 16) /* Bit 16: Slave Select for receive */ +# define SPI_FIFORD_RXSSEL1N (1 << 17) /* Bit 17: Slave Select for receive */ +# define SPI_FIFORD_RXSSEL2N (1 << 18) /* Bit 18: Slave Select for receive */ +# define SPI_FIFORD_RXSSEL3N (1 << 19) /* Bit 19: Slave Select for receive */ +#define SPI_FIFORD_SOT (1 << 20) /* Bit 20: Start of Transfer flag */ + /* SPI module Identification */ -#define SPI_ID_ + +#define SPI_ID_APERTURE_SHIFT (0) /* Bits 0-7: Aperture encoded as (aperture size/4K) -1 */ +#define SPI_ID_APERTURE_MASK (0xff << SPI_ID_APERTURE_SHIFT) +#define SPI_ID_MINORREV_SHIFT (8) /* Bits 8-11: Minor revision of module implementation */ +#define SPI_ID_MINORREV_MASK (15 << SPI_ID_MINORREV_SHIFT) +#define SPI_ID_MAJORREV_SHIFT (12) /* Bits 12-15: Major revision of module implementation */ +#define SPI_ID_MAJORREV_MASK (15 << SPI_ID_MAJORREV_SHIFT) +#define SPI_ID_ID_SHIFT (15) /* Bits 16-31: Unique module identifier for this IP block */ +#define SPI_ID_ID_MASK (0xffff << SPI_ID_ID_SHIFT) #endif /* __ARCH_ARM_SRC_LPC54XX_CHIP_LPC54_SPI_H */ diff --git a/arch/arm/src/lpc54xx/lpc54_spi_master.c b/arch/arm/src/lpc54xx/lpc54_spi_master.c index 6189dc9135..35dd60ed8f 100644 --- a/arch/arm/src/lpc54xx/lpc54_spi_master.c +++ b/arch/arm/src/lpc54xx/lpc54_spi_master.c @@ -33,6 +33,16 @@ * ****************************************************************************/ +/* TODO: + * + * - There are no interrupt driven transfers, only polled. I don't + * consider this a significant problem because of the higher rate that + * would be necessary for interrupt driven transfers. + * - Integrate DMA transfers. This is fairly important because it can + * a) improve the data transfer rates and b) free the CPU when the + * SPI driver would otherwise be stuck in a tight polling loop. + */ + /**************************************************************************** * Included Files ****************************************************************************/ @@ -59,6 +69,7 @@ #include "chip/lpc54_spi.h" #include "lpc54_config.h" #include "lpc54_enableclk.h" +#include "lpc54_gpio.h" #include "lpc54_spi_master.h" #ifdef HAVE_SPI_MASTER_DEVICE @@ -67,7 +78,15 @@ * Pre-processor Definitions ****************************************************************************/ -#define SPI_DUMMYDATA 0xff +#define SPI_DUMMYDATA8 0xff +#define SPI_DUMMYDATA16 0xffff + +#define SPI_MINWIDTH 4 +#ifdef CONFIG_LPC54_SPI_WIDEDATA +# define SPI_MAXWIDTH 16 +#else +# define SPI_MAXWIDTH 8 +#endif /**************************************************************************** * Private Types @@ -77,22 +96,110 @@ struct lpc54_spidev_s { - struct spi_dev_s dev; /* Externally visible part of the SPI interface */ - uintptr_t base; /* Base address of Flexcomm registers */ - sem_t exclsem; /* Held while chip is selected for mutual exclusion */ - uint32_t fclock; /* Flexcomm function clock frequency */ - uint32_t frequency; /* Requested clock frequency */ - uint32_t actual; /* Actual clock frequency */ - uint16_t irq; /* Flexcomm IRQ number */ - uint8_t nbits; /* Width of word in bits (8 to 16) */ - uint8_t mode; /* Mode 0,1,2,3 */ + struct spi_dev_s dev; /* Externally visible part of the SPI interface */ + uintptr_t base; /* Base address of Flexcomm registers */ + sem_t exclsem; /* Held while chip is selected for mutual exclusion */ + uint32_t fclock; /* Flexcomm function clock frequency */ + uint32_t frequency; /* Requested clock frequency */ + uint32_t actual; /* Actual clock frequency */ + uint16_t irq; /* Flexcomm IRQ number */ + uint8_t nbits; /* Width of word in bits (SPI_MINWIDTH to SPI_MAXWIDTH) */ + uint8_t mode; /* Mode 0,1,2,3 */ +}; + +/* These structures describes the Rx side of an 8- or 16-bit SPI data + * exchange. + */ + +struct lpc54_rxtransfer8_s +{ + FAR uint8_t *rxptr; /* Pointer into receive buffer */ + unsigned int remaining; /* Bytes remaining in the receive buffer */ + unsigned int expected; /* Bytes expected to be received */ +}; + +#ifdef CONFIG_LPC54_SPI_WIDEDATA +struct lpc54_rxtransfer16_s +{ + FAR uint16_t *rxptr; /* Pointer into receive buffer */ + unsigned int remaining; /* Hwords remaining in the receive buffer */ + unsigned int expected; /* Hwords expected to be received */ +}; +#endif + +/* These structures describes the Tx side of an 8- or 16-bit SPI data + * exchange. + */ + +struct lpc54_txtransfer8_s +{ + uint32_t txctrl; /* Tx control bits */ + FAR const uint8_t *txptr; /* Pointer into transmit buffer */ + unsigned int remaining; /* Bytes remaining in the transmit buffer */ +}; + +#ifdef CONFIG_LPC54_SPI_WIDEDATA +struct lpc54_txtransfer16_s +{ + uint32_t txctrl; /* Tx control bits */ + FAR const uint16_t *txptr; /* Pointer into transmit buffer */ + unsigned int remaining; /* Hwords remaining in the transmit buffer */ +}; +#endif + +struct lpc54_txdummy_s +{ + uint32_t txctrl; /* Tx control bits */ + unsigned int remaining; /* Bytes remaining in the transmit buffer */ }; /**************************************************************************** * Private Function Prototypes ****************************************************************************/ -static inline bool lpc54_spi_16bitmode(FAR struct lpc54_spidev_s *priv); +/* Transfer helpers */ + +static inline unsigned int lpc54_spi_fifodepth(FAR struct lpc54_spidev_s *priv); +static inline bool lpc54_spi_txavailable(FAR struct lpc54_spidev_s *priv); +static inline bool lpc54_spi_rxavailable(FAR struct lpc54_spidev_s *priv); + +static void lpc54_spi_resetfifos(FAR struct lpc54_spidev_s *priv); +static void lpc54_spi_rxtransfer8(FAR struct lpc54_spidev_s *priv, + FAR struct lpc54_rxtransfer8_s *xfr); +#ifdef CONFIG_LPC54_SPI_WIDEDATA +static void lpc54_spi_rxtransfer16(FAR struct lpc54_spidev_s *priv, + FAR struct lpc54_rxtransfer16_s *xfr); +#endif +static bool lpc54_spi_txtransfer8(FAR struct lpc54_spidev_s *priv, + FAR struct lpc54_txtransfer8_s *xfr); +#ifdef CONFIG_LPC54_SPI_WIDEDATA +static bool lpc54_spi_txtransfer16(FAR struct lpc54_spidev_s *priv, + FAR struct lpc54_txtransfer16_s *xfr); +#endif +static bool lpc54_spi_txdummy(FAR struct lpc54_spidev_s *priv, + FAR struct lpc54_txdummy_s *xfr); +#ifdef CONFIG_SPI_EXCHANGE +static void lpc54_spi_exchange8(FAR struct lpc54_spidev_s *priv, + FAR const void *txbuffer, FAR void *rxbuffer, + size_t nwords); +#ifdefCONFIG_LPC54_SPI_WIDEDATA +static void lpc54_spi_exchange16(FAR struct lpc54_spidev_s *priv, + FAR const void *txbuffer, FAR void *rxbuffer, + size_t nwords); +#endif +#endif +static void lpc54_spi_sndblock8(FAR struct lpc54_spidev_s *priv, + FAR const void *buffer, size_t nwords); +#ifdef CONFIG_LPC54_SPI_WIDEDATA +static void lpc54_spi_sndblock16(FAR struct lpc54_spidev_s *priv, + FAR const void *buffer, size_t nwords); +#endif +static void lpc54_spi_recvblock8(FAR struct lpc54_spidev_s *priv, + FAR void *buffer, size_t nwords); +#ifdef CONFIG_LPC54_SPI_WIDEDATA +static void lpc54_spi_recvblock16(FAR struct lpc54_spidev_s *priv, + FAR void *buffer, size_t nwords); +#endif /* SPI methods */ @@ -103,20 +210,15 @@ static void lpc54_spi_setmode(FAR struct spi_dev_s *dev, enum spi_mode_e mode); static void lpc54_spi_setbits(FAR struct spi_dev_s *dev, int nbits); static uint16_t lpc54_spi_send(FAR struct spi_dev_s *dev, uint16_t ch); -#ifdef CONFIG_LPC54_SPI_MASTER_DMA -static void lpc54_spi_exchange_nodma(FAR struct spi_dev_s *dev, - FAR const void *txbuffer, FAR void *rxbuffer, - size_t nwords) -#endif +#ifdef CONFIG_SPI_EXCHANGE static void lpc54_spi_exchange(FAR struct spi_dev_s *dev, FAR const void *txbuffer, FAR void *rxbuffer, size_t nwords); -#ifndef CONFIG_SPI_EXCHANGE +#endif static void lpc54_spi_sndblock(FAR struct spi_dev_s *dev, FAR const void *buffer, size_t nwords); static void lpc54_spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t nwords); -#endif /**************************************************************************** * Private Data @@ -475,25 +577,667 @@ static inline uint32_t lpc54_spi_getreg(struct lpc54_spidev_s *priv, } /**************************************************************************** - * Name: lpc54_spi_16bitmode + * Name: lpc54_spi_fifodepth + * + * Description: + * Return the depth of the SPI FIFOs. This is a constant value and could + * be hard coded. + * + * Input Parameters: + * priv - Device-specific state data + * + * Returned Value: + * The FIFO depth in words of the configured bit width. + * + ****************************************************************************/ + +static inline unsigned int lpc54_spi_fifodepth(FAR struct lpc54_spidev_s *priv) +{ + uint32_t regval = lpc54_spi_getreg(priv, LPC54_SPI_FIFOCFG_OFFSET); + return ((regval & SPI_FIFOCFG_SIZE_MASK) >> SPI_FIFOCFG_SIZE_SHIFT) << 3; +} + +/**************************************************************************** + * Name: lpc54_spi_txavailable + * + * Description: + * Return true if the Tx FIFO is not full. + * + * Input Parameters: + * priv - Device-specific state data + * + * Returned Value: + * true: Tx FIFO is not full. + * + ****************************************************************************/ + +static inline bool lpc54_spi_txavailable(FAR struct lpc54_spidev_s *priv) +{ + uint32_t regval = lpc54_spi_getreg(priv, LPC54_SPI_FIFOSTAT_OFFSET); + return ((regval & SPI_FIFOSTAT_TXNOTFULL) != 0); +} + +/**************************************************************************** + * Name: lpc54_spi_rxavailable + * + * Description: + * Return true if the Rx FIFO is not empty. + * + * Input Parameters: + * priv - Device-specific state data + * + * Returned Value: + * true: Rx FIFO is not empty. + * + ****************************************************************************/ + +static inline bool lpc54_spi_rxavailable(FAR struct lpc54_spidev_s *priv) +{ + uint32_t regval = lpc54_spi_getreg(priv, LPC54_SPI_FIFOSTAT_OFFSET); + return ((regval & SPI_FIFOSTAT_RXNOTEMPTY) != 0); +} + +/**************************************************************************** + * Name: lpc54_spi_rxdiscard + * + * Description: + * Read and discard the data until the Rx FIFO is empty. + * + * Input Parameters: + * priv - Device-specific state data + * + * Returned Value: + * None + * + ****************************************************************************/ + +static void lpc54_spi_rxdiscard(FAR struct lpc54_spidev_s *priv) +{ + while (lpc54_spi_rxavailable(priv)) + { + (void)lpc54_spi_getreg(priv, LPC54_SPI_FIFORD_OFFSET); + } +} + +/**************************************************************************** + * Name: lpc54_spi_resetfifos + * + * Description: + * Clear Tx/Rx errors and empty FIFOs. + * + * Input Parameters: + * priv - Device-specific state data + * + * Returned Value: + * None + * + ****************************************************************************/ + +static void lpc54_spi_resetfifos(FAR struct lpc54_spidev_s *priv) +{ + uint32_t regval; + + /* Clear Tx/Rx errors and empty FIFOs */ + + regval = lpc54_spi_getreg(priv, LPC54_SPI_FIFOCFG_OFFSET); + regval |= (SPI_FIFOCFG_EMPTYTX | SPI_FIFOCFG_EMPTYRX); + lpc54_spi_putreg(priv, LPC54_SPI_FIFOCFG_OFFSET, regval); + + regval = lpc54_spi_getreg(priv, LPC54_SPI_FIFOSTAT_OFFSET); + regval |= (SPI_FIFOSTAT_TXERR | SPI_FIFOSTAT_RXERR); + lpc54_spi_putreg(priv, LPC54_SPI_FIFOSTAT_OFFSET, regval); +} + +/**************************************************************************** + * Name: lpc54_spi_rxtransfer8 and lpc54_spi_rxtransfer16 + * + * Description: + * Receive one 8- or 16-bit value from the selected SPI device. + * + * Input Parameters: + * priv - Device-specific state data + * xfr - Describes the Rx transfer + * + * Returned Value: + * None + * + ****************************************************************************/ + +static void lpc54_spi_rxtransfer8(FAR struct lpc54_spidev_s *priv, + FAR struct lpc54_rxtransfer8_s *xfr) +{ + /* Read one byte if available and expected */ + + if (lpc54_spi_rxavailable(priv)) + { + /* There is something in the Rx FIFO to be read. Are we expecting + * data in the Rx FIFO? Is there space available in the Rx buffer? + */ + + if (xfr->expected == 0 || xfr->remaining == 0) + { + /* No.. then just read and discard the data until the Rx FIFO is empty */ + + lpc54_spi_rxdiscard(priv); + xfr->expected = 0; + } + else + { + /* Read and transfer one byte */ + + *xfr->rxptr = lpc54_spi_getreg(priv, LPC54_SPI_FIFORD_OFFSET); + + /* Update pointers and counts */ + + xfr->rxptr++; + xfr->remaining--; + xfr->expected--; + } + } +} + +#ifdef CONFIG_LPC54_SPI_WIDEDATA +static void lpc54_spi_rxtransfer16(FAR struct lpc54_spidev_s *priv, + FAR struct lpc54_rxtransfer16_s *xfr) +{ + /* Read one HWord if available and expected */ + + if (lpc54_spi_rxavailable(priv)) + { + /* There is something in the Rx FIFO to be read. Are we expecting + * data in the Rx FIFO? Is there space available in the Rx buffer? + */ + + if (xfr->expected == 0 || xfr->remaining == 0) + { + /* No.. then just read and discard the data until the Rx FIFO + * is empty. + */ + + lpc54_spi_rxdiscard(priv); + xfr->expected = 0; + } + else + { + /* Read and transfer HWord */ + + *xfr->rxptr = lpc54_spi_getreg(priv, LPC54_SPI_FIFORD_OFFSET); + + /* Update pointers and counts */ + + xfr->rxptr++; + xfr->remaining--; + xfr->expected--; + } + } +} +#endif + +/**************************************************************************** + * Name: lpc54_spi_txtransfer8 and lpc54_spi_txtransfer16 * * Description: - * Check if the SPI is operating in > 8-bit mode (16-bit accesses) + * Send one 8- or 16-bit value to the selected SPI device. * * Input Parameters: * priv - Device-specific state data + * xfr - Describes the Tx transfer * * Returned Value: - * true: 16-bit mode, false: 8-bit mode + * true: The value was added to the TxFIFO * ****************************************************************************/ -static inline bool lpc54_spi_16bitmode(FAR struct lpc54_spidev_s *priv) +static bool lpc54_spi_txtransfer8(FAR struct lpc54_spidev_s *priv, + FAR struct lpc54_txtransfer8_s *xfr) { -#warning Missing logic + uint32_t regval; + + /* Transmit if txFIFO is not full and there is more Tx data to be sent */ + + if (lpc54_spi_txavailable(priv) && xfr->remaining > 0) + { + /* Get the next byte to be sent */ + + regval = *xfr->txptr; + + /* And send it */ + + regval |= xfr->txctrl; + lpc54_spi_putreg(priv, LPC54_SPI_FIFOWR_OFFSET, regval); + + /* Update pointers and counts */ + + xfr->txptr++; + xfr->remaining--; + + return true; + } + return false; } +#ifdef CONFIG_LPC54_SPI_WIDEDATA +static bool lpc54_spi_txtransfer16(FAR struct lpc54_spidev_s *priv, + FAR struct lpc54_txtransfer16_s *xfr) +{ + uint32_t regval; + + /* Transmit if txFIFO is not full and there is more Tx data to be sent */ + + if (lpc54_spi_txavailable(priv) && xfr->remaining > 0) + { + /* Get the next byte to be sent */ + + regval = *xfr->txptr; + + /* And send it */ + + regval |= xfr->txctrl; + lpc54_spi_putreg(priv, LPC54_SPI_FIFOWR_OFFSET, regval); + + /* Update pointers and counts */ + + xfr->txptr++; + xfr->remaining--; + + return true; + } + + return false; +} +#endif + +/**************************************************************************** + * Name: lpc54_spi_txdummy + * + * Description: + * Send dummy Tx data when we really only care about the Rx data. + * + * Input Parameters: + * priv - Device-specific state data + * xfr - Describes the Tx transfer + * + * Returned Value: + * true: The dummy value was added to the TxFIFO + * + ****************************************************************************/ + +static bool lpc54_spi_txdummy(FAR struct lpc54_spidev_s *priv, + FAR struct lpc54_txdummy_s *xfr) +{ + /* Transmit if txFIFO is not full and there is more Tx data to be sent */ + + if (lpc54_spi_txavailable(priv) && xfr->remaining > 0) + { + /* Send the dummy data */ + + lpc54_spi_putreg(priv, LPC54_SPI_FIFOWR_OFFSET, xfr->txctrl); + + /* Update counts */ + + xfr->remaining--; + return true; + } + + return false; +} + +/**************************************************************************** + * Name: lpc54_spi_exchange8 and lpc54_spi_exchange16 + * + * Description: + * Implements the SPI exchange method for the case of 8- and 16-bit transfers. + * + * Input Parameters: + * priv - Device-specific state data + * txbuffer - A pointer to the buffer of data to be sent + * rxbuffer - A pointer to a buffer in which to receive data + * nwords - the length of data to be exchanged in units of words. + * The wordsize is determined by the number of bits-per-word + * selected for the SPI interface. If nbits <= 8, the data is + * packed into uint8_t's; if nbits >8, the data is packed into + * uint16_t's + * + * Returned Value: + * None + * + ****************************************************************************/ + +#ifdef CONFIG_SPI_EXCHANGE +static void lpc54_spi_exchange8(FAR struct lpc54_spidev_s *priv, + FAR const void *txbuffer, FAR void *rxbuffer, + size_t nwords) +{ + struct lpc54_rxtransfer8_s rxtransfer; + struct lpc54_txtransfer8_s txtransfer; + unsigned int depth; + + DEBUGASSERT(rxbuffer != NULL && txbuffer != NULL); + + /* Get the FIFO depth */ + + depth = lpc54_spi_fifodepth(priv); + + /* Set up the transfer data */ + + txtransfer.txctrl = SPI_FIFOWR_LEN(priv->nbits) | SPI_FIFOWR_TXSSELN_ALL; + txtransfer.txptr = (FAR uint8_t *)txbuffer; + txtransfer.remaining = nwords; + rxtransfer.rxptr = (FAR uint8_t *)rxbuffer; + rxtransfer.remaining = nwords; + rxtransfer.expected = 0; + + /* Clear Tx/Rx errors and empty FIFOs */ + + lpc54_spi_resetfifos(priv); + + /* Loop until all Tx data has been sent and until all Rx data has been + * received. + */ + + while (txtransfer.remaining != 0 || rxtransfer.remaining != 0) + { + /* Transfer one byte from the Rx FIFO to the caller's Rx buffer */ + + lpc54_spi_rxtransfer8(priv, &rxtransfer); + + /* If sending another byte would exceed the capacity of the Rx FIFO + * then read-only until there space freed. + */ + + if (rxtransfer.expected < depth) + { + /* Attempt to transfer one byte from the caller's Tx buffer to + * the Tx FIFO. + */ + + if (lpc54_spi_txtransfer8(priv, &txtransfer)) + { + /* Increment the Rx expected count if successful */ + + rxtransfer.expected++; + } + } + } +} +#endif /* CONFIG_SPI_EXCHANGE */ + +#if defined(CONFIG_SPI_EXCHANGE) && defined(CONFIG_LPC54_SPI_WIDEDATA) +static void lpc54_spi_exchange16(FAR struct lpc54_spidev_s *priv, + FAR const void *txbuffer, FAR void *rxbuffer, + size_t nwords) +{ + struct lpc54_rxtransfer16_s rxtransfer; + struct lpc54_txtransfer16_s txtransfer; + uint32_t regval; + unsigned int depth; + + DEBUGASSERT(rxbuffer != NULL && ((uintptr_t)rxbuffer & 1) == 0); + DEBUGASSERT(txbuffer != NULL && ((uintptr_t)txbuffer & 1) == 0); + + /* Get the FIFO depth */ + + depth = lpc54_spi_fifodepth(priv); + + /* Set up the transfer data */ + + txtransfer.txctrl = SPI_FIFOWR_LEN(priv->nbits) | SPI_FIFOWR_TXSSELN_ALL; + txtransfer.txptr = (FAR uint16_t *)txbuffer; + txtransfer.remaining = nwords; + rxtransfer.rxptr = (FAR uint16_t *)rxbuffer; + rxtransfer.remaining = nwords; + rxtransfer.expected = 0; + + /* Clear Tx/Rx errors and empty FIFOs */ + + lpc54_spi_resetfifos(priv); + + /* Loop until all Tx data has been sent and until all Rx data has been + * received. + */ + + while (txtransfer.remaining || rxtransfer.remaining || rxtransfer.expected) + { + /* Transfer one HWord from the Rx FIFO to the caller's Rx buffer */ + + lpc54_spi_rxtransfer16(priv, &rxtransfer); + + /* If sending another byte would exceed the capacity of the Rx FIFO + * then read-only until there space freed. + */ + + if (rxtransfer.expected < depth) + { + /* Attempt to send one more byte */ + + if (lpc54_spi_txtransfer16(priv, &txtransfer)) + { + /* Increment the Rx expected count if successful */ + + rxtransfer.expected++; + } + } + } +} +#endif /* CONFIG_SPI_EXCHANGE && CONFIG_LPC54_SPI_WIDEDATA */ + +/**************************************************************************** + * Name: lpc54_spi_sndblock8 and lpc54_spi_sndblock16 + * + * Description: + * Implements the SPI sndblock method for the case of 8- and 16-bit + * transfers. + * + * Input Parameters: + * priv - Device-specific state data + * buffer - A pointer to the buffer of data to be sent + * nwords - the length of data to send from the buffer in number of words. + * The wordsize is determined by the number of bits-per-word + * selected for the SPI interface. If nbits <= 8, the data is + * packed into uint8_t's; if nbits >8, the data is packed into + * uint16_t's + * + * Returned Value: + * None + * + ****************************************************************************/ + +static void lpc54_spi_sndblock8(FAR struct lpc54_spidev_s *priv, + FAR const void *buffer, size_t nwords) +{ + struct lpc54_txtransfer8_s txtransfer; + + DEBUGASSERT(buffer != NULL); + + /* Set up the transfer data. NOTE that we are ignoring returned Rx data */ + + txtransfer.txctrl = SPI_FIFOWR_RXIGNORE | SPI_FIFOWR_LEN(priv->nbits) | + SPI_FIFOWR_TXSSELN_ALL; + txtransfer.txptr = (FAR uint8_t *)buffer; + txtransfer.remaining = nwords; + + /* Clear Tx/Rx errors and empty FIFOs */ + + lpc54_spi_resetfifos(priv); + + /* Loop until all Tx data has been sent */ + + while (txtransfer.remaining != 0) + { + /* Attempt to transfer one byte from the caller's Tx buffer to the + * Tx FIFO. + */ + + (void)lpc54_spi_txtransfer8(priv, &txtransfer); + } +} + +#ifdef CONFIG_LPC54_SPI_WIDEDATA +static void lpc54_spi_sndblock16(FAR struct lpc54_spidev_s *priv, + FAR const void *buffer, size_t nwords) +{ + struct lpc54_txtransfer16_s txtransfer; + + DEBUGASSERT(buffer != NULL); + + /* Set up the transfer data. NOTE that we are ignoring returned Rx data */ + + txtransfer.txctrl = SPI_FIFOWR_RXIGNORE | SPI_FIFOWR_LEN(priv->nbits) | + SPI_FIFOWR_TXSSELN_ALL; + txtransfer.txptr = (FAR uint16_t *)buffer; + txtransfer.remaining = nwords; + + /* Clear Tx/Rx errors and empty FIFOs */ + + lpc54_spi_resetfifos(priv); + + /* Loop until all Tx data has been sent and until all Rx data has been + * received. + */ + + while (txtransfer.remaining != 0) + { + /* Attempt to transfer one byte from the caller's Tx buffer to the + * Tx FIFO. + */ + + lpc54_spi_txtransfer16(priv, &txtransfer); + } +} +#endif /*CONFIG_LPC54_SPI_WIDEDATA */ + +/**************************************************************************** + * Name: lpc54_spi_recvblock8 and lpc54_spi_recvblock16 + * + * Description: + * Implements the SPI recvblock method for the case of 8- and 16-bit + * transfers. + * + * Input Parameters: + * priv - Device-specific state data + * buffer - A pointer to the buffer in which to receive data + * nwords - the length of data that can be received in the buffer in + * number of words. The wordsize is determined by the number of + * bits-per-word selected for the SPI interface. If nbits <= 8, + * the data is packed into uint8_t's; if nbits >8, the data is + * packed into uint16_t's + * + * Returned Value: + * None + * + ****************************************************************************/ + +static void lpc54_spi_recvblock8(FAR struct lpc54_spidev_s *priv, + FAR void *buffer, size_t nwords) +{ + struct lpc54_rxtransfer8_s rxtransfer; + struct lpc54_txdummy_s txtransfer; + unsigned int depth; + + DEBUGASSERT(buffer != NULL); + + /* Get the FIFO depth */ + + depth = lpc54_spi_fifodepth(priv); + + /* Set up the transfer data */ + + txtransfer.txctrl = SPI_DUMMYDATA8 | SPI_FIFOWR_LEN(priv->nbits) | + SPI_FIFOWR_TXSSELN_ALL; + txtransfer.remaining = nwords; + rxtransfer.rxptr = (FAR uint8_t *)buffer; + rxtransfer.remaining = nwords; + rxtransfer.expected = 0; + + /* Clear Tx/Rx errors and empty FIFOs */ + + lpc54_spi_resetfifos(priv); + + /* Loop until all Tx data has been sent and until all Rx data has been + * received. + */ + + while (txtransfer.remaining != 0|| rxtransfer.remaining != 0) + { + /* Transfer one byte from the Rx FIFO to the caller's Rx buffer */ + + lpc54_spi_rxtransfer8(priv, &rxtransfer); + + /* If sending another byte would exceed the capacity of the Rx FIFO + * then read-only until there space freed. + */ + + if (rxtransfer.expected < depth) + { + /* Attempt to transfer one dummy byte to the Tx FIFO. */ + + if (lpc54_spi_txdummy(priv, &txtransfer)) + { + /* Increment the Rx expected count if successful */ + + rxtransfer.expected++; + } + } + } +} + +#ifdef CONFIG_LPC54_SPI_WIDEDATA +static void lpc54_spi_recvblock16(FAR struct lpc54_spidev_s *priv, + FAR void *buffer, size_t nwords) +{ + struct lpc54_rxtransfer16_s rxtransfer; + struct lpc54_txdummy_s txtransfer; + unsigned int depth; + + DEBUGASSERT(buffer != NULL); + + /* Get the FIFO depth */ + + depth = lpc54_spi_fifodepth(priv); + + /* Set up the transfer data */ + + txtransfer.txctrl = SPI_DUMMYDATA16 | SPI_FIFOWR_LEN(priv->nbits) | + SPI_FIFOWR_TXSSELN_ALL; + txtransfer.remaining = nwords; + rxtransfer.rxptr = (FAR uint16_t *)rxbuffer; + rxtransfer.remaining = nwords; + rxtransfer.expected = 0; + + /* Clear Tx/Rx errors and empty FIFOs */ + + lpc54_spi_resetfifos(priv); + + /* Loop until all Tx data has been sent and until all Rx data has been + * received. + */ + + while (txtransfer.remaining || rxtransfer.remaining || rxtransfer.expected) + { + /* Transfer one HWord from the Rx FIFO to the caller's Rx buffer */ + + lpc54_spi_rxtransfer16(priv, &rxtransfer); + + /* If sending another byte would exceed the capacity of the Rx FIFO + * then read-only until there space freed. + */ + + if (rxtransfer.expected < depth) + { + /* Attempt to transfer one dummy HWord to the Tx FIFO. */ + + if (lpc54_spi_txdummy(priv, &txtransfer)) + { + /* Increment the Rx expected count if successful */ + + rxtransfer.expected++; + } + } + } +} +#endif /* CONFIG_LPC54_SPI_WIDEDATA */ + /**************************************************************************** * Name: lpc54_spi_lock * @@ -686,11 +1430,11 @@ static void lpc54_spi_setbits(FAR struct spi_dev_s *dev, int nbits) { FAR struct lpc54_spidev_s *priv = (FAR struct lpc54_spidev_s *)dev; - /* The valid range of bit selections is 4 through 16 */ + /* The valid range of bit selections is SPI_MINWIDTH through SPI_MAXWIDTH */ - DEBUGASSERT(priv != NULL && nbits >=4 && nbits <= 16); + DEBUGASSERT(priv != NULL && nbits >= SPI_MINWIDTH && nbits <= SPI_MAXWIDTH); - if (nbits >= 4 && nbits <= 16) + if (nbits >= SPI_MINWIDTH && nbits <= SPI_MAXWIDTH) { /* Save the selection. It will be applied when data is transferred. */ @@ -716,28 +1460,46 @@ static void lpc54_spi_setbits(FAR struct spi_dev_s *dev, int nbits) static uint16_t lpc54_spi_send(FAR struct spi_dev_s *dev, uint16_t wd) { - uint16_t ret; + FAR struct lpc54_spidev_s *priv = (FAR struct lpc54_spidev_s *)dev; + uint32_t regval; - /* Write the data to transmitted to the SPI Data Register */ -#warning Missing logic + DEBUGASSERT(priv != NULL); - /* Read the SPI Status Register again to clear the status bit */ -#warning Missing logic + /* Clear Tx/Rx errors and empty FIFOs */ - return ret; + lpc54_spi_resetfifos(priv); + + /* Send the word. Since we just reset the FIFOs, we assume that the Tx + * FIFO is not full and that the Rx FIFO is empty. + */ + + DEBUGASSERT(lpc54_spi_txavailable(priv) || !lpc54_spi_rxavailable(priv)); + + regval = wd | SPI_FIFOWR_LEN(priv->nbits) | SPI_FIFOWR_TXSSELN_ALL; + lpc54_spi_putreg(priv, LPC54_SPI_FIFOWR_OFFSET, regval); + + /* Wait for the Rx FIFO to become non-empty. */ + + while (!lpc54_spi_rxavailable(priv)) + { + } + + /* Then read and return the value from the Rx FIFO */ + + return (uint16_t)lpc54_spi_getreg(priv, LPC54_SPI_FIFORD_OFFSET); } /**************************************************************************** - * Name: lpc54_spi_exchange (no DMA). aka lpc54_spi_exchange_nodma + * Name: lpc54_spi_exchange * * Description: - * Exchange a block of data on SPI without using DMA + * Exchange a block of data on SPI * * Input Parameters: * dev - Device-specific state data * txbuffer - A pointer to the buffer of data to be sent * rxbuffer - A pointer to a buffer in which to receive data - * nwords - the length of data to be exchaned in units of words. + * nwords - the length of data to be exchanged in units of words. * The wordsize is determined by the number of bits-per-word * selected for the SPI interface. If nbits <= 8, the data is * packed into uint8_t's; if nbits >8, the data is packed into @@ -748,125 +1510,52 @@ static uint16_t lpc54_spi_send(FAR struct spi_dev_s *dev, uint16_t wd) * ****************************************************************************/ -#ifndef CONFIG_LPC54_SPI_MASTER_DMA -static void lpc54_spi_exchange(FAR struct spi_dev_s *dev, +#ifdef CONFIG_SPI_EXCHANGE +static void lpc54_spi_exchange(FAR struct lpc54_spidev_s *priv, FAR const void *txbuffer, FAR void *rxbuffer, size_t nwords) -#else -static void lpc54_spi_exchange_nodma(FAR struct spi_dev_s *dev, - FAR const void *txbuffer, - FAR void *rxbuffer, size_t nwords) -#endif { FAR struct lpc54_spidev_s *priv = (FAR struct lpc54_spidev_s *)dev; - DEBUGASSERT(priv && priv->base); - spiinfo("txbuffer=%p rxbuffer=%p nwords=%d\n", - txbuffer, rxbuffer, nwords); + DEBUGASSERT(priv != NULL); - /* 8- or 16-bit mode? */ + /* If there is no data sink, then handle this transfer with + * lpc54_spi_sndblock(). + */ - if (lpc54_spi_16bitmode(priv)) + if (rxbuffer == NULL) { - /* 16-bit mode */ - - FAR const uint16_t *src = (FAR const uint16_t *)txbuffer; - FAR uint16_t *dest = (FAR uint16_t *)rxbuffer; - uint16_t word; - - while (nwords-- > 0) - { - /* Get the next word to write. Is there a source buffer? */ - - if (src) - { - word = *src++; - } - else - { - word = 0xffff; - } - - /* Exchange one word */ - - word = lpc54_spi_send(dev, word); - - /* Is there a buffer to receive the return value? */ - - if (dest) - { - *dest++ = word; - } - } + lpc54_spi_sndblock(priv, txbuffer, nwords) } - else - { - /* 8-bit mode */ - - FAR const uint8_t *src = (FAR const uint8_t *)txbuffer; - FAR uint8_t *dest = (FAR uint8_t *)rxbuffer; - uint8_t word; - - while (nwords-- > 0) - { - /* Get the next word to write. Is there a source buffer? */ - if (src) - { - word = *src++; - } - else - { - word = 0xff; - } - - /* Exchange one word */ + /* If there is no data source, then handle this transfer with + * lpc54_spi_recvblock(). + */ - word = (uint8_t)lpc54_spi_send(dev, (uint16_t)word); + else if (txbuffer == NULL) + { + lpc54_spi_recvblock(priv, rxbuffer, nwords) + } - /* Is there a buffer to receive the return value? */ +#ifdef CONFIG_LPC54_SPI_WIDEDATA + /* If the data with is > 8-bits, then handle this transfer with + * lpc54_spi_exchange16(). + */ - if (dest) - { - *dest++ = word; - } - } + else if (priv->nbits > 8) + { + lpc54_spi_exchange16(priv, txbuffer, rxbuffer, nwords); } -} - -/**************************************************************************** - * Name: lpc54_spi_exchange (no DMA). aka lpc54_spi_exchange_nodma - * - * Description: - * Exchange a block of data on SPI without using DMA - * - * Input Parameters: - * dev - Device-specific state data - * txbuffer - A pointer to the buffer of data to be sent - * rxbuffer - A pointer to a buffer in which to receive data - * nwords - the length of data to be exchaned in units of words. - * The wordsize is determined by the number of bits-per-word - * selected for the SPI interface. If nbits <= 8, the data is - * packed into uint8_t's; if nbits >8, the data is packed into - * uint16_t's - * - * Returned Value: - * None - * - ****************************************************************************/ +#endif -#ifdef CONFIG_LPC54_SPI_MASTER_DMA -static void lpc54_spi_exchange(FAR struct spi_dev_s *dev, - FAR const void *txbuffer, FAR void *rxbuffer, - size_t nwords) -{ - /* If the transfer is small, then perform the exchange without using DMA. */ -#warning Missing logic + /* Otherwise, let lpc54_spi_exchange8() do the job */ - /* Otherwise, use DMA */ -#warning Missing logic + else if (priv->nbits > 8) + { + lpc54_spi_exchange8(priv, txbuffer, rxbuffer, nwords); + } } -#endif /* CONFIG_LPC54_SPI_MASTER_DMA */ +#endif /* CONFIG_SPI_EXCHANGE */ /**************************************************************************** * Name: lpc54_spi_sndblock @@ -891,8 +1580,28 @@ static void lpc54_spi_exchange(FAR struct spi_dev_s *dev, static void lpc54_spi_sndblock(FAR struct spi_dev_s *dev, FAR const void *buffer, size_t nwords) { - spiinfo("txbuffer=%p nwords=%d\n", buffer, nwords); - return lpc54_spi_exchange(dev, buffer, NULL, nwords); + FAR struct lpc54_spidev_s *priv = (FAR struct lpc54_spidev_s *)dev; + + spiinfo("buffer=%p nwords=%d\n", buffer, nwords); + DEBUGASSERT(priv != NULL && buffer != NULL); + +#ifdef CONFIG_LPC54_SPI_WIDEDATA + /* If the data with is > 8-bits, then handle this transfer with + * lpc54_spi_sndblock16(). + */ + + if (priv->nbits > 8) + { + lpc54_spi_sndblock16(priv, buffer, nwords); + } + + /* Otherwise, let lpc54_spi_sndblock8() do the job */ + + else if (priv->nbits > 8) +#endif + { + lpc54_spi_sndblock8(priv, buffer, nwords); + } } /**************************************************************************** @@ -903,7 +1612,7 @@ static void lpc54_spi_sndblock(FAR struct spi_dev_s *dev, * * Input Parameters: * dev - Device-specific state data - * buffer - A pointer to the buffer in which to recieve data + * buffer - A pointer to the buffer in which to receive data * nwords - the length of data that can be received in the buffer in * number of words. The wordsize is determined by the number of * bits-per-word selected for the SPI interface. If nbits <= 8, @@ -918,8 +1627,28 @@ static void lpc54_spi_sndblock(FAR struct spi_dev_s *dev, static void lpc54_spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t nwords) { - spiinfo("rxbuffer=%p nwords=%d\n", buffer, nwords); - return lpc54_spi_exchange(dev, NULL, buffer, nwords); + FAR struct lpc54_spidev_s *priv = (FAR struct lpc54_spidev_s *)dev; + + spiinfo("buffer=%p nwords=%d\n", buffer, nwords); + DEBUGASSERT(priv != NULL && buffer != NULL); + +#ifdef CONFIG_LPC54_SPI_WIDEDATA + /* If the data with is > 8-bits, then handle this transfer with + * lpc54_spi_recvblock16(). + */ + + if (priv->nbits > 8) + { + lpc54_spi_recvblock16(priv, buffer, nwords); + } + + /* Otherwise, let lpc54_spi_recvblock8() do the job */ + + else if (priv->nbits > 8) +#endif + { + lpc54_spi_recvblock8(priv, buffer, nwords); + } } /**************************************************************************** @@ -952,7 +1681,7 @@ FAR struct spi_dev_s *lpc54_spibus_initialize(int port) flags = enter_critical_section(); - /* Configure the requestin SPI peripheral */ + /* Configure the requested SPI peripheral */ /* NOTE: The basic FLEXCOMM initialization was performed in * lpc54_lowputc.c. */ @@ -1332,23 +2061,23 @@ FAR struct spi_dev_s *lpc54_spibus_initialize(int port) /* Enable FIFOs */ - regval = lpc54_spi_getreg(priv, LPC54_SPI_CFG_OFFSET); + regval = lpc54_spi_getreg(priv, LPC54_SPI_FIFOCFG_OFFSET); regval |= (SPI_FIFOCFG_EMPTYTX | SPI_FIFOCFG_EMPTYRX); - lpc54_spi_putreg(priv, LPC54_SPI_CFG_OFFSET, regval); + lpc54_spi_putreg(priv, LPC54_SPI_FIFOCFG_OFFSET, regval); regval |= (SPI_FIFOCFG_ENABLETX | SPI_FIFOCFG_ENABLERX); - lpc54_spi_putreg(priv, LPC54_SPI_CFG_OFFSET, regval); + lpc54_spi_putreg(priv, LPC54_SPI_FIFOCFG_OFFSET, regval); /* Set FIFO trigger levels: Empty for Tx FIFO; 1 word for RxFIFO */ - regval = lpc54_spi_getreg(priv, LPC54_SPI_CFG_OFFSET); + regval = lpc54_spi_getreg(priv, LPC54_SPI_FIFOCFG_OFFSET); regval &= ~(SPI_FIFOTRIG_TXLVL_MASK | SPI_FIFOTRIG_RXLVL_MASK); regval |= (SPI_FIFOTRIG_TXLVL_EMPTY | SPI_FIFOTRIG_RXLVL_NOTEMPTY); /* Enable generation of interrupts for selected FIFO trigger levels */ regval |= (SPI_FIFOTRIG_TXLVLENA | SPI_FIFOTRIG_RXLVLENA); - lpc54_spi_putreg(priv, LPC54_SPI_CFG_OFFSET, regval); + lpc54_spi_putreg(priv, LPC54_SPI_FIFOCFG_OFFSET, regval); /* Set the delay configuration (not used) */ diff --git a/arch/arm/src/lpc54xx/lpc54_spi_master.h b/arch/arm/src/lpc54xx/lpc54_spi_master.h index 12009872a7..aba9a30e72 100644 --- a/arch/arm/src/lpc54xx/lpc54_spi_master.h +++ b/arch/arm/src/lpc54xx/lpc54_spi_master.h @@ -263,7 +263,7 @@ int lpc54_spi8_register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, v #ifdef CONFIG_LPC54_SPI9_MASTER int lpc54_spi9_register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, void *arg); #endif -#endif +#endif /* CONFIG_SPI_CALLBACK */ #undef EXTERN #if defined(__cplusplus) diff --git a/configs/lpcxpresso-lpc54628/README.txt b/configs/lpcxpresso-lpc54628/README.txt index 31a65ff18e..926fc1bd9d 100644 --- a/configs/lpcxpresso-lpc54628/README.txt +++ b/configs/lpcxpresso-lpc54628/README.txt @@ -86,20 +86,13 @@ STATUS of this writing. Also added the netnsh configuration will, eventually, be used to test the Ethernet driver. 2018-01-01: There Ethernet driver appears to be fully functional although - more testing is certainly needed. I believe that there is a memory - corruption issue in the current configuration that cause problems - occasionally. For example, after a longer Telnet session, I sometimes - see the following DEBUGASSERT after exiting the session from the host: + more testing is certainly needed. + 2018-01-14: The basic SPI driver is code complete but still untested. It + is "basic" in the sense that it supports only polled mode (no DMA). - up_assert: Assertion failed at file:mm_heap/mm_free.c line: 129 - - which is a clear indication heap corruption. Increasing the size of some - stacks might correct this problem, but I have not yet experimented with - that. I have not seen the problem in any other context. - - There is still no support for the Accelerometer, SPIFI, or USB. There is a - complete but not-yet-functional SD card. There is a partial SPI driver, - but no on-board SPI devices to test it. + There is still no support for the Accelerometer, SPIFI, or USB. There are + complete but not-yet-functional SD card and SPI drivers. There are no + on-board devices to support SPI testing. Configurations ============== diff --git a/include/nuttx/spi/spi.h b/include/nuttx/spi/spi.h index 08b28e2625..b881e96257 100644 --- a/include/nuttx/spi/spi.h +++ b/include/nuttx/spi/spi.h @@ -70,8 +70,8 @@ * Name: SPI_LOCK * * Description: - * On SPI busses where there are multiple devices, it will be necessary to - * lock SPI to have exclusive access to the busses for a sequence of + * On SPI buses where there are multiple devices, it will be necessary to + * lock SPI to have exclusive access to the buses for a sequence of * transfers. The bus should be locked before the chip is selected. After * locking the SPI bus, the caller should then also call the setfrequency, * setbits, and setmode methods to make sure that the SPI is properly -- GitLab From fd5d811b0a4a6c3aae8a00ea246b37bc7e171b4e Mon Sep 17 00:00:00 2001 From: Mateusz Szafoni Date: Sun, 14 Jan 2018 19:00:18 +0000 Subject: [PATCH 014/228] Merged in raiden00/nuttx (pull request #569) Master * stm32f33xxx_hrtim.h: fix some definitions * stm32_hrtim: fix some bugs stm32_hrtim: fix deadtime configuration stm32_hrtim: add interface to change outputs SET/RST configuration Approved-by: Gregory Nutt --- arch/arm/src/stm32/chip/stm32f33xxx_hrtim.h | 4 +- arch/arm/src/stm32/stm32_hrtim.c | 381 ++++++++++++++++++-- arch/arm/src/stm32/stm32_hrtim.h | 38 +- 3 files changed, 369 insertions(+), 54 deletions(-) diff --git a/arch/arm/src/stm32/chip/stm32f33xxx_hrtim.h b/arch/arm/src/stm32/chip/stm32f33xxx_hrtim.h index 0e962104f9..32dff07659 100644 --- a/arch/arm/src/stm32/chip/stm32f33xxx_hrtim.h +++ b/arch/arm/src/stm32/chip/stm32f33xxx_hrtim.h @@ -447,8 +447,8 @@ # define HRTIM_TIMDT_DTPRSC_110 (6 << HRTIM_TIMDT_DTPRSC_SHIFT) # define HRTIM_TIMDT_DTPRSC_111 (7 << HRTIM_TIMDT_DTPRSC_SHIFT) #define HRTIM_TIMDT_DTRSLK (1 << 14) /* Bit 14: Deadtime Rising Sign Lock */ -#define HRTIM_TIMDT_DTRLK (1 << 14) /* Bit 15: Deadtime Rising Lock */ -#define HRTIM_TIMDT_DTF_SHIFT 0 /* Bits 16-24: Deadtime Falling Value */ +#define HRTIM_TIMDT_DTRLK (1 << 15) /* Bit 15: Deadtime Rising Lock */ +#define HRTIM_TIMDT_DTF_SHIFT 16 /* Bits 16-24: Deadtime Falling Value */ #define HRTIM_TIMDT_DTF_MASK (0x1ff << HRTIM_TIMDT_DTF_SHIFT) #define HRTIM_TIMDT_SDTF (1 << 25) /* Bit 25: Sign Deadtime Falling Value */ #define HRTIM_TIMDT_DTFSLK (1 << 30) /* Bit 30: Deadtime Falling Sign Lock */ diff --git a/arch/arm/src/stm32/stm32_hrtim.c b/arch/arm/src/stm32/stm32_hrtim.c index d064c8e1d3..44f78bff6f 100644 --- a/arch/arm/src/stm32/stm32_hrtim.c +++ b/arch/arm/src/stm32/stm32_hrtim.c @@ -317,10 +317,11 @@ struct stm32_hrtim_chopper_s #ifdef CONFIG_STM32_HRTIM_DEADTIME struct stm32_hrtim_deadtime_s { + uint8_t en:1; /* Enable deadtime for timer */ uint8_t fsign_lock:1; /* Deadtime falling sing lock */ uint8_t rsign_lock:1; /* Deadtime rising sing lock */ - uint8_t rising_lock:1; /* Deadtime rising value lock */ uint8_t falling_lock:1; /* Deadtime falling value lock */ + uint8_t rising_lock:1; /* Deadtime rising value lock */ uint8_t fsign:1; /* Deadtime falling sign */ uint8_t rsign:1; /* Deadtime rising sign */ uint8_t prescaler:3; /* Deadtime prescaler */ @@ -645,6 +646,10 @@ static int hrtim_synch_config(FAR struct stm32_hrtim_s *priv); static int hrtim_outputs_config(FAR struct stm32_hrtim_s *priv); static int hrtim_outputs_enable(FAR struct hrtim_dev_s *dev, uint16_t outputs, bool state); +static int hrtim_output_set_set(FAR struct hrtim_dev_s *dev, uint16_t output, + uint32_t set); +static int hrtim_output_rst_set(FAR struct hrtim_dev_s *dev, uint16_t output, + uint32_t rst); #endif #ifdef HRTIM_HAVE_ADC static int hrtim_adc_config(FAR struct stm32_hrtim_s *priv); @@ -658,13 +663,14 @@ static int hrtim_tim_dma_cfg(FAR struct stm32_hrtim_s *priv, uint8_t timer, uint16_t dma); #endif #ifdef CONFIG_STM32_HRTIM_DEADTIME -static int hrtim_deadtime_update(FAR struct stm32_dev_s *dev, uint8_t dt, - uint16_t value) -static uint16_t hrtim_deadtime_get(FAR struct stm32_dev_s *dev, uint8_t dt); +static int hrtim_deadtime_update(FAR struct hrtim_dev_s *dev, uint8_t timer, + uint8_t dt, uint16_t value); +static uint16_t hrtim_deadtime_get(FAR struct hrtim_dev_s *dev, uint8_t dt); +static int hrtim_tim_deadtime_cfg(FAR struct stm32_hrtim_s *priv, uint8_t timer); static int hrtim_deadtime_config(FAR struct stm32_hrtim_s *priv); #endif #ifdef CONFIG_STM32_HRTIM_CHOPPER -static int hrtim_chopper_enable(FAR struct stm32_dev_s *dev, uint8_t timer, +static int hrtim_chopper_enable(FAR struct hrtim_dev_s *dev, uint8_t timer, uint8_t chan, bool state); static int hrtim_tim_chopper_cfg(FAR struct stm32_hrtim_s *priv, uint8_t timer); static int hrtim_chopper_config(FAR struct stm32_hrtim_s *priv); @@ -816,13 +822,14 @@ static struct stm32_hrtim_slave_priv_s g_tima_priv = #ifdef CONFIG_STM32_HRTIM_TIMA_DT .dt = { - .fsign_lock = HRTIM_TIMA_DT_RSLOCK, + .en = 1, + .fsign_lock = HRTIM_TIMA_DT_FSLOCK, .rsign_lock = HRTIM_TIMA_DT_RSLOCK, - .rising_lock = HRTIM_TIMA_DT_RVLOCK, .falling_lock = HRTIM_TIMA_DT_FVLOCK, + .rising_lock = HRTIM_TIMA_DT_RVLOCK, .fsign = HRTIM_TIMA_DT_FSIGN, .rsign = HRTIM_TIMA_DT_RSIGN, - .prescaler = HRTIM_TIMA_DT_PRESALER + .prescaler = HRTIM_TIMA_DT_PRESCALER } #endif }, @@ -911,13 +918,14 @@ static struct stm32_hrtim_slave_priv_s g_timb_priv = #ifdef CONFIG_STM32_HRTIM_TIMB_DT .dt = { - .fsign_lock = HRTIM_TIMB_DT_RSLOCK, + .en = 1, + .fsign_lock = HRTIM_TIMB_DT_FSLOCK, .rsign_lock = HRTIM_TIMB_DT_RSLOCK, - .rising_lock = HRTIM_TIMB_DT_RVLOCK, .falling_lock = HRTIM_TIMB_DT_FVLOCK, + .rising_lock = HRTIM_TIMB_DT_RVLOCK, .fsign = HRTIM_TIMB_DT_FSIGN, .rsign = HRTIM_TIMB_DT_RSIGN, - .prescaler = HRTIM_TIMB_DT_PRESALER + .prescaler = HRTIM_TIMB_DT_PRESCALER } #endif }, @@ -1006,13 +1014,14 @@ static struct stm32_hrtim_slave_priv_s g_timc_priv = #ifdef CONFIG_STM32_HRTIM_TIMC_DT .dt = { - .fsign_lock = HRTIM_TIMC_DT_RSLOCK, + .en = 1, + .fsign_lock = HRTIM_TIMC_DT_FSLOCK, .rsign_lock = HRTIM_TIMC_DT_RSLOCK, - .rising_lock = HRTIM_TIMC_DT_RVLOCK, .falling_lock = HRTIM_TIMC_DT_FVLOCK, + .rising_lock = HRTIM_TIMC_DT_RVLOCK, .fsign = HRTIM_TIMC_DT_FSIGN, .rsign = HRTIM_TIMC_DT_RSIGN, - .prescaler = HRTIM_TIMC_DT_PRESALER + .prescaler = HRTIM_TIMC_DT_PRESCALER } #endif }, @@ -1101,13 +1110,14 @@ static struct stm32_hrtim_slave_priv_s g_timd_priv = #ifdef CONFIG_STM32_HRTIM_TIMD_DT .dt = { - .fsign_lock = HRTIM_TIMD_DT_RSLOCK, + .en = 1, + .fsign_lock = HRTIM_TIMD_DT_FSLOCK, .rsign_lock = HRTIM_TIMD_DT_RSLOCK, - .rising_lock = HRTIM_TIMD_DT_RVLOCK, .falling_lock = HRTIM_TIMD_DT_FVLOCK, + .rising_lock = HRTIM_TIMD_DT_RVLOCK, .fsign = HRTIM_TIMD_DT_FSIGN, .rsign = HRTIM_TIMD_DT_RSIGN, - .prescaler = HRTIM_TIMD_DT_PRESALER + .prescaler = HRTIM_TIMD_DT_PRESCALER } #endif }, @@ -1196,13 +1206,14 @@ static struct stm32_hrtim_slave_priv_s g_time_priv = #ifdef CONFIG_STM32_HRTIM_TIME_DT .dt = { - .fsign_lock = HRTIM_TIME_DT_RSLOCK, + .en = 1, + .fsign_lock = HRTIM_TIME_DT_FSLOCK, .rsign_lock = HRTIM_TIME_DT_RSLOCK, - .rising_lock = HRTIM_TIME_DT_RVLOCK, .falling_lock = HRTIM_TIME_DT_FVLOCK, + .rising_lock = HRTIM_TIME_DT_RVLOCK, .fsign = HRTIM_TIME_DT_FSIGN, .rsign = HRTIM_TIME_DT_RSIGN, - .prescaler = HRTIM_TIME_DT_PRESALER + .prescaler = HRTIM_TIME_DT_PRESCALER } #endif }, @@ -1482,6 +1493,8 @@ static const struct stm32_hrtim_ops_s g_hrtim1ops = #endif #ifdef CONFIG_STM32_HRTIM_PWM .outputs_enable = hrtim_outputs_enable, + .output_rst_set = hrtim_output_rst_set, + .output_set_set = hrtim_output_set_set, #endif #ifdef CONFIG_STM32_HRTIM_BURST .burst_enable = hrtim_burst_enable, @@ -2151,6 +2164,10 @@ static int hrtim_tim_clock_config(FAR struct stm32_hrtim_s *priv, } } + /* Write prescaler configuration */ + + hrtim_tim_putreg(priv, timer, STM32_HRTIM_TIM_CR_OFFSET, regval); + errout: return ret; } @@ -2637,9 +2654,8 @@ static int hrtim_tim_outputs_config(FAR struct stm32_hrtim_s *priv, uint8_t time { FAR struct stm32_hrtim_tim_s* tim; FAR struct stm32_hrtim_slave_priv_s* slave; - - int ret = OK; uint32_t regval = 0; + int ret = OK; /* Master Timer has no outputs */ @@ -2724,6 +2740,24 @@ static int hrtim_tim_outputs_config(FAR struct stm32_hrtim_s *priv, uint8_t time } #endif +#ifdef CONFIG_STM32_HRTIM_DEADTIME + if (slave->pwm.dt.en == 1) + { + regval = 0; + + /* Set deadtime enable */ + + regval |= HRTIM_TIMOUT_DTEN; + + /* TODO: deadtime upon burst mode Idle entry */ + + /* Write register */ + + hrtim_tim_modifyreg(priv, timer, STM32_HRTIM_TIM_OUTR_OFFSET, 0, + regval); + } +#endif + errout: return ret; } @@ -2841,6 +2875,243 @@ static int hrtim_outputs_enable(FAR struct hrtim_dev_s *dev, return OK; } + +/**************************************************************************** + * Name: output_tim_index_get + ****************************************************************************/ + +static uint8_t output_tim_index_get(uint16_t output) +{ + uint8_t timer = 0; + + switch(output) + { +#ifdef CONFIG_STM32_HRTIM_TIMA + case HRTIM_OUT_TIMA_CH1: + case HRTIM_OUT_TIMA_CH2: + { + timer = HRTIM_TIMER_TIMA; + break; + } +#endif + +#ifdef CONFIG_STM32_HRTIM_TIMB + case HRTIM_OUT_TIMB_CH1: + case HRTIM_OUT_TIMB_CH2: + { + timer = HRTIM_TIMER_TIMB; + break; + } +#endif + +#ifdef CONFIG_STM32_HRTIM_TIMC + case HRTIM_OUT_TIMC_CH1: + case HRTIM_OUT_TIMC_CH2: + { + timer = HRTIM_TIMER_TIMC; + break; + } +#endif + +#ifdef CONFIG_STM32_HRTIM_TIMD + case HRTIM_OUT_TIMD_CH1: + case HRTIM_OUT_TIMD_CH2: + { + timer = HRTIM_TIMER_TIMD; + break; + } +#endif + +#ifdef CONFIG_STM32_HRTIM_TIME + case HRTIM_OUT_TIME_CH1: + case HRTIM_OUT_TIME_CH2: + { + timer = HRTIM_TIMER_TIME; + break; + } +#endif + + default: + { + timer = 0; + break; + } + } + + return timer; +} + +/**************************************************************************** + * Name: output_tim_ch_get + ****************************************************************************/ + +static uint8_t output_tim_ch_get(uint16_t output) +{ + uint8_t ch = 0; + + switch (output) + { +#ifdef CONFIG_STM32_HRTIM_TIMA + case HRTIM_OUT_TIMA_CH1: +#endif +#ifdef CONFIG_STM32_HRTIM_TIMB + case HRTIM_OUT_TIMB_CH1: +#endif +#ifdef CONFIG_STM32_HRTIM_TIMC + case HRTIM_OUT_TIMC_CH1: +#endif +#ifdef CONFIG_STM32_HRTIM_TIMD + case HRTIM_OUT_TIMD_CH1: +#endif +#ifdef CONFIG_STM32_HRTIM_TIME + case HRTIM_OUT_TIME_CH1: +#endif + { + ch = HRTIM_OUT_CH1; + break; + } + +#ifdef CONFIG_STM32_HRTIM_TIMA + case HRTIM_OUT_TIMA_CH2: +#endif +#ifdef CONFIG_STM32_HRTIM_TIMB + case HRTIM_OUT_TIMB_CH2: +#endif +#ifdef CONFIG_STM32_HRTIM_TIMC + case HRTIM_OUT_TIMC_CH2: +#endif +#ifdef CONFIG_STM32_HRTIM_TIMD + case HRTIM_OUT_TIMD_CH2: +#endif +#ifdef CONFIG_STM32_HRTIM_TIME + case HRTIM_OUT_TIME_CH2: +#endif + { + ch = HRTIM_OUT_CH2; + break; + } + + default: + { + ch = 0; + break; + } + } + + return ch; +} + +/**************************************************************************** + * Name: hrtim_output_set_set + ****************************************************************************/ + +static int hrtim_output_set_set(FAR struct hrtim_dev_s *dev, uint16_t output, + uint32_t set) +{ + FAR struct stm32_hrtim_s *priv = (FAR struct stm32_hrtim_s *)dev->hd_priv; + FAR struct stm32_hrtim_tim_s* tim; + FAR struct stm32_hrtim_slave_priv_s* slave; + uint8_t timer = 0; + int ret = OK; + + /* Get timer index from output */ + + timer = output_tim_index_get(output); + + /* Get Timer data strucutre */ + + tim = hrtim_tim_get(priv, timer); + if (tim == NULL) + { + ret = -EINVAL; + goto errout; + } + + slave = (struct stm32_hrtim_slave_priv_s*)tim->priv; + + /* Set new SET value */ + + switch (output_tim_ch_get(output)) + { + case HRTIM_OUT_CH1: + { + slave->pwm.ch1.set = set; + hrtim_tim_putreg(priv, timer, STM32_HRTIM_TIM_SET1R_OFFSET, set); + break; + } + + case HRTIM_OUT_CH2: + { + slave->pwm.ch2.set = set; + hrtim_tim_putreg(priv, timer, STM32_HRTIM_TIM_SET2R_OFFSET, set); + break; + } + + default: + { + ret = -EINVAL; + goto errout; + } + } + +errout: + return ret; +} + +/**************************************************************************** + * Name: hrtim_output_rst_set + ****************************************************************************/ +static int hrtim_output_rst_set(FAR struct hrtim_dev_s *dev, uint16_t output, + uint32_t rst) +{ + FAR struct stm32_hrtim_s *priv = (FAR struct stm32_hrtim_s *)dev->hd_priv; + FAR struct stm32_hrtim_tim_s* tim; + FAR struct stm32_hrtim_slave_priv_s* slave; + uint8_t timer = 0; + int ret = OK; + + /* Get timer index from output */ + + timer = output_tim_index_get(output); + + /* Get Timer data strucutre */ + + tim = hrtim_tim_get(priv, timer); + if (tim == NULL) + { + ret = -EINVAL; + goto errout; + } + + slave = (struct stm32_hrtim_slave_priv_s*)tim->priv; + + /* Set new RST value */ + + switch (output_tim_ch_get(output)) + { + case HRTIM_OUT_CH1: + { + slave->pwm.ch1.rst = rst; + hrtim_tim_putreg(priv, timer, STM32_HRTIM_TIM_RST1R_OFFSET, rst); + } + + case HRTIM_OUT_CH2: + { + slave->pwm.ch2.rst = rst; + hrtim_tim_putreg(priv, timer, STM32_HRTIM_TIM_RST2R_OFFSET, rst); + } + + default: + { + ret = -EINVAL; + goto errout; + } + } + +errout: + return ret; +} + #endif /**************************************************************************** @@ -3069,7 +3340,7 @@ static int hrtim_dma_cfg(FAR struct stm32_hrtim_s *priv) * Name: hrtim_deadtime_update ****************************************************************************/ -static int hrtim_deadtime_update(FAR struct stm32_dev_s *dev, uint8_t timer, +static int hrtim_deadtime_update(FAR struct hrtim_dev_s *dev, uint8_t timer, uint8_t dt, uint16_t value) { FAR struct stm32_hrtim_s *priv = (FAR struct stm32_hrtim_s *)dev->hd_priv; @@ -3078,17 +3349,18 @@ static int hrtim_deadtime_update(FAR struct stm32_dev_s *dev, uint8_t timer, uint32_t shift = 0; uint32_t mask = 0; - /* Sanity check */ + /* For safety reasons we saturate deadtime value if it exceeds + * the acceptable range. + */ if (value > 0x1FF) { - ret = -EINVAL; - goto errout; + value = 0x1FF; } /* Get shift value */ - switch (index) + switch (dt) { case HRTIM_DT_EDGE_RISING: { @@ -3115,7 +3387,7 @@ static int hrtim_deadtime_update(FAR struct stm32_dev_s *dev, uint8_t timer, /* Update register */ - hrtim_tim_modify(priv, timer, STM32_HRTIM_TIM_DTR_OFFSET, mask, regval); + hrtim_tim_modifyreg(priv, timer, STM32_HRTIM_TIM_DTR_OFFSET, mask, regval); errout: return ret; @@ -3125,7 +3397,7 @@ errout: * Name: hrtim_deadtime_get ****************************************************************************/ -static uint16_t hrtim_deadtime_get(FAR struct stm32_dev_s *dev, uint8_t dt) +static uint16_t hrtim_deadtime_get(FAR struct hrtim_dev_s *dev, uint8_t dt) { #warning missing logic } @@ -3134,20 +3406,36 @@ static uint16_t hrtim_deadtime_get(FAR struct stm32_dev_s *dev, uint8_t dt) * Name: hrtim_tim_deadtime_cfg ****************************************************************************/ -static int hrtim_tim_deadtime_cfg(FAR struct stm32_hrtim_s *priv, uint8_t index) +static int hrtim_tim_deadtime_cfg(FAR struct stm32_hrtim_s *priv, uint8_t timer) { + FAR struct stm32_hrtim_tim_s* tim; FAR struct stm32_hrtim_slave_priv_s* slave; uint32_t regval = 0; int ret = OK; + /* Master Timer has no outputs */ + if (timer == HRTIM_TIMER_MASTER) { ret = -EINVAL; goto errout; } + /* Get Timer data strucutre */ + + tim = hrtim_tim_get(priv, timer); + if (tim == NULL) + { + ret = -EINVAL; + goto errout; + } + slave = (struct stm32_hrtim_slave_priv_s*)tim->priv; + /* Configure deadtime prescaler */ + + regval |= slave->pwm.dt.prescaler << HRTIM_TIMDT_DTPRSC_SHIFT; + /* Configure rising deadtime */ regval |= slave->pwm.dt.rising << HRTIM_TIMDT_DTR_SHIFT; @@ -3158,14 +3446,14 @@ static int hrtim_tim_deadtime_cfg(FAR struct stm32_hrtim_s *priv, uint8_t index) /* Configure falling deadtime sign */ - if (slave->pwm.dt.fsign == HRTIM_DT_SIGN_POSITIVE) + if (slave->pwm.dt.fsign == HRTIM_DT_SIGN_NEGATIVE) { regval |= HRTIM_TIMDT_SDTF; } /* Configure risign deadtime sign */ - if (slave->pwm.dt.rsign == HRTIM_DT_SIGN_POSITIVE) + if (slave->pwm.dt.rsign == HRTIM_DT_SIGN_NEGATIVE) { regval |= HRTIM_TIMDT_SDTR; } @@ -3198,6 +3486,12 @@ static int hrtim_tim_deadtime_cfg(FAR struct stm32_hrtim_s *priv, uint8_t index) regval |= HRTIM_TIMDT_DTFLK; } + /* TODO: configure default deadtime values */ + + /* Write register */ + + hrtim_tim_putreg(priv, timer, STM32_HRTIM_TIM_DTR_OFFSET, regval); + errout: return ret; } @@ -3210,31 +3504,31 @@ static int hrtim_deadtime_config(FAR struct stm32_hrtim_s *priv) { /* Configure Timer A deadtime */ -#ifdef CONFIG_STM32_HRTIM_TIMA +#ifdef CONFIG_STM32_HRTIM_TIMA_DT hrtim_tim_deadtime_cfg(priv, HRTIM_TIMER_TIMA); #endif /* Configure Timer B deadtime */ -#ifdef CONFIG_STM32_HRTIM_TIMB +#ifdef CONFIG_STM32_HRTIM_TIMB_DT hrtim_tim_deadtime_cfg(priv, HRTIM_TIMER_TIMB); #endif /* Configure Timer C deadtime */ -#ifdef CONFIG_STM32_HRTIM_TIMC +#ifdef CONFIG_STM32_HRTIM_TIMC_DT hrtim_tim_deadtime_cfg(priv, HRTIM_TIMER_TIMC); #endif /* Configure Timer D deadtime */ -#ifdef CONFIG_STM32_HRTIM_TIMD +#ifdef CONFIG_STM32_HRTIM_TIMD_DT hrtim_tim_deadtime_cfg(priv, HRTIM_TIMER_TIMD); #endif /* Configure Timer E deadtime */ -#ifdef CONFIG_STM32_HRTIM_TIME +#ifdef CONFIG_STM32_HRTIM_TIME_DT hrtim_tim_deadtime_cfg(priv, HRTIM_TIMER_TIME); #endif @@ -3260,7 +3554,7 @@ static int hrtim_deadtime_config(FAR struct stm32_hrtim_s *priv) * ****************************************************************************/ -static int hrtim_chopper_enable(FAR struct stm32_dev_s *dev, uint8_t timer, +static int hrtim_chopper_enable(FAR struct hrtim_dev_s *dev, uint8_t timer, uint8_t chan, bool state) { FAR struct stm32_hrtim_s *priv = (FAR struct stm32_hrtim_s *)dev->hd_priv; @@ -4595,6 +4889,17 @@ static int stm32_hrtimconfig(FAR struct stm32_hrtim_s *priv) } #endif + /* Configure HRTIM outputs deadtime */ + +#if defined(CONFIG_STM32_HRTIM_DEADTIME) + ret = hrtim_deadtime_config(priv); + if (ret != OK) + { + tmrerr("ERROR: HRTIM deadtime configuration failed!\n"); + goto errout; + } +#endif + /* Configure HRTIM outputs GPIOs */ #if defined(CONFIG_STM32_HRTIM_PWM) diff --git a/arch/arm/src/stm32/stm32_hrtim.h b/arch/arm/src/stm32/stm32_hrtim.h index 1085951fb9..40ffe37b8d 100644 --- a/arch/arm/src/stm32/stm32_hrtim.h +++ b/arch/arm/src/stm32/stm32_hrtim.h @@ -208,10 +208,12 @@ (hrtim)->hd_ops->cmp_update(hrtim, tim, index, cmp) #define HRTIM_PER_SET(hrtim, tim, per) \ (hrtim)->hd_ops->per_update(hrtim, tim, per) -#define HRTIM_OUTPUTS_ENABLE(hrtim, tim, state) \ - (hrtim)->hd_ops->outputs_enable(hrtim, tim, state) -#define HRTIM_OUTPUTS_ENABLE(hrtim, tim, state) \ - (hrtim)->hd_ops->outputs_enable(hrtim, tim, state) +#define HRTIM_OUTPUTS_ENABLE(hrtim, outputs, state) \ + (hrtim)->hd_ops->outputs_enable(hrtim, outputs, state) +#define HRTIM_OUTPUT_SET_SET(hrtim, output, set) \ + (hrtim)->hd_ops->output_set_set(hrtim, output, set) +#define HRTIM_OUTPUT_RST_SET(hrtim, output, rst) \ + (hrtim)->hd_ops->output_rst_set(hrtim, output, rst) #define HRTIM_BURST_CMP_SET(hrtim, cmp) \ (hrtim)->hd_ops->burst_cmp_set(hrtim, cmp) #define HRTIM_BURST_PER_SET(hrtim, per) \ @@ -220,6 +222,8 @@ (hrtim)->hd_ops->burst_pre_set(hrtim, pre) #define HRTIM_BURST_ENABLE(hrtim, state) \ (hrtim)->hd_ops->burst_enable(hrtim, state) +#define HRTIM_DEADTIME_UPDATE(hrtim, tim, dt, val) \ + (hrtim)->hd_ops->deadtime_update(hrtim, tim, dt, val) /************************************************************************************ * Public Types @@ -229,23 +233,23 @@ enum stm32_hrtim_tim_e { - HRTIM_TIMER_MASTER = 0, + HRTIM_TIMER_MASTER = (1<<0), #ifdef CONFIG_STM32_HRTIM_TIMA - HRTIM_TIMER_TIMA = 1, + HRTIM_TIMER_TIMA = (1<<1), #endif #ifdef CONFIG_STM32_HRTIM_TIMB - HRTIM_TIMER_TIMB = 2, + HRTIM_TIMER_TIMB = (1<<2), #endif #ifdef CONFIG_STM32_HRTIM_TIMC - HRTIM_TIMER_TIMC = 3, + HRTIM_TIMER_TIMC = (1<<3), #endif #ifdef CONFIG_STM32_HRTIM_TIMD - HRTIM_TIMER_TIMD = 4, + HRTIM_TIMER_TIMD = (1<<4), #endif #ifdef CONFIG_STM32_HRTIM_TIME - HRTIM_TIMER_TIME = 5, + HRTIM_TIMER_TIME = (1<<5), #endif - HRTIM_TIMER_COMMON = 6 + HRTIM_TIMER_COMMON = (1<<6) }; /* Source which can force the Tx1/Tx2 output to its inactive state */ @@ -571,7 +575,7 @@ enum stm32_outputs_e enum stm32_hrtim_deadtime_sign_e { HRTIM_DT_SIGN_POSITIVE = 0, - HRTIM_DT_DIGN_NEGATIVE = 1 + HRTIM_DT_SIGN_NEGATIVE = 1 }; /* HRTIM Deadtime types */ @@ -973,6 +977,10 @@ struct stm32_hrtim_ops_s #ifdef CONFIG_STM32_HRTIM_PWM int (*outputs_enable)(FAR struct hrtim_dev_s *dev, uint16_t outputs, bool state); + int (*output_set_set)(FAR struct hrtim_dev_s *dev, uint16_t output, + uint32_t set); + int (*output_rst_set)(FAR struct hrtim_dev_s *dev, uint16_t output, + uint32_t rst); #endif #ifdef CONFIG_STM32_HRTIM_BURST int (*burst_enable)(FAR struct hrtim_dev_s *dev, bool state); @@ -988,8 +996,10 @@ struct stm32_hrtim_ops_s uint8_t chan, bool state); #endif #ifdef CONFIG_STM32_HRTIM_DEADTIME - int (*deadtime_update)(FAR struct hrtim_dev_s *dev, uint8_t dt, uint16_t value); - uint16_t (*deadtime_get)(FAR struct hrtim_dev_s *dev, uint8_t dt); + int (*deadtime_update)(FAR struct hrtim_dev_s *dev, uint8_t timer, + uint8_t dt, uint16_t value); + uint16_t (*deadtime_get)(FAR struct hrtim_dev_s *dev, uint8_t timer, + uint8_t dt); #endif #ifdef CONFIG_STM32_HRTIM_CAPTURE uint16_t (*capture_get)(FAR struct hrtim_dev_s *dev, uint8_t timer, -- GitLab From 57b6dec74da8dcfd35f1500b259b8f6bdf0945d4 Mon Sep 17 00:00:00 2001 From: Fabio D'Urso Date: Sun, 14 Jan 2018 17:09:23 -0600 Subject: [PATCH 015/228] If we want to open read-only in losetup.c, flags should be O_RDONLY not O_RDWR --- drivers/loop/losetup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/loop/losetup.c b/drivers/loop/losetup.c index 32c2f4d437..0690776e23 100644 --- a/drivers/loop/losetup.c +++ b/drivers/loop/losetup.c @@ -440,7 +440,7 @@ int losetup(FAR const char *devname, FAR const char *filename, { /* If that fails, then try to open the device read-only */ - fd = open(filename, O_RDWR); + fd = open(filename, O_RDONLY); if (fd < 0) { ret = -get_errno(); -- GitLab From 0ecef4dbcbcfacc96a1a0a8e7b5244be31d17491 Mon Sep 17 00:00:00 2001 From: Masayuki Ishikawa Date: Mon, 15 Jan 2018 13:04:32 +0900 Subject: [PATCH 016/228] clock_systimer: Replace critical section APIs with spinlock APIs. (64bit only) If SMP=n or SMP=y && SPINLOCK_IRQ=n, this works in the same way as before. If SMP=y && SPINLOCK_IRQ=y, performance will be improved. Signed-off-by: Masayuki Ishikawa --- sched/clock/clock_systimer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sched/clock/clock_systimer.c b/sched/clock/clock_systimer.c index 1b13451092..288bcf66e7 100644 --- a/sched/clock/clock_systimer.c +++ b/sched/clock/clock_systimer.c @@ -120,9 +120,9 @@ systime_t clock_systimer(void) /* 64-bit accesses are not atomic on most architectures. */ - flags = enter_critical_section(); + flags = spin_lock_irqsave(); sample = g_system_timer; - leave_critical_section(flags); + spin_unlock_irqrestore(flags); return sample; # else /* CONFIG_SYSTEM_TIME64 */ -- GitLab From e238c8b0904988b966c3b33e7df2ba3faba52e2b Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 15 Jan 2018 11:05:45 -0600 Subject: [PATCH 017/228] sched/clock/clock_systimer.c: Change the way that the 64-bit time is sampled. Previously, we disabled interrupts before sampling the 64-bit timer since the uint64_t access is not atomic on most CPUs. However, disabling (local) interrupts does not work in the SMP case. In that case, the timer interrupt will be running on only one of the CPUs; disabling interrupts on a different CPU will provide no protection from timer rollover. To work around this, logic was added that samples 64-bit timer is sampled twice and if 32-bit rollover was detected between samples, then loops until there is no rollover. --- sched/clock/clock_systimer.c | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/sched/clock/clock_systimer.c b/sched/clock/clock_systimer.c index 288bcf66e7..e1d4440ab1 100644 --- a/sched/clock/clock_systimer.c +++ b/sched/clock/clock_systimer.c @@ -1,7 +1,7 @@ /**************************************************************************** * sched/clock/clock_systimer.c * - * Copyright (C) 2011, 2014-2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2011, 2014-2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -50,10 +50,15 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* See nuttx/clock.h */ #undef clock_systimer +/* 32-bit mask for 64-bit timer values */ + +#define TIMER_MASK32 0x00000000ffffffff + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -109,20 +114,34 @@ systime_t clock_systimer(void) /* Convert to a 64- then a 32-bit value */ tmp = USEC2TICK(1000000 * (uint64_t)ts.tv_sec + (uint64_t)ts.tv_nsec / 1000); - return (systime_t)(tmp & 0x00000000ffffffff); + return (systime_t)(tmp & TIMER_MASK32); # endif /* CONFIG_SYSTEM_TIME64 */ #else /* CONFIG_SCHED_TICKLESS */ # ifdef CONFIG_SYSTEM_TIME64 - irqstate_t flags; systime_t sample; + systime_t verify; + + /* 64-bit accesses are not atomic on most architectures. The following + * loop samples the 64-bit timer twice and loops in the rare event that + * there was 32-bit rollover between samples. + * + * If there is no 32-bit rollover, then: + * + * - The MS 32-bits of each sample will be the same, and + * - The LS 32-bits of the second sample will be greater than or equal to + * the LS 32-bits for the first sample. + */ + + do + { + verify = g_system_timer; + sample = g_system_timer; + } + while ((sample & TIMER_MASK32) < (verify & TIMER_MASK32) || + (sample & ~TIMER_MASK32) != (verify & ~TIMER_MASK32)); - /* 64-bit accesses are not atomic on most architectures. */ - - flags = spin_lock_irqsave(); - sample = g_system_timer; - spin_unlock_irqrestore(flags); return sample; # else /* CONFIG_SYSTEM_TIME64 */ -- GitLab From a30ccce7ced3732e0c9cac5b8fa66b94157fddc6 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 15 Jan 2018 18:22:29 -0600 Subject: [PATCH 018/228] configs/nucleo-l432kc/src: Fix some bogus logic noted by Fanda. --- configs/nucleo-l432kc/src/stm32_userleds.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/configs/nucleo-l432kc/src/stm32_userleds.c b/configs/nucleo-l432kc/src/stm32_userleds.c index 0ff3ce66c8..8dec7afee3 100644 --- a/configs/nucleo-l432kc/src/stm32_userleds.c +++ b/configs/nucleo-l432kc/src/stm32_userleds.c @@ -181,7 +181,7 @@ void board_userled_initialize(void) void board_userled(int led, bool ledon) { - if (led == 1) + if (led == BOARD_LD2) { stm32l4_gpiowrite(GPIO_LD2, ledon); } @@ -193,10 +193,7 @@ void board_userled(int led, bool ledon) void board_userled_all(uint8_t ledset) { - if (led == 1) - { - stm32l4_gpiowrite(GPIO_LD2, (ledset & BOARD_LD2_BIT) != 0); - } + stm32l4_gpiowrite(GPIO_LD2, (ledset & BOARD_LD2_BIT) != 0); } /**************************************************************************** -- GitLab From bb7703dc8c7fbb089768da38a56fc9029865b4d8 Mon Sep 17 00:00:00 2001 From: Jussi Kivilinna Date: Tue, 16 Jan 2018 07:17:35 -0600 Subject: [PATCH 019/228] fs/smartfs: Fix inverted ifdef for CONFIG_SMARTFS_USE_SECTOR_BUFFER in smartfs_extendfile() --- fs/smartfs/smartfs_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/smartfs/smartfs_utils.c b/fs/smartfs/smartfs_utils.c index da37b92212..99bb8c1656 100644 --- a/fs/smartfs/smartfs_utils.c +++ b/fs/smartfs/smartfs_utils.c @@ -2072,7 +2072,7 @@ int smartfs_extendfile(FAR struct smartfs_mountpt_s *fs, ret = OK; errout_with_buffer: -#ifdef CONFIG_SMARTFS_USE_SECTOR_BUFFER +#ifndef CONFIG_SMARTFS_USE_SECTOR_BUFFER /* Release the allocated buffer */ kmm_free(buffer); -- GitLab From 802f146781fed4018b3ebbaa269388d81e4ebf8a Mon Sep 17 00:00:00 2001 From: Juha Niskanen Date: Tue, 16 Jan 2018 07:20:41 -0600 Subject: [PATCH 020/228] configs/nucleo-* and configs/stm32l476vg-disco: Fix more stm32_userleds.c bogus logic --- configs/nucleo-f072rb/src/stm32_userleds.c | 9 +++------ configs/nucleo-f091rc/src/stm32_userleds.c | 9 +++------ configs/nucleo-f410rb/src/stm32_userleds.c | 9 +++------ configs/nucleo-l452re/src/stm32_userleds.c | 9 +++------ configs/nucleo-l476rg/src/stm32_userleds.c | 11 ++++------- configs/stm32l476vg-disco/src/stm32_userleds.c | 4 ++-- 6 files changed, 18 insertions(+), 33 deletions(-) diff --git a/configs/nucleo-f072rb/src/stm32_userleds.c b/configs/nucleo-f072rb/src/stm32_userleds.c index 0b967fc662..8febc96b46 100644 --- a/configs/nucleo-f072rb/src/stm32_userleds.c +++ b/configs/nucleo-f072rb/src/stm32_userleds.c @@ -181,9 +181,9 @@ void board_userled_initialize(void) void board_userled(int led, bool ledon) { - if (led == 1) + if (led == BOARD_LD2) { - stm32f0_gpiowrite(GPIO_LD2, ldeon); + stm32f0_gpiowrite(GPIO_LD2, ledon); } } @@ -193,10 +193,7 @@ void board_userled(int led, bool ledon) void board_userled_all(uint8_t ledset) { - if (led == 1) - { - stm32f0_gpiowrite(GPIO_LD2, (ledset & BOARD_LD2_BIT) != 0); - } + stm32f0_gpiowrite(GPIO_LD2, (ledset & BOARD_LD2_BIT) != 0); } /**************************************************************************** diff --git a/configs/nucleo-f091rc/src/stm32_userleds.c b/configs/nucleo-f091rc/src/stm32_userleds.c index b13c1882b7..f62e84a30e 100644 --- a/configs/nucleo-f091rc/src/stm32_userleds.c +++ b/configs/nucleo-f091rc/src/stm32_userleds.c @@ -181,9 +181,9 @@ void board_userled_initialize(void) void board_userled(int led, bool ledon) { - if (led == 1) + if (led == BOARD_LD2) { - stm32f0_gpiowrite(GPIO_LD2, ldeon); + stm32f0_gpiowrite(GPIO_LD2, ledon); } } @@ -193,10 +193,7 @@ void board_userled(int led, bool ledon) void board_userled_all(uint8_t ledset) { - if (led == 1) - { - stm32f0_gpiowrite(GPIO_LD2, (ledset & BOARD_LD2_BIT) != 0); - } + stm32f0_gpiowrite(GPIO_LD2, (ledset & BOARD_LD2_BIT) != 0); } /**************************************************************************** diff --git a/configs/nucleo-f410rb/src/stm32_userleds.c b/configs/nucleo-f410rb/src/stm32_userleds.c index bdd1be2b18..fb283a50cc 100644 --- a/configs/nucleo-f410rb/src/stm32_userleds.c +++ b/configs/nucleo-f410rb/src/stm32_userleds.c @@ -181,9 +181,9 @@ void board_userled_initialize(void) void board_userled(int led, bool ledon) { - if (led == 1) + if (led == BOARD_LD2) { - stm32_gpiowrite(GPIO_LD2, ldeon); + stm32_gpiowrite(GPIO_LD2, ledon); } } @@ -193,10 +193,7 @@ void board_userled(int led, bool ledon) void board_userled_all(uint8_t ledset) { - if (led == 1) - { - stm32_gpiowrite(GPIO_LD2, (ledset & BOARD_LD2_BIT) != 0); - } + stm32_gpiowrite(GPIO_LD2, (ledset & BOARD_LD2_BIT) != 0); } /**************************************************************************** diff --git a/configs/nucleo-l452re/src/stm32_userleds.c b/configs/nucleo-l452re/src/stm32_userleds.c index 77ba277c34..4ed1b8d807 100644 --- a/configs/nucleo-l452re/src/stm32_userleds.c +++ b/configs/nucleo-l452re/src/stm32_userleds.c @@ -181,9 +181,9 @@ void board_userled_initialize(void) void board_userled(int led, bool ledon) { - if (led == 1) + if (led == BOARD_LD2) { - stm32l4_gpiowrite(GPIO_LD2, ldeon); + stm32l4_gpiowrite(GPIO_LD2, ledon); } } @@ -193,10 +193,7 @@ void board_userled(int led, bool ledon) void board_userled_all(uint8_t ledset) { - if (led == 1) - { - stm32l4_gpiowrite(GPIO_LD2, (ledset & BOARD_LD2_BIT) != 0); - } + stm32l4_gpiowrite(GPIO_LD2, (ledset & BOARD_LD2_BIT) != 0); } /**************************************************************************** diff --git a/configs/nucleo-l476rg/src/stm32_userleds.c b/configs/nucleo-l476rg/src/stm32_userleds.c index 53d9193230..9464a6ad34 100644 --- a/configs/nucleo-l476rg/src/stm32_userleds.c +++ b/configs/nucleo-l476rg/src/stm32_userleds.c @@ -172,7 +172,7 @@ void board_userled_initialize(void) { /* Configure LD2 GPIO for output */ - stm32_configgpio(GPIO_LD2); + stm32l4_configgpio(GPIO_LD2); } /**************************************************************************** @@ -181,9 +181,9 @@ void board_userled_initialize(void) void board_userled(int led, bool ledon) { - if (led == 1) + if (led == BOARD_LD2) { - stm32_gpiowrite(GPIO_LD2, ldeon); + stm32l4_gpiowrite(GPIO_LD2, ledon); } } @@ -193,10 +193,7 @@ void board_userled(int led, bool ledon) void board_userled_all(uint8_t ledset) { - if (led == 1) - { - stm32_gpiowrite(GPIO_LD2, (ledset & BOARD_LD2_BIT) != 0); - } + stm32l4_gpiowrite(GPIO_LD2, (ledset & BOARD_LD2_BIT) != 0); } /**************************************************************************** diff --git a/configs/stm32l476vg-disco/src/stm32_userleds.c b/configs/stm32l476vg-disco/src/stm32_userleds.c index 4bee92bde8..f1b27fb26f 100644 --- a/configs/stm32l476vg-disco/src/stm32_userleds.c +++ b/configs/stm32l476vg-disco/src/stm32_userleds.c @@ -192,11 +192,11 @@ void board_userled(int led, bool ledon) switch (led) { case BOARD_LED_RED: - stm32l4_gpiowrite(GPIO_LED_RED, ldeon); + stm32l4_gpiowrite(GPIO_LED_RED, ledon); break; case BOARD_LED_GRN: - stm32l4_gpiowrite(GPIO_LED_GRN, ldeon); + stm32l4_gpiowrite(GPIO_LED_GRN, ledon); break; } } -- GitLab From c67de1f114ac1601707180b65420e27d6af08dae Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 16 Jan 2018 11:48:36 -0600 Subject: [PATCH 021/228] configs/lpcxpresso-lpc54628: Add pin definitions for USART, I2C, and SPI on the Arduino Uno connector. --- configs/lpcxpresso-lpc54628/README.txt | 6 +++ configs/lpcxpresso-lpc54628/include/board.h | 54 +++++++++++++++++++-- 2 files changed, 56 insertions(+), 4 deletions(-) diff --git a/configs/lpcxpresso-lpc54628/README.txt b/configs/lpcxpresso-lpc54628/README.txt index 926fc1bd9d..0f31315c94 100644 --- a/configs/lpcxpresso-lpc54628/README.txt +++ b/configs/lpcxpresso-lpc54628/README.txt @@ -24,6 +24,12 @@ README device functionality - 10/100Mbps Ethernet (RJ45 connector) +CONTENTS +======== + + - STATUS + - Configurations + STATUS ====== diff --git a/configs/lpcxpresso-lpc54628/include/board.h b/configs/lpcxpresso-lpc54628/include/board.h index 2ca923462a..802d35575c 100644 --- a/configs/lpcxpresso-lpc54628/include/board.h +++ b/configs/lpcxpresso-lpc54628/include/board.h @@ -306,7 +306,7 @@ /* Pin Disambiguation *******************************************************/ /* Flexcomm0/USART0 * - * USART0 connects to the serial bridge on LPC4322JET100 and is typlical used + * USART0 connects to the serial bridge on LPC4322JET100 and is typically used * for the serial console. * * BRIDGE_UART_RXD -> P0_29-ISP_FC0_RXD -> P0.29 GPIO_FC0_RXD_SDA_MOSI_2 @@ -316,6 +316,18 @@ #define GPIO_USART0_RXD (GPIO_FC0_RXD_SDA_MOSI_2 | GPIO_FILTER_OFF) #define GPIO_USART0_TXD (GPIO_FC0_TXD_SCL_MISO_2 | GPIO_FILTER_OFF) +/* An alternative for the serial console is a Arduino Uno compatible serial + * shield: + * + * Arduino Uno J13 Board Signal + * ----------- ------ ---------------- + * D0 RX Pin 15 P3_26-FC4_RXD + * D1 TX Pin 13 P3_27-FC4_TXD + */ + +#define GPIO_USART4_RXD (GPIO_FC4_RXD_SDA_MOSI_2 | GPIO_FILTER_OFF) +#define GPIO_USART4_TXD (GPIO_FC4_TXD_SCL_MISO_2 | GPIO_FILTER_OFF) + /* Flexcomm2/I2C * * For I2C: @@ -329,8 +341,14 @@ * Type I pins need for high speed I2C need: * GPIO_FILTER_OFF + GPIO_I2C_FILTER_OFF + GPIO_I2CDRIVE_HIGH * - * The touchscreen controller is on I2C2: SCL P3.24, SDA P3.23. These are - * both Type D/I pins. + * There are several on-board devices using I2C2: + * + * Codec I2C address: 0x1a + * Accel I2C address: 0x1d + * Touch panel I2C address: 0x38 + * + * In addition, these same I2C2 pins are brought out through D14 and D15 of + * the Arduino Uno connector. */ #if defined(CONFIG_LPC54_I2C_FAST) @@ -351,6 +369,35 @@ GPIO_FILTER_OFF | _I2CFILTER | \ _I2CDRIVE) +/* Flexcomm2/SPI + * + * There are no SPI devices on board the LPCXpresso-LPC54628. SPI is + * available on the Arduino Uno compatible connector, however: + * + * Arduino Uno J9 Board Signal Pin Type + * ----------- ------ ---------------- --------- + * D10 SSEL Pin 15 P3_20-FC9_SCK Type D + * D11 MOSI Pin 13 P3_21-FC9_MOSI Type A + * D12 MISO Pin 11 P3_22-FC9_MISO Type A + * D13 SCK Pin 9 P3_30-FC9_SSELn0 Type D + * + * For SPI: + * Type A & D pins need: + * GPIO_PUSHPULL (on outputs) + GPIO_SLEW_STANDARD (Type D) + + * GPIO_FILTER_OFF + * GPIO_SLEW_FAST is optional for high data rates (Type D). + * Type I need: + * GPIO_I2C_FILTER_OFF + GPIO_I2CDRIVE_LOW + GPIO_FILTER_OFF + + * GPIO_I2CSLEW_GPIO + */ + +#define GPIO_FC9_RXD_SDA_MOSI (GPIO_FC9_RXD_SDA_MOSI_1 | \ + GPIO_PUSHPULL | GPIO_FILTER_OFF) +#define GPIO_FC9_TXD_SCL_MISO (GPIO_FC9_TXD_SCL_MISO_1 | \ + GPIO_FILTER_OFF) +#define GPIO_FC9_SCK (GPIO_FC9_SCK_1 | GPIO_PUSHPULL | \ + GPIO_SLEW_STANDARD | GPIO_FILTER_OFF) + /* SD/MMC * * P2_10-SD_CDn @@ -412,7 +459,6 @@ * feature. */ - #define GPIO_ENET_MDIO GPIO_ENET_MDIO_2 /* P4.16 */ #define GPIO_ENET_MDC GPIO_ENET_MDC_2 /* P4.15 */ -- GitLab From 7d36a818061dd65ed49176633429c83535cb5113 Mon Sep 17 00:00:00 2001 From: Evgeniy Bobkov Date: Tue, 16 Jan 2018 12:41:02 -0600 Subject: [PATCH 022/228] Fixes two bugs in multi-block SD-card operations on the STM32F7 platform. arch/arm/src/stm32f7: DBLOCKSIZE must be the size of SD-card block, not the total amount of transferred bytes. drivers/mmcsd: respect SDIO_CAPS_DMABEFOREWRITE on CMD25. --- arch/arm/src/stm32f7/Kconfig | 2 + arch/arm/src/stm32f7/stm32_sdmmc.c | 76 +++++++++++++++++++++++------- drivers/mmcsd/mmcsd_sdio.c | 45 ++++++++++++++---- 3 files changed, 96 insertions(+), 27 deletions(-) diff --git a/arch/arm/src/stm32f7/Kconfig b/arch/arm/src/stm32f7/Kconfig index 9e80a64934..4f07188d09 100644 --- a/arch/arm/src/stm32f7/Kconfig +++ b/arch/arm/src/stm32f7/Kconfig @@ -1430,6 +1430,7 @@ config STM32F7_SDMMC1 select ARCH_HAVE_SDIO select ARCH_HAVE_SDIOWAIT_WRCOMPLETE select SDIO_PREFLIGHT + select SDIO_BLOCKSETUP config STM32F7_SDMMC2 bool "SDMMC2" @@ -1439,6 +1440,7 @@ config STM32F7_SDMMC2 select ARCH_HAVE_SDIO select ARCH_HAVE_SDIOWAIT_WRCOMPLETE select SDIO_PREFLIGHT + select SDIO_BLOCKSETUP config STM32F7_SPDIFRX bool "SPDIFRX" diff --git a/arch/arm/src/stm32f7/stm32_sdmmc.c b/arch/arm/src/stm32f7/stm32_sdmmc.c index e6168ad663..e5ac6632df 100644 --- a/arch/arm/src/stm32f7/stm32_sdmmc.c +++ b/arch/arm/src/stm32f7/stm32_sdmmc.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/stm32f7/stm32_sdmmc.c * - * Copyright (C) 2009, 2011-2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2009, 2011-2018 Gregory Nutt. All rights reserved. * Authors: Gregory Nutt * David Sidrane * @@ -388,6 +388,10 @@ struct stm32_dev_s bool dmamode; /* true: DMA mode transfer */ DMA_HANDLE dma; /* Handle for DMA channel */ #endif + + /* Misc */ + + uint32_t blocksize; /* Current block size */ }; /* Register logging support */ @@ -421,8 +425,8 @@ struct stm32_sampleregs_s /* Low-level helpers ********************************************************/ -static inline void sdmmc_putreg32(struct stm32_dev_s *priv, uint32_t value,\ - int offset); +static inline void sdmmc_putreg32(struct stm32_dev_s *priv, uint32_t value, + int offset); static inline uint32_t sdmmc_getreg32(struct stm32_dev_s *priv, int offset); static void stm32_takesem(struct stm32_dev_s *priv); #define stm32_givesem(priv) (nxsem_post(&priv->waitsem)) @@ -438,7 +442,7 @@ static inline uint32_t stm32_getpwrctrl(struct stm32_dev_s *priv); #ifdef CONFIG_STM32F7_SDMMC_XFRDEBUG static void stm32_sampleinit(void); static void stm32_sdiosample(struct stm32_dev_s *priv, - struct stm32_sdioregs_s *regs); + struct stm32_sdioregs_s *regs); static void stm32_sample(struct stm32_dev_s *priv, int index); static void stm32_sdiodump(struct stm32_sdioregs_s *regs, const char *msg); static void stm32_dumpsample(struct stm32_dev_s *priv, @@ -458,13 +462,15 @@ static void stm32_dmacallback(DMA_HANDLE handle, uint8_t status, void *arg); static uint8_t stm32_log2(uint16_t value); static void stm32_dataconfig(struct stm32_dev_s *priv, uint32_t timeout, - uint32_t dlen, uint32_t dctrl); + uint32_t dlen, uint32_t dctrl); static void stm32_datadisable(struct stm32_dev_s *priv); static void stm32_sendfifo(struct stm32_dev_s *priv); static void stm32_recvfifo(struct stm32_dev_s *priv); static void stm32_eventtimeout(int argc, uint32_t arg); -static void stm32_endwait(struct stm32_dev_s *priv, sdio_eventset_t wkupevent); -static void stm32_endtransfer(struct stm32_dev_s *priv, sdio_eventset_t wkupevent); +static void stm32_endwait(struct stm32_dev_s *priv, + sdio_eventset_t wkupevent); +static void stm32_endtransfer(struct stm32_dev_s *priv, + sdio_eventset_t wkupevent); /* Interrupt Handling *******************************************************/ @@ -495,6 +501,8 @@ static int stm32_attach(FAR struct sdio_dev_s *dev); static int stm32_sendcmd(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t arg); +static void stm32_blocksetup(FAR struct sdio_dev_s *dev, + unsigned int blocksize, unsigned int nblocks); static int stm32_recvsetup(FAR struct sdio_dev_s *dev, FAR uint8_t *buffer, size_t nbytes); static int stm32_sendsetup(FAR struct sdio_dev_s *dev, @@ -543,6 +551,7 @@ static void stm32_default(struct stm32_dev_s *priv); /**************************************************************************** * Private Data ****************************************************************************/ + #ifdef CONFIG_STM32F7_SDMMC1 struct stm32_dev_s g_sdmmcdev1 = { @@ -558,9 +567,7 @@ struct stm32_dev_s g_sdmmcdev1 = .clock = stm32_clock, .attach = stm32_attach, .sendcmd = stm32_sendcmd, -#ifdef CONFIG_SDIO_BLOCKSETUP - .blocksetup = stm32_blocksetup, /* Not implemented yet */ -#endif + .blocksetup = stm32_blocksetup, .recvsetup = stm32_recvsetup, .sendsetup = stm32_sendsetup, .cancel = stm32_cancel, @@ -620,9 +627,7 @@ struct stm32_dev_s g_sdmmcdev2 = .clock = stm32_clock, .attach = stm32_attach, .sendcmd = stm32_sendcmd, -#ifdef CONFIG_SDIO_BLOCKSETUP - .blocksetup = stm32_blocksetup, /* Not implemented yet */ -#endif + .blocksetup = stm32_blocksetup, .recvsetup = stm32_recvsetup, .sendsetup = stm32_sendsetup, .cancel = stm32_cancel, @@ -1433,6 +1438,19 @@ static void stm32_endwait(struct stm32_dev_s *priv, sdio_eventset_t wkupevent) static void stm32_endtransfer(struct stm32_dev_s *priv, sdio_eventset_t wkupevent) { + /* Disable the DTEN bit (it should not be left set after previous read when + * the next write initialization starts). + */ + +#if 1 + sdmmc_putreg32(priv, + sdmmc_getreg32(priv, STM32_SDMMC_DCTRL_OFFSET) & + ~STM32_SDMMC_DCTRL_DTEN, + STM32_SDMMC_DCTRL_OFFSET); +#else + stm32_datadisable(priv); +#endif + /* Disable all transfer related interrupts */ stm32_configxfrints(priv, 0); @@ -2057,6 +2075,30 @@ static int stm32_sendcmd(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t arg) return OK; } +/**************************************************************************** + * Name: stm32_blocksetup + * + * Description: + * Configure block size and the number of blocks for next transfer. + * + * Input Parameters: + * dev - An instance of the SDIO device interface. + * blocksize - The selected block size. + * nblocks - The number of blocks to transfer. + * + * Returned Value: + * None + * + ****************************************************************************/ + +static void stm32_blocksetup(FAR struct sdio_dev_s *dev, unsigned int blocksize, + unsigned int nblocks) +{ + struct stm32_dev_s *priv = (struct stm32_dev_s *)dev; + + priv->blocksize = blocksize; +} + /**************************************************************************** * Name: stm32_recvsetup * @@ -2103,7 +2145,7 @@ static int stm32_recvsetup(FAR struct sdio_dev_s *dev, FAR uint8_t *buffer, /* Then set up the SDIO data path */ - dblocksize = stm32_log2(nbytes) << STM32_SDMMC_DCTRL_DBLOCKSIZE_SHIFT; + dblocksize = stm32_log2(priv->blocksize) << STM32_SDMMC_DCTRL_DBLOCKSIZE_SHIFT; stm32_dataconfig(priv, SDMMC_DTIMER_DATATIMEOUT, nbytes, dblocksize | STM32_SDMMC_DCTRL_DTDIR); @@ -2158,7 +2200,7 @@ static int stm32_sendsetup(FAR struct sdio_dev_s *dev, FAR const /* Then set up the SDIO data path */ - dblocksize = stm32_log2(nbytes) << STM32_SDMMC_DCTRL_DBLOCKSIZE_SHIFT; + dblocksize = stm32_log2(priv->blocksize) << STM32_SDMMC_DCTRL_DBLOCKSIZE_SHIFT; stm32_dataconfig(priv, SDMMC_DTIMER_DATATIMEOUT, nbytes, dblocksize); /* Enable TX interrupts */ @@ -2882,7 +2924,7 @@ static int stm32_dmarecvsetup(FAR struct sdio_dev_s *dev, FAR uint8_t *buffer, /* Then set up the SDIO data path */ - dblocksize = stm32_log2(buflen) << STM32_SDMMC_DCTRL_DBLOCKSIZE_SHIFT; + dblocksize = stm32_log2(priv->blocksize) << STM32_SDMMC_DCTRL_DBLOCKSIZE_SHIFT; stm32_dataconfig(priv, SDMMC_DTIMER_DATATIMEOUT, buflen, dblocksize | STM32_SDMMC_DCTRL_DTDIR); @@ -2975,7 +3017,7 @@ static int stm32_dmasendsetup(FAR struct sdio_dev_s *dev, /* Then set up the SDIO data path */ - dblocksize = stm32_log2(buflen) << STM32_SDMMC_DCTRL_DBLOCKSIZE_SHIFT; + dblocksize = stm32_log2(priv->blocksize) << STM32_SDMMC_DCTRL_DBLOCKSIZE_SHIFT; stm32_dataconfig(priv, SDMMC_DTIMER_DATATIMEOUT, buflen, dblocksize); /* Configure the TX DMA */ diff --git a/drivers/mmcsd/mmcsd_sdio.c b/drivers/mmcsd/mmcsd_sdio.c index 3d89028701..9cb491feb7 100644 --- a/drivers/mmcsd/mmcsd_sdio.c +++ b/drivers/mmcsd/mmcsd_sdio.c @@ -1895,6 +1895,25 @@ static ssize_t mmcsd_writemultiple(FAR struct mmcsd_state_s *priv, } } + /* If Controller does not need DMA setup before the write then send CMD25 + * now. + */ + + if ((priv->caps & SDIO_CAPS_DMABEFOREWRITE) == 0) + { + /* Send CMD25, WRITE_MULTIPLE_BLOCK, and verify that good R1 status + * is returned + */ + + mmcsd_sendcmdpoll(priv, MMCSD_CMD25, offset); + ret = mmcsd_recvR1(priv, MMCSD_CMD25); + if (ret != OK) + { + ferr("ERROR: mmcsd_recvR1 for CMD25 failed: %d\n", ret); + return ret; + } + } + /* Configure SDIO controller hardware for the write transfer */ SDIO_BLOCKSETUP(priv->dev, priv->blocksize, nblocks); @@ -1923,24 +1942,30 @@ static ssize_t mmcsd_writemultiple(FAR struct mmcsd_state_s *priv, priv->wrbusy = true; - /* Send CMD25, WRITE_MULTIPLE_BLOCK, and verify that good R1 status - * is returned - */ + /* If Controller needs DMA setup before write then only send CMD25 now. */ - mmcsd_sendcmdpoll(priv, MMCSD_CMD25, offset); - ret = mmcsd_recvR1(priv, MMCSD_CMD25); - if (ret != OK) + if ((priv->caps & SDIO_CAPS_DMABEFOREWRITE) != 0) { - ferr("ERROR: mmcsd_recvR1 for CMD25 failed: %d\n", ret); - return ret; + /* Send CMD25, WRITE_MULTIPLE_BLOCK, and verify that good R1 status + * is returned + */ + + mmcsd_sendcmdpoll(priv, MMCSD_CMD25, offset); + ret = mmcsd_recvR1(priv, MMCSD_CMD25); + if (ret != OK) + { + ferr("ERROR: mmcsd_recvR1 for CMD25 failed: %d\n", ret); + return ret; + } } /* Wait for the transfer to complete */ - ret = mmcsd_eventwait(priv, SDIOWAIT_TIMEOUT | SDIOWAIT_ERROR, nblocks * MMCSD_BLOCK_WDATADELAY); + ret = mmcsd_eventwait(priv, SDIOWAIT_TIMEOUT | SDIOWAIT_ERROR, + nblocks * MMCSD_BLOCK_WDATADELAY); if (ret != OK) { - ferr("ERROR: CMD18 transfer failed: %d\n", ret); + ferr("ERROR: CMD25 transfer failed: %d\n", ret); return ret; } -- GitLab From 53db5c80f315dc395505e88654f93ea63ca87457 Mon Sep 17 00:00:00 2001 From: Fanda Date: Tue, 16 Jan 2018 23:33:58 +0000 Subject: [PATCH 023/228] Merged in fvacek/nuttx (pull request #572) Fixed nucleo-l432kc broken build when CONFIG_USERLED_LOWER defined Approved-by: Gregory Nutt --- configs/nucleo-l432kc/include/board.h | 2 ++ configs/nucleo-l432kc/src/nucleo-l432kc.h | 1 + configs/nucleo-l432kc/src/stm32_appinit.c | 11 +++++++++++ 3 files changed, 14 insertions(+) diff --git a/configs/nucleo-l432kc/include/board.h b/configs/nucleo-l432kc/include/board.h index cbec4b9c37..dbe6dbe48f 100644 --- a/configs/nucleo-l432kc/include/board.h +++ b/configs/nucleo-l432kc/include/board.h @@ -45,7 +45,9 @@ # include #endif +#ifdef __KERNEL__ #include +#endif /************************************************************************************ * Pre-processor Definitions diff --git a/configs/nucleo-l432kc/src/nucleo-l432kc.h b/configs/nucleo-l432kc/src/nucleo-l432kc.h index a9ce4bee64..9ce05bc83d 100644 --- a/configs/nucleo-l432kc/src/nucleo-l432kc.h +++ b/configs/nucleo-l432kc/src/nucleo-l432kc.h @@ -87,6 +87,7 @@ #define GPIO_LD2 \ (GPIO_PORTA | GPIO_PIN5 | GPIO_OUTPUT_CLEAR | GPIO_OUTPUT | GPIO_PULLUP | \ GPIO_SPEED_50MHz) +#define LED_DRIVER_PATH "/dev/userleds" /* Buttons * diff --git a/configs/nucleo-l432kc/src/stm32_appinit.c b/configs/nucleo-l432kc/src/stm32_appinit.c index 0422e0cf20..d3a725c776 100644 --- a/configs/nucleo-l432kc/src/stm32_appinit.c +++ b/configs/nucleo-l432kc/src/stm32_appinit.c @@ -51,6 +51,7 @@ #include #include #include +#include #include #include @@ -135,6 +136,16 @@ int board_app_initialize(uintptr_t arg) } #endif +#if !defined(CONFIG_ARCH_LEDS) && defined(CONFIG_USERLED_LOWER) + /* Register the LED driver */ + + ret = userled_lower_initialize(LED_DRIVER_PATH); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret); + } +#endif + #ifdef HAVE_RTC_DRIVER /* Instantiate the STM32L4 lower-half RTC driver */ -- GitLab From e276d4d16dd896d974513dcbfdcb663366eed2ad Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 16 Jan 2018 18:03:21 -0600 Subject: [PATCH 024/228] Remove the BOARDIOC_TSCTEST_TEARNDOWN boardctl() command. Remove all implementations of board_tsc_teardown() (the were all stubs anyway except for the simulation). --- configs/Kconfig | 3 +-- configs/arduino-due/src/sam_touchscreen.c | 23 ---------------- configs/boardctl.c | 14 ---------- configs/hymini-stm32v/src/stm32_ts.c | 21 --------------- .../lpcxpresso-lpc54628/src/lpc54_ft5x06.c | 7 +---- .../mikroe-stm32f4/src/stm32_touchscreen.c | 21 --------------- .../olimex-lpc1766stk/src/lpc17_hidmouse.c | 23 ---------------- configs/open1788/src/lpc17_touchscreen.c | 21 --------------- configs/pic32mx7mmb/src/pic32_touchscreen.c | 21 --------------- configs/sam3u-ek/src/sam_touchscreen.c | 21 --------------- configs/sam4e-ek/src/sam_ads7843e.c | 21 --------------- configs/sama5d3x-ek/src/sam_touchscreen.c | 21 --------------- configs/sama5d4-ek/src/sam_maxtouch.c | 23 ---------------- configs/samv71-xult/src/sam_maxtouch.c | 23 ---------------- configs/shenzhou/src/stm32_touchscreen.c | 21 --------------- configs/sim/src/sim_touchscreen.c | 20 -------------- configs/stm3220g-eval/src/stm32_stmpe811.c | 21 --------------- configs/stm3240g-eval/src/stm32_stmpe811.c | 21 --------------- configs/stm32f429i-disco/src/stm32_stmpe811.c | 21 --------------- .../src/stm32_touchscreen.c | 23 ---------------- include/nuttx/board.h | 27 +------------------ include/sys/boardctl.h | 11 ++------ 22 files changed, 5 insertions(+), 423 deletions(-) diff --git a/configs/Kconfig b/configs/Kconfig index c278ece1e8..bc45349949 100644 --- a/configs/Kconfig +++ b/configs/Kconfig @@ -2357,8 +2357,7 @@ config BOARDCTL_TSCTEST ---help--- Enables support for the BOARDIOC_TSCTEST_SETUP and BOARDIOC_TSCTEST_TEARDOWN boardctl() commands. Architecture - specific logic must provide board_tsc_setup() and - board_tsc_teardown() interfaces. + specific logic must provide the board_tsc_setup() interface. config BOARDCTL_IOCTL bool "Board-specific boardctl() commands" diff --git a/configs/arduino-due/src/sam_touchscreen.c b/configs/arduino-due/src/sam_touchscreen.c index 4e78c9376a..2c20c0f2b2 100644 --- a/configs/arduino-due/src/sam_touchscreen.c +++ b/configs/arduino-due/src/sam_touchscreen.c @@ -405,27 +405,4 @@ int board_tsc_setup(int minor) return OK; } -/**************************************************************************** - * Name: board_tsc_teardown - * - * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * uninitialize the touchscreen device. - * - * Input Parameters: - * None - * - * Returned Value: - * None - * - ****************************************************************************/ - -void board_tsc_teardown(void) -{ - /* No support for un-initializing the touchscreen XPT2046 device. It will - * continue to run and process touch interrupts in the background. - */ -} - #endif /* CONFIG_ARDUINO_ITHEAD_TFT && CONFIG_SPI_BITBANG && CONFIG_INPUT_ADS7843E */ diff --git a/configs/boardctl.c b/configs/boardctl.c index d540471135..a1f4f6ebc6 100644 --- a/configs/boardctl.c +++ b/configs/boardctl.c @@ -414,20 +414,6 @@ int boardctl(unsigned int cmd, uintptr_t arg) ret = board_tsc_setup((int)arg); } break; - - /* CMD: BOARDIOC_TSCTEST_TEARDOWN - * DESCRIPTION: Touchscreen controller test configuration - * ARG: None - * CONFIGURATION: CONFIG_LIB_BOARDCTL && CONFIG_BOARDCTL_TSCTEST - * DEPENDENCIES: Board logic must provide board_tsc_teardown() - */ - - case BOARDIOC_TSCTEST_TEARDOWN: - { - board_tsc_teardown(); - ret = OK; - } - break; #endif default: diff --git a/configs/hymini-stm32v/src/stm32_ts.c b/configs/hymini-stm32v/src/stm32_ts.c index 781eafc9f1..529a3fc1a6 100644 --- a/configs/hymini-stm32v/src/stm32_ts.c +++ b/configs/hymini-stm32v/src/stm32_ts.c @@ -172,24 +172,3 @@ int board_tsc_setup(int minor) return ads7843e_register(dev, &ts_cfg, minor); } - -/**************************************************************************** - * Name: board_tsc_teardown - * - * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * uninitialize the touchscreen device. - * - * Input Parameters: - * None - * - * Returned Value: - * None. - * - ****************************************************************************/ - -void board_tsc_teardown(void) -{ - /* FIXME What can/should we do here ? */ -} diff --git a/configs/lpcxpresso-lpc54628/src/lpc54_ft5x06.c b/configs/lpcxpresso-lpc54628/src/lpc54_ft5x06.c index 162089b190..84b4ede70b 100644 --- a/configs/lpcxpresso-lpc54628/src/lpc54_ft5x06.c +++ b/configs/lpcxpresso-lpc54628/src/lpc54_ft5x06.c @@ -246,7 +246,7 @@ int lpc54_ft5x06_register(void) } /**************************************************************************** - * Name: board_tsc_setup and board_tsc_teardown + * Name: board_tsc_setup * * Description: * Stubs for expected interfaces. This implementation does not permit the @@ -261,9 +261,4 @@ int board_tsc_setup(int minor) return OK; } -void board_tsc_teardown(void) -{ -} -#endif - #endif /* HAVE_FT5x06*/ diff --git a/configs/mikroe-stm32f4/src/stm32_touchscreen.c b/configs/mikroe-stm32f4/src/stm32_touchscreen.c index 8dfb259f48..ec1cb2e00e 100644 --- a/configs/mikroe-stm32f4/src/stm32_touchscreen.c +++ b/configs/mikroe-stm32f4/src/stm32_touchscreen.c @@ -1583,25 +1583,4 @@ errout_with_priv: return ret; } -/**************************************************************************** - * Name: board_tsc_teardown - * - * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * uninitialize the touchscreen device. - * - * Input Parameters: - * None - * - * Returned Value: - * None. - * - ****************************************************************************/ - -void board_tsc_teardown(void) -{ - /* Need to unregister the /dev/inputN device here. */ -} - #endif /* CONFIG_INPUT */ diff --git a/configs/olimex-lpc1766stk/src/lpc17_hidmouse.c b/configs/olimex-lpc1766stk/src/lpc17_hidmouse.c index f583d52679..a44d62cbab 100644 --- a/configs/olimex-lpc1766stk/src/lpc17_hidmouse.c +++ b/configs/olimex-lpc1766stk/src/lpc17_hidmouse.c @@ -132,27 +132,4 @@ int board_tsc_setup(int minor) return OK; } -/**************************************************************************** - * Name: board_tsc_teardown - * - * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * uninitialize the touchscreen device. - * - * Input Parameters: - * None - * - * Returned Value: - * None - * - ****************************************************************************/ - -void board_tsc_teardown(void) -{ - /* No support for un-initializing the USB mouse driver. It will continue - * to run and process touch interrupts in the background. - */ -} - #endif /* CONFIG_USBHOST_HIDMOUSE */ diff --git a/configs/open1788/src/lpc17_touchscreen.c b/configs/open1788/src/lpc17_touchscreen.c index eb63f52614..03416505ff 100644 --- a/configs/open1788/src/lpc17_touchscreen.c +++ b/configs/open1788/src/lpc17_touchscreen.c @@ -323,25 +323,4 @@ int board_tsc_setup(int minor) return OK; } -/**************************************************************************** - * Name: board_tsc_teardown - * - * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * uninitialize the touchscreen device. - * - * Input Parameters: - * None - * - * Returned Value: - * None. - * - ****************************************************************************/ - -void board_tsc_teardown(void) -{ - /* No support for un-initializing the touchscreen XPT2046 device yet */ -} - #endif /* CONFIG_INPUT_ADS7843E */ diff --git a/configs/pic32mx7mmb/src/pic32_touchscreen.c b/configs/pic32mx7mmb/src/pic32_touchscreen.c index 950d1fc867..f0ed889a2f 100644 --- a/configs/pic32mx7mmb/src/pic32_touchscreen.c +++ b/configs/pic32mx7mmb/src/pic32_touchscreen.c @@ -1435,25 +1435,4 @@ errout_with_priv: return ret; } -/**************************************************************************** - * Name: board_tsc_teardown - * - * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * uninitialize the touchscreen device. - * - * Input Parameters: - * None - * - * Returned Value: - * None. - * - ****************************************************************************/ - -void board_tsc_teardown(void) -{ - /* Need to unregister the /dev/inputN device here. */ -} - #endif /* CONFIG_INPUT */ diff --git a/configs/sam3u-ek/src/sam_touchscreen.c b/configs/sam3u-ek/src/sam_touchscreen.c index c5cc9df288..398838710f 100644 --- a/configs/sam3u-ek/src/sam_touchscreen.c +++ b/configs/sam3u-ek/src/sam_touchscreen.c @@ -272,26 +272,5 @@ int board_tsc_setup(int minor) return OK; } -/**************************************************************************** - * Name: board_tsc_teardown - * - * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * uninitialize the touchscreen device. - * - * Input Parameters: - * None - * - * Returned Value: - * None. - * - ****************************************************************************/ - -void board_tsc_teardown(void) -{ - /* No support for un-initializing the touchscreen ADS7843E device yet */ -} - #endif /* CONFIG_INPUT_ADS7843E */ diff --git a/configs/sam4e-ek/src/sam_ads7843e.c b/configs/sam4e-ek/src/sam_ads7843e.c index 82dd848cd9..aeeddceb27 100644 --- a/configs/sam4e-ek/src/sam_ads7843e.c +++ b/configs/sam4e-ek/src/sam_ads7843e.c @@ -269,25 +269,4 @@ int board_tsc_setup(int minor) return OK; } -/**************************************************************************** - * Name: board_tsc_teardown - * - * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * uninitialize the touchscreen device. - * - * Input Parameters: - * None - * - * Returned Value: - * None. - * - ****************************************************************************/ - -void board_tsc_teardown(void) -{ - /* No support for un-initializing the touchscreen ADS7843E device yet */ -} - #endif /* CONFIG_INPUT && CONFIG_INPUT_ADS7843E */ diff --git a/configs/sama5d3x-ek/src/sam_touchscreen.c b/configs/sama5d3x-ek/src/sam_touchscreen.c index ba5126643a..ced5853522 100644 --- a/configs/sama5d3x-ek/src/sam_touchscreen.c +++ b/configs/sama5d3x-ek/src/sam_touchscreen.c @@ -142,25 +142,4 @@ int board_tsc_setup(int minor) return OK; } -/**************************************************************************** - * Name: board_tsc_teardown - * - * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * uninitialize the touchscreen device. - * - * Input Parameters: - * None - * - * Returned Value: - * None. - * - ****************************************************************************/ - -void board_tsc_teardown(void) -{ - /* No support for un-initializing the touchscreen yet */ -} - #endif /* CONFIG_INPUT_ADS7843E */ diff --git a/configs/sama5d4-ek/src/sam_maxtouch.c b/configs/sama5d4-ek/src/sam_maxtouch.c index 1511c7a662..f64f661836 100644 --- a/configs/sama5d4-ek/src/sam_maxtouch.c +++ b/configs/sama5d4-ek/src/sam_maxtouch.c @@ -290,27 +290,4 @@ int board_tsc_setup(int minor) return OK; } -/**************************************************************************** - * Name: board_tsc_teardown - * - * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * uninitialize the touchscreen device. - * - * Input Parameters: - * None - * - * Returned Value: - * None - * - ****************************************************************************/ - -void board_tsc_teardown(void) -{ - /* No support for un-initializing the touchscreen maXTouch device. It will - * continue to run and process touch interrupts in the background. - */ -} - #endif /* HAVE_MAXTOUCH */ diff --git a/configs/samv71-xult/src/sam_maxtouch.c b/configs/samv71-xult/src/sam_maxtouch.c index e6e97de0e5..42cd74a16e 100644 --- a/configs/samv71-xult/src/sam_maxtouch.c +++ b/configs/samv71-xult/src/sam_maxtouch.c @@ -289,27 +289,4 @@ int board_tsc_setup(int minor) return OK; } -/**************************************************************************** - * Name: board_tsc_teardown - * - * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * uninitialize the touchscreen device. - * - * Input Parameters: - * None - * - * Returned Value: - * None - * - ****************************************************************************/ - -void board_tsc_teardown(void) -{ - /* No support for un-initializing the touchscreen maXTouch device. It will - * continue to run and process touch interrupts in the background. - */ -} - #endif /* HAVE_MAXTOUCH */ diff --git a/configs/shenzhou/src/stm32_touchscreen.c b/configs/shenzhou/src/stm32_touchscreen.c index 99b3971df8..c499f33a27 100644 --- a/configs/shenzhou/src/stm32_touchscreen.c +++ b/configs/shenzhou/src/stm32_touchscreen.c @@ -281,26 +281,5 @@ int board_tsc_setup(int minor) return OK; } -/**************************************************************************** - * Name: board_tsc_teardown - * - * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * uninitialize the touchscreen device. - * - * Input Parameters: - * None - * - * Returned Value: - * None. - * - ****************************************************************************/ - -void board_tsc_teardown(void) -{ - /* No support for un-initializing the touchscreen ADS7843E device yet */ -} - #endif /* CONFIG_INPUT_ADS7843E */ diff --git a/configs/sim/src/sim_touchscreen.c b/configs/sim/src/sim_touchscreen.c index 0f45d5300d..229b5a79d6 100644 --- a/configs/sim/src/sim_touchscreen.c +++ b/configs/sim/src/sim_touchscreen.c @@ -263,23 +263,3 @@ errout: return ret; } -/**************************************************************************** - * Name: board_tsc_teardown() - * - * Description: - * Perform architecuture-specific un-initialization of the touchscreen - * hardware. This interface must be provided by all configurations - * using apps/examples/touchscreen - * - ****************************************************************************/ - -void board_tsc_teardown(void) -{ - /* Shut down the touchscreen driver */ - - sim_tsc_uninitialize(); - - /* Close NX */ - - nx_disconnect(g_simtc.hnx); -} diff --git a/configs/stm3220g-eval/src/stm32_stmpe811.c b/configs/stm3220g-eval/src/stm32_stmpe811.c index ec79a31864..716761235c 100644 --- a/configs/stm3220g-eval/src/stm32_stmpe811.c +++ b/configs/stm3220g-eval/src/stm32_stmpe811.c @@ -336,26 +336,5 @@ int board_tsc_setup(int minor) #endif } -/**************************************************************************** - * Name: board_tsc_teardown - * - * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * uninitialize the touchscreen device. - * - * Input Parameters: - * None - * - * Returned Value: - * None. - * - ****************************************************************************/ - -void board_tsc_teardown(void) -{ - /* No support for un-initializing the touchscreen STMPE811 device yet */ -} - #endif /* CONFIG_INPUT_STMPE811 */ diff --git a/configs/stm3240g-eval/src/stm32_stmpe811.c b/configs/stm3240g-eval/src/stm32_stmpe811.c index b1b8126c57..1a03197263 100644 --- a/configs/stm3240g-eval/src/stm32_stmpe811.c +++ b/configs/stm3240g-eval/src/stm32_stmpe811.c @@ -336,26 +336,5 @@ int board_tsc_setup(int minor) #endif } -/**************************************************************************** - * Name: board_tsc_teardown - * - * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * uninitialize the touchscreen device. - * - * Input Parameters: - * None - * - * Returned Value: - * None. - * - ****************************************************************************/ - -void board_tsc_teardown(void) -{ - /* No support for un-initializing the touchscreen STMPE811 device yet */ -} - #endif /* CONFIG_INPUT_STMPE811 */ diff --git a/configs/stm32f429i-disco/src/stm32_stmpe811.c b/configs/stm32f429i-disco/src/stm32_stmpe811.c index 29fb9284a8..c089990ee7 100644 --- a/configs/stm32f429i-disco/src/stm32_stmpe811.c +++ b/configs/stm32f429i-disco/src/stm32_stmpe811.c @@ -339,26 +339,5 @@ int board_tsc_setup(int minor) #endif } -/**************************************************************************** - * Name: board_tsc_teardown - * - * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * uninitialize the touchscreen device. - * - * Input Parameters: - * None - * - * Returned Value: - * None. - * - ****************************************************************************/ - -void board_tsc_teardown(void) -{ - /* No support for un-initializing the touchscreen STMPE811 device yet */ -} - #endif /* CONFIG_INPUT_STMPE811 */ diff --git a/configs/viewtool-stm32f107/src/stm32_touchscreen.c b/configs/viewtool-stm32f107/src/stm32_touchscreen.c index 8d6bc3c259..17539fc9b5 100644 --- a/configs/viewtool-stm32f107/src/stm32_touchscreen.c +++ b/configs/viewtool-stm32f107/src/stm32_touchscreen.c @@ -304,27 +304,4 @@ int board_tsc_setup(int minor) return OK; } -/**************************************************************************** - * Name: board_tsc_teardown - * - * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * uninitialize the touchscreen device. - * - * Input Parameters: - * None - * - * Returned Value: - * None - * - ****************************************************************************/ - -void board_tsc_teardown(void) -{ - /* No support for un-initializing the touchscreen XPT2046 device. It will - * continue to run and process touch interrupts in the background. - */ -} - #endif /* CONFIG_INPUT_ADS7843E */ diff --git a/include/nuttx/board.h b/include/nuttx/board.h index af120a8808..b2b39d5c88 100644 --- a/include/nuttx/board.h +++ b/include/nuttx/board.h @@ -1,7 +1,7 @@ /**************************************************************************** * include/nuttx/board.h * - * Copyright (C) 2015-2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2015-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -312,31 +312,6 @@ FAR void *board_composite_connect(int port, int configid); int board_tsc_setup(int minor); -/**************************************************************************** - * Name: board_tsc_teardown - * - * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * uninitialize the touchscreen device. - * - * This is an internal OS interface but may be invoked indirectly from - * application-level touchscreen testing logic (perhaps by - * apps/examples/touchscreen). If CONFIG_LIB_BOARDCTL=y and - * CONFIG_BOARDCTL_TSCTEST=y, then this functions will be invoked via the - * (non-standard) boardctl() interface using the BOARDIOC_TSCTEST_TEARDOWN - * command. - * - * Input Parameters: - * None - * - * Returned Value: - * None. - * - ****************************************************************************/ - -void board_tsc_teardown(void); - /**************************************************************************** * Name: board_graphics_setup * diff --git a/include/sys/boardctl.h b/include/sys/boardctl.h index d059b9f828..84d828f8a2 100644 --- a/include/sys/boardctl.h +++ b/include/sys/boardctl.h @@ -1,7 +1,7 @@ /**************************************************************************** * include/sys/boardctl.h * - * Copyright (C) 2015-2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2015-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -120,12 +120,6 @@ * ARG: Touch controller device minor number * CONFIGURATION: CONFIG_LIB_BOARDCTL && CONFIG_BOARDCTL_TSCTEST * DEPENDENCIES: Board logic must provide board_tsc_setup() - * - * CMD: BOARDIOC_TSCTEST_TEARDOWN - * DESCRIPTION: Touchscreen controller test configuration - * ARG: None - * CONFIGURATION: CONFIG_LIB_BOARDCTL && CONFIG_BOARDCTL_TSCTEST - * DEPENDENCIES: Board logic must provide board_tsc_teardown() */ #define BOARDIOC_INIT _BOARDIOC(0x0001) @@ -137,7 +131,6 @@ #define BOARDIOC_USBDEV_CONTROL _BOARDIOC(0x0007) #define BOARDIOC_NX_START _BOARDIOC(0x0008) #define BOARDIOC_TSCTEST_SETUP _BOARDIOC(0x0009) -#define BOARDIOC_TSCTEST_TEARDOWN _BOARDIOC(0x000a) /* If CONFIG_BOARDCTL_IOCTL=y, then board-specific commands will be support. * In this case, all commands not recognized by boardctl() will be forwarded @@ -146,7 +139,7 @@ * User defined board commands may begin with this value: */ -#define BOARDIOC_USER _BOARDIOC(0x000b) +#define BOARDIOC_USER _BOARDIOC(0x000a) /**************************************************************************** * Public Type Definitions -- GitLab From ab3fa890239399de51e5482e595a751fee249b1c Mon Sep 17 00:00:00 2001 From: Masayuki Ishikawa Date: Wed, 17 Jan 2018 13:08:03 +0900 Subject: [PATCH 025/228] SMP: Introduce spin_lock_wo_note() and spin_unlock_wo_note() These APIs are used in sched_note.c to protect instumentation data. The deffrence between these APIs to exsiting spin_lock() and spin_unlock() is that they do not perform insturumentation to avoid recursive call when SCHED_INSTRUMENTATION_SPINLOCKS=y. Signed-off-by: Masayuki Ishikawa --- include/nuttx/spinlock.h | 46 +++++++++++++++++++++++++++++ sched/sched/sched_note.c | 28 +++++++++--------- sched/semaphore/spinlock.c | 59 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 118 insertions(+), 15 deletions(-) diff --git a/include/nuttx/spinlock.h b/include/nuttx/spinlock.h index 3798e177ff..7ce1c1594e 100644 --- a/include/nuttx/spinlock.h +++ b/include/nuttx/spinlock.h @@ -197,6 +197,30 @@ void spin_initializer(FAR struct spinlock_s *lock); void spin_lock(FAR volatile spinlock_t *lock); +/**************************************************************************** + * Name: spin_lock_wo_note + * + * Description: + * If this CPU does not already hold the spinlock, then loop until the + * spinlock is successfully locked. + * + * This implementation is the same as the above spin_lock() except that + * it does not perform instrumentation logic. + * + * Input Parameters: + * lock - A reference to the spinlock object to lock. + * + * Returned Value: + * None. When the function returns, the spinlock was successfully locked + * by this CPU. + * + * Assumptions: + * Not running at the interrupt level. + * + ****************************************************************************/ + +void spin_lock_wo_note(FAR volatile spinlock_t *lock); + /**************************************************************************** * Name: spin_trylock * @@ -268,6 +292,28 @@ void spin_unlock(FAR volatile spinlock_t *lock); # define spin_unlock(l) do { *(l) = SP_UNLOCKED; } while (0) #endif +/**************************************************************************** + * Name: spin_unlock_wo_note + * + * Description: + * Release one count on a non-reentrant spinlock. + * + * This implementation is the same as the above spin_unlock() except that + * it does not perform instrumentation logic. + * + * Input Parameters: + * lock - A reference to the spinlock object to unlock. + * + * Returned Value: + * None. + * + * Assumptions: + * Not running at the interrupt level. + * + ****************************************************************************/ + +void spin_unlock_wo_note(FAR volatile spinlock_t *lock); + /**************************************************************************** * Name: spin_unlockr * diff --git a/sched/sched/sched_note.c b/sched/sched/sched_note.c index 6dc17b9936..40470b6561 100644 --- a/sched/sched/sched_note.c +++ b/sched/sched/sched_note.c @@ -94,6 +94,10 @@ static void note_add(FAR const uint8_t *note, uint8_t notelen); static struct note_info_s g_note_info; +#ifdef CONFIG_SMP +static volatile spinlock_t g_note_lock; +#endif + /**************************************************************************** * Private Functions ****************************************************************************/ @@ -299,21 +303,10 @@ static void note_add(FAR const uint8_t *note, uint8_t notelen) } #endif - /* REVISIT: In the single CPU case, the following should be safe because - * the logic is always called within a critical section, but in the SMP - * case we have protection. One option would be to precalculate and - * advancing the new head entry before writing the data into the buffer. - * That will eliminate fatal race conditions (although could result in - * single notes being corrupted harmlessly). - * - * But there is a complexity: Advancing the head pointer where the note - * buffer is almost full could advance the head to wrap beyond the tail - * leaving the buffer in a bad state. A solution to this would be to pre- - * remove entries at the tail of the buffer as necessary to make certain - * that there will be space for the new note at the beginning of the - * buffer. I am less certain that this can be done safely in the SMP - * case. - */ +#ifdef CONFIG_SMP + irqstate_t flags = up_irq_save(); + spin_lock_wo_note(&g_note_lock); +#endif /* Get the index to the head of the circular buffer */ @@ -345,6 +338,11 @@ static void note_add(FAR const uint8_t *note, uint8_t notelen) } g_note_info.ni_head = head; + +#ifdef CONFIG_SMP + spin_unlock_wo_note(&g_note_lock); + up_irq_restore(flags); +#endif } /**************************************************************************** diff --git a/sched/semaphore/spinlock.c b/sched/semaphore/spinlock.c index 674ebb6b52..2d667c0ed3 100644 --- a/sched/semaphore/spinlock.c +++ b/sched/semaphore/spinlock.c @@ -139,6 +139,38 @@ void spin_lock(FAR volatile spinlock_t *lock) SP_DMB(); } +/**************************************************************************** + * Name: spin_lock_wo_note + * + * Description: + * If this CPU does not already hold the spinlock, then loop until the + * spinlock is successfully locked. + * + * This implementation is the same as the above spin_lock() except that + * it does not perform instrumentation logic. + * + * Input Parameters: + * lock - A reference to the spinlock object to lock. + * + * Returned Value: + * None. When the function returns, the spinlock was successfully locked + * by this CPU. + * + * Assumptions: + * Not running at the interrupt level. + * + ****************************************************************************/ + +void spin_lock_wo_note(FAR volatile spinlock_t *lock) +{ + while (up_testset(lock) == SP_LOCKED) + { + SP_DSB(); + } + + SP_DMB(); +} + /**************************************************************************** * Name: spin_unlock * @@ -171,6 +203,33 @@ void spin_unlock(FAR volatile spinlock_t *lock) } #endif +/**************************************************************************** + * Name: spin_unlock_wo_note + * + * Description: + * Release one count on a non-reentrant spinlock. + * + * This implementation is the same as the above spin_unlock() except that + * it does not perform instrumentation logic. + * + * Input Parameters: + * lock - A reference to the spinlock object to unlock. + * + * Returned Value: + * None. + * + * Assumptions: + * Not running at the interrupt level. + * + ****************************************************************************/ + +void spin_unlock_wo_note(FAR volatile spinlock_t *lock) +{ + SP_DMB(); + *lock = SP_UNLOCKED; + SP_DSB(); +} + /**************************************************************************** * Name: spin_lockr * -- GitLab From 7d1f13377478022f38053a1ae4bf00c696b7d430 Mon Sep 17 00:00:00 2001 From: DL Date: Wed, 17 Jan 2018 15:57:06 +0300 Subject: [PATCH 026/228] Fixed misprint in smartfs_utils.c --- fs/smartfs/smartfs_utils.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/smartfs/smartfs_utils.c b/fs/smartfs/smartfs_utils.c index 99bb8c1656..0fcfecfd4e 100644 --- a/fs/smartfs/smartfs_utils.c +++ b/fs/smartfs/smartfs_utils.c @@ -1825,6 +1825,7 @@ int smartfs_shrinkfile(FAR struct smartfs_mountpt_s *fs, { dest = (FAR uint8_t *)&sf->buffer; destsize = fs->fs_llformat.availbytes; + } else { offset = sizeof(struct smartfs_chain_header_s) + length; -- GitLab From 301bf1ee774b46955bb5bb9deb2d20ed8603458c Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 17 Jan 2018 09:22:19 -0600 Subject: [PATCH 027/228] This commit eliminates the BOARDIOC_TSCTEST_SETUP command. Squashed commit of the following: configs: Each board now initializes the touchscreen controller as a normal part of its board bring-up. board_tsc_setup() is gone; the touchscreen controller is now treated like any other on-board device. Remove all support for BOARDIOC_TSCTEST_SETUP Move prototype for board_tsc_setup() from include/nuttx/board.h to individual board header files. --- configs/Kconfig | 8 --- configs/arduino-due/src/arduino-due.h | 31 +++++++++-- configs/arduino-due/src/sam_bringup.c | 11 ++++ configs/arduino-due/src/sam_touchscreen.c | 11 ++-- configs/boardctl.c | 15 ------ configs/hymini-stm32v/src/hymini-stm32v.h | 27 ++++++++-- configs/hymini-stm32v/src/stm32_appinit.c | 17 +++++- configs/hymini-stm32v/src/stm32_ts.c | 13 +++-- configs/lpcxpresso-lpc54628/fb/defconfig | 1 - configs/lpcxpresso-lpc54628/nxwm/defconfig | 1 - .../lpcxpresso-lpc54628/src/lpc54_ft5x06.c | 16 ------ configs/mikroe-stm32f4/src/mikroe-stm32f4.h | 32 ++++++++--- configs/mikroe-stm32f4/src/stm32_appinit.c | 12 ++++- .../mikroe-stm32f4/src/stm32_touchscreen.c | 11 ++-- configs/olimex-lpc1766stk/src/lpc1766stk.h | 23 +++++++- configs/olimex-lpc1766stk/src/lpc17_appinit.c | 12 ++++- .../olimex-lpc1766stk/src/lpc17_hidmouse.c | 14 +++-- configs/open1788/src/lpc17_appinit.c | 2 +- configs/open1788/src/lpc17_boardinitialize.c | 2 +- configs/open1788/src/lpc17_bringup.c | 17 ++++-- configs/open1788/src/lpc17_touchscreen.c | 12 ++--- configs/open1788/src/open1788.h | 31 +++++++++-- configs/pic32mx7mmb/src/pic32_bringup.c | 12 ++++- configs/pic32mx7mmb/src/pic32_touchscreen.c | 11 ++-- configs/pic32mx7mmb/src/pic32mx7mmb.h | 39 ++++++++++---- configs/sam3u-ek/nxwm/defconfig | 1 - configs/sam3u-ek/src/sam3u-ek.h | 23 +++++++- configs/sam3u-ek/src/sam_appinit.c | 17 +++++- configs/sam3u-ek/src/sam_touchscreen.c | 12 ++--- configs/sam4e-ek/src/sam4e-ek.h | 27 ++++++++-- configs/sam4e-ek/src/sam_ads7843e.c | 11 ++-- configs/sam4e-ek/src/sam_appinit.c | 15 ++++-- configs/sama5d3x-ek/nxwm/defconfig | 1 - configs/sama5d3x-ek/src/sam_appinit.c | 12 ++++- configs/sama5d3x-ek/src/sam_touchscreen.c | 27 ++-------- configs/sama5d3x-ek/src/sama5d3x-ek.h | 23 +++++++- configs/sama5d4-ek/README.txt | 1 - configs/sama5d4-ek/src/sam_bringup.c | 12 ++++- configs/sama5d4-ek/src/sam_maxtouch.c | 11 ++-- configs/sama5d4-ek/src/sama5d4-ek.h | 32 +++++++++-- configs/samv71-xult/README.txt | 1 - configs/samv71-xult/nxwm/defconfig | 1 - configs/samv71-xult/src/sam_bringup.c | 10 ++++ configs/samv71-xult/src/sam_maxtouch.c | 11 ++-- configs/samv71-xult/src/samv71-xult.h | 53 +++++++++++++------ configs/shenzhou/nxwm/defconfig | 1 - configs/shenzhou/src/shenzhou.h | 29 ++++++++-- configs/shenzhou/src/stm32_appinit.c | 12 ++++- configs/shenzhou/src/stm32_touchscreen.c | 11 ++-- configs/sim/README.txt | 4 -- configs/sim/src/sim.h | 23 +++++++- configs/sim/src/sim_bringup.c | 15 ++++-- configs/sim/src/sim_touchscreen.c | 18 ++++--- configs/stm3220g-eval/nxwm/defconfig | 1 - configs/stm3220g-eval/src/stm3220g-eval.h | 35 +++++++++--- configs/stm3220g-eval/src/stm32_appinit.c | 12 ++++- configs/stm3220g-eval/src/stm32_stmpe811.c | 16 +++--- configs/stm3240g-eval/knxwm/defconfig | 1 - configs/stm3240g-eval/nxwm/defconfig | 1 - configs/stm3240g-eval/src/stm3240g-eval.h | 22 +++++++- configs/stm3240g-eval/src/stm32_appinit.c | 2 +- configs/stm3240g-eval/src/stm32_boot.c | 48 ++++------------- configs/stm3240g-eval/src/stm32_bringup.c | 20 +++++++ configs/stm3240g-eval/src/stm32_stmpe811.c | 11 ++-- configs/stm32f429i-disco/nxwm/defconfig | 1 - configs/stm32f429i-disco/src/stm32_boot.c | 18 ++----- configs/stm32f429i-disco/src/stm32_bringup.c | 12 ++++- configs/stm32f429i-disco/src/stm32_stmpe811.c | 11 ++-- .../stm32f429i-disco/src/stm32f429i-disco.h | 28 ++++++++-- .../viewtool-stm32f107/src/stm32_bringup.c | 12 ++++- .../src/stm32_touchscreen.c | 11 ++-- .../src/viewtool_stm32f107.h | 27 ++++++++-- include/nuttx/board.h | 27 ---------- include/sys/boardctl.h | 9 +--- 74 files changed, 753 insertions(+), 367 deletions(-) diff --git a/configs/Kconfig b/configs/Kconfig index bc45349949..bf770edd1d 100644 --- a/configs/Kconfig +++ b/configs/Kconfig @@ -2351,14 +2351,6 @@ config BOARDCTL_USBDEVCTRL ---help--- Enables support for the BOARDIOC_USBDEV_CONTROL boardctl() command. -config BOARDCTL_TSCTEST - bool "Enable touchscreen test interfaces" - default n - ---help--- - Enables support for the BOARDIOC_TSCTEST_SETUP and - BOARDIOC_TSCTEST_TEARDOWN boardctl() commands. Architecture - specific logic must provide the board_tsc_setup() interface. - config BOARDCTL_IOCTL bool "Board-specific boardctl() commands" default n diff --git a/configs/arduino-due/src/arduino-due.h b/configs/arduino-due/src/arduino-due.h index 0e2b6736b3..01768855d7 100644 --- a/configs/arduino-due/src/arduino-due.h +++ b/configs/arduino-due/src/arduino-due.h @@ -166,7 +166,7 @@ * and the SD card. * 2. UART0 cannot be used. USARTs on the COMM connector should be available. * 3. Parallel data is not contiguous in the PIO register - * 4. Touchcontroller /CS pin is connected to ground (always selected). + * 4. Touch controller /CS pin is connected to ground (always selected). * 5. Either PA28 or PC29 may drive PWM10 */ @@ -308,7 +308,7 @@ * Public Functions ************************************************************************************/ -/**************************************************************************** +/************************************************************************************ * Name: sam_bringup * * Description: @@ -320,23 +320,44 @@ * CONFIG_BOARD_INITIALIZE=y && CONFIG_LIB_BOARDCTL=y : * Called from the NSH library * - ****************************************************************************/ + ************************************************************************************/ int sam_bringup(void); -/**************************************************************************** +/************************************************************************************ * Name: sam_sdinitialize * * Description: * Initialize the SPI-based SD card. * - ****************************************************************************/ + ************************************************************************************/ #if defined(CONFIG_ARDUINO_ITHEAD_TFT) && defined(CONFIG_SPI_BITBANG) && \ defined(CONFIG_MMCSD_SPI) int sam_sdinitialize(int minor); #endif +/************************************************************************************ + * Name: sam_tsc_setup + * + * Description: + * This function is called by board-bringup logic to configure the touchscreen + * device. This function will register the driver as /dev/inputN where N is the + * minor device number. + * + * Input Parameters: + * minor - The input device minor number + * + * Returned Value: + * Zero is returned on success. Otherwise, a negated errno value is returned to + * indicate the nature of the failure. + * + ************************************************************************************/ + +#if defined(CONFIG_ARDUINO_ITHEAD_TFT) && defined(CONFIG_SPI_BITBANG) && \ + defined(CONFIG_INPUT_ADS7843E) +int sam_tsc_setup(int minor); +#endif #endif /* __ASSEMBLY__ */ #endif /* __CONFIGS_ARDUINO_DUE_SRC_ARDUNO_DUE_H */ diff --git a/configs/arduino-due/src/sam_bringup.c b/configs/arduino-due/src/sam_bringup.c index 298a5b0dbb..50dc141500 100644 --- a/configs/arduino-due/src/sam_bringup.c +++ b/configs/arduino-due/src/sam_bringup.c @@ -118,6 +118,17 @@ int sam_bringup(void) } #endif +#if defined(CONFIG_ARDUINO_ITHEAD_TFT) && defined(CONFIG_SPI_BITBANG) && \ + defined(CONFIG_INPUT_ADS7843E) + /* Initialize the touchscreen */ + + ret = sam_tsc_setup(0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: sam_tsc_setup failed: %d\n", ret); + } +#endif + UNUSED(ret); return OK; } diff --git a/configs/arduino-due/src/sam_touchscreen.c b/configs/arduino-due/src/sam_touchscreen.c index 2c20c0f2b2..b03ba31fb8 100644 --- a/configs/arduino-due/src/sam_touchscreen.c +++ b/configs/arduino-due/src/sam_touchscreen.c @@ -336,13 +336,12 @@ static FAR struct spi_dev_s *sam_tsc_spiinitialize(void) ****************************************************************************/ /**************************************************************************** - * Name: board_tsc_setup + * Name: sam_tsc_setup * * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * configure the touchscreen device. This function will register the driver - * as /dev/inputN where N is the minor device number. + * This function is called by board-bringup logic to configure the + * touchscreen device. This function will register the driver as + * /dev/inputN where N is the minor device number. * * Input Parameters: * minor - The input device minor number @@ -353,7 +352,7 @@ static FAR struct spi_dev_s *sam_tsc_spiinitialize(void) * ****************************************************************************/ -int board_tsc_setup(int minor) +int sam_tsc_setup(int minor) { FAR struct spi_dev_s *dev; static bool initialized = false; diff --git a/configs/boardctl.c b/configs/boardctl.c index a1f4f6ebc6..d7e6d3c4ee 100644 --- a/configs/boardctl.c +++ b/configs/boardctl.c @@ -401,21 +401,6 @@ int boardctl(unsigned int cmd, uintptr_t arg) break; #endif -#ifdef CONFIG_BOARDCTL_TSCTEST - /* CMD: BOARDIOC_TSCTEST_SETUP - * DESCRIPTION: Touchscreen controller test configuration - * ARG: Touch controller device minor number - * CONFIGURATION: CONFIG_LIB_BOARDCTL && CONFIG_BOARDCTL_TSCTEST - * DEPENDENCIES: Board logic must provide board_tsc_setup() - */ - - case BOARDIOC_TSCTEST_SETUP: - { - ret = board_tsc_setup((int)arg); - } - break; -#endif - default: { #ifdef CONFIG_BOARDCTL_IOCTL diff --git a/configs/hymini-stm32v/src/hymini-stm32v.h b/configs/hymini-stm32v/src/hymini-stm32v.h index f821d03465..cdfd96704a 100644 --- a/configs/hymini-stm32v/src/hymini-stm32v.h +++ b/configs/hymini-stm32v/src/hymini-stm32v.h @@ -1,7 +1,7 @@ /************************************************************************************ * configs/hymini-stm32v/src/hymini-stm32v.h * - * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2009, 2011, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * Laurent Latil * @@ -122,7 +122,7 @@ * ************************************************************************************/ -extern void weak_function stm32_spidev_initialize(void); +void weak_function stm32_spidev_initialize(void); /************************************************************************************ * Name: stm32_usbinitialize @@ -132,7 +132,28 @@ extern void weak_function stm32_spidev_initialize(void); * ************************************************************************************/ -extern void weak_function stm32_usbinitialize(void); +void weak_function stm32_usbinitialize(void); + +/************************************************************************************ + * Name: stm32_tsc_setup + * + * Description: + * This function is called by board-bringup logic to configure the touchscreen + * device. This function will register the driver as /dev/inputN where N is the + * minor device number. + * + * Input Parameters: + * minor - The input device minor number + * + * Returned Value: + * Zero is returned on success. Otherwise, a negated errno value is returned to + * indicate the nature of the failure. + * + ************************************************************************************/ + +#ifdef CONFIG_INPUT +int stm32_tsc_setup(int minor); +#endif #endif /* __ASSEMBLY__ */ #endif /* __CONFIGS_HYMINI_STM32V_H */ diff --git a/configs/hymini-stm32v/src/stm32_appinit.c b/configs/hymini-stm32v/src/stm32_appinit.c index 5b99c4445b..85be09ecb7 100644 --- a/configs/hymini-stm32v/src/stm32_appinit.c +++ b/configs/hymini-stm32v/src/stm32_appinit.c @@ -1,7 +1,7 @@ /**************************************************************************** * config/hymini-stm32v/src/stm32_appinit.c * - * Copyright (C) 2009, 2011, 2016-2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2009, 2011, 2016-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -170,10 +170,11 @@ static int nsh_cdinterrupt(int irq, FAR void *context, FAR void *arg) int board_app_initialize(uintptr_t arg) { -#ifdef NSH_HAVEMMCSD int ret; +#ifdef NSH_HAVEMMCSD /* Card detect */ + bool cd_status; /* Configure the card detect GPIO */ @@ -220,5 +221,17 @@ int board_app_initialize(uintptr_t arg) sdio_mediachange(g_sdiodev, cd_status); #endif + +#ifdef CONFIG_INPUT + /* Initialize the touchscreen */ + + ret = stm32_tsc_setup(0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_tsc_setup failed: %d\n", ret); + } +#endif + + UNUSED(ret); return OK; } diff --git a/configs/hymini-stm32v/src/stm32_ts.c b/configs/hymini-stm32v/src/stm32_ts.c index 529a3fc1a6..59f7caa050 100644 --- a/configs/hymini-stm32v/src/stm32_ts.c +++ b/configs/hymini-stm32v/src/stm32_ts.c @@ -53,7 +53,7 @@ #include "hymini-stm32v.h" /************************************************************************************ - * Pre-processor Defintiions + * Pre-processor Definitions ************************************************************************************/ #if !defined(CONFIG_STM32_SPI1) @@ -136,13 +136,12 @@ static bool hymini_ts_pendown(FAR struct ads7843e_config_s *state) } /**************************************************************************** - * Name: board_tsc_setup + * Name: stm32_tsc_setup * * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * configure the touchscreen device. This function will register the driver - * as /dev/inputN where N is the minor device number. + * This function is called by board-bringup logic to configure the + * touchscreen device. This function will register the driver as + * /dev/inputN where N is the minor device number. * * Input Parameters: * minor - The input device minor number @@ -153,7 +152,7 @@ static bool hymini_ts_pendown(FAR struct ads7843e_config_s *state) * ****************************************************************************/ -int board_tsc_setup(int minor) +int stm32_tsc_setup(int minor) { FAR struct spi_dev_s *dev; diff --git a/configs/lpcxpresso-lpc54628/fb/defconfig b/configs/lpcxpresso-lpc54628/fb/defconfig index 2dc326a079..afc8562724 100644 --- a/configs/lpcxpresso-lpc54628/fb/defconfig +++ b/configs/lpcxpresso-lpc54628/fb/defconfig @@ -1,5 +1,4 @@ # CONFIG_ARCH_FPU is not set -# CONFIG_EXAMPLES_TOUCHSCREEN_ARCHINIT is not set CONFIG_ARCH_BOARD_LPCXPRESSO_LPC54628=y CONFIG_ARCH_BOARD="lpcxpresso-lpc54628" CONFIG_ARCH_CHIP_LPC54628=y diff --git a/configs/lpcxpresso-lpc54628/nxwm/defconfig b/configs/lpcxpresso-lpc54628/nxwm/defconfig index 5bc987dbb5..47cda398c4 100644 --- a/configs/lpcxpresso-lpc54628/nxwm/defconfig +++ b/configs/lpcxpresso-lpc54628/nxwm/defconfig @@ -2,7 +2,6 @@ # CONFIG_NX_DISABLE_16BPP is not set # CONFIG_NXFONTS_DISABLE_16BPP is not set # CONFIG_NXTK_DEFAULT_BORDERCOLORS is not set -# CONFIG_NXWM_TOUCHSCREEN_DEVINIT is not set CONFIG_ARCH_BOARD_LPCXPRESSO_LPC54628=y CONFIG_ARCH_BOARD="lpcxpresso-lpc54628" CONFIG_ARCH_CHIP_LPC54628=y diff --git a/configs/lpcxpresso-lpc54628/src/lpc54_ft5x06.c b/configs/lpcxpresso-lpc54628/src/lpc54_ft5x06.c index 84b4ede70b..8893f08ff6 100644 --- a/configs/lpcxpresso-lpc54628/src/lpc54_ft5x06.c +++ b/configs/lpcxpresso-lpc54628/src/lpc54_ft5x06.c @@ -245,20 +245,4 @@ int lpc54_ft5x06_register(void) return OK; } -/**************************************************************************** - * Name: board_tsc_setup - * - * Description: - * Stubs for expected interfaces. This implementation does not permit the - * application to mange the touch screen controller. - * - ****************************************************************************/ - -#ifdef CONFIG_BOARDCTL_TSCTEST -int board_tsc_setup(int minor) -{ - DEBUGASSERT(minor == 0); - return OK; -} - #endif /* HAVE_FT5x06*/ diff --git a/configs/mikroe-stm32f4/src/mikroe-stm32f4.h b/configs/mikroe-stm32f4/src/mikroe-stm32f4.h index 4b8bcc3daf..0df889c424 100644 --- a/configs/mikroe-stm32f4/src/mikroe-stm32f4.h +++ b/configs/mikroe-stm32f4/src/mikroe-stm32f4.h @@ -1,7 +1,7 @@ /**************************************************************************************************** * configs/mikroe-stm32f4/src/mikroe-stm32f4.h * - * Copyright (C) 2011-2013, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2011-2013, 2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -218,7 +218,7 @@ void weak_function stm32_spidev_initialize(void); * Name: stm32_usbinitialize * * Description: - * Called from stm32_usbinitialize very early in inialization to setup USB-related + * Called from stm32_usbinitialize very early in initialization to setup USB-related * GPIO pins for the Mikroe-stm32f4 board. * ****************************************************************************************************/ @@ -227,13 +227,13 @@ void weak_function stm32_spidev_initialize(void); void weak_function stm32_usbinitialize(void); #endif -/************************************************************************************ +/**************************************************************************************************** * Name: stm32_pwm_setup * * Description: * Initialize PWM and register the PWM device. * - ************************************************************************************/ + ****************************************************************************************************/ #ifdef CONFIG_PWM int stm32_pwm_setup(void); @@ -252,13 +252,13 @@ int stm32_pwm_setup(void); # error "The Mikroe-STM32F4 board does not support HOST OTG, only device!" #endif -/**************************************************************************** +/**************************************************************************************************** * Name: stm32_qencoder_initialize * * Description: * Initialize and register a qencoder * - ****************************************************************************/ + ****************************************************************************************************/ #ifdef CONFIG_SENSORS_QENCODER int stm32_qencoder_initialize(FAR const char *devpath, int timer); @@ -277,6 +277,26 @@ int stm32_qencoder_initialize(FAR const char *devpath, int timer); void stm32_lcdinitialize(void); #endif +/**************************************************************************************************** + * Name: stm32_tsc_setup + * + * Description: + * This function is called by board-bringup logic to configure the touchscreen device. This + * function will register the driver as /dev/inputN where N is the minor device number. + * + * Input Parameters: + * minor - The input device minor number + * + * Returned Value: + * Zero is returned on success. Otherwise, a negated errno value is returned to indicate the + * nature of the failure. + * + ****************************************************************************************************/ + +#ifdef CONFIG_INPUT +int stm32_tsc_setup(int minor); +#endif + /**************************************************************************************************** * Name: up_vs1053initialize * diff --git a/configs/mikroe-stm32f4/src/stm32_appinit.c b/configs/mikroe-stm32f4/src/stm32_appinit.c index 134f819fc4..18028def31 100644 --- a/configs/mikroe-stm32f4/src/stm32_appinit.c +++ b/configs/mikroe-stm32f4/src/stm32_appinit.c @@ -1,7 +1,7 @@ /**************************************************************************** * config/mikroe_stm32f4/src/stm32_appinit.c * - * Copyright (C) 2012-2013, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2012-2013, 2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -350,6 +350,16 @@ int board_app_initialize(uintptr_t arg) } #endif +#ifdef CONFIG_INPUT + /* Initialize the touchscreen */ + + ret = stm32_tsc_setup(0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_tsc_setup failed: %d\n", ret); + } +#endif + #ifdef CONFIG_PWM /* Initialize PWM and register the PWM device. */ diff --git a/configs/mikroe-stm32f4/src/stm32_touchscreen.c b/configs/mikroe-stm32f4/src/stm32_touchscreen.c index ec1cb2e00e..efdb46d9a2 100644 --- a/configs/mikroe-stm32f4/src/stm32_touchscreen.c +++ b/configs/mikroe-stm32f4/src/stm32_touchscreen.c @@ -1474,13 +1474,12 @@ errout: ************************************************************************************/ /**************************************************************************** - * Name: board_tsc_setup + * Name: stm32_tsc_setup * * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * configure the touchscreen device. This function will register the driver - * as /dev/inputN where N is the minor device number. + * This function is called by board-bringup logic to configure the + * touchscreen device. This function will register the driver as + * /dev/inputN where N is the minor device number. * * Input Parameters: * minor - The input device minor number @@ -1491,7 +1490,7 @@ errout: * ****************************************************************************/ -int board_tsc_setup(int minor) +int stm32_tsc_setup(int minor) { FAR struct tc_dev_s *priv; char devname[DEV_NAMELEN]; diff --git a/configs/olimex-lpc1766stk/src/lpc1766stk.h b/configs/olimex-lpc1766stk/src/lpc1766stk.h index e591862819..bb67e6b7ef 100644 --- a/configs/olimex-lpc1766stk/src/lpc1766stk.h +++ b/configs/olimex-lpc1766stk/src/lpc1766stk.h @@ -1,7 +1,7 @@ /************************************************************************************ * configs/olimex-lpc1766stk/src/lpc1766stk.h * - * Copyright (C) 2010-2011, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2010-2011, 2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -272,6 +272,27 @@ void weak_function lpc1766stk_sspdev_initialize(void); int lpc1766stk_can_setup(void); #endif +/************************************************************************************ + * Name: lpc1766stk_hidmouse_setup + * + * Description: + * This function is called by board-bringup logic to configure the HID mouse + * device. This function will register the driver as /dev/inputN where N is the + * minor device number. + * + * Input Parameters: + * minor - The input device minor number + * + * Returned Value: + * Zero is returned on success. Otherwise, a negated errno value is returned to + * indicate the nature of the failure. + * + ************************************************************************************/ + +#ifdef CONFIG_USBHOST_HIDMOUSE +int lpc1766stk_hidmouse_setup(int minor); +#endif + #endif /* __ASSEMBLY__ */ #endif /* _CONFIGS_OLIMEX_LPC1766STK_SRC_LPC1766STK_H */ diff --git a/configs/olimex-lpc1766stk/src/lpc17_appinit.c b/configs/olimex-lpc1766stk/src/lpc17_appinit.c index 22e4858fc3..8c3d455e9a 100644 --- a/configs/olimex-lpc1766stk/src/lpc17_appinit.c +++ b/configs/olimex-lpc1766stk/src/lpc17_appinit.c @@ -1,7 +1,7 @@ /**************************************************************************** * config/olimex-lpc1766stk/src/lpc17_appinit.c * - * Copyright (C) 2010, 2013-2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2010, 2013-2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -362,6 +362,16 @@ int board_app_initialize(uintptr_t arg) syslog(LOG_ERR, "ERROR: Failed to initialize USB host: %d\n", ret); } +#ifdef CONFIG_USBHOST_HIDMOUSE + /* Initialize the HID Mouse class */ + + ret = lpc1766stk_hidmouse_setup(0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: lpc1766stk_hidmouse_setup failed: %d\n", ret); + } +#endif + #ifdef CONFIG_CAN /* Initialize CAN and register the CAN driver. */ diff --git a/configs/olimex-lpc1766stk/src/lpc17_hidmouse.c b/configs/olimex-lpc1766stk/src/lpc17_hidmouse.c index a44d62cbab..c4b6792d12 100644 --- a/configs/olimex-lpc1766stk/src/lpc17_hidmouse.c +++ b/configs/olimex-lpc1766stk/src/lpc17_hidmouse.c @@ -71,17 +71,15 @@ ****************************************************************************/ /**************************************************************************** - * Name: board_tsc_setup + * Name: lpc1766stk_hidmouse_setup * * Description: - * Each board that supports a touchscreen device must provide this - * function. This function is called by application-specific, setup logic - * to configure the USB HID mouse driver that emulates a touchscreen - * device. This function will register the driver as /dev/mouseN where N - * is the minor device number. + * This function is called by board-bringup logic to configure the HID + * mouse device. This function will register the driver as /dev/inputN + * where N is the minor device number. * * Input Parameters: - * minor - The mouse device minor number + * minor - The mouse device minor number * * Returned Value: * Zero is returned on success. Otherwise, a negated errno value is @@ -89,7 +87,7 @@ * ****************************************************************************/ -int board_tsc_setup(int minor) +int lpc1766stk_hidmouse_setup(int minor) { static bool initialized = false; int ret; diff --git a/configs/open1788/src/lpc17_appinit.c b/configs/open1788/src/lpc17_appinit.c index 19cc0ee0ac..ee557911a5 100644 --- a/configs/open1788/src/lpc17_appinit.c +++ b/configs/open1788/src/lpc17_appinit.c @@ -89,6 +89,6 @@ int board_app_initialize(uintptr_t arg) #else /* Perform board-specific initialization */ - return lpc17_bringup(); + return open1788_bringup(); #endif } diff --git a/configs/open1788/src/lpc17_boardinitialize.c b/configs/open1788/src/lpc17_boardinitialize.c index 12109ea14e..1058f6cc7e 100644 --- a/configs/open1788/src/lpc17_boardinitialize.c +++ b/configs/open1788/src/lpc17_boardinitialize.c @@ -137,6 +137,6 @@ void board_initialize(void) { /* Perform board-specific initialization */ - (void)lpc17_bringup(); + (void)open1788_bringup(); } #endif diff --git a/configs/open1788/src/lpc17_bringup.c b/configs/open1788/src/lpc17_bringup.c index 98a79fcf4e..047c31df84 100644 --- a/configs/open1788/src/lpc17_bringup.c +++ b/configs/open1788/src/lpc17_bringup.c @@ -245,12 +245,11 @@ static int nsh_sdinitialize(void) lpc17_configgpio(GPIO_SD_CD); +#ifdef NSH_HAVE_MMCSD_CDINT /* Attach an interrupt handler to get notifications when a card is * inserted or deleted. */ -#ifdef NSH_HAVE_MMCSD_CDINT - (void)irq_attach(LPC17_IRQ_P0p13, nsh_cdinterrupt, NULL); up_enable_irq(LPC17_IRQ_P0p13); @@ -361,7 +360,7 @@ static int nsh_usbhostinitialize(void) ****************************************************************************/ /**************************************************************************** - * Name: lpc17_bringup + * Name: open1788_bringup * * Description: * Perform architecture-specific initialization @@ -374,7 +373,7 @@ static int nsh_usbhostinitialize(void) * ****************************************************************************/ -int lpc17_bringup(void) +int open1788_bringup(void) { int ret; @@ -398,6 +397,16 @@ int lpc17_bringup(void) } #endif +#ifdef CONFIG_INPUT_ADS7843E + /* Initialize the touchscreen */ + + ret = open1788_tsc_setup(0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: open1788_tsc_setup failed: %d\n", ret); + } +#endif + #ifdef CONFIG_OPEN1788_DJOYSTICK /* Initialize and register the joystick driver */ diff --git a/configs/open1788/src/lpc17_touchscreen.c b/configs/open1788/src/lpc17_touchscreen.c index 03416505ff..6c72a9205e 100644 --- a/configs/open1788/src/lpc17_touchscreen.c +++ b/configs/open1788/src/lpc17_touchscreen.c @@ -1,6 +1,5 @@ /************************************************************************************ * configs/open1788/src/lpc17_touchscreen.c - * arch/arm/src/board/lpc17_touchscreen.c * * Copyright (C) 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -255,13 +254,12 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state) ****************************************************************************/ /**************************************************************************** - * Name: board_tsc_setup + * Name: open1788_tsc_setup * * Description: - * Each board that supports a touchscreen device must provide this - * function. This function is called by application-specific, setup logic - * to configure the touchscreen device. This function will register the - * driver as /dev/inputN where N is the minor device number. + * This function is called by board-bringup logic to configure the + * touchscreen device. This function will register the driver as + * /dev/inputN where N is the minor device number. * * Input Parameters: * minor - The input device minor number @@ -272,7 +270,7 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state) * ****************************************************************************/ -int board_tsc_setup(int minor) +int open1788_tsc_setup(int minor) { static bool initialized = false; FAR struct spi_dev_s *dev; diff --git a/configs/open1788/src/open1788.h b/configs/open1788/src/open1788.h index 589d78b261..4a8254348b 100644 --- a/configs/open1788/src/open1788.h +++ b/configs/open1788/src/open1788.h @@ -2,7 +2,7 @@ * configs/open1788/src/open1788.h * arch/arm/src/board/open1788.n * - * Copyright (C) 2013, 2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2013, 2017-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -162,7 +162,7 @@ ************************************************************************************/ /************************************************************************************ - * Name: lpc17_bringup + * Name: open1788_bringup * * Description: * Perform architecture-specific initialization @@ -175,7 +175,7 @@ * ************************************************************************************/ -int lpc17_bringup(void); +int open1788_bringup(void); /************************************************************************************ * Name: open1788_sspdev_initialize @@ -237,13 +237,34 @@ void open1788_nand_initialize(void); void open1788_lcd_initialize(void); #endif -/**************************************************************************** +/************************************************************************************ + * Name: open1788_tsc_setup + * + * Description: + * This function is called by board-bringup logic to configure the touchscreen + * device. This function will register the driver as /dev/inputN where N is the + * minor device number. + * + * Input Parameters: + * minor - The input device minor number + * + * Returned Value: + * Zero is returned on success. Otherwise, a negated errno value is returned to + * indicate the nature of the failure. + * + ************************************************************************************/ + +#ifdef CONFIG_INPUT_ADS7843E +int open1788_tsc_setup(int minor); +#endif + +/************************************************************************************ * Name: lpc17_djoy_initialization * * Description: * Initialize and register the discrete joystick driver * - ****************************************************************************/ + ************************************************************************************/ #ifdef CONFIG_OPEN1788_DJOYSTICK int lpc17_djoy_initialization(void); diff --git a/configs/pic32mx7mmb/src/pic32_bringup.c b/configs/pic32mx7mmb/src/pic32_bringup.c index c082621356..81fc7e98e7 100644 --- a/configs/pic32mx7mmb/src/pic32_bringup.c +++ b/configs/pic32mx7mmb/src/pic32_bringup.c @@ -1,7 +1,7 @@ /**************************************************************************** * config/pic32mx7mmb/src/pic32_bringup.c * - * Copyright (C) 2012, 2016-2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2016-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -407,5 +407,15 @@ int pic32mx_bringup(void) ret = nsh_usbdevinitialize(); } +#ifdef CONFIG_INPUT + /* Initialize the touchscreen */ + + ret = pic32mx_tsc_setup(0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: pic32mx_tsc_setup failed: %d\n", ret); + } +#endif + return ret; } diff --git a/configs/pic32mx7mmb/src/pic32_touchscreen.c b/configs/pic32mx7mmb/src/pic32_touchscreen.c index f0ed889a2f..3974d6a358 100644 --- a/configs/pic32mx7mmb/src/pic32_touchscreen.c +++ b/configs/pic32mx7mmb/src/pic32_touchscreen.c @@ -1343,13 +1343,12 @@ errout: ************************************************************************************/ /**************************************************************************** - * Name: board_tsc_setup + * Name: pic32mx_tsc_setup * * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * configure the touchscreen device. This function will register the driver - * as /dev/inputN where N is the minor device number. + * This function is called by board-bringup logic to configure the + * touchscreen device. This function will register the driver as + * /dev/inputN where N is the minor device number. * * Input Parameters: * minor - The input device minor number @@ -1360,7 +1359,7 @@ errout: * ****************************************************************************/ -int board_tsc_setup(int minor) +int pic32mx_tsc_setup(int minor) { FAR struct tc_dev_s *priv; char devname[DEV_NAMELEN]; diff --git a/configs/pic32mx7mmb/src/pic32mx7mmb.h b/configs/pic32mx7mmb/src/pic32mx7mmb.h index da60ef9b6f..f28e0cb901 100644 --- a/configs/pic32mx7mmb/src/pic32mx7mmb.h +++ b/configs/pic32mx7mmb/src/pic32mx7mmb.h @@ -1,7 +1,7 @@ /**************************************************************************** * configs/pic32mx7mmb/src/pic32mx7mmb.h * - * Copyright (C) 2012, 2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2017-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -119,33 +119,33 @@ extern "C" { #define EXTERN extern #endif -/************************************************************************************ +/**************************************************************************** * Name: pic32mx_spidev_initialize * * Description: - * Called to configure SPI chip select GPIO pins for the Mikroelektronika PIC32MX7 - * MMB board. + * Called to configure SPI chip select GPIO pins for the Mikroelektronika + * PIC32MX7 MMB board. * - ************************************************************************************/ + ****************************************************************************/ #if defined(CONFIG_PIC32MX_SPI1) || defined(CONFIG_PIC32MX_SPI2) || \ defined(CONFIG_PIC32MX_SPI3) || defined(CONFIG_PIC32MX_SPI4) void weak_function pic32mx_spidev_initialize(void); #endif -/************************************************************************************ +/**************************************************************************** * Name: pic32mx_led_initialize * * Description: * Configure on-board LEDs if LED support has been selected. * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_ARCH_LEDS void pic32mx_led_initialize(void); #endif -/************************************************************************************ +/**************************************************************************** * Name: pic32mx_bringup * * Description: @@ -157,7 +157,7 @@ void pic32mx_led_initialize(void); * CONFIG_BOARD_INITIALIZE=y && CONFIG_LIB_BOARDCTL=y : * Called from the NSH library * - ************************************************************************************/ + ****************************************************************************/ int pic32mx_bringup(void); @@ -173,6 +173,27 @@ int pic32mx_bringup(void); void pic32mx_lcdinitialize(void); +/**************************************************************************** + * Name: pic32mx_tsc_setup + * + * Description: + * This function is called by board-bringup logic to configure the + * touchscreen device. This function will register the driver as + * /dev/inputN where N is the minor device number. + * + * Input Parameters: + * minor - The input device minor number + * + * Returned Value: + * Zero is returned on success. Otherwise, a negated errno value is + * returned to indicate the nature of the failure. + * + ****************************************************************************/ + +#ifdef CONFIG_INPUT +int pic32mx_tsc_setup(int minor); +#endif + #undef EXTERN #ifdef __cplusplus } diff --git a/configs/sam3u-ek/nxwm/defconfig b/configs/sam3u-ek/nxwm/defconfig index 3e21c6bd89..feb067d7a5 100644 --- a/configs/sam3u-ek/nxwm/defconfig +++ b/configs/sam3u-ek/nxwm/defconfig @@ -19,7 +19,6 @@ CONFIG_ARCH="arm" CONFIG_ARMV7M_OABI_TOOLCHAIN=y CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y CONFIG_BOARD_LOOPSPERMSEC=8720 -CONFIG_BOARDCTL_TSCTEST=y CONFIG_CXX_NEWLONG=y CONFIG_DISABLE_POLL=y CONFIG_HAVE_CXX=y diff --git a/configs/sam3u-ek/src/sam3u-ek.h b/configs/sam3u-ek/src/sam3u-ek.h index 714ff54c2a..87119e417d 100644 --- a/configs/sam3u-ek/src/sam3u-ek.h +++ b/configs/sam3u-ek/src/sam3u-ek.h @@ -1,7 +1,7 @@ /************************************************************************************ * configs/sam3u-ek/src/sam3u-ek.h * - * Copyright (C) 2009-2011, 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2009-2011, 2013, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -263,5 +263,26 @@ bool sam_writeprotected(unsigned char slot); # define sam_writeprotected(slot) (false) #endif +/************************************************************************************ + * Name: sam_tsc_setup + * + * Description: + * This function is called by board-bringup logic to configure the touchscreen + * device. This function will register the driver as /dev/inputN where N is the + * minor device number. + * + * Input Parameters: + * minor - The input device minor number + * + * Returned Value: + * Zero is returned on success. Otherwise, a negated errno value is returned to + * indicate the nature of the failure. + * + ***********************************************************************************/ + +#ifdef CONFIG_INPUT_ADS7843E +int sam_tsc_setup(int minor); +#endif + #endif /* __ASSEMBLY__ */ #endif /* __CONFIGS_SAM3U_EK_SRC_SAM3U_EK_H */ diff --git a/configs/sam3u-ek/src/sam_appinit.c b/configs/sam3u-ek/src/sam_appinit.c index 00f2cd2e21..3de2d64e61 100644 --- a/configs/sam3u-ek/src/sam_appinit.c +++ b/configs/sam3u-ek/src/sam_appinit.c @@ -1,7 +1,7 @@ /**************************************************************************** * config/sam3u-ek/src/sam_appinit.c * - * Copyright (C) 2010, 2013, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2010, 2013, 2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -128,9 +128,10 @@ int board_app_initialize(uintptr_t arg) { + int ret; + #ifdef NSH_HAVE_MMCSD FAR struct sdio_dev_s *sdio; - int ret; /* Mount the SDIO-based MMC/SD block driver */ /* First, get an instance of the SDIO interface */ @@ -164,5 +165,17 @@ int board_app_initialize(uintptr_t arg) sdio_mediachange(sdio, sam_cardinserted(0)); #endif + +#ifdef CONFIG_INPUT + /* Initialize the touchscreen */ + + ret = sam_tsc_setup(0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: sam_tsc_setup failed: %d\n", ret); + } +#endif + + UNUSED(ret); return OK; } diff --git a/configs/sam3u-ek/src/sam_touchscreen.c b/configs/sam3u-ek/src/sam_touchscreen.c index 398838710f..da529f2d87 100644 --- a/configs/sam3u-ek/src/sam_touchscreen.c +++ b/configs/sam3u-ek/src/sam_touchscreen.c @@ -216,13 +216,12 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state) ****************************************************************************/ /**************************************************************************** - * Name: board_tsc_setup + * Name: sam_tsc_setup * * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * configure the touchscreen device. This function will register the driver - * as /dev/inputN where N is the minor device number. + * This function is called by board-bringup logic to configure the + * touchscreen device. This function will register the driver as + * /dev/inputN where N is the minor device number. * * Input Parameters: * minor - The input device minor number @@ -233,7 +232,7 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state) * ****************************************************************************/ -int board_tsc_setup(int minor) +int sam_tsc_setup(int minor) { FAR struct spi_dev_s *dev; int ret; @@ -273,4 +272,3 @@ int board_tsc_setup(int minor) } #endif /* CONFIG_INPUT_ADS7843E */ - diff --git a/configs/sam4e-ek/src/sam4e-ek.h b/configs/sam4e-ek/src/sam4e-ek.h index 591b90be1f..dacbe51098 100644 --- a/configs/sam4e-ek/src/sam4e-ek.h +++ b/configs/sam4e-ek/src/sam4e-ek.h @@ -1,7 +1,7 @@ /************************************************************************************ * configs/sam4e-ek/src/sam4e-ek.h * - * Copyright (C) 2014 Gregory Nutt. All rights reserved. + * Copyright (C) 2014, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -440,14 +440,14 @@ bool sam_writeprotected(int slotno); # define sam_writeprotected(slotno) (false) #endif -/**************************************************************************** +/************************************************************************************ * Name: sam_at25_automount * * Description: * Initialize, configure, and mount the AT25 serial FLASH. The FLASH will * be mounted at /dev/at25. * - ****************************************************************************/ + ************************************************************************************/ #ifdef HAVE_AT25 int sam_at25_automount(int minor); @@ -455,5 +455,26 @@ int sam_at25_automount(int minor); # define sam_at25_automount(minor) (-ENOSYS) #endif +/************************************************************************************ + * Name: sam_tsc_setup + * + * Description: + * This function is called by board-bringup logic to configure the touchscreen + * device. This function will register the driver as /dev/inputN where N is the + * minor device number. + * + * Input Parameters: + * minor - The input device minor number + * + * Returned Value: + * Zero is returned on success. Otherwise, a negated errno value is returned to + * indicate the nature of the failure. + * + ***********************************************************************************/ + +#ifdef CONFIG_INPUT_ADS7843E +int sam_tsc_setup(int minor); +#endif + #endif /* __ASSEMBLY__ */ #endif /* __CONFIGS_SAM4E_EK_SRC_SAM4E_EK_H */ diff --git a/configs/sam4e-ek/src/sam_ads7843e.c b/configs/sam4e-ek/src/sam_ads7843e.c index aeeddceb27..b925125a51 100644 --- a/configs/sam4e-ek/src/sam_ads7843e.c +++ b/configs/sam4e-ek/src/sam_ads7843e.c @@ -213,13 +213,12 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state) ****************************************************************************/ /**************************************************************************** - * Name: board_tsc_setup + * Name: sam_tsc_setup * * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * configure the touchscreen device. This function will register the driver - * as /dev/inputN where N is the minor device number. + * This function is called by board-bringup logic to configure the + * touchscreen device. This function will register the driver as + * /dev/inputN where N is the minor device number. * * Input Parameters: * minor - The input device minor number @@ -230,7 +229,7 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state) * ****************************************************************************/ -int board_tsc_setup(int minor) +int sam_tsc_setup(int minor) { FAR struct spi_dev_s *dev; int ret; diff --git a/configs/sam4e-ek/src/sam_appinit.c b/configs/sam4e-ek/src/sam_appinit.c index b9ec0bcf11..38c239602f 100644 --- a/configs/sam4e-ek/src/sam_appinit.c +++ b/configs/sam4e-ek/src/sam_appinit.c @@ -1,7 +1,7 @@ /**************************************************************************** * config/sam4e-ek/src/sam_appinit.c * - * Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2014, 2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -89,9 +89,7 @@ int board_app_initialize(uintptr_t arg) { -#if defined(HAVE_AT25) || defined(HAVE_HSMCI) || defined(HAVE_USBMONITOR) int ret; -#endif #ifdef HAVE_AT25 /* Initialize the AT25 driver */ @@ -115,6 +113,16 @@ int board_app_initialize(uintptr_t arg) } #endif +#ifdef CONFIG_INPUT_ADS7843E + /* Initialize the touchscreen */ + + ret = sam_tsc_setup(0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: sam_tsc_setup failed: %d\n", ret); + } +#endif + #ifdef HAVE_USBMONITOR /* Start the USB Monitor */ @@ -126,5 +134,6 @@ int board_app_initialize(uintptr_t arg) } #endif + UNUSED(ret); return OK; } diff --git a/configs/sama5d3x-ek/nxwm/defconfig b/configs/sama5d3x-ek/nxwm/defconfig index 998bd7c252..005230b47f 100644 --- a/configs/sama5d3x-ek/nxwm/defconfig +++ b/configs/sama5d3x-ek/nxwm/defconfig @@ -12,7 +12,6 @@ CONFIG_ARCH_STACKDUMP=y CONFIG_ARCH="arm" CONFIG_ARMV7A_TOOLCHAIN_CODESOURCERYW=y CONFIG_BOARD_LOOPSPERMSEC=49341 -CONFIG_BOARDCTL_TSCTEST=y CONFIG_BUILTIN=y CONFIG_DISABLE_POLL=y CONFIG_FLASH_SIZE=134217728 diff --git a/configs/sama5d3x-ek/src/sam_appinit.c b/configs/sama5d3x-ek/src/sam_appinit.c index 0d3083ad2b..5da376d042 100644 --- a/configs/sama5d3x-ek/src/sam_appinit.c +++ b/configs/sama5d3x-ek/src/sam_appinit.c @@ -1,7 +1,7 @@ /**************************************************************************** * config/sama5d3x-ek/src/sam_appinit.c * - * Copyright (C) 2013-2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2013-2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -173,6 +173,16 @@ int board_app_initialize(uintptr_t arg) } #endif +#ifdef CONFIG_SAMA5_TSD + /* Initialize the touchscreen */ + + ret = sam_tsc_setup(0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: sam_tsc_setup failed: %d\n", ret); + } +#endif + #ifdef HAVE_WM8904 /* Configure WM8904 audio */ diff --git a/configs/sama5d3x-ek/src/sam_touchscreen.c b/configs/sama5d3x-ek/src/sam_touchscreen.c index ced5853522..cbeba1ec02 100644 --- a/configs/sama5d3x-ek/src/sam_touchscreen.c +++ b/configs/sama5d3x-ek/src/sam_touchscreen.c @@ -64,34 +64,17 @@ # define CONFIG_SAMA5D3xEK_TSD_DEVMINOR 0 #endif -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - /**************************************************************************** * Public Functions ****************************************************************************/ /**************************************************************************** - * Name: board_tsc_setup + * Name: sam_tsc_setup * * Description: - * Each board that supports a touchscreen device must provide this - * function. This function is called by application-specific, setup logic - * to configure the touchscreen device. This function will register the - * driver as /dev/inputN where N is the minor device number. + * This function is called by board-bringup logic to configure the + * touchscreen device. This function will register the driver as + * /dev/inputN where N is the minor device number. * * Input Parameters: * minor - The input device minor number @@ -102,7 +85,7 @@ * ****************************************************************************/ -int board_tsc_setup(int minor) +int sam_tsc_setup(int minor) { struct sam_adc_s *adc; static bool initialized = false; diff --git a/configs/sama5d3x-ek/src/sama5d3x-ek.h b/configs/sama5d3x-ek/src/sama5d3x-ek.h index fcdfa53b3e..c6dd625998 100644 --- a/configs/sama5d3x-ek/src/sama5d3x-ek.h +++ b/configs/sama5d3x-ek/src/sama5d3x-ek.h @@ -1,7 +1,7 @@ /************************************************************************************ * configs/sama5d3x-ek/src/sama5d3x-ek.h * - * Copyright (C) 2013-2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2013-2015, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -833,6 +833,27 @@ int sam_usbhost_initialize(void); void weak_function sam_netinitialize(void); #endif +/************************************************************************************ + * Name: sam_tsc_setup + * + * Description: + * This function is called by board-bringup logic to configure the touchscreen + * device. This function will register the driver as /dev/inputN where N is the + * minor device number. + * + * Input Parameters: + * minor - The input device minor number + * + * Returned Value: + * Zero is returned on success. Otherwise, a negated errno value is returned to + * indicate the nature of the failure. + * + ***********************************************************************************/ + +#ifdef CONFIG_SAMA5_TSD +int sam_tsc_setup(int minor); +#endif + /************************************************************************************ * Name: sam_pwm_setup * diff --git a/configs/sama5d4-ek/README.txt b/configs/sama5d4-ek/README.txt index 40a703e402..fa063560b7 100644 --- a/configs/sama5d4-ek/README.txt +++ b/configs/sama5d4-ek/README.txt @@ -3268,7 +3268,6 @@ TM7000 LCD/Touchscreen build in a touchscreen test: CONFIG_EXAMPLES_TOUCHSCREEN=y - CONFIG_EXAMPLES_TOUCHSCREEN_ARCHINIT=y CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/input0" CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0 diff --git a/configs/sama5d4-ek/src/sam_bringup.c b/configs/sama5d4-ek/src/sam_bringup.c index 5669b17fc7..d5a01c2fe6 100644 --- a/configs/sama5d4-ek/src/sam_bringup.c +++ b/configs/sama5d4-ek/src/sam_bringup.c @@ -1,7 +1,7 @@ /**************************************************************************** * config/sama5d4-ek/src/sam_bringup.c * - * Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2014, 2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -288,6 +288,16 @@ int sam_bringup(void) } #endif +#ifdef HAVE_MAXTOUCH + /* Initialize the touchscreen */ + + ret = sam_tsc_setup(0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: sam_tsc_setup failed: %d\n", ret); + } +#endif + #ifdef CONFIG_PWM /* Initialize PWM and register the PWM device. */ diff --git a/configs/sama5d4-ek/src/sam_maxtouch.c b/configs/sama5d4-ek/src/sam_maxtouch.c index f64f661836..3a2e3f5f37 100644 --- a/configs/sama5d4-ek/src/sam_maxtouch.c +++ b/configs/sama5d4-ek/src/sam_maxtouch.c @@ -219,13 +219,12 @@ static int mxt_interrupt(int irq, FAR void *context, FAR void *arg) ****************************************************************************/ /**************************************************************************** - * Name: board_tsc_setup + * Name: sam_tsc_setup * * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * configure the touchscreen device. This function will register the driver - * as /dev/inputN where N is the minor device number. + * This function is called by board-bringup logic to configure the + * touchscreen device. This function will register the driver as + * /dev/inputN where N is the minor device number. * * Input Parameters: * minor - The input device minor number @@ -236,7 +235,7 @@ static int mxt_interrupt(int irq, FAR void *context, FAR void *arg) * ****************************************************************************/ -int board_tsc_setup(int minor) +int sam_tsc_setup(int minor) { FAR struct i2c_master_s *i2c; static bool initialized = false; diff --git a/configs/sama5d4-ek/src/sama5d4-ek.h b/configs/sama5d4-ek/src/sama5d4-ek.h index 1a364f64c2..50e956b08d 100644 --- a/configs/sama5d4-ek/src/sama5d4-ek.h +++ b/configs/sama5d4-ek/src/sama5d4-ek.h @@ -1,7 +1,7 @@ /************************************************************************************ * configs/sama5d4-ek/src/sama5d4-ek.h * - * Copyright (C) 2014-2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2014-2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -1060,19 +1060,41 @@ bool sam_writeprotected(int slotno); void weak_function sam_usbinitialize(void); #endif -/**************************************************************************************************** +/************************************************************************************ * Name: stm32_usbhost_initialize * * Description: - * Called at application startup time to initialize the USB host functionality. This function will - * start a thread that will monitor for device connection/disconnection events. + * Called at application startup time to initialize the USB host functionality. + * This function will start a thread that will monitor for device connection/ + * disconnection events. * - ****************************************************************************************************/ + ************************************************************************************/ #ifdef HAVE_USBHOST int sam_usbhost_initialize(void); #endif +/************************************************************************************ + * Name: sam_tsc_setup + * + * Description: + * This function is called by board-bringup logic to configure the touchscreen + * device. This function will register the driver as /dev/inputN where N is the + * minor device number. + * + * Input Parameters: + * minor - The input device minor number + * + * Returned Value: + * Zero is returned on success. Otherwise, a negated errno value is returned to + * indicate the nature of the failure. + * + ***********************************************************************************/ + +#ifdef HAVE_MAXTOUCH +int sam_tsc_setup(int minor); +#endif + /************************************************************************************ * Name: sam_pwm_setup * diff --git a/configs/samv71-xult/README.txt b/configs/samv71-xult/README.txt index c290d05bad..782bdaf632 100644 --- a/configs/samv71-xult/README.txt +++ b/configs/samv71-xult/README.txt @@ -1231,7 +1231,6 @@ MXT Configuration Options Application Configuration -> Examples -> Touchscreen example CONFIG_EXAMPLES_TOUCHSCREEN=y : Enables the example - CONFIG_EXAMPLES_TOUCHSCREEN_ARCHINIT=y : Have board-specific intialization CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/input0" CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0 diff --git a/configs/samv71-xult/nxwm/defconfig b/configs/samv71-xult/nxwm/defconfig index 80cc25bf5c..9a5d3cb7e9 100644 --- a/configs/samv71-xult/nxwm/defconfig +++ b/configs/samv71-xult/nxwm/defconfig @@ -27,7 +27,6 @@ CONFIG_AT24XX_EXTENDED=y CONFIG_AT24XX_EXTSIZE=160 CONFIG_AT24XX_SIZE=2 CONFIG_BOARD_LOOPSPERMSEC=51262 -CONFIG_BOARDCTL_TSCTEST=y CONFIG_BUILTIN=y CONFIG_DISABLE_POLL=y CONFIG_FAT_LCNAMES=y diff --git a/configs/samv71-xult/src/sam_bringup.c b/configs/samv71-xult/src/sam_bringup.c index 5d6e288e21..4326c2b8ee 100644 --- a/configs/samv71-xult/src/sam_bringup.c +++ b/configs/samv71-xult/src/sam_bringup.c @@ -507,6 +507,16 @@ int sam_bringup(void) } #endif +#ifdef HAVE_MAXTOUCH + /* Initialize the touchscreen */ + + ret = sam_tsc_setup(0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: sam_tsc_setup failed: %d\n", ret); + } +#endif + #ifdef HAVE_WM8904 /* Configure WM8904 audio */ diff --git a/configs/samv71-xult/src/sam_maxtouch.c b/configs/samv71-xult/src/sam_maxtouch.c index 42cd74a16e..7db38fd551 100644 --- a/configs/samv71-xult/src/sam_maxtouch.c +++ b/configs/samv71-xult/src/sam_maxtouch.c @@ -218,13 +218,12 @@ static int mxt_interrupt(int irq, FAR void *context, FAR void *arg) ****************************************************************************/ /**************************************************************************** - * Name: board_tsc_setup + * Name: sam_tsc_setup * * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * configure the touchscreen device. This function will register the driver - * as /dev/inputN where N is the minor device number. + * This function is called by board-bringup logic to configure the + * touchscreen device. This function will register the driver as + * /dev/inputN where N is the minor device number. * * Input Parameters: * minor - The input device minor number @@ -235,7 +234,7 @@ static int mxt_interrupt(int irq, FAR void *context, FAR void *arg) * ****************************************************************************/ -int board_tsc_setup(int minor) +int sam_tsc_setup(int minor) { FAR struct i2c_master_s *i2c; static bool initialized = false; diff --git a/configs/samv71-xult/src/samv71-xult.h b/configs/samv71-xult/src/samv71-xult.h index c9b3718b2c..cb273a819f 100644 --- a/configs/samv71-xult/src/samv71-xult.h +++ b/configs/samv71-xult/src/samv71-xult.h @@ -1,7 +1,7 @@ /************************************************************************************ * configs/samv71-xult/src/samv71-xult.h * - * Copyright (C) 2015-2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2015-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -846,28 +846,49 @@ bool sam_writeprotected(int slotno); int sam_at24config(void); #endif -/**************************************************************************** +/************************************************************************************ + * Name: sam_tsc_setup + * + * Description: + * This function is called by board-bringup logic to configure the touchscreen + * device. This function will register the driver as /dev/inputN where N is the + * minor device number. + * + * Input Parameters: + * minor - The input device minor number + * + * Returned Value: + * Zero is returned on success. Otherwise, a negated errno value is returned to + * indicate the nature of the failure. + * + ************************************************************************************/ + +#ifdef HAVE_MAXTOUCH +int sam_tsc_setup(int minor); +#endif + +/************************************************************************************ * Name: sam_wm8904_initialize * * Description: - * This function is called by platform-specific, setup logic to configure - * and register the WM8904 device. This function will register the driver - * as /dev/wm8904[x] where x is determined by the minor device number. + * This function is called by platform-specific, setup logic to configure and + * register the WM8904 device. This function will register the driver as + * /dev/wm8904[x] where x is determined by the minor device number. * * Input Parameters: * minor - The input device minor number * * Returned Value: - * Zero is returned on success. Otherwise, a negated errno value is - * returned to indicate the nature of the failure. + * Zero is returned on success. Otherwise, a negated errno value is returned + * to indicate the nature of the failure. * - ****************************************************************************/ + ************************************************************************************/ #ifdef HAVE_WM8904 int sam_wm8904_initialize(int minor); #endif /* HAVE_WM8904 */ -/**************************************************************************** +/************************************************************************************ * Name: sam_audio_null_initialize * * Description: @@ -877,26 +898,26 @@ int sam_wm8904_initialize(int minor); * minor - The input device minor number * * Returned Value: - * Zero is returned on success. Otherwise, a negated errno value is - * returned to indicate the nature of the failure. + * Zero is returned on success. Otherwise, a negated errno value is returned + * to indicate the nature of the failure. * - ****************************************************************************/ + ************************************************************************************/ #ifdef HAVE_AUDIO_NULL int sam_audio_null_initialize(int minor); #endif /* HAVE_AUDIO_NULL */ -/**************************************************************************** +/************************************************************************************ * Name: stm32_mrf24j40_initialize * * Description: * Initialize the MRF24J40 device. * * Returned Value: - * Zero is returned on success. Otherwise, a negated errno value is - * returned to indicate the nature of the failure. + * Zero is returned on success. Otherwise, a negated errno value is returned + * to indicate the nature of the failure. * - ****************************************************************************/ + ************************************************************************************/ #ifdef HAVE_MRF24J40 int sam_mrf24j40_initialize(void); diff --git a/configs/shenzhou/nxwm/defconfig b/configs/shenzhou/nxwm/defconfig index 33241b13dc..3c0273cff3 100644 --- a/configs/shenzhou/nxwm/defconfig +++ b/configs/shenzhou/nxwm/defconfig @@ -17,7 +17,6 @@ CONFIG_ARCH_STACKDUMP=y CONFIG_ARCH="arm" CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=y CONFIG_BOARD_LOOPSPERMSEC=5483 -CONFIG_BOARDCTL_TSCTEST=y CONFIG_ETH0_PHY_DM9161=y CONFIG_HAVE_CXX=y CONFIG_HAVE_CXXINITIALIZE=y diff --git a/configs/shenzhou/src/shenzhou.h b/configs/shenzhou/src/shenzhou.h index 68fb63d102..a841307dfb 100644 --- a/configs/shenzhou/src/shenzhou.h +++ b/configs/shenzhou/src/shenzhou.h @@ -1,7 +1,7 @@ /**************************************************************************************************** * configs/shenzhou/src/shenzhou.h * - * Copyright (C) 2012, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -426,7 +426,7 @@ void weak_function stm32_spidev_initialize(void); * Name: stm32_usbinitialize * * Description: - * Called from stm32_usbinitialize very early in inialization to setup USB-related GPIO pins for + * Called from stm32_usbinitialize very early in initialization to setup USB-related GPIO pins for * the STM3240G-EVAL board. * ****************************************************************************************************/ @@ -448,13 +448,34 @@ void weak_function stm32_usbinitialize(void); int stm32_usbhost_initialize(void); #endif -/************************************************************************************ +/**************************************************************************** + * Name: stm32_tsc_setup + * + * Description: + * This function is called by board-bringup logic to configure the + * touchscreen device. This function will register the driver as + * /dev/inputN where N is the minor device number. + * + * Input Parameters: + * minor - The input device minor number + * + * Returned Value: + * Zero is returned on success. Otherwise, a negated errno value is + * returned to indicate the nature of the failure. + * + ****************************************************************************/ + +#ifdef CONFIG_INPUT_ADS7843E +int stm32_tsc_setup(int minor); +#endif + +/**************************************************************************** * Name: stm32_adc_setup * * Description: * Initialize ADC and register the ADC driver. * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_ADC int stm32_adc_setup(void); diff --git a/configs/shenzhou/src/stm32_appinit.c b/configs/shenzhou/src/stm32_appinit.c index a260c4ec1e..18de2f1660 100644 --- a/configs/shenzhou/src/stm32_appinit.c +++ b/configs/shenzhou/src/stm32_appinit.c @@ -1,7 +1,7 @@ /**************************************************************************** * config/shenzhou/src/stm32_appinit.c * - * Copyright (C) 2012, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -204,6 +204,16 @@ int board_app_initialize(uintptr_t arg) } #endif +#ifdef CONFIG_INPUT_ADS7843E + /* Initialize the touchscreen */ + + ret = stm32_tsc_setup(0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_tsc_setup failed: %d\n", ret); + } +#endif + #ifdef CONFIG_ADC /* Initialize ADC and register the ADC driver. */ diff --git a/configs/shenzhou/src/stm32_touchscreen.c b/configs/shenzhou/src/stm32_touchscreen.c index c499f33a27..1e0fe2e12c 100644 --- a/configs/shenzhou/src/stm32_touchscreen.c +++ b/configs/shenzhou/src/stm32_touchscreen.c @@ -230,13 +230,12 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state) ****************************************************************************/ /**************************************************************************** - * Name: board_tsc_setup + * Name: stm32_tsc_setup * * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * configure the touchscreen device. This function will register the driver - * as /dev/inputN where N is the minor device number. + * This function is called by board-bringup logic to configure the + * touchscreen device. This function will register the driver as + * /dev/inputN where N is the minor device number. * * Input Parameters: * minor - The input device minor number @@ -247,7 +246,7 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state) * ****************************************************************************/ -int board_tsc_setup(int minor) +int stm32_tsc_setup(int minor) { FAR struct spi_dev_s *dev; int ret; diff --git a/configs/sim/README.txt b/configs/sim/README.txt index 226ddd3ffd..b463f412af 100644 --- a/configs/sim/README.txt +++ b/configs/sim/README.txt @@ -729,10 +729,6 @@ nx11 CONFIG_INPUT=y CONFIG_SIM_TOUCHSCREEN=y - Then you must also have some application logic that will call - board_tsc_setup(0) to register the touchscreen driver. See - also configuration "touchscreen" - NOTES: a. If you do not have the call to sim_tcinitialize(0), the build diff --git a/configs/sim/src/sim.h b/configs/sim/src/sim.h index f851b339cc..808818da1a 100644 --- a/configs/sim/src/sim.h +++ b/configs/sim/src/sim.h @@ -1,7 +1,7 @@ /**************************************************************************** * config/sim/src/sim.h * - * Copyright (C) 2015-2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2015-2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -123,4 +123,25 @@ int sim_zoneinfo(int minor); int sim_gpio_initialize(void); #endif +/**************************************************************************** + * Name: sim_tsc_setup + * + * Description: + * This function is called by board-bringup logic to configure the + * touchscreen device. This function will register the driver as + * /dev/inputN where N is the minor device number. + * + * Input Parameters: + * minor - The input device minor number + * + * Returned Value: + * Zero is returned on success. Otherwise, a negated errno value is + * returned to indicate the nature of the failure. + * + ****************************************************************************/ + +#if defined(CONFIG_SIM_X11FB) && defined(CONFIG_SIM_TOUCHSCREEN) +int sim_tsc_setup(int minor); +#endif + #endif /* __CONFIGS_SIM_SRC_SIM_H */ \ No newline at end of file diff --git a/configs/sim/src/sim_bringup.c b/configs/sim/src/sim_bringup.c index 22351f6270..a2233a5fd8 100644 --- a/configs/sim/src/sim_bringup.c +++ b/configs/sim/src/sim_bringup.c @@ -1,7 +1,7 @@ /**************************************************************************** * configs/sim/src/sam_bringup.c * - * Copyright (C) 2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2015, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -68,8 +68,7 @@ int trv_mount_world(int minor, FAR const char *mountpoint); #define NEED_FRAMEBUFFER 1 /* If we are using the X11 touchscreen simulation, then the frame buffer - * initialization happens in board_tsc_setup. Otherwise, we will need to - * do that here. + * initialization will need to be done here. */ #if defined(CONFIG_SIM_X11FB) && defined(CONFIG_SIM_TOUCHSCREEN) @@ -200,6 +199,16 @@ int sim_bringup(void) sim_ajoy_initialize(); #endif +#if defined(CONFIG_SIM_X11FB) && defined(CONFIG_SIM_TOUCHSCREEN) + /* Initialize the touchscreen */ + + ret = sim_tsc_setup(0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: sim_tsc_setup failed: %d\n", ret); + } +#endif + #ifdef CONFIG_GRAPHICS_TRAVELER_ROMFSDEMO /* Special initialization for the Traveler game simulation */ diff --git a/configs/sim/src/sim_touchscreen.c b/configs/sim/src/sim_touchscreen.c index 229b5a79d6..c3b15a8e5d 100644 --- a/configs/sim/src/sim_touchscreen.c +++ b/configs/sim/src/sim_touchscreen.c @@ -145,16 +145,23 @@ static FAR void *sim_listener(FAR void *arg) ****************************************************************************/ /**************************************************************************** - * Name: board_tsc_setup() + * Name: sim_tsc_setup * * Description: - * Perform architecuture-specific initialization of the touchscreen - * hardware. This interface must be provided by all configurations - * using apps/examples/touchscreen + * This function is called by board-bringup logic to configure the + * touchscreen device. This function will register the driver as + * /dev/inputN where N is the minor device number. + * + * Input Parameters: + * minor - The input device minor number + * + * Returned Value: + * Zero is returned on success. Otherwise, a negated errno value is + * returned to indicate the nature of the failure. * ****************************************************************************/ -int board_tsc_setup(int minor) +int sim_tsc_setup(int minor) { struct sched_param param; nxgl_mxpixel_t color; @@ -262,4 +269,3 @@ errout_with_nx: errout: return ret; } - diff --git a/configs/stm3220g-eval/nxwm/defconfig b/configs/stm3220g-eval/nxwm/defconfig index 1bfe7f8541..25a868d872 100644 --- a/configs/stm3220g-eval/nxwm/defconfig +++ b/configs/stm3220g-eval/nxwm/defconfig @@ -15,7 +15,6 @@ CONFIG_ARCH_STACKDUMP=y CONFIG_ARCH="arm" CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=y CONFIG_BOARD_LOOPSPERMSEC=10926 -CONFIG_BOARDCTL_TSCTEST=y CONFIG_ETH0_PHY_DP83848C=y CONFIG_FAT_LCNAMES=y CONFIG_FAT_LFN=y diff --git a/configs/stm3220g-eval/src/stm3220g-eval.h b/configs/stm3220g-eval/src/stm3220g-eval.h index 1e3087109f..95e603fd17 100644 --- a/configs/stm3220g-eval/src/stm3220g-eval.h +++ b/configs/stm3220g-eval/src/stm3220g-eval.h @@ -1,7 +1,7 @@ /**************************************************************************************************** * configs/stm3220g_eval/src/stm3220g.h * - * Copyright (C) 2012, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -249,6 +249,26 @@ void weak_function stm32_usbinitialize(void); int stm32_usbhost_initialize(void); #endif +/**************************************************************************************************** + * Name: stm32_tsc_setup + * + * Description: + * This function is called by board-bringup logic to configure the touchscreen device. This + * function will register the driver as /dev/inputN where N is the minor device number. + * + * Input Parameters: + * minor - The input device minor number + * + * Returned Value: + * Zero is returned on success. Otherwise, a negated errno value is returned to indicate the + * nature of the failure. + * + ****************************************************************************************************/ + +#ifdef CONFIG_INPUT_STMPE811 +int stm32_tsc_setup(int minor); +#endif + /**************************************************************************************************** * Name: stm32_pwm_setup * @@ -321,7 +341,7 @@ void stm32_extmemaddr(int naddrs); void stm32_extmemdata(int ndata); #endif -/************************************************************************************ +/**************************************************************************************************** * Name: stm32_enablefsmc * * Description: @@ -333,7 +353,7 @@ void stm32_extmemdata(int ndata); void stm32_enablefsmc(void); #endif -/************************************************************************************ +/**************************************************************************************************** * Name: stm32_disablefsmc * * Description: @@ -345,7 +365,7 @@ void stm32_enablefsmc(void); void stm32_disablefsmc(void); #endif -/************************************************************************************ +/**************************************************************************************************** * Name: stm32_selectsram * * Description: @@ -375,7 +395,7 @@ void stm32_disablefsmc(void); void stm32_selectsram(void); #endif -/************************************************************************************ +/**************************************************************************************************** * Name: stm32_deselectsram * * Description: @@ -387,7 +407,7 @@ void stm32_selectsram(void); void stm32_deselectsram(void); #endif -/************************************************************************************ +/**************************************************************************************************** * Name: stm32_selectlcd * * Description: @@ -399,7 +419,7 @@ void stm32_deselectsram(void); void stm32_selectlcd(void); #endif -/************************************************************************************ +/**************************************************************************************************** * Name: stm32_deselectlcd * * Description: @@ -413,4 +433,3 @@ void stm32_deselectlcd(void); #endif /* __ASSEMBLY__ */ #endif /* __CONFIGS_STM3220G_EVAL_SRC_STM3220G_H */ - diff --git a/configs/stm3220g-eval/src/stm32_appinit.c b/configs/stm3220g-eval/src/stm32_appinit.c index 447bb24f3d..4800fca070 100644 --- a/configs/stm3220g-eval/src/stm32_appinit.c +++ b/configs/stm3220g-eval/src/stm32_appinit.c @@ -1,7 +1,7 @@ /**************************************************************************** * config/stm3220g_eval/src/stm32_appinit.c * - * Copyright (C) 2012, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -292,6 +292,16 @@ int board_app_initialize(uintptr_t arg) } #endif +#ifdef CONFIG_INPUT_STMPE811 + /* Initialize the touchscreen */ + + ret = stm32_tsc_setup(0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_tsc_setup failed: %d\n", ret); + } +#endif + #ifdef CONFIG_PWM /* Initialize PWM and register the PWM device. */ diff --git a/configs/stm3220g-eval/src/stm32_stmpe811.c b/configs/stm3220g-eval/src/stm32_stmpe811.c index 716761235c..d0346d5cf2 100644 --- a/configs/stm3220g-eval/src/stm32_stmpe811.c +++ b/configs/stm3220g-eval/src/stm32_stmpe811.c @@ -146,7 +146,8 @@ struct stm32_stmpe811config_s /* IRQ/GPIO access callbacks. These operations all hidden behind callbacks * to isolate the STMPE811 driver from differences in GPIO - * interrupt handling by varying boards and MCUs.* so that contact and loss-of-contact events can be detected. + * interrupt handling by varying boards and MCUs.* so that contact and loss- + * of-contact events can be detected. * * attach - Attach the STMPE811 interrupt handler to the GPIO interrupt * enable - Enable or disable the GPIO interrupt @@ -264,16 +265,15 @@ static void stmpe811_clear(FAR struct stmpe811_config_s *state) ****************************************************************************/ /**************************************************************************** - * Name: board_tsc_setup + * Name: stm32_tsc_setup * * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * configure the touchscreen device. This function will register the driver - * as /dev/inputN where N is the minor device number. + * This function is called by board-bringup logic to configure the + * touchscreen device. This function will register the driver as + * /dev/inputN where N is the minor device number. * * Input Parameters: - * minor - The input device minor number + * minor - The input device minor number * * Returned Value: * Zero is returned on success. Otherwise, a negated errno value is @@ -281,7 +281,7 @@ static void stmpe811_clear(FAR struct stmpe811_config_s *state) * ****************************************************************************/ -int board_tsc_setup(int minor) +int stm32_tsc_setup(int minor) { #ifndef CONFIG_STMPE811_TSC_DISABLE FAR struct i2c_master_s *dev; diff --git a/configs/stm3240g-eval/knxwm/defconfig b/configs/stm3240g-eval/knxwm/defconfig index 8a33d10f56..916720ff0a 100644 --- a/configs/stm3240g-eval/knxwm/defconfig +++ b/configs/stm3240g-eval/knxwm/defconfig @@ -15,7 +15,6 @@ CONFIG_ARM_MPU=y CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y CONFIG_BOARD_INITIALIZE=y CONFIG_BOARD_LOOPSPERMSEC=16717 -CONFIG_BOARDCTL_TSCTEST=y CONFIG_BUILD_PROTECTED=y CONFIG_CXX_NEWLONG=y CONFIG_DISABLE_POLL=y diff --git a/configs/stm3240g-eval/nxwm/defconfig b/configs/stm3240g-eval/nxwm/defconfig index a72b8984d4..6a277c9bd8 100644 --- a/configs/stm3240g-eval/nxwm/defconfig +++ b/configs/stm3240g-eval/nxwm/defconfig @@ -15,7 +15,6 @@ CONFIG_ARCH_STACKDUMP=y CONFIG_ARCH="arm" CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=y CONFIG_BOARD_LOOPSPERMSEC=16717 -CONFIG_BOARDCTL_TSCTEST=y CONFIG_FAT_LCNAMES=y CONFIG_FAT_LFN=y CONFIG_FS_FAT=y diff --git a/configs/stm3240g-eval/src/stm3240g-eval.h b/configs/stm3240g-eval/src/stm3240g-eval.h index 8b98bf85d5..71d997bbd3 100644 --- a/configs/stm3240g-eval/src/stm3240g-eval.h +++ b/configs/stm3240g-eval/src/stm3240g-eval.h @@ -1,7 +1,7 @@ /**************************************************************************************************** * configs/stm3240g_eval/src/stm3240g_eval.h * - * Copyright (C) 2011-2013, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2011-2013, 2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -266,6 +266,26 @@ void weak_function stm32_usbinitialize(void); int stm32_usbhost_initialize(void); #endif +/**************************************************************************************************** + * Name: stm32_tsc_setup + * + * Description: + * This function is called by board-bringup logic to configure the touchscreen device. This + * function will register the driver as /dev/inputN where N is the minor device number. + * + * Input Parameters: + * minor - The input device minor number + * + * Returned Value: + * Zero is returned on success. Otherwise, a negated errno value is returned to indicate the + * nature of the failure. + * + ****************************************************************************************************/ + +#ifdef CONFIG_INPUT_STMPE811 +int stm32_tsc_setup(int minor); +#endif + /**************************************************************************************************** * Name: stm32_led_initialize * diff --git a/configs/stm3240g-eval/src/stm32_appinit.c b/configs/stm3240g-eval/src/stm32_appinit.c index f3362bf012..1ae1aa76ba 100644 --- a/configs/stm3240g-eval/src/stm32_appinit.c +++ b/configs/stm3240g-eval/src/stm32_appinit.c @@ -67,7 +67,7 @@ * arg - The boardctl() argument is passed to the board_app_initialize() * implementation without modification. The argument has no * meaning to NuttX; the meaning of the argument is a contract - * between the board-specific initalization logic and the + * between the board-specific initialization logic and the * matching application logic. The value cold be such things as a * mode enumeration value, a set of DIP switch switch settings, a * pointer to configuration data read from a file or serial FLASH, diff --git a/configs/stm3240g-eval/src/stm32_boot.c b/configs/stm3240g-eval/src/stm32_boot.c index 13f7591a40..2309fc50bb 100644 --- a/configs/stm3240g-eval/src/stm32_boot.c +++ b/configs/stm3240g-eval/src/stm32_boot.c @@ -64,12 +64,8 @@ #endif /* Should we initialize the touchscreen for the NxWM (CONFIG_NXWM=y)? This - * is done if we have a touchscreen (CONFIG_INPUT_STMPE811=y), NxWM uses the - * touchscreen (CONFIG_NXWM_TOUCHSCREEN=y), and if we were asked to - * initialize the touchscreen for NxWM (NXWM_TOUCHSCREEN_DEVINIT=n). This - * combination of settings is normally only used in the kernel build mode - * (CONFIG_BUILD_PROTECTED) when NxWidgets is unable to initialize NX from - * user-space. + * is done if we have a touchscreen (CONFIG_INPUT_STMPE811=y) and NxWM uses the + * touchscreen (CONFIG_NXWM_TOUCHSCREEN=y). */ #undef HAVE_TCINIT @@ -78,14 +74,10 @@ # if !defined(CONFIG_NXWM_TOUCHSCREEN_DEVNO) # error CONFIG_NXWM_TOUCHSCREEN_DEVNO is not defined # elif defined(CONFIG_INPUT_STMPE811) -# if !defined(CONFIG_NXWM_TOUCHSCREEN_DEVINIT) -# define HAVE_TCINIT -# include -# endif +# define HAVE_TCINIT 1 +# include # else -# if !defined(CONFIG_NXWM_TOUCHSCREEN_DEVINIT) && defined(CONFIG_BUILD_PROTECTED) -# error CONFIG_INPUT_STMPE811=y is needed -# endif +# error CONFIG_INPUT_STMPE811=y is needed # endif #endif @@ -143,10 +135,7 @@ static int board_initthread(int argc, char *argv[]) { int ret; - /* Perform NSH initialization here instead of from the NSH. This - * alternative NSH initialization is necessary when NSH is ran in user-space - * but the initialization function must run in kernel space. - */ + /* Perform the board initialization on an initialization thread */ ret = stm32_bringup(); if (ret < 0) @@ -154,26 +143,6 @@ static int board_initthread(int argc, char *argv[]) gerr("ERROR: stm32_bringup failed: %d\n", ret); } -#ifdef HAVE_NXSTART - /* Initialize the NX server */ - - ret = nx_start(); - if (ret < 0) - { - gerr("ERROR: nx_start failed: %d\n", ret); - } -#endif - -#ifdef HAVE_TCINIT - /* Initialize the touchscreen */ - - ret = board_tsc_setup(CONFIG_NXWM_TOUCHSCREEN_DEVNO); - if (ret < 0) - { - gerr("ERROR: board_tsc_setup failed: %d\n", ret); - } -#endif - return EXIT_SUCCESS; } #endif @@ -257,6 +226,11 @@ void board_initialize(void) NULL); ASSERT(server > 0); #else + /* Perform the board initialization on the start-up thread. Some + * initializations may fail in this case due to the limited capability of + * the start-up thread. + */ + (void)stm32_bringup(); #endif } diff --git a/configs/stm3240g-eval/src/stm32_bringup.c b/configs/stm3240g-eval/src/stm32_bringup.c index 3fcc402b22..61d3f4a69c 100644 --- a/configs/stm3240g-eval/src/stm32_bringup.c +++ b/configs/stm3240g-eval/src/stm32_bringup.c @@ -354,6 +354,26 @@ int stm32_bringup(void) } #endif +#ifdef HAVE_NXSTART + /* Initialize the NX server */ + + ret = nx_start(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: nx_start failed: %d\n", ret); + } +#endif + +#ifdef HAVE_TCINIT + /* Initialize the touchscreen */ + + ret = stm32_tsc_setup(CONFIG_NXWM_TOUCHSCREEN_DEVNO); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_tsc_setup failed: %d\n", ret); + } +#endif + #ifdef CONFIG_PWM /* Initialize PWM and register the PWM device. */ diff --git a/configs/stm3240g-eval/src/stm32_stmpe811.c b/configs/stm3240g-eval/src/stm32_stmpe811.c index 1a03197263..876b91d0d5 100644 --- a/configs/stm3240g-eval/src/stm32_stmpe811.c +++ b/configs/stm3240g-eval/src/stm32_stmpe811.c @@ -264,13 +264,12 @@ static void stmpe811_clear(FAR struct stmpe811_config_s *state) ****************************************************************************/ /**************************************************************************** - * Name: board_tsc_setup + * Name: stm32_tsc_setup * * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * configure the touchscreen device. This function will register the driver - * as /dev/inputN where N is the minor device number. + * This function is called by board-bringup logic to configure the + * touchscreen device. This function will register the driver as + * /dev/inputN where N is the minor device number. * * Input Parameters: * minor - The input device minor number @@ -281,7 +280,7 @@ static void stmpe811_clear(FAR struct stmpe811_config_s *state) * ****************************************************************************/ -int board_tsc_setup(int minor) +int stm32_tsc_setup(int minor) { #ifndef CONFIG_STMPE811_TSC_DISABLE FAR struct i2c_master_s *dev; diff --git a/configs/stm32f429i-disco/nxwm/defconfig b/configs/stm32f429i-disco/nxwm/defconfig index c1bda648f9..4485aa414b 100644 --- a/configs/stm32f429i-disco/nxwm/defconfig +++ b/configs/stm32f429i-disco/nxwm/defconfig @@ -13,7 +13,6 @@ CONFIG_ARCH_STACKDUMP=y CONFIG_ARCH="arm" CONFIG_BOARD_INITIALIZE=y CONFIG_BOARD_LOOPSPERMSEC=16717 -CONFIG_BOARDCTL_TSCTEST=y CONFIG_BUILTIN=y CONFIG_DEBUG_CUSTOMOPT=y CONFIG_DEBUG_SYMBOLS=y diff --git a/configs/stm32f429i-disco/src/stm32_boot.c b/configs/stm32f429i-disco/src/stm32_boot.c index 8af811400a..9dda08d1de 100644 --- a/configs/stm32f429i-disco/src/stm32_boot.c +++ b/configs/stm32f429i-disco/src/stm32_boot.c @@ -68,12 +68,8 @@ #endif /* Should we initialize the touchscreen for the NxWM (CONFIG_NXWM=y)? This - * is done if we have a touchscreen (CONFIG_INPUT_STMPE811=y), NxWM uses the - * touchscreen (CONFIG_NXWM_TOUCHSCREEN=y), and if we were asked to - * initialize the touchscreen for NxWM (NXWM_TOUCHSCREEN_DEVINIT=n). This - * combination of settings is normally only used in the kernel build mode - * (CONFIG_BUILD_PROTECTED) when NxWidgets is unable to initialize NX from - * user-space. + * is done if we have a touchscreen (CONFIG_INPUT_STMPE811=y) and NxWM uses the + * touchscreen (CONFIG_NXWM_TOUCHSCREEN=y). */ #undef HAVE_TCINIT @@ -82,14 +78,10 @@ # if !defined(CONFIG_NXWM_TOUCHSCREEN_DEVNO) # error CONFIG_NXWM_TOUCHSCREEN_DEVNO is not defined # elif defined(CONFIG_INPUT_STMPE811) -# if !defined(CONFIG_NXWM_TOUCHSCREEN_DEVINIT) -# define HAVE_TCINIT -# include -# endif +# define HAVE_TCINIT +# include # else -# if !defined(CONFIG_NXWM_TOUCHSCREEN_DEVINIT) && defined(CONFIG_BUILD_PROTECTED) -# error CONFIG_INPUT_STMPE811=y is needed -# endif +# error CONFIG_INPUT_STMPE811=y is needed # endif #endif diff --git a/configs/stm32f429i-disco/src/stm32_bringup.c b/configs/stm32f429i-disco/src/stm32_bringup.c index 3ba8a5c213..821ddeb199 100644 --- a/configs/stm32f429i-disco/src/stm32_bringup.c +++ b/configs/stm32f429i-disco/src/stm32_bringup.c @@ -1,7 +1,7 @@ /**************************************************************************** * config/stm32f429i-disco/src/stm32_bringup.c * - * Copyright (C) 2012, 2015-2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2015-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -345,6 +345,16 @@ int stm32_bringup(void) } #endif +#ifdef CONFIG_INPUT_STMPE811 + /* Initialize the touchscreen */ + + ret = stm32_tsc_setup(0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_tsc_setup failed: %d\n", ret); + } +#endif + #ifdef CONFIG_SENSORS_L3GD20 ret = stm32_l3gd20initialize("/dev/gyr0"); if (ret != OK) diff --git a/configs/stm32f429i-disco/src/stm32_stmpe811.c b/configs/stm32f429i-disco/src/stm32_stmpe811.c index c089990ee7..71bc9830d9 100644 --- a/configs/stm32f429i-disco/src/stm32_stmpe811.c +++ b/configs/stm32f429i-disco/src/stm32_stmpe811.c @@ -267,13 +267,12 @@ static void stmpe811_clear(FAR struct stmpe811_config_s *state) ****************************************************************************/ /**************************************************************************** - * Name: board_tsc_setup + * Name: stm32_tsc_setup * * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * configure the touchscreen device. This function will register the driver - * as /dev/inputN where N is the minor device number. + * This function is called by board-bringup logic to configure the + * touchscreen device. This function will register the driver as + * /dev/inputN where N is the minor device number. * * Input Parameters: * minor - The input device minor number @@ -284,7 +283,7 @@ static void stmpe811_clear(FAR struct stmpe811_config_s *state) * ****************************************************************************/ -int board_tsc_setup(int minor) +int stm32_tsc_setup(int minor) { #ifndef CONFIG_STMPE811_TSC_DISABLE FAR struct i2c_master_s *dev; diff --git a/configs/stm32f429i-disco/src/stm32f429i-disco.h b/configs/stm32f429i-disco/src/stm32f429i-disco.h index 46355dcdc1..d324060876 100644 --- a/configs/stm32f429i-disco/src/stm32f429i-disco.h +++ b/configs/stm32f429i-disco/src/stm32f429i-disco.h @@ -1,7 +1,7 @@ /**************************************************************************** * configs/stm32f429i-disco/src/stm32f429i-disco.h * - * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2011-2012, 2018 Gregory Nutt. All rights reserved. * Authors: Gregory Nutt * Marco Krahl * @@ -230,8 +230,8 @@ void weak_function stm32_spidev_initialize(void); * Name: stm32_usbinitialize * * Description: - * Called from stm32_usbinitialize very early in inialization to setup USB-related - * GPIO pins for the STM32F429Discovery board. + * Called from stm32_usbinitialize very early in inialization to setup USB- + * related GPIO pins for the STM32F429Discovery board. * ****************************************************************************/ @@ -253,6 +253,27 @@ void weak_function stm32_usbinitialize(void); int stm32_usbhost_initialize(void); #endif +/**************************************************************************** + * Name: stm32_tsc_setup + * + * Description: + * This function is called by board-bringup logic to configure the + * touchscreen device. This function will register the driver as + * /dev/inputN where N is the minor device number. + * + * Input Parameters: + * minor - The input device minor number + * + * Returned Value: + * Zero is returned on success. Otherwise, a negated errno value is + * returned to indicate the nature of the failure. + * + ****************************************************************************/ + +#ifdef CONFIG_INPUT_STMPE811 +int stm32_tsc_setup(int minor); +#endif + /**************************************************************************** * Name: stm32_enablefsmc @@ -352,7 +373,6 @@ FAR struct ili9341_lcd_s *stm32_ili93414ws_initialize(void); FAR struct spi_dev_s *stm32_spi5initialize(void); #endif - /**************************************************************************** * Name: stm32_l3gd20initialize() * diff --git a/configs/viewtool-stm32f107/src/stm32_bringup.c b/configs/viewtool-stm32f107/src/stm32_bringup.c index cba3798e88..97ca12b986 100644 --- a/configs/viewtool-stm32f107/src/stm32_bringup.c +++ b/configs/viewtool-stm32f107/src/stm32_bringup.c @@ -1,7 +1,7 @@ /**************************************************************************** * config/viewtool-stm32f107/src/stm32_bringup.c * - * Copyright (C) 2013, 2016-2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2013, 2016-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -165,6 +165,16 @@ int stm32_bringup(void) } #endif +#ifdef CONFIG_INPUT_ADS7843E + /* Initialize the touchscreen */ + + ret = stm32_tsc_setup(0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_tsc_setup failed: %d\n", ret); + } +#endif + #ifdef CONFIG_CAN /* Initialize CAN and register the CAN driver. */ diff --git a/configs/viewtool-stm32f107/src/stm32_touchscreen.c b/configs/viewtool-stm32f107/src/stm32_touchscreen.c index 17539fc9b5..afac08aa2b 100644 --- a/configs/viewtool-stm32f107/src/stm32_touchscreen.c +++ b/configs/viewtool-stm32f107/src/stm32_touchscreen.c @@ -239,13 +239,12 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state) ****************************************************************************/ /**************************************************************************** - * Name: board_tsc_setup + * Name: stm32_tsc_setup * * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * configure the touchscreen device. This function will register the driver - * as /dev/inputN where N is the minor device number. + * This function is called by board-bringup logic to configure the + * touchscreen device. This function will register the driver as + * /dev/inputN where N is the minor device number. * * Input Parameters: * minor - The input device minor number @@ -256,7 +255,7 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state) * ****************************************************************************/ -int board_tsc_setup(int minor) +int stm32_tsc_setup(int minor) { FAR struct spi_dev_s *dev; static bool initialized = false; diff --git a/configs/viewtool-stm32f107/src/viewtool_stm32f107.h b/configs/viewtool-stm32f107/src/viewtool_stm32f107.h index 8ec579e140..8a196108c5 100644 --- a/configs/viewtool-stm32f107/src/viewtool_stm32f107.h +++ b/configs/viewtool-stm32f107/src/viewtool_stm32f107.h @@ -1,7 +1,7 @@ /**************************************************************************** * configs/viewtool-stm32f107/src/viewtool_stm32f107.h * - * Copyright (C) 2013-2014, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2013-2014, 2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -348,8 +348,8 @@ void stm32_led_initialize(void); * Name: stm32_usbdev_initialize * * Description: - * Called from stm32_usbdev_initialize very early in initialization to setup USB-related - * GPIO pins for the Viewtool STM32F107 board. + * Called from stm32_usbdev_initialize very early in initialization to + * setup USB-related GPIO pins for the Viewtool STM32F107 board. * ****************************************************************************/ @@ -357,6 +357,27 @@ void stm32_led_initialize(void); void weak_function stm32_usbdev_initialize(void); #endif +/**************************************************************************** + * Name: stm32_tsc_setup + * + * Description: + * This function is called by board-bringup logic to configure the + * touchscreen device. This function will register the driver as + * /dev/inputN where N is the minor device number. + * + * Input Parameters: + * minor - The input device minor number + * + * Returned Value: + * Zero is returned on success. Otherwise, a negated errno value is + * returned to indicate the nature of the failure. + * + ****************************************************************************/ + +#ifdef CONFIG_INPUT_ADS7843E +int stm32_tsc_setup(int minor); +#endif + /**************************************************************************** * Name: stm32_sdinitialize * diff --git a/include/nuttx/board.h b/include/nuttx/board.h index b2b39d5c88..5c646a48a9 100644 --- a/include/nuttx/board.h +++ b/include/nuttx/board.h @@ -285,33 +285,6 @@ int board_composite_initialize(int port); FAR void *board_composite_connect(int port, int configid); #endif -/**************************************************************************** - * Name: board_tsc_setup - * - * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * configure the touchscreen device. This function will register the driver - * as /dev/inputN where N is the minor device number. - * - * This is an internal OS interface but may be invoked indirectly from - * application-level touchscreen testing logic (perhaps by - * apps/examples/touchscreen). If CONFIG_LIB_BOARDCTL=y and - * CONFIG_BOARDCTL_TSCTEST=y, then this functions will be invoked via the - * (non-standard) boardctl() interface using the BOARDIOC_TSCTEST_SETUP - * command. - * - * Input Parameters: - * minor - The input device minor number - * - * Returned Value: - * Zero is returned on success. Otherwise, a negated errno value is - * returned to indicate the nature of the failure. - * - ****************************************************************************/ - -int board_tsc_setup(int minor); - /**************************************************************************** * Name: board_graphics_setup * diff --git a/include/sys/boardctl.h b/include/sys/boardctl.h index 84d828f8a2..907fbd6606 100644 --- a/include/sys/boardctl.h +++ b/include/sys/boardctl.h @@ -114,12 +114,6 @@ * ARG: None * CONFIGURATION: CONFIG_NX * DEPENDENCIES: Base graphics logic provides nx_start() - * - * CMD: BOARDIOC_TSCTEST_SETUP - * DESCRIPTION: Touchscreen controller test configuration - * ARG: Touch controller device minor number - * CONFIGURATION: CONFIG_LIB_BOARDCTL && CONFIG_BOARDCTL_TSCTEST - * DEPENDENCIES: Board logic must provide board_tsc_setup() */ #define BOARDIOC_INIT _BOARDIOC(0x0001) @@ -130,7 +124,6 @@ #define BOARDIOC_OS_SYMTAB _BOARDIOC(0x0006) #define BOARDIOC_USBDEV_CONTROL _BOARDIOC(0x0007) #define BOARDIOC_NX_START _BOARDIOC(0x0008) -#define BOARDIOC_TSCTEST_SETUP _BOARDIOC(0x0009) /* If CONFIG_BOARDCTL_IOCTL=y, then board-specific commands will be support. * In this case, all commands not recognized by boardctl() will be forwarded @@ -139,7 +132,7 @@ * User defined board commands may begin with this value: */ -#define BOARDIOC_USER _BOARDIOC(0x000a) +#define BOARDIOC_USER _BOARDIOC(0x0009) /**************************************************************************** * Public Type Definitions -- GitLab From 43390c78eaa7f7fa2eee4ec8e6ac73f4e3e9d861 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 17 Jan 2018 10:14:03 -0600 Subject: [PATCH 028/228] configs: Since the touch screen initialization is now called from one-time board-initialization logic, it no longer needs protection from re-entry. --- configs/arduino-due/src/sam_touchscreen.c | 50 +++++++---------- configs/open1788/src/lpc17_touchscreen.c | 50 +++++++---------- configs/sama5d3x-ek/src/sam_touchscreen.c | 42 ++++++--------- configs/sama5d4-ek/src/sam_maxtouch.c | 54 +++++++------------ configs/samv71-xult/src/sam_maxtouch.c | 54 +++++++------------ .../src/stm32_touchscreen.c | 46 ++++++---------- 6 files changed, 110 insertions(+), 186 deletions(-) diff --git a/configs/arduino-due/src/sam_touchscreen.c b/configs/arduino-due/src/sam_touchscreen.c index b03ba31fb8..48dae4c162 100644 --- a/configs/arduino-due/src/sam_touchscreen.c +++ b/configs/arduino-due/src/sam_touchscreen.c @@ -355,50 +355,36 @@ static FAR struct spi_dev_s *sam_tsc_spiinitialize(void) int sam_tsc_setup(int minor) { FAR struct spi_dev_s *dev; - static bool initialized = false; int ret; iinfo("minor %d\n", minor); DEBUGASSERT(minor == 0); - /* Have we already initialized? Since we never uninitialize we must prevent - * multiple initializations. This is necessary, for example, when the - * touchscreen example is used as a built-in application in NSH and can be - * called numerous time. It will attempt to initialize each time. - */ + /* Configure and enable the XPT2046 interrupt pin as an input */ - if (!initialized) - { - /* Configure and enable the XPT2046 interrupt pin as an input */ - - (void)sam_configgpio(GPIO_TSC_IRQ); - - /* Configure the PIO interrupt */ - - sam_gpioirq(SAM_TSC_IRQ); + (void)sam_configgpio(GPIO_TSC_IRQ); - /* Get an instance of the SPI interface for the touchscreen chip select */ + /* Configure the PIO interrupt */ - dev = sam_tsc_spiinitialize(); - if (!dev) - { - ierr("ERROR: Failed to initialize bit bang SPI\n"); - return -ENODEV; - } + sam_gpioirq(SAM_TSC_IRQ); - /* Initialize and register the SPI touschscreen device */ + /* Get an instance of the SPI interface for the touchscreen chip select */ - ret = ads7843e_register(dev, &g_tscinfo, CONFIG_ADS7843E_DEVMINOR); - if (ret < 0) - { - ierr("ERROR: Failed to register touchscreen device\n"); - /* up_spiuninitialize(dev); */ - return -ENODEV; - } + dev = sam_tsc_spiinitialize(); + if (!dev) + { + ierr("ERROR: Failed to initialize bit bang SPI\n"); + return -ENODEV; + } - /* Now we are initialized */ + /* Initialize and register the SPI touschscreen device */ - initialized = true; + ret = ads7843e_register(dev, &g_tscinfo, CONFIG_ADS7843E_DEVMINOR); + if (ret < 0) + { + ierr("ERROR: Failed to register touchscreen device\n"); + /* up_spiuninitialize(dev); */ + return -ENODEV; } return OK; diff --git a/configs/open1788/src/lpc17_touchscreen.c b/configs/open1788/src/lpc17_touchscreen.c index 6c72a9205e..65a0f33fae 100644 --- a/configs/open1788/src/lpc17_touchscreen.c +++ b/configs/open1788/src/lpc17_touchscreen.c @@ -272,50 +272,40 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state) int open1788_tsc_setup(int minor) { - static bool initialized = false; FAR struct spi_dev_s *dev; int ret; - iinfo("initialized:%d minor:%d\n", initialized, minor); + iinfo("minor:%d\n", minor); DEBUGASSERT(minor == 0); - /* Since there is no uninitialized logic, this initialization can be - * performed only one time. - */ - - if (!initialized) - { - /* Configure and enable the XPT2046 PENIRQ pin as an interrupting input. */ + /* Configure and enable the XPT2046 PENIRQ pin as an interrupting input. */ - (void)lpc17_configgpio(GPIO_TC_PENIRQ); + (void)lpc17_configgpio(GPIO_TC_PENIRQ); - /* Configure the XPT2046 BUSY pin as a normal input. */ + /* Configure the XPT2046 BUSY pin as a normal input. */ #ifndef XPT2046_NO_BUSY - (void)lpc17_configgpio(GPIO_TC_BUSY); + (void)lpc17_configgpio(GPIO_TC_BUSY); #endif - /* Get an instance of the SPI interface */ - - dev = lpc17_sspbus_initialize(CONFIG_ADS7843E_SPIDEV); - if (!dev) - { - ierr("ERROR: Failed to initialize SPI bus %d\n", CONFIG_ADS7843E_SPIDEV); - return -ENODEV; - } + /* Get an instance of the SPI interface */ - /* Initialize and register the SPI touchscreen device */ + dev = lpc17_sspbus_initialize(CONFIG_ADS7843E_SPIDEV); + if (!dev) + { + ierr("ERROR: Failed to initialize SPI bus %d\n", CONFIG_ADS7843E_SPIDEV); + return -ENODEV; + } - ret = ads7843e_register(dev, &g_tscinfo, CONFIG_ADS7843E_DEVMINOR); - if (ret < 0) - { - ierr("ERROR: Failed to register touchscreen device minor=%d\n", - CONFIG_ADS7843E_DEVMINOR); - /* up_spiuninitialize(dev); */ - return -ENODEV; - } + /* Initialize and register the SPI touchscreen device */ - initialized = true; + ret = ads7843e_register(dev, &g_tscinfo, CONFIG_ADS7843E_DEVMINOR); + if (ret < 0) + { + ierr("ERROR: Failed to register touchscreen device minor=%d\n", + CONFIG_ADS7843E_DEVMINOR); + /* up_spiuninitialize(dev); */ + return -ENODEV; } return OK; diff --git a/configs/sama5d3x-ek/src/sam_touchscreen.c b/configs/sama5d3x-ek/src/sam_touchscreen.c index cbeba1ec02..e22f991121 100644 --- a/configs/sama5d3x-ek/src/sam_touchscreen.c +++ b/configs/sama5d3x-ek/src/sam_touchscreen.c @@ -88,38 +88,28 @@ int sam_tsc_setup(int minor) { struct sam_adc_s *adc; - static bool initialized = false; int ret; - iinfo("initialized:%d minor:%d\n", initialized, minor); + iinfo("minor:%d\n", minor); DEBUGASSERT(minor == 0); - /* Since there is no uninitialized logic, this initialization can be - * performed only one time. - */ + /* Initialize the ADC driver */ - if (!initialized) + adc = sam_adc_initialize(); + if (!adc) { - /* Initialize the ADC driver */ - - adc = sam_adc_initialize(); - if (!adc) - { - ierr("ERROR: Failed to initialize the ADC driver\n"); - return -ENODEV; - } - - /* Initialize and register the SPI touchscreen device */ - - ret = sam_tsd_register(adc, CONFIG_SAMA5D3xEK_TSD_DEVMINOR); - if (ret < 0) - { - ierr("ERROR: Failed to register touchscreen device /dev/input%d: %d\n", - CONFIG_SAMA5D3xEK_TSD_DEVMINOR, ret); - return -ENODEV; - } - - initialized = true; + ierr("ERROR: Failed to initialize the ADC driver\n"); + return -ENODEV; + } + + /* Initialize and register the SPI touchscreen device */ + + ret = sam_tsd_register(adc, CONFIG_SAMA5D3xEK_TSD_DEVMINOR); + if (ret < 0) + { + ierr("ERROR: Failed to register touchscreen device /dev/input%d: %d\n", + CONFIG_SAMA5D3xEK_TSD_DEVMINOR, ret); + return -ENODEV; } return OK; diff --git a/configs/sama5d4-ek/src/sam_maxtouch.c b/configs/sama5d4-ek/src/sam_maxtouch.c index 3a2e3f5f37..0790caa711 100644 --- a/configs/sama5d4-ek/src/sam_maxtouch.c +++ b/configs/sama5d4-ek/src/sam_maxtouch.c @@ -238,52 +238,38 @@ static int mxt_interrupt(int irq, FAR void *context, FAR void *arg) int sam_tsc_setup(int minor) { FAR struct i2c_master_s *i2c; - static bool initialized = false; int ret; iinfo("minor %d\n", minor); DEBUGASSERT(minor == 0); - /* Have we already initialized? Since we never uninitialize we must prevent - * multiple initializations. This is necessary, for example, when the - * touchscreen example is used as a built-in application in NSH and can be - * called numerous time. It will attempt to initialize each time. - */ - - if (!initialized) - { - /* Configure the maXTouch CHG interrupt pin */ - - (void)sam_configpio(PIO_CHG_MXT); + /* Configure the maXTouch CHG interrupt pin */ - /* Get an instance of the I2C interface for the touchscreen chip select */ + (void)sam_configpio(PIO_CHG_MXT); - i2c = sam_i2cbus_initialize(MXT_TWI_BUS); - if (!i2c) - { - ierr("ERROR: Failed to initialize I2C%d\n", MXT_TWI_BUS); - return -ENODEV; - } + /* Get an instance of the I2C interface for the touchscreen chip select */ - /* Configure maXTouch CHG interrupts */ - - sam_pioirq(PIO_CHG_MXT); - (void)irq_attach(IRQ_CHG_MXT, mxt_interrupt, NULL); + i2c = sam_i2cbus_initialize(MXT_TWI_BUS); + if (!i2c) + { + ierr("ERROR: Failed to initialize I2C%d\n", MXT_TWI_BUS); + return -ENODEV; + } - /* Initialize and register the I2C touchscreen device */ + /* Configure maXTouch CHG interrupts */ - ret = mxt_register(i2c, &g_mxtinfo.lower, CONFIG_SAMA5D4EK_MXT_DEVMINOR); - if (ret < 0) - { - ierr("ERROR: Failed to register touchscreen device\n"); - irq_detach(IRQ_CHG_MXT); - /* sam_i2cbus_uninitialize(i2c); */ - return -ENODEV; - } + sam_pioirq(PIO_CHG_MXT); + (void)irq_attach(IRQ_CHG_MXT, mxt_interrupt, NULL); - /* Now we are initialized */ + /* Initialize and register the I2C touchscreen device */ - initialized = true; + ret = mxt_register(i2c, &g_mxtinfo.lower, CONFIG_SAMA5D4EK_MXT_DEVMINOR); + if (ret < 0) + { + ierr("ERROR: Failed to register touchscreen device\n"); + irq_detach(IRQ_CHG_MXT); + /* sam_i2cbus_uninitialize(i2c); */ + return -ENODEV; } return OK; diff --git a/configs/samv71-xult/src/sam_maxtouch.c b/configs/samv71-xult/src/sam_maxtouch.c index 7db38fd551..e368d5958d 100644 --- a/configs/samv71-xult/src/sam_maxtouch.c +++ b/configs/samv71-xult/src/sam_maxtouch.c @@ -237,52 +237,38 @@ static int mxt_interrupt(int irq, FAR void *context, FAR void *arg) int sam_tsc_setup(int minor) { FAR struct i2c_master_s *i2c; - static bool initialized = false; int ret; iinfo("minor %d\n", minor); DEBUGASSERT(minor == 0); - /* Have we already initialized? Since we never uninitialize we must prevent - * multiple initializations. This is necessary, for example, when the - * touchscreen example is used as a built-in application in NSH and can be - * called numerous time. It will attempt to initialize each time. - */ - - if (!initialized) - { - /* Configure the maXTouch CHG interrupt pin */ - - (void)sam_configgpio(GPIO_MXT_CHG); + /* Configure the maXTouch CHG interrupt pin */ - /* Get an instance of the I2C interface for the touchscreen chip select */ + (void)sam_configgpio(GPIO_MXT_CHG); - i2c = sam_i2cbus_initialize(MXT_TWI_BUS); - if (!i2c) - { - ierr("ERROR: Failed to initialize I2C%d\n", MXT_TWI_BUS); - return -ENODEV; - } + /* Get an instance of the I2C interface for the touchscreen chip select */ - /* Configure maXTouch CHG interrupts */ - - sam_gpioirq(GPIO_MXT_CHG); - (void)irq_attach(IRQ_MXT_CHG, mxt_interrupt, NULL); + i2c = sam_i2cbus_initialize(MXT_TWI_BUS); + if (!i2c) + { + ierr("ERROR: Failed to initialize I2C%d\n", MXT_TWI_BUS); + return -ENODEV; + } - /* Initialize and register the I2C touchscreen device */ + /* Configure maXTouch CHG interrupts */ - ret = mxt_register(i2c, &g_mxtinfo.lower, CONFIG_SAMV71XULT_MXT_DEVMINOR); - if (ret < 0) - { - ierr("ERROR: Failed to register touchscreen device\n"); - irq_detach(IRQ_MXT_CHG); - /* sam_i2cbus_uninitialize(i2c); */ - return -ENODEV; - } + sam_gpioirq(GPIO_MXT_CHG); + (void)irq_attach(IRQ_MXT_CHG, mxt_interrupt, NULL); - /* Now we are initialized */ + /* Initialize and register the I2C touchscreen device */ - initialized = true; + ret = mxt_register(i2c, &g_mxtinfo.lower, CONFIG_SAMV71XULT_MXT_DEVMINOR); + if (ret < 0) + { + ierr("ERROR: Failed to register touchscreen device\n"); + irq_detach(IRQ_MXT_CHG); + /* sam_i2cbus_uninitialize(i2c); */ + return -ENODEV; } return OK; diff --git a/configs/viewtool-stm32f107/src/stm32_touchscreen.c b/configs/viewtool-stm32f107/src/stm32_touchscreen.c index afac08aa2b..39130e7893 100644 --- a/configs/viewtool-stm32f107/src/stm32_touchscreen.c +++ b/configs/viewtool-stm32f107/src/stm32_touchscreen.c @@ -258,46 +258,32 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state) int stm32_tsc_setup(int minor) { FAR struct spi_dev_s *dev; - static bool initialized = false; int ret; iinfo("minor %d\n", minor); DEBUGASSERT(minor == 0); - /* Have we already initialized? Since we never uninitialize we must prevent - * multiple initializations. This is necessary, for example, when the - * touchscreen example is used as a built-in application in NSH and can be - * called numerous time. It will attempt to initialize each time. - */ - - if (!initialized) - { - /* Configure the XPT2046 interrupt pin as an input */ - - (void)stm32_configgpio(GPIO_LCDTP_IRQ); + /* Configure the XPT2046 interrupt pin as an input */ - /* Get an instance of the SPI interface for the touchscreen chip select */ + (void)stm32_configgpio(GPIO_LCDTP_IRQ); - dev = stm32_spibus_initialize(TSC_DEVNUM); - if (!dev) - { - ierr("ERROR: Failed to initialize SPI%d\n", TSC_DEVNUM); - return -ENODEV; - } + /* Get an instance of the SPI interface for the touchscreen chip select */ - /* Initialize and register the SPI touchscreen device */ - - ret = ads7843e_register(dev, &g_tscinfo.config, CONFIG_ADS7843E_DEVMINOR); - if (ret < 0) - { - ierr("ERROR: Failed to register touchscreen device\n"); - /* up_spiuninitialize(dev); */ - return -ENODEV; - } + dev = stm32_spibus_initialize(TSC_DEVNUM); + if (!dev) + { + ierr("ERROR: Failed to initialize SPI%d\n", TSC_DEVNUM); + return -ENODEV; + } - /* Now we are initialized */ + /* Initialize and register the SPI touchscreen device */ - initialized = true; + ret = ads7843e_register(dev, &g_tscinfo.config, CONFIG_ADS7843E_DEVMINOR); + if (ret < 0) + { + ierr("ERROR: Failed to register touchscreen device\n"); + /* up_spiuninitialize(dev); */ + return -ENODEV; } return OK; -- GitLab From c456b87dcda407d9c71f1d6fdfb49705b6950490 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 17 Jan 2018 10:54:39 -0600 Subject: [PATCH 029/228] configs: CONFIG_MAX_TASKS muast be a power of 2 --- configs/olimexino-stm32/can/defconfig | 2 +- configs/olimexino-stm32/composite/defconfig | 2 +- configs/olimexino-stm32/nsh/defconfig | 2 +- configs/spark/composite/defconfig | 2 +- configs/spark/nsh/defconfig | 2 +- configs/spark/usbmsc/defconfig | 2 +- configs/spark/usbserial/defconfig | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/configs/olimexino-stm32/can/defconfig b/configs/olimexino-stm32/can/defconfig index 0791cf7889..8ed1c49642 100644 --- a/configs/olimexino-stm32/can/defconfig +++ b/configs/olimexino-stm32/can/defconfig @@ -48,7 +48,7 @@ CONFIG_I2C=y CONFIG_IDLETHREAD_STACKSIZE=300 CONFIG_INTELHEX_BINARY=y CONFIG_LIB_SENDFILE_BUFSIZE=0 -CONFIG_MAX_TASKS=12 +CONFIG_MAX_TASKS=16 CONFIG_MAX_WDOGPARMS=2 CONFIG_MM_SMALL=y CONFIG_NAME_MAX=8 diff --git a/configs/olimexino-stm32/composite/defconfig b/configs/olimexino-stm32/composite/defconfig index ad25c1672d..868b2a697e 100644 --- a/configs/olimexino-stm32/composite/defconfig +++ b/configs/olimexino-stm32/composite/defconfig @@ -66,7 +66,7 @@ CONFIG_HAVE_CXXINITIALIZE=y CONFIG_IDLETHREAD_STACKSIZE=300 CONFIG_INTELHEX_BINARY=y CONFIG_LIB_SENDFILE_BUFSIZE=0 -CONFIG_MAX_TASKS=12 +CONFIG_MAX_TASKS=16 CONFIG_MAX_WDOGPARMS=2 CONFIG_MM_SMALL=y CONFIG_MMCSD=y diff --git a/configs/olimexino-stm32/nsh/defconfig b/configs/olimexino-stm32/nsh/defconfig index 30a421918e..0bd53f08b2 100644 --- a/configs/olimexino-stm32/nsh/defconfig +++ b/configs/olimexino-stm32/nsh/defconfig @@ -54,7 +54,7 @@ CONFIG_HAVE_CXXINITIALIZE=y CONFIG_IDLETHREAD_STACKSIZE=300 CONFIG_INTELHEX_BINARY=y CONFIG_LIB_SENDFILE_BUFSIZE=0 -CONFIG_MAX_TASKS=12 +CONFIG_MAX_TASKS=16 CONFIG_MAX_WDOGPARMS=2 CONFIG_MM_SMALL=y CONFIG_MMCSD=y diff --git a/configs/spark/composite/defconfig b/configs/spark/composite/defconfig index af4f871100..64e28d8db7 100644 --- a/configs/spark/composite/defconfig +++ b/configs/spark/composite/defconfig @@ -58,7 +58,7 @@ CONFIG_IDLETHREAD_STACKSIZE=280 CONFIG_INTELHEX_BINARY=y CONFIG_LIB_RAND_ORDER=2 CONFIG_LIB_SENDFILE_BUFSIZE=0 -CONFIG_MAX_TASKS=12 +CONFIG_MAX_TASKS=16 CONFIG_MAX_WDOGPARMS=2 CONFIG_MM_SMALL=y CONFIG_MQ_MAXMSGSIZE=8 diff --git a/configs/spark/nsh/defconfig b/configs/spark/nsh/defconfig index 40363aae9f..28222b3f4d 100644 --- a/configs/spark/nsh/defconfig +++ b/configs/spark/nsh/defconfig @@ -49,7 +49,7 @@ CONFIG_IDLETHREAD_STACKSIZE=300 CONFIG_INTELHEX_BINARY=y CONFIG_LIB_RAND_ORDER=2 CONFIG_LIB_SENDFILE_BUFSIZE=0 -CONFIG_MAX_TASKS=12 +CONFIG_MAX_TASKS=16 CONFIG_MAX_WDOGPARMS=2 CONFIG_MM_SMALL=y CONFIG_MQ_MAXMSGSIZE=8 diff --git a/configs/spark/usbmsc/defconfig b/configs/spark/usbmsc/defconfig index 37cd3ef6cc..eed15c31c7 100644 --- a/configs/spark/usbmsc/defconfig +++ b/configs/spark/usbmsc/defconfig @@ -44,7 +44,7 @@ CONFIG_IDLETHREAD_STACKSIZE=280 CONFIG_INTELHEX_BINARY=y CONFIG_LIB_RAND_ORDER=2 CONFIG_LIB_SENDFILE_BUFSIZE=0 -CONFIG_MAX_TASKS=12 +CONFIG_MAX_TASKS=16 CONFIG_MAX_WDOGPARMS=2 CONFIG_MM_SMALL=y CONFIG_MQ_MAXMSGSIZE=8 diff --git a/configs/spark/usbserial/defconfig b/configs/spark/usbserial/defconfig index 1699ef387d..7b0d94af99 100644 --- a/configs/spark/usbserial/defconfig +++ b/configs/spark/usbserial/defconfig @@ -41,7 +41,7 @@ CONFIG_INTELHEX_BINARY=y CONFIG_LIB_BOARDCTL=y CONFIG_LIB_RAND_ORDER=2 CONFIG_LIB_SENDFILE_BUFSIZE=0 -CONFIG_MAX_TASKS=12 +CONFIG_MAX_TASKS=16 CONFIG_MAX_WDOGPARMS=2 CONFIG_MM_SMALL=y CONFIG_MQ_MAXMSGSIZE=8 -- GitLab From 2d95fa6d2a7e4cbc83c4abf88d92134a9e3ffcd6 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 17 Jan 2018 11:15:43 -0600 Subject: [PATCH 030/228] arch/arm/src/samdl: Correct a link time error if CONFIG_SAMDL_EIC is not enabled. --- arch/arm/src/samdl/sam_eic.c | 62 ++++++++++++++++++++++++++++------- arch/arm/src/samdl/sam_eic.h | 36 ++++++++++---------- arch/arm/src/samdl/sam_port.c | 4 ++- 3 files changed, 72 insertions(+), 30 deletions(-) diff --git a/arch/arm/src/samdl/sam_eic.c b/arch/arm/src/samdl/sam_eic.c index e666154838..15c33811c2 100644 --- a/arch/arm/src/samdl/sam_eic.c +++ b/arch/arm/src/samdl/sam_eic.c @@ -83,7 +83,7 @@ static int sam_eic_isr(int irq, FAR void *context, FAR void *arg) for(bit=0;bit> bit & 0x1) + if (intflag >> bit & 0x1) { irq_dispatch(SAM_IRQ_EXTINT0 + bit, context); } @@ -126,7 +126,13 @@ void sam_eic_dumpregs(void) * Name: sam_eic_initialize * * Description: - * Configure the external interrupt controller. + * Initialize the external interrupt controller (EIC). + * + * Input Parameters: + * gclkgen - GCLK Generator + * + * Returned Value: + * None * ****************************************************************************/ @@ -151,12 +157,26 @@ int sam_eic_initialize(uint8_t gclkgen) return OK; } +/**************************************************************************** + * Name: sam_eic_initialize + * + * Description: + * Enable a external interrupt. + * + * Input Parameters: + * irq - SAM_IRQ_EXTINTn IRQ to be enabled + * + * Returned Value: + * None + * + ****************************************************************************/ + int sam_eic_irq_enable(int irq) { uint32_t config; int eirq = irq - SAM_IRQ_EXTINT0; - config = getreg32(SAM_EIC_CONFIG0); + config = getreg32(SAM_EIC_CONFIG0); config |= EIC_CONFIG0_FILTEN(eirq) | EIC_CONFIG0_SENSE_FALL(eirq); putreg32(config, SAM_EIC_CONFIG0); @@ -165,6 +185,21 @@ int sam_eic_irq_enable(int irq) return OK; } +/**************************************************************************** + * Name: sam_eic_config + * + * Description: + * Configure the interrupt edge sensitivity in CONFIGn register of the EIC + * + * Input Parameters: + * eirq - Pin to be configured + * pinset - Configuration of the pin + * + * Returned Value: + * None + * + ****************************************************************************/ + int sam_eic_config(uint8_t eirq, port_pinset_t pinset) { uint32_t reg; @@ -173,18 +208,24 @@ int sam_eic_config(uint8_t eirq, port_pinset_t pinset) /* Determine which of the CONFIG[0:2] registers to write to */ - if(eirq < 8) + if (eirq < 8) { reg = SAM_EIC_CONFIG0; val = EIC_CONFIG0_SENSE_BOTH(eirq); - if(pinset & PORT_INT_RISING) - val = EIC_CONFIG0_SENSE_RISE(eirq); - if(pinset & PORT_INT_FALLING) - val = EIC_CONFIG0_SENSE_FALL(eirq); + if (pinset & PORT_INT_RISING) + { + val = EIC_CONFIG0_SENSE_RISE(eirq); + } + + if (pinset & PORT_INT_FALLING) + { + val = EIC_CONFIG0_SENSE_FALL(eirq); + } + val |= EIC_CONFIG0_FILTEN(eirq); } - else if(eirq < 16) + else if (eirq < 16) { reg = SAM_EIC_CONFIG1; val = EIC_CONFIG1_FILTEN(eirq) | EIC_CONFIG1_SENSE_FALL(eirq); @@ -197,7 +238,7 @@ int sam_eic_config(uint8_t eirq, port_pinset_t pinset) /* Write the new config to the CONFIGn register */ - config = getreg32(reg); + config = getreg32(reg); config |= val; putreg32(config, reg); @@ -206,6 +247,5 @@ int sam_eic_config(uint8_t eirq, port_pinset_t pinset) putreg32(EIC_EXTINT(eirq), SAM_EIC_INTENSET); sam_eic_dumpregs(); - return OK; } diff --git a/arch/arm/src/samdl/sam_eic.h b/arch/arm/src/samdl/sam_eic.h index b149d182ea..53fe547b36 100644 --- a/arch/arm/src/samdl/sam_eic.h +++ b/arch/arm/src/samdl/sam_eic.h @@ -57,19 +57,7 @@ #endif /**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/**************************************************************************** - * Inline Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Data + * Public Function Prototypes ****************************************************************************/ #undef EXTERN @@ -82,24 +70,36 @@ extern "C" #endif /**************************************************************************** - * Public Function Prototypes + * Name: sam_eic_initialize + * + * Description: + * Initialize the EIC + * + * Input Parameters: + * gclkgen - GCLK Generator + * + * Returned Value: + * None + * ****************************************************************************/ +int sam_eic_initialize(uint8_t gclkgen); + /**************************************************************************** - * Name: sam_eic_configure + * Name: sam_eic_config * * Description: - * Configure the EIC + * Configure the interrupt edge sensitivity in CONFIGn register of the EIC * * Input Parameters: - * gclkgen - GCLK Generator + * eirq - Pin to be configured + * pinset - Configuration of the pin * * Returned Value: * None * ****************************************************************************/ -int sam_eic_initialize(uint8_t gclkgen); int sam_eic_config(uint8_t eirq, port_pinset_t pinset); #undef EXTERN diff --git a/arch/arm/src/samdl/sam_port.c b/arch/arm/src/samdl/sam_port.c index 19be6f030f..7faaa6c44f 100644 --- a/arch/arm/src/samdl/sam_port.c +++ b/arch/arm/src/samdl/sam_port.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/samdl/sam_port.c * - * Copyright (C) 2014-2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2014-2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * References: @@ -204,9 +204,11 @@ static inline void sam_configinterrupt(uintptr_t base, port_pinset_t pinset) putreg32(regval, base + SAM_PORT_WRCONFIG_OFFSET); +#ifdef CONFIG_SAMDL_EIC /* Configure the interrupt edge sensitivity in CONFIGn register of the EIC */ sam_eic_config(pin, pinset); +#endif #ifdef CONFIG_DEBUG_GPIO_INFO sam_dumpport(pinset, "extint"); -- GitLab From 3ff30608ef463321f333349bb60bbb2b1613d03a Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 17 Jan 2018 11:39:43 -0600 Subject: [PATCH 031/228] arch/arm/src/samdl: Mostly cosmetic improvements to previous commit. --- arch/arm/src/samdl/chip/samd_eic.h | 3 +-- arch/arm/src/samdl/chip/saml_eic.h | 2 +- arch/arm/src/samdl/sam_eic.c | 12 ++++++------ arch/arm/src/samdl/sam_eic.h | 16 ++++++++++++++++ arch/arm/src/samdl/sam_port.c | 11 ++++++----- 5 files changed, 30 insertions(+), 14 deletions(-) diff --git a/arch/arm/src/samdl/chip/samd_eic.h b/arch/arm/src/samdl/chip/samd_eic.h index 9bbd0dc4fe..adc8982124 100644 --- a/arch/arm/src/samdl/chip/samd_eic.h +++ b/arch/arm/src/samdl/chip/samd_eic.h @@ -6,7 +6,7 @@ * Matt Thompson * * References: - * "Microchip SAMD21 datasheet" + * "Microchip SAMD21 datasheet" * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -116,7 +116,6 @@ #define EIC_EXTINT_SHIFT (0) /* Bits 0-15: External interrupt n */ #define EIC_EXTINT_MASK (0x3ffff << EIC_EXTINT_SHIFT) -//# define EIC_EXTINT(n) ((uint32_t)(n) << EIC_EXTINT_SHIFT) # define EIC_EXTINT(n) (1 << (n)) # define EIC_EXTINT_0 (1 << 0) /* Bit 0: External interrupt 0 */ # define EIC_EXTINT_1 (1 << 1) /* Bit 1: External interrupt 1 */ diff --git a/arch/arm/src/samdl/chip/saml_eic.h b/arch/arm/src/samdl/chip/saml_eic.h index e6bb167e2e..56d91824ec 100644 --- a/arch/arm/src/samdl/chip/saml_eic.h +++ b/arch/arm/src/samdl/chip/saml_eic.h @@ -123,7 +123,7 @@ #define EIC_EXTINT_SHIFT (0) /* Bits 0-15: External interrupt n */ #define EIC_EXTINT_MASK (0xffff << EIC_EXTINT_SHIFT) -# define EIC_EXTINT(n) ((uint32_t)(n) << EIC_EXTINT_SHIFT) +# define EIC_EXTINT(n) (1 << (n)) # define EIC_EXTINT_0 (1 << 0) /* Bit 0: External interrupt 0 */ # define EIC_EXTINT_1 (1 << 1) /* Bit 1: External interrupt 1 */ # define EIC_EXTINT_2 (1 << 2) /* Bit 2: External interrupt 2 */ diff --git a/arch/arm/src/samdl/sam_eic.c b/arch/arm/src/samdl/sam_eic.c index 15c33811c2..ff73950cc0 100644 --- a/arch/arm/src/samdl/sam_eic.c +++ b/arch/arm/src/samdl/sam_eic.c @@ -84,15 +84,15 @@ static int sam_eic_isr(int irq, FAR void *context, FAR void *arg) for(bit=0;bit> bit & 0x1) - { - irq_dispatch(SAM_IRQ_EXTINT0 + bit, context); - } + { + irq_dispatch(SAM_IRQ_EXTINT0 + bit, context); + } } /* Clear the pending interrupt flags */ putreg32(EIC_EXTINT_ALL, SAM_EIC_INTFLAG); - + return 0; } @@ -145,7 +145,7 @@ int sam_eic_initialize(uint8_t gclkgen) regval = GCLK_CLKCTRL_ID_EIC | GCLK_CLKCTRL_GEN(gclkgen) | GCLK_CLKCTRL_CLKEN; putreg16(regval, SAM_GCLK_CLKCTRL); - putreg8(EIC_CTRLA_ENABLE, SAM_EIC_CTRLA); + putreg8(EIC_CTRLA_ENABLE, SAM_EIC_CTRLA); sam_eic_syncwait(); irq_attach(SAM_IRQ_EIC, sam_eic_isr, NULL); @@ -211,7 +211,7 @@ int sam_eic_config(uint8_t eirq, port_pinset_t pinset) if (eirq < 8) { reg = SAM_EIC_CONFIG0; - + val = EIC_CONFIG0_SENSE_BOTH(eirq); if (pinset & PORT_INT_RISING) { diff --git a/arch/arm/src/samdl/sam_eic.h b/arch/arm/src/samdl/sam_eic.h index 53fe547b36..d60c936cef 100644 --- a/arch/arm/src/samdl/sam_eic.h +++ b/arch/arm/src/samdl/sam_eic.h @@ -85,6 +85,22 @@ extern "C" int sam_eic_initialize(uint8_t gclkgen); +/**************************************************************************** + * Name: sam_eic_initialize + * + * Description: + * Enable a external interrupt. + * + * Input Parameters: + * irq - SAM_IRQ_EXTINTn IRQ to be enabled + * + * Returned Value: + * None + * + ****************************************************************************/ + +int sam_eic_irq_enable(int irq); + /**************************************************************************** * Name: sam_eic_config * diff --git a/arch/arm/src/samdl/sam_port.c b/arch/arm/src/samdl/sam_port.c index 7faaa6c44f..df35aae65a 100644 --- a/arch/arm/src/samdl/sam_port.c +++ b/arch/arm/src/samdl/sam_port.c @@ -190,13 +190,15 @@ static inline void sam_configinput(uintptr_t base, port_pinset_t pinset) static inline void sam_configinterrupt(uintptr_t base, port_pinset_t pinset) { +#ifdef CONFIG_SAMDL_EIC uint32_t func; uint32_t regval; int pin; - pin = (pinset & PORT_PIN_MASK) >> PORT_PIN_SHIFT; + pin = (pinset & PORT_PIN_MASK) >> PORT_PIN_SHIFT; - regval = (PORT_WRCONFIG_WRPINCFG | PORT_WRCONFIG_WRPMUX | PORT_WRCONFIG_PMUXEN | PORT_WRCONFIG_INEN); + regval = (PORT_WRCONFIG_WRPINCFG | PORT_WRCONFIG_WRPMUX | + PORT_WRCONFIG_PMUXEN | PORT_WRCONFIG_INEN); regval |= PORT_WRCONFIG_PINMASK(pin); func = (pinset & PORT_FUNC_MASK) >> PORT_FUNC_SHIFT; @@ -204,15 +206,14 @@ static inline void sam_configinterrupt(uintptr_t base, port_pinset_t pinset) putreg32(regval, base + SAM_PORT_WRCONFIG_OFFSET); -#ifdef CONFIG_SAMDL_EIC /* Configure the interrupt edge sensitivity in CONFIGn register of the EIC */ sam_eic_config(pin, pinset); -#endif #ifdef CONFIG_DEBUG_GPIO_INFO sam_dumpport(pinset, "extint"); #endif +#endif /* CONFIG_SAMDL_EIC */ } /**************************************************************************** @@ -554,7 +555,7 @@ int sam_dumpport(uint32_t pinset, const char *msg) /* Get the base address associated with the PIO port */ - pin = (pinset & PORT_PIN_MASK) >> PORT_PIN_SHIFT; + pin = (pinset & PORT_PIN_MASK) >> PORT_PIN_SHIFT; port = (pinset & PORT_MASK) >> PORT_SHIFT; base = SAM_PORTN_BASE(port); -- GitLab From 6deebac4aef7b05d9389f4d8d7fa3574a68e7ca2 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 17 Jan 2018 12:12:07 -0600 Subject: [PATCH 032/228] configs: There should be either CONFIG_LIB_BOARDCTL=y or CONFIG_BOARD_INITIALIZE=y in the defconfig of every standalone NxWM configuration to assure that all of the board resources are initialized... especially the touchscreen since it it now a part of the board driver initialization. --- configs/mikroe-stm32f4/fulldemo/defconfig | 1 + configs/sam3u-ek/nxwm/defconfig | 1 + configs/sam4e-ek/nxwm/defconfig | 1 + configs/sama5d3x-ek/nxwm/defconfig | 1 + configs/sama5d4-ek/nxwm/defconfig | 1 + configs/samv71-xult/nxwm/defconfig | 1 + configs/samv71-xult/vnxwm/defconfig | 1 + configs/shenzhou/nxwm/defconfig | 1 + configs/sim/nxwm/defconfig | 1 + 9 files changed, 9 insertions(+) diff --git a/configs/mikroe-stm32f4/fulldemo/defconfig b/configs/mikroe-stm32f4/fulldemo/defconfig index 0896fb1412..dab8c12914 100644 --- a/configs/mikroe-stm32f4/fulldemo/defconfig +++ b/configs/mikroe-stm32f4/fulldemo/defconfig @@ -45,6 +45,7 @@ CONFIG_INTELHEX_BINARY=y CONFIG_LCD_MIO283QT2=y CONFIG_LCD=y CONFIG_LIBC_PERROR_STDOUT=y +CONFIG_LIB_BOARDCTL=y CONFIG_LIBC_STRERROR=y CONFIG_M25P_MANUFACTURER=0x1C CONFIG_M25P_MEMORY_TYPE=0x31 diff --git a/configs/sam3u-ek/nxwm/defconfig b/configs/sam3u-ek/nxwm/defconfig index feb067d7a5..498f5833f5 100644 --- a/configs/sam3u-ek/nxwm/defconfig +++ b/configs/sam3u-ek/nxwm/defconfig @@ -28,6 +28,7 @@ CONFIG_INPUT=y CONFIG_LCD_MAXCONTRAST=1 CONFIG_LCD_MAXPOWER=31 CONFIG_LCD=y +CONFIG_LIB_BOARDCTL=y CONFIG_MAX_TASKS=16 CONFIG_MAX_WDOGPARMS=2 CONFIG_MM_REGIONS=2 diff --git a/configs/sam4e-ek/nxwm/defconfig b/configs/sam4e-ek/nxwm/defconfig index a9b0bb4aea..bb74cc1952 100644 --- a/configs/sam4e-ek/nxwm/defconfig +++ b/configs/sam4e-ek/nxwm/defconfig @@ -31,6 +31,7 @@ CONFIG_INTELHEX_BINARY=y CONFIG_LCD_MAXCONTRAST=1 CONFIG_LCD_MAXPOWER=64 CONFIG_LCD=y +CONFIG_LIB_BOARDCTL=y CONFIG_LIBC_FLOATINGPOINT=y CONFIG_LIBM=y CONFIG_MAX_TASKS=16 diff --git a/configs/sama5d3x-ek/nxwm/defconfig b/configs/sama5d3x-ek/nxwm/defconfig index 005230b47f..8fef1f7fd9 100644 --- a/configs/sama5d3x-ek/nxwm/defconfig +++ b/configs/sama5d3x-ek/nxwm/defconfig @@ -22,6 +22,7 @@ CONFIG_HAVE_CXX=y CONFIG_HAVE_CXXINITIALIZE=y CONFIG_HOST_WINDOWS=y CONFIG_INTELHEX_BINARY=y +CONFIG_LIB_BOARDCTL=y CONFIG_LIBC_FLOATINGPOINT=y CONFIG_LIBM=y CONFIG_MAX_TASKS=16 diff --git a/configs/sama5d4-ek/nxwm/defconfig b/configs/sama5d4-ek/nxwm/defconfig index 5970178745..c669a50f4a 100644 --- a/configs/sama5d4-ek/nxwm/defconfig +++ b/configs/sama5d4-ek/nxwm/defconfig @@ -46,6 +46,7 @@ CONFIG_I2CTOOL_MAXBUS=0 CONFIG_INPUT_MXT=y CONFIG_INPUT=y CONFIG_INTELHEX_BINARY=y +CONFIG_LIB_BOARDCTL=y CONFIG_LIBC_FLOATINGPOINT=y CONFIG_LIBM=y CONFIG_MAX_TASKS=16 diff --git a/configs/samv71-xult/nxwm/defconfig b/configs/samv71-xult/nxwm/defconfig index 9a5d3cb7e9..668cdb620d 100644 --- a/configs/samv71-xult/nxwm/defconfig +++ b/configs/samv71-xult/nxwm/defconfig @@ -40,6 +40,7 @@ CONFIG_INPUT_MXT=y CONFIG_INPUT=y CONFIG_LCD_NOGETRUN=y CONFIG_LCD=y +CONFIG_LIB_BOARDCTL=y CONFIG_LIBC_FLOATINGPOINT=y CONFIG_LIBM=y CONFIG_MAX_TASKS=16 diff --git a/configs/samv71-xult/vnxwm/defconfig b/configs/samv71-xult/vnxwm/defconfig index ac4e18a30d..40870a8f12 100644 --- a/configs/samv71-xult/vnxwm/defconfig +++ b/configs/samv71-xult/vnxwm/defconfig @@ -39,6 +39,7 @@ CONFIG_HOST_WINDOWS=y CONFIG_I2C_DRIVER=y CONFIG_IOB_NBUFFERS=72 CONFIG_IOB_THROTTLE=32 +CONFIG_LIB_BOARDCTL=y CONFIG_LIBC_FLOATINGPOINT=y CONFIG_LIBM=y CONFIG_MAX_TASKS=16 diff --git a/configs/shenzhou/nxwm/defconfig b/configs/shenzhou/nxwm/defconfig index 3c0273cff3..859bb2ca3e 100644 --- a/configs/shenzhou/nxwm/defconfig +++ b/configs/shenzhou/nxwm/defconfig @@ -28,6 +28,7 @@ CONFIG_LCD_MAXCONTRAST=1 CONFIG_LCD_NOGETRUN=y CONFIG_LCD_SSD1289=y CONFIG_LCD=y +CONFIG_LIB_BOARDCTL=y CONFIG_MAX_TASKS=16 CONFIG_MAX_WDOGPARMS=2 CONFIG_MQ_MAXMSGSIZE=64 diff --git a/configs/sim/nxwm/defconfig b/configs/sim/nxwm/defconfig index 17fadb5035..a0c17d2cfa 100644 --- a/configs/sim/nxwm/defconfig +++ b/configs/sim/nxwm/defconfig @@ -15,6 +15,7 @@ CONFIG_FS_PROCFS=y CONFIG_FS_ROMFS=y CONFIG_HAVE_CXX=y CONFIG_IDLETHREAD_STACKSIZE=8192 +CONFIG_LIB_BOARDCTL=y CONFIG_MAX_TASKS=16 CONFIG_MQ_MAXMSGSIZE=64 CONFIG_NSH_ARCHINIT=y -- GitLab From d481ac347decf0c707b3f21767541e5187158743 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 17 Jan 2018 13:51:29 -0600 Subject: [PATCH 033/228] configs: Both CONFIG_LIB_BOARDCTL=y and CONFIG_BOARD_INITIALIZE=y is not meaningful in the standalone NxWM. CONFIG_LIB_BOARDCTL=y is the better option so CONFIG_BOARD_INITIALIZE=y removed from these configurations. --- configs/lpcxpresso-lpc54628/README.txt | 1 - configs/lpcxpresso-lpc54628/nxwm/defconfig | 1 - configs/stm3240g-eval/knxwm/defconfig | 1 - configs/stm32f429i-disco/nxwm/defconfig | 2 +- 4 files changed, 1 insertion(+), 4 deletions(-) diff --git a/configs/lpcxpresso-lpc54628/README.txt b/configs/lpcxpresso-lpc54628/README.txt index 0f31315c94..2cb8625a85 100644 --- a/configs/lpcxpresso-lpc54628/README.txt +++ b/configs/lpcxpresso-lpc54628/README.txt @@ -264,7 +264,6 @@ Configurations $ telnet fc00::42 - nsh: Configures the NuttShell (nsh) application located at examples/nsh. diff --git a/configs/lpcxpresso-lpc54628/nxwm/defconfig b/configs/lpcxpresso-lpc54628/nxwm/defconfig index 47cda398c4..6bcffd4a4b 100644 --- a/configs/lpcxpresso-lpc54628/nxwm/defconfig +++ b/configs/lpcxpresso-lpc54628/nxwm/defconfig @@ -10,7 +10,6 @@ CONFIG_ARCH_INTERRUPTSTACK=2048 CONFIG_ARCH_STACKDUMP=y CONFIG_ARCH_STDARG_H=y CONFIG_ARCH="arm" -CONFIG_BOARD_INITIALIZE=y CONFIG_BOARD_LOOPSPERMSEC=21082 CONFIG_BUILTIN=y CONFIG_FAT_LCNAMES=y diff --git a/configs/stm3240g-eval/knxwm/defconfig b/configs/stm3240g-eval/knxwm/defconfig index 916720ff0a..18f80a8e22 100644 --- a/configs/stm3240g-eval/knxwm/defconfig +++ b/configs/stm3240g-eval/knxwm/defconfig @@ -13,7 +13,6 @@ CONFIG_ARCH_STACKDUMP=y CONFIG_ARCH="arm" CONFIG_ARM_MPU=y CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y -CONFIG_BOARD_INITIALIZE=y CONFIG_BOARD_LOOPSPERMSEC=16717 CONFIG_BUILD_PROTECTED=y CONFIG_CXX_NEWLONG=y diff --git a/configs/stm32f429i-disco/nxwm/defconfig b/configs/stm32f429i-disco/nxwm/defconfig index 4485aa414b..06a3ce05a2 100644 --- a/configs/stm32f429i-disco/nxwm/defconfig +++ b/configs/stm32f429i-disco/nxwm/defconfig @@ -11,7 +11,6 @@ CONFIG_ARCH_CHIP_STM32F429Z=y CONFIG_ARCH_INTERRUPTSTACK=2048 CONFIG_ARCH_STACKDUMP=y CONFIG_ARCH="arm" -CONFIG_BOARD_INITIALIZE=y CONFIG_BOARD_LOOPSPERMSEC=16717 CONFIG_BUILTIN=y CONFIG_DEBUG_CUSTOMOPT=y @@ -28,6 +27,7 @@ CONFIG_HEAP2_SIZE=8081408 CONFIG_INPUT_STMPE811=y CONFIG_INPUT=y CONFIG_INTELHEX_BINARY=y +CONFIG_LIB_BOARDCTL=y CONFIG_MAX_TASKS=16 CONFIG_MAX_WDOGPARMS=2 CONFIG_MM_REGIONS=2 -- GitLab From d7cc0c73685eaad76086b77f551087c27952c952 Mon Sep 17 00:00:00 2001 From: Matt Thompson Date: Wed, 17 Jan 2018 17:23:05 -0800 Subject: [PATCH 034/228] SAMDL: SPI must be disabled before changing the mode bits in CTRLA register --- arch/arm/src/samdl/sam_spi.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/arm/src/samdl/sam_spi.c b/arch/arm/src/samdl/sam_spi.c index 0596d9e84c..dbecb7e09b 100644 --- a/arch/arm/src/samdl/sam_spi.c +++ b/arch/arm/src/samdl/sam_spi.c @@ -944,7 +944,12 @@ static void spi_setmode(struct spi_dev_s *dev, enum spi_mode_e mode) { /* Yes... Set the mode appropriately */ + /* First we need to disable SPI while we change the mode */ + regval = spi_getreg32(priv, SAM_SPI_CTRLA_OFFSET); + spi_putreg32(priv, regval & ~SPI_CTRLA_ENABLE, SAM_SPI_CTRLA_OFFSET); + spi_wait_synchronization(priv); + regval &= ~(SPI_CTRLA_CPOL | SPI_CTRLA_CPHA); switch (mode) @@ -969,7 +974,7 @@ static void spi_setmode(struct spi_dev_s *dev, enum spi_mode_e mode) return; } - spi_putreg32(priv, regval, SAM_SPI_CTRLA_OFFSET); + spi_putreg32(priv, regval | SPI_CTRLA_ENABLE, SAM_SPI_CTRLA_OFFSET); /* Save the mode so that subsequent re-configurations will be faster */ -- GitLab From d43c52cf037e91d41327fb307204ad58e7c46f12 Mon Sep 17 00:00:00 2001 From: Masayuki Ishikawa Date: Thu, 18 Jan 2018 12:30:43 +0900 Subject: [PATCH 035/228] arch/arm/src/lc823450: Assign I2S IRQ handling to CPU0 Previous commit assumed that the caller is running on CPU0. However, the caller sometimes runs at CPU1. This patch will assign the caller to CPU0 explicitly. Signed-off-by: Masayuki Ishikawa --- arch/arm/src/lc823450/lc823450_i2s.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/arch/arm/src/lc823450/lc823450_i2s.c b/arch/arm/src/lc823450/lc823450_i2s.c index 3eced5cb4f..fb9efa28df 100644 --- a/arch/arm/src/lc823450/lc823450_i2s.c +++ b/arch/arm/src/lc823450/lc823450_i2s.c @@ -51,6 +51,10 @@ #include #include +#ifdef CONFIG_SMP +# include +#endif + #include "up_arch.h" #include "lc823450_dma.h" #include "lc823450_i2s.h" @@ -460,8 +464,32 @@ FAR struct i2s_dev_s *lc823450_i2sdev_initialize(void) nxsem_init(&_sem_txdma, 0, 0); nxsem_init(&_sem_buf_under, 0, 0); +#ifdef CONFIG_SMP + cpu_set_t cpuset0; + cpu_set_t cpuset1; + + CPU_ZERO(&cpuset1); + CPU_SET(0, &cpuset1); + + /* Backup the current affinity */ + + sched_getaffinity(getpid(), sizeof(cpuset0), &cpuset0); + + /* Set the new affinity which assigns to CPU0 */ + + sched_setaffinity(getpid(), sizeof(cpuset1), &cpuset1); + nxsig_usleep(10 * 1000); +#endif + irq_attach(LC823450_IRQ_AUDIOBUF0, _i2s_isr, NULL); +#ifdef CONFIG_SMP + /* Restore the original affinity */ + + sched_setaffinity(getpid(), sizeof(cpuset0), &cpuset0); + nxsig_usleep(10 * 1000); +#endif + /* Enable IRQ for Audio Buffer */ up_enable_irq(LC823450_IRQ_AUDIOBUF0); -- GitLab From a3ed16dd302ac4a32eff9e233765c342d7a056a0 Mon Sep 17 00:00:00 2001 From: Masayuki Ishikawa Date: Thu, 18 Jan 2018 12:48:07 +0900 Subject: [PATCH 036/228] arch/arm/src/lc823450: Change irqwarn() to ASSERT() in up_ack_irq() Signed-off-by: Masayuki Ishikawa --- arch/arm/src/lc823450/lc823450_irq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/arm/src/lc823450/lc823450_irq.c b/arch/arm/src/lc823450/lc823450_irq.c index 9339f7cd63..bd159ef545 100644 --- a/arch/arm/src/lc823450/lc823450_irq.c +++ b/arch/arm/src/lc823450/lc823450_irq.c @@ -711,7 +711,9 @@ void up_ack_irq(int irq) #ifdef CONFIG_SMP if (irq > LC823450_IRQ_LPDSP0 && 1 == up_cpu_index()) { - irqwarn("*** warning irq(%d) handled on CPU1."); + /* IRQ should be handled on CPU0 */ + + ASSERT(false); } #endif -- GitLab From 0fa630d29d81314554fe691b5ec3da54f7e3bdf3 Mon Sep 17 00:00:00 2001 From: Masayuki Ishikawa Date: Thu, 18 Jan 2018 12:49:46 +0900 Subject: [PATCH 037/228] configs/lc823450-xgevk: Update README.txt and defconfigs Update comments on SMP in README.txt Enable SYSTEM_TIME64 in defconfigs. Enable INSTRUMENTATION in rndis configuration. Signed-off-by: Masayuki Ishikawa --- configs/lc823450-xgevk/README.txt | 30 +++++++++++++++++++++----- configs/lc823450-xgevk/audio/defconfig | 1 + configs/lc823450-xgevk/nsh/defconfig | 1 + configs/lc823450-xgevk/rndis/defconfig | 4 ++++ configs/lc823450-xgevk/usb/defconfig | 1 + 5 files changed, 32 insertions(+), 5 deletions(-) diff --git a/configs/lc823450-xgevk/README.txt b/configs/lc823450-xgevk/README.txt index 63db6a0a30..a152c893e1 100644 --- a/configs/lc823450-xgevk/README.txt +++ b/configs/lc823450-xgevk/README.txt @@ -45,13 +45,33 @@ to set MSP (main stack pointer) as follows. SMP related Status ^^^^^^^^^^^^^^^^^^ -Currently all applications except for ostest work in SMP mode but might stop -due to deadlocks or ASSERT(). - CPU activities are shown at D9 (CPU0) and D10 (CPU1) respectively. -1. "nsh> smp" works but the result will be corrupted. -2. "nsh> ostest" works but might cause a deadlock or assertion. +Currently all applications except for ostest work in SMP mode but might stop +due to deadlocks or ASSERT(). For a workaround, please try + +$ cd apps; git diff +diff --git a/examples/ostest/waitpid.c b/examples/ostest/waitpid.c +index 687f50ca..8418eff8 100644 +--- a/examples/ostest/waitpid.c ++++ b/examples/ostest/waitpid.c +@@ -54,7 +54,7 @@ + ****************************************************************************/ + + #define RETURN_STATUS 14 +-#define NCHILDREN 3 ++#define NCHILDREN 2 + #define PRIORITY 100 + + /**************************************************************************** + +If other deadlocks or ASSERT() still happen, please try the following. + +$ cd nuttx; git revert e238c8b0904988b966c3b33e7df2ba3faba52e2b + +This will revert the changes for clock_systimer() for 64bit so that it can +use spinlock to protect the internal data. We think that there still exist +race conditions somewhere in SMP logic but the revert might relax the conditions. Other Status ^^^^^^^^^^^^ diff --git a/configs/lc823450-xgevk/audio/defconfig b/configs/lc823450-xgevk/audio/defconfig index ae8ef0ad37..e06f30abc5 100644 --- a/configs/lc823450-xgevk/audio/defconfig +++ b/configs/lc823450-xgevk/audio/defconfig @@ -127,6 +127,7 @@ CONFIG_START_MONTH=10 CONFIG_START_YEAR=2013 CONFIG_SYSTEM_I2CTOOL=y CONFIG_SYSTEM_NXPLAYER=y +CONFIG_SYSTEM_TIME64=y CONFIG_SYSTEM_USBMSC_CMD_STACKSIZE=2048 CONFIG_SYSTEM_USBMSC_DEVPATH1="/dev/mtdblock0p10" CONFIG_SYSTEM_USBMSC_DEVPATH2="/dev/mtdblock1" diff --git a/configs/lc823450-xgevk/nsh/defconfig b/configs/lc823450-xgevk/nsh/defconfig index 74040a6739..91b32fbe49 100644 --- a/configs/lc823450-xgevk/nsh/defconfig +++ b/configs/lc823450-xgevk/nsh/defconfig @@ -124,6 +124,7 @@ CONFIG_START_DAY=3 CONFIG_START_MONTH=10 CONFIG_START_YEAR=2013 CONFIG_SYSTEM_I2CTOOL=y +CONFIG_SYSTEM_TIME64=y CONFIG_TASK_NAME_SIZE=24 CONFIG_UART0_RXBUFSIZE=512 CONFIG_UART0_SERIAL_CONSOLE=y diff --git a/configs/lc823450-xgevk/rndis/defconfig b/configs/lc823450-xgevk/rndis/defconfig index c07e826ca6..32a899edd9 100644 --- a/configs/lc823450-xgevk/rndis/defconfig +++ b/configs/lc823450-xgevk/rndis/defconfig @@ -150,6 +150,9 @@ CONFIG_SCHED_HAVE_PARENT=y CONFIG_SCHED_HPWORKPERIOD=50000 CONFIG_SCHED_HPWORKPRIORITY=192 CONFIG_SCHED_HPWORK=y +CONFIG_SCHED_INSTRUMENTATION_BUFFER=y +CONFIG_SCHED_INSTRUMENTATION_PREEMPTION=y +CONFIG_SCHED_INSTRUMENTATION=y CONFIG_SCHED_LPWORK=y CONFIG_SCHED_ONEXIT_MAX=32 CONFIG_SCHED_ONEXIT=y @@ -169,6 +172,7 @@ CONFIG_START_YEAR=2013 CONFIG_SYSTEM_I2CTOOL=y CONFIG_SYSTEM_NXPLAYER=y CONFIG_SYSTEM_PING=y +CONFIG_SYSTEM_TIME64=y CONFIG_TASK_NAME_SIZE=24 CONFIG_TELNET_CHARACTER_MODE=y CONFIG_UART0_RXBUFSIZE=512 diff --git a/configs/lc823450-xgevk/usb/defconfig b/configs/lc823450-xgevk/usb/defconfig index 4b680dbd51..3ca1889d1b 100644 --- a/configs/lc823450-xgevk/usb/defconfig +++ b/configs/lc823450-xgevk/usb/defconfig @@ -126,6 +126,7 @@ CONFIG_START_DAY=3 CONFIG_START_MONTH=10 CONFIG_START_YEAR=2013 CONFIG_SYSTEM_I2CTOOL=y +CONFIG_SYSTEM_TIME64=y CONFIG_SYSTEM_USBMSC_CMD_STACKSIZE=2048 CONFIG_SYSTEM_USBMSC_DEVPATH1="/dev/mtdblock0p10" CONFIG_SYSTEM_USBMSC_DEVPATH2="/dev/mtdblock1" -- GitLab From 1ec8a6f34cc89444e7c41bf0310ecdb30b43e074 Mon Sep 17 00:00:00 2001 From: Matt Thompson Date: Thu, 18 Jan 2018 12:33:41 +0000 Subject: [PATCH 038/228] Merged in extent3d/nuttx (pull request #575) SAMDL: SPI must be disabled before changing the mode bits in CTRLA register * SAMD External Interrupt Controller (EIC) support * removed comment * SAMDL: SPI must be disabled before changing the mode bits in CTRLA register Approved-by: Gregory Nutt --- arch/arm/src/samdl/sam_spi.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/arm/src/samdl/sam_spi.c b/arch/arm/src/samdl/sam_spi.c index 0596d9e84c..dbecb7e09b 100644 --- a/arch/arm/src/samdl/sam_spi.c +++ b/arch/arm/src/samdl/sam_spi.c @@ -944,7 +944,12 @@ static void spi_setmode(struct spi_dev_s *dev, enum spi_mode_e mode) { /* Yes... Set the mode appropriately */ + /* First we need to disable SPI while we change the mode */ + regval = spi_getreg32(priv, SAM_SPI_CTRLA_OFFSET); + spi_putreg32(priv, regval & ~SPI_CTRLA_ENABLE, SAM_SPI_CTRLA_OFFSET); + spi_wait_synchronization(priv); + regval &= ~(SPI_CTRLA_CPOL | SPI_CTRLA_CPHA); switch (mode) @@ -969,7 +974,7 @@ static void spi_setmode(struct spi_dev_s *dev, enum spi_mode_e mode) return; } - spi_putreg32(priv, regval, SAM_SPI_CTRLA_OFFSET); + spi_putreg32(priv, regval | SPI_CTRLA_ENABLE, SAM_SPI_CTRLA_OFFSET); /* Save the mode so that subsequent re-configurations will be faster */ -- GitLab From ce7df1f961d218e824b88f98f8b9b96a63efed63 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 18 Jan 2018 06:57:13 -0600 Subject: [PATCH 039/228] configst/stm3240g-eval: Remove only bogus logic to start the NX server. That was there only to support the knxwm configuration and was implemented priorit to boardctl(BOARCIOC_NX_START). --- configs/lpcxpresso-lpc54628/README.txt | 1 - configs/stm3240g-eval/src/stm32_boot.c | 111 +--------------------- configs/stm3240g-eval/src/stm32_bringup.c | 22 ++--- configs/stm32f429i-disco/src/stm32_boot.c | 37 -------- 4 files changed, 10 insertions(+), 161 deletions(-) diff --git a/configs/lpcxpresso-lpc54628/README.txt b/configs/lpcxpresso-lpc54628/README.txt index 2cb8625a85..e7b195ef41 100644 --- a/configs/lpcxpresso-lpc54628/README.txt +++ b/configs/lpcxpresso-lpc54628/README.txt @@ -475,4 +475,3 @@ Configurations $ cd ~//nuttx $ make - diff --git a/configs/stm3240g-eval/src/stm32_boot.c b/configs/stm3240g-eval/src/stm32_boot.c index 2309fc50bb..2861a30b1d 100644 --- a/configs/stm3240g-eval/src/stm32_boot.c +++ b/configs/stm3240g-eval/src/stm32_boot.c @@ -45,108 +45,10 @@ #include "stm3240g-eval.h" -/************************************************************************************ - * Pre-processor Definitions - ************************************************************************************/ -/* Configuration ********************************************************************/ -/* Should we initialize the NX server using nx_start? This is done for NxWidgets - * (CONFIG_NXWIDGETS=y) and if the NxWidget::CNxServer class expects the RTOS do the - * the NX initialization (CONFIG_NXWIDGET_SERVERINIT=n). This combination of - * settings is normally only used in the kernel build mode* (CONFIG_BUILD_PROTECTED) - * when NxWidgets is unable to initialize NX from user-space. - */ - -#undef HAVE_NXSTART - -#if defined(CONFIG_NXWIDGETS) && !defined(CONFIG_NXWIDGET_SERVERINIT) -# define HAVE_NXSTART -# include -#endif - -/* Should we initialize the touchscreen for the NxWM (CONFIG_NXWM=y)? This - * is done if we have a touchscreen (CONFIG_INPUT_STMPE811=y) and NxWM uses the - * touchscreen (CONFIG_NXWM_TOUCHSCREEN=y). - */ - -#undef HAVE_TCINIT - -#if defined(CONFIG_NXWM_TOUCHSCREEN) -# if !defined(CONFIG_NXWM_TOUCHSCREEN_DEVNO) -# error CONFIG_NXWM_TOUCHSCREEN_DEVNO is not defined -# elif defined(CONFIG_INPUT_STMPE811) -# define HAVE_TCINIT 1 -# include -# else -# error CONFIG_INPUT_STMPE811=y is needed -# endif -#endif - -/* Check if we will need to support the initialization kernel thread */ - -#undef HAVE_INITTHREAD - -#ifdef CONFIG_BOARD_INITIALIZE -# if defined(CONFIG_NSH_LIBRARY) && !defined(CONFIG_LIB_BOARDCTL) -# define HAVE_INITTHREAD 1 -# elif defined(HAVE_NXSTART) -# define HAVE_INITTHREAD 1 -# elif defined(HAVE_TCINIT) -# define HAVE_INITTHREAD 1 -# endif -#endif - -#ifdef HAVE_INITTHREAD -# include -# include -# include -# ifndef CONFIG_STM3240G_BOARDINIT_PRIO -# define CONFIG_STM3240G_BOARDINIT_PRIO 196 -# endif -# ifndef CONFIG_STM3240G_BOARDINIT_STACK -# define CONFIG_STM3240G_BOARDINIT_STACK 2048 -# endif -#endif - /************************************************************************************ * Private Functions ************************************************************************************/ -/************************************************************************************ - * Name: board_initthread - * - * Description: - * Board initialization kernel thread. This thread exists to support - * initialization when CONFIG_BOARD_INITIALIZE is defined. It is started by - * board_initialize() which runs on the IDLE thread. - * - * This function thread exists because some initialization steps may require - * waiting for events. Such waiting is not possible on the IDLE thread. - * - * Input Parameters: - * Standard task start-up parameters (none of which are used) - * - * Returned Value: - * Always returns EXIT_SUCCESS. - * - ************************************************************************************/ - -#ifdef HAVE_INITTHREAD -static int board_initthread(int argc, char *argv[]) -{ - int ret; - - /* Perform the board initialization on an initialization thread */ - - ret = stm32_bringup(); - if (ret < 0) - { - gerr("ERROR: stm32_bringup failed: %d\n", ret); - } - - return EXIT_SUCCESS; -} -#endif - /************************************************************************************ * Public Functions ************************************************************************************/ @@ -184,7 +86,7 @@ void stm32_boardinitialize(void) /* Initialize USB if the 1) OTG FS controller is in the configuration and 2) * disabled, and 3) the weak function stm32_usbinitialize() has been brought * the weak function stm32_usbinitialize() has been brought into the build. - * Presumeably either CONFIG_USBDEV or CONFIG_USBHOST is also selected. + * Presumably either CONFIG_USBDEV or CONFIG_USBHOST is also selected. */ if (stm32_usbinitialize) @@ -216,22 +118,11 @@ void stm32_boardinitialize(void) #ifdef CONFIG_BOARD_INITIALIZE void board_initialize(void) { -#ifdef HAVE_INITTHREAD - pid_t server; - - /* Start the board initialization kernel thread */ - - server = kthread_create("Board Init", CONFIG_STM3240G_BOARDINIT_PRIO, - CONFIG_STM3240G_BOARDINIT_STACK, board_initthread, - NULL); - ASSERT(server > 0); -#else /* Perform the board initialization on the start-up thread. Some * initializations may fail in this case due to the limited capability of * the start-up thread. */ (void)stm32_bringup(); -#endif } #endif diff --git a/configs/stm3240g-eval/src/stm32_bringup.c b/configs/stm3240g-eval/src/stm32_bringup.c index 61d3f4a69c..7f78ccb8f3 100644 --- a/configs/stm3240g-eval/src/stm32_bringup.c +++ b/configs/stm3240g-eval/src/stm32_bringup.c @@ -71,6 +71,10 @@ # include #endif +#ifdef CONFIG_INPUT_STMPE811 +# include +#endif + #include "stm32.h" #include "stm32_i2c.h" #include "stm3240g-eval.h" @@ -354,20 +358,12 @@ int stm32_bringup(void) } #endif -#ifdef HAVE_NXSTART - /* Initialize the NX server */ - - ret = nx_start(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: nx_start failed: %d\n", ret); - } -#endif - -#ifdef HAVE_TCINIT - /* Initialize the touchscreen */ +#ifdef CONFIG_INPUT_STMPE811 + /* Initialize the touchscreen. + * WARNING: stm32_tsc_setup() cannot be called from the IDLE thread. + */ - ret = stm32_tsc_setup(CONFIG_NXWM_TOUCHSCREEN_DEVNO); + ret = stm32_tsc_setup(0); if (ret < 0) { syslog(LOG_ERR, "ERROR: stm32_tsc_setup failed: %d\n", ret); diff --git a/configs/stm32f429i-disco/src/stm32_boot.c b/configs/stm32f429i-disco/src/stm32_boot.c index 9dda08d1de..d76f3122fa 100644 --- a/configs/stm32f429i-disco/src/stm32_boot.c +++ b/configs/stm32f429i-disco/src/stm32_boot.c @@ -48,43 +48,6 @@ #include "stm32f429i-disco.h" #include "stm32_ccm.h" -/************************************************************************************ - * Pre-processor Definitions - ************************************************************************************/ - -/* Configuration ********************************************************************/ -/* Should we initialize the NX server using nx_start? This is done for NxWidgets - * (CONFIG_NXWIDGETS=y) and if the NxWidget::CNxServer class expects the RTOS do the - * the NX initialization (CONFIG_NXWIDGET_SERVERINIT=n). This combination of - * settings is normally only used in the kernel build mode* (CONFIG_BUILD_PROTECTED) - * when NxWidgets is unable to initialize NX from user-space. - */ - -#undef HAVE_NXSTART - -#if defined(CONFIG_NXWIDGETS) && !defined(CONFIG_NXWIDGET_SERVERINIT) -# define HAVE_NXSTART -# include -#endif - -/* Should we initialize the touchscreen for the NxWM (CONFIG_NXWM=y)? This - * is done if we have a touchscreen (CONFIG_INPUT_STMPE811=y) and NxWM uses the - * touchscreen (CONFIG_NXWM_TOUCHSCREEN=y). - */ - -#undef HAVE_TCINIT - -#if defined(CONFIG_NXWM_TOUCHSCREEN) -# if !defined(CONFIG_NXWM_TOUCHSCREEN_DEVNO) -# error CONFIG_NXWM_TOUCHSCREEN_DEVNO is not defined -# elif defined(CONFIG_INPUT_STMPE811) -# define HAVE_TCINIT -# include -# else -# error CONFIG_INPUT_STMPE811=y is needed -# endif -#endif - /************************************************************************************ * Public Functions ************************************************************************************/ -- GitLab From 3fb0a50036ef30f826e198222d00d0cdfda012f7 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 18 Jan 2018 09:59:31 -0600 Subject: [PATCH 040/228] drivers/input/ft5x06.c: Remove cool logic to disable polling when there there is no client waiting for read data. That was a great idea to save CPU cycles when there is nothing reading from the touchscrren but, unfortunately, does not work with readers that open the driver in non-blocking mode. So I think we just have to eat the CPUs even when there is nothing waiting for touchscreen input. --- drivers/input/ft5x06.c | 40 ++++++---------------------------------- 1 file changed, 6 insertions(+), 34 deletions(-) diff --git a/drivers/input/ft5x06.c b/drivers/input/ft5x06.c index 25bd5f1551..de23742fba 100644 --- a/drivers/input/ft5x06.c +++ b/drivers/input/ft5x06.c @@ -364,15 +364,9 @@ static void ft5x06_data_worker(FAR void *arg) } #ifdef CONFIG_FT5X06_POLLMODE - /* Exit, re-starting the poll (unless there is no longer any task waiting - * for touch data). - */ + /* Exit, re-starting the poll. */ - if (priv->nwaiters > 0) - { - (void)wd_start(priv->polltimer, priv->delay, ft5x06_poll_timeout, 1, - priv); - } + (void)wd_start(priv->polltimer, priv->delay, ft5x06_poll_timeout, 1, priv); #else /* Exit, re-enabling FT5x06 interrupts */ @@ -398,14 +392,11 @@ static void ft5x06_poll_timeout(int argc, wdparm_t arg1, ...) * required to protected the work queue. */ - if (priv->nwaiters > 0) + DEBUGASSERT(priv->work.worker == NULL); + ret = work_queue(HPWORK, &priv->work, ft5x06_data_worker, priv, 0); + if (ret != 0) { - DEBUGASSERT(priv->work.worker == NULL); - ret = work_queue(HPWORK, &priv->work, ft5x06_data_worker, priv, 0); - if (ret != 0) - { - ierr("ERROR: Failed to queue work: %d\n", ret); - } + ierr("ERROR: Failed to queue work: %d\n", ret); } } #endif @@ -682,25 +673,6 @@ static ssize_t ft5x06_waitsample(FAR struct ft5x06_dev_s *priv, priv->nwaiters++; -#ifdef CONFIG_FT5X06_POLLMODE - /* The poll timer is stopped when there are no waiters. So we may - * need to restart with at the maximum rate. - */ - - if (priv->nwaiters == 1) - { - priv->delay = POLL_MINDELAY; - - ret = wd_start(priv->polltimer, priv->delay, ft5x06_poll_timeout, - 1, priv); - if (ret < 0) - { - ierr("ERROR: nxsem_wait failed: %d\n", ret); - goto errout; - } - } -#endif - /* Wait for a change in the FT5x06 state */ ret = nxsem_wait(&priv->waitsem); -- GitLab From c0a343a6f0d5a84a1dc27bba51c7bdcbebe50faf Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 18 Jan 2018 10:00:27 -0600 Subject: [PATCH 041/228] configs/lpcxpresso-lpc54628/lvgl: Add LittlevGL graphics demo configuration. --- configs/lpcxpresso-lpc54628/README.txt | 21 +++++++ configs/lpcxpresso-lpc54628/lvgl/defconfig | 71 ++++++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 configs/lpcxpresso-lpc54628/lvgl/defconfig diff --git a/configs/lpcxpresso-lpc54628/README.txt b/configs/lpcxpresso-lpc54628/README.txt index e7b195ef41..ff1597cc4a 100644 --- a/configs/lpcxpresso-lpc54628/README.txt +++ b/configs/lpcxpresso-lpc54628/README.txt @@ -229,6 +229,27 @@ Configurations interrupts are not supported on P4. So polled mode only for this puppy. + lvgl + ---- + This is a demonstration of the LittlevGL graphics library running on + the NuttX frame buffer driver (as in the fb configuration). You can + find LittlevGL here: + + https://littlevgl.com/ + https://github.com/littlevgl + + This configuration uses the LittlevGL demonstration at apps/examples/lvgldemo. + + NOTES: + + 1. The LittlevGL demonstration is quit large, due mostly to some large + graphic images. So memory is tight in the LPC54628's 512Kb FLASH. In + fact, if you disable optimization, the demo will not fit into FLASH + memory (at least not with debug output also enabled). + + A longer term solution might load the large images into the abundant + SDRAM at runtime instead of linking it statically in FLASH. + netnsh: ------ This is a special version of the NuttShell (nsh) configuration that is diff --git a/configs/lpcxpresso-lpc54628/lvgl/defconfig b/configs/lpcxpresso-lpc54628/lvgl/defconfig new file mode 100644 index 0000000000..69faf20696 --- /dev/null +++ b/configs/lpcxpresso-lpc54628/lvgl/defconfig @@ -0,0 +1,71 @@ +# CONFIG_ARCH_FPU is not set +# CONFIG_LV_FONT_ANTIALIAS is not set +CONFIG_ARCH_BOARD_LPCXPRESSO_LPC54628=y +CONFIG_ARCH_BOARD="lpcxpresso-lpc54628" +CONFIG_ARCH_CHIP_LPC54628=y +CONFIG_ARCH_CHIP_LPC54XX=y +CONFIG_ARCH_INTERRUPTSTACK=2048 +CONFIG_ARCH_STACKDUMP=y +CONFIG_ARCH_STDARG_H=y +CONFIG_ARCH="arm" +CONFIG_BOARD_LOOPSPERMSEC=21082 +CONFIG_BUILTIN=y +CONFIG_DRIVERS_VIDEO=y +CONFIG_EXAMPLES_LVGLDEMO=y +CONFIG_FS_PROCFS=y +CONFIG_FT5X06_POLLMODE=y +CONFIG_FT5X06_SINGLEPOINT=y +CONFIG_FT5X06_SWAPXY=y +CONFIG_GRAPHICS_LVGL=y +CONFIG_HAVE_CXX=y +CONFIG_HAVE_CXXINITIALIZE=y +CONFIG_HOST_WINDOWS=y +CONFIG_INPUT_FT5X06=y +CONFIG_INPUT=y +CONFIG_INTELHEX_BINARY=y +CONFIG_LIB_BOARDCTL=y +CONFIG_LPC54_EMC_DYNAMIC_CS0_OFFSET=0x00080000 +CONFIG_LPC54_EMC_DYNAMIC_CS0_SIZE=0x00f80000 +CONFIG_LPC54_EMC_DYNAMIC_CS0=y +CONFIG_LPC54_EMC=y +CONFIG_LPC54_GPIOIRQ=y +CONFIG_LPC54_I2C2_MASTER=y +CONFIG_LPC54_LCD_BGR=y +CONFIG_LPC54_LCD_BPP16_565=y +CONFIG_LPC54_LCD_HBACKPORCH=43 +CONFIG_LPC54_LCD_HFRONTPORCH=8 +CONFIG_LPC54_LCD_VBACKPORCH=12 +CONFIG_LPC54_LCD_VFRONTPORCH=4 +CONFIG_LPC54_LCD_VPULSE=10 +CONFIG_LPC54_LCD_VRAMBASE=0xa0000000 +CONFIG_LPC54_LCD=y +CONFIG_LPC54_USART0=y +CONFIG_LV_HOR_RES=480 +CONFIG_LV_VER_RES=272 +CONFIG_MAX_TASKS=16 +CONFIG_MAX_WDOGPARMS=2 +CONFIG_MM_REGIONS=2 +CONFIG_NFILE_DESCRIPTORS=8 +CONFIG_NFILE_STREAMS=8 +CONFIG_PREALLOC_MQ_MSGS=4 +CONFIG_PREALLOC_TIMERS=4 +CONFIG_PREALLOC_WDOGS=4 +CONFIG_RAM_SIZE=163840 +CONFIG_RAM_START=0x20000000 +CONFIG_RAW_BINARY=y +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_HPWORK=y +CONFIG_SCHED_WAITPID=y +CONFIG_SDCLONE_DISABLE=y +CONFIG_TASK_NAME_SIZE=32 +CONFIG_USART0_SERIAL_CONSOLE=y +CONFIG_USE_LV_FONT_DEJAVU_40_CYRILLIC=y +CONFIG_USE_LV_FONT_DEJAVU_40_LATIN_EXT_A=y +CONFIG_USE_LV_FONT_DEJAVU_40_LATIN_EXT_B=y +CONFIG_USE_LV_FONT_DEJAVU_40_SUP=y +CONFIG_USE_LV_FONT_SYMBOL_40_BASIC=y +CONFIG_USE_LV_FONT_SYMBOL_40_FEEDBACK=y +CONFIG_USE_LV_FONT_SYMBOL_40_FILE=y +CONFIG_USER_ENTRYPOINT="lvgldemo_main" +CONFIG_VIDEO_FB=y +CONFIG_WDOG_INTRESERVE=0 -- GitLab From ff8cdcc89f1762fd471f1dccb65c542521361a5b Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 18 Jan 2018 11:14:54 -0600 Subject: [PATCH 042/228] configs/lpcxpresso-lpc54628: Update README --- configs/lpcxpresso-lpc54628/README.txt | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/configs/lpcxpresso-lpc54628/README.txt b/configs/lpcxpresso-lpc54628/README.txt index ff1597cc4a..c9b3cbb524 100644 --- a/configs/lpcxpresso-lpc54628/README.txt +++ b/configs/lpcxpresso-lpc54628/README.txt @@ -95,10 +95,12 @@ STATUS more testing is certainly needed. 2018-01-14: The basic SPI driver is code complete but still untested. It is "basic" in the sense that it supports only polled mode (no DMA). + 2018-01-18: Added the lvgl configuration. See notes under "Configuration + Sub-directories" for additional status. - There is still no support for the Accelerometer, SPIFI, or USB. There are - complete but not-yet-functional SD card and SPI drivers. There are no - on-board devices to support SPI testing. + There is still no support for the Accelerometer, SPIFI, or USB. There is + a complete but not-yet-functional SD card driver and and tested SPI + driver. There are no on-board devices to support SPI testing. Configurations ============== @@ -156,7 +158,7 @@ Configurations System Type -> Toolchain: CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIW=y : GNU ARM EABI toolchain - Configuration sub-directories + Configuration Sub-directories ----------------------------- fb: @@ -250,6 +252,18 @@ Configurations A longer term solution might load the large images into the abundant SDRAM at runtime instead of linking it statically in FLASH. + STATUS: + + 2018-01-18: The demo is basically function but has some issues: + + a) The font is too big on the "Write" screen. They don't fit in on + the keyboard. + b) The "List" display is filled with a big box that says "Click a + button to copy its text to Text area." There are no buttons and + nothing to click on (maybe they are behind the big box?). This + may also be a font size issue. + c) The "Chart" display looks okay. + netnsh: ------ This is a special version of the NuttShell (nsh) configuration that is -- GitLab From 9417bfde0ee3aff79d8e8413c3221e66e4f6c8bf Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 18 Jan 2018 12:51:07 -0600 Subject: [PATCH 043/228] include/termios.h: Update comments; fix long lines. --- include/termios.h | 70 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 52 insertions(+), 18 deletions(-) diff --git a/include/termios.h b/include/termios.h index 8427cbf599..10e88d7e00 100644 --- a/include/termios.h +++ b/include/termios.h @@ -58,7 +58,8 @@ #define INLCR (1 << 5) /* Bit 5: Map NL to CR on input */ #define INPCK (1 << 6) /* Bit 6: Enable input parity check */ #define ISTRIP (1 << 7) /* Bit 7: Strip character */ -#define IUCLC (1 << 8) /* Bit 8: Map upper-case to lower-case on input (LEGACY) */ +#define IUCLC (1 << 8) /* Bit 8: Map upper-case to lower-case on input + * (LEGACY) */ #define IXANY (1 << 9) /* Bit 9: Enable any character to restart output */ #define IXOFF (1 << 10) /* Bit 10: Enable start/stop input control */ #define IXON (1 << 11) /* Bit 11: Enable start/stop output control */ @@ -67,7 +68,8 @@ /* Terminal output modes (c_oflag in the termios structure) */ #define OPOST (1 << 0) /* Bit 0: Post-process output */ -#define OLCUC (1 << 1) /* Bit 1: Map lower-case to upper-case on output (LEGACY) */ +#define OLCUC (1 << 1) /* Bit 1: Map lower-case to upper-case on +* * output (LEGACY) */ #define ONLCR (1 << 2) /* Bit 2: Map NL to CR-NL on output */ #define OCRNL (1 << 3) /* Bit 3: Map CR to NL on output */ #define ONOCR (1 << 4) /* Bit 4: No CR output at column 0 */ @@ -116,22 +118,47 @@ /* Local Modes (c_lflag in the termios structure) */ #define ECHO (1 << 0) /* Bit 0: Enable echo */ -#define ECHOE (1 << 1) /* Bit 1: Echo erase character as error-correcting backspace */ +#define ECHOE (1 << 1) /* Bit 1: Echo erase character as error- + * correcting backspace */ #define ECHOK (1 << 2) /* Bit 2: Echo KILL */ #define ECHONL (1 << 3) /* Bit 3: Echo NL */ -#define ICANON (1 << 4) /* Bit 4: Canonical input (erase and kill processing) */ -#define IEXTEN (1 << 5) /* Bit 5: Enable extended input character processing */ +#define ICANON (1 << 4) /* Bit 4: Canonical input (erase and kill + * processing) */ +#define IEXTEN (1 << 5) /* Bit 5: Enable extended input character + * processing */ #define ISIG (1 << 6) /* Bit 6: Enable signals */ #define NOFLSH (1 << 7) /* Bit 7: Disable flush after interrupt or quit */ #define TOSTOP (1 << 8) /* Bit 8: Send SIGTTOU for background output */ -#define XCASE (1 << 9) /* Bit 9: Canonical upper/lower presentation (LEGACY) */ +#define XCASE (1 << 9) /* Bit 9: Canonical upper/lower presentation + * (LEGACY) */ -/* The following are subscript names for the termios c_cc array */ +/* The following are subscript names for the termios c_cc array. + * + * Common characters: VINTR, VQUIT, VSTART, VSTOP, VSUSP + * + * VINTR: Interrupt character (Default ETX, Control-C) + * VQUIT: Quit character (Default FS, Control-\) + * VSTART: Start character (Default DC1, Control-Q) + * VSTOP: Stop character (Default DC3, Control-S) + * VSUSP: Suspend character (Default SUB, Control-Z) + * + * Canonical mode: Adds VEOF, VEOL, VERASE, VKILL + * + * VEOL: End-of-file character (Default SUB, Control-Z) + * VEOF: End-of-line character (Default NUL) + * VERASE: Erase character (Default DEL or BS, Control-H) + * VKILL: Kill character (Default NAK or BS, Control-U) + * + * Non-canonical mode: Adds VMIN, VTIME + * + * VMIN: Minimum number of characters for non-canonical read + * VTIME: Timeout in deciseconds for non-canonical read + */ #define VEOF 0 /* Bit 0: EOF character (canonical mode) */ -#define VMIN VEOF /* Bit 0: MIN value (Non-canonical mode) */ +#define VMIN VEOF /* Bit 0: MIN value (non-canonical mode) */ #define VEOL 1 /* Bit 1: EOL character (canonical mode) */ -#define VTIME VEOL /* Bit 1: TIME value (Non-canonical mode) */ +#define VTIME VEOL /* Bit 1: TIME value (non-canonical mode) */ #define VERASE 2 /* Bit 2: ERASE character (canonical mode) */ #define VINTR 3 /* Bit 3: INTR character */ #define VKILL 4 /* Bit 4: KILL character (canonical mode) */ @@ -139,11 +166,13 @@ #define VSTART 6 /* Bit 6: START character */ #define VSTOP 7 /* Bit 7: STOP character */ #define VSUSP 8 /* Bit 8: SUSP character */ -#define NCCS 9 /* Bit 9: Size of the array c_cc for control characters */ +#define NCCS 9 /* Bit 9: Size of the array c_cc for control + * characters */ -/* Baud Rate Selection. These are instances of type speed_t. Values of 38400 - * and below are specified by POSIX; values above 38400 are sometimes referred - * to as extended values and most values appear in most termios.h implementations. +/* Baud Rate Selection. These are instances of type speed_t. Values of + * 38400 and below are specified by POSIX; values above 38400 are sometimes + * referred to as extended values and most values appear in most termios.h + * implementations. * * NOTE that is NuttX that the encoding of the speed_t values is simply the * value of the baud itself. So this opens a window for non-portable abuse @@ -188,18 +217,23 @@ #define TCSANOW 0 /* Change attributes immediately */ #define TCSADRAIN 1 /* Change attributes when output has drained */ -#define TCSAFLUSH 2 /* Change attributes when output has drained; also flush pending input */ +#define TCSAFLUSH 2 /* Change attributes when output has drained; + * also flush pending input */ /* Line Control (used with tcflush()) */ -#define TCIFLUSH 0 /* Flush pending input. Flush untransmitted output */ -#define TCIOFLUSH 1 /* Flush both pending input and untransmitted output */ +#define TCIFLUSH 0 /* Flush pending input. Flush untransmitted + * output */ +#define TCIOFLUSH 1 /* Flush both pending input and untransmitte + * output */ #define TCOFLUSH 2 /* Flush untransmitted output */ /* Constants for use with tcflow() */ -#define TCIOFF 0 /* Transmit a STOP character, intended to suspend input data */ -#define TCION 1 /* Transmit a START character, intended to restart input data */ +#define TCIOFF 0 /* Transmit a STOP character, intended to + * suspend input data */ +#define TCION 1 /* Transmit a START character, intended to + * restart input data */ #define TCOOFF 2 /* Suspend output */ #define TCOON 3 /* Restart output */ -- GitLab From 99b944fb6e09d7d102b8f7904b626e29ee2f2101 Mon Sep 17 00:00:00 2001 From: Masayuki Ishikawa Date: Fri, 19 Jan 2018 22:11:09 +0900 Subject: [PATCH 044/228] sched/semaphore: Add ASSERT(false) in nxsem_post() if no waiting task is found. Signed-off-by: Masayuki Ishikawa --- sched/semaphore/sem_post.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sched/semaphore/sem_post.c b/sched/semaphore/sem_post.c index 08a399b916..a550c0aab4 100644 --- a/sched/semaphore/sem_post.c +++ b/sched/semaphore/sem_post.c @@ -165,6 +165,12 @@ int nxsem_post(FAR sem_t *sem) up_unblock_task(stcb); } + else + { + /* This should not happen. */ + + ASSERT(false); + } } /* Check if we need to drop the priority of any threads holding -- GitLab From f012fe96cb3bc539c6b15dd84af08d3176cbdab3 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 19 Jan 2018 08:49:55 -0600 Subject: [PATCH 045/228] sched/sched/sched_sporadic.c: fix compiler error when priority inheritance is enabled. Noted by eunb.song@samsung.com --- sched/sched/sched_sporadic.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sched/sched/sched_sporadic.c b/sched/sched/sched_sporadic.c index 666416cf7d..dda7a355b8 100644 --- a/sched/sched/sched_sporadic.c +++ b/sched/sched/sched_sporadic.c @@ -138,7 +138,7 @@ static int sporadic_set_lowpriority(FAR struct tcb_s *tcb) * state. */ - tcb->base_priority = sporadic->low_priority; + tcb->base_priority = tcb->low_priority; } #endif @@ -194,7 +194,7 @@ static int sporadic_set_hipriority(FAR struct tcb_s *tcb) { /* Boosted... Do we still need to reprioritize? */ - if (sporadic->hi_priority < sporadic->base_priority) + if (sporadic->hi_priority < tcb->base_priority) { /* No.. the current execution priority is lower than the * boosted priority. Just reset the base priority. @@ -322,7 +322,7 @@ static int sporadic_interval_start(FAR struct replenishment_s *mrepl) /* Start the timer that will terminate the low priority cycle. This timer * expiration is independent of what else may occur (except that it must - * be cancelled if the thread exits. + * be canceled if the thread exits. */ DEBUGVERIFY(wd_start(&mrepl->timer, remainder, sporadic_interval_expire, -- GitLab From be3c2d1e367174e8353bd3293149ee63c5ffcb73 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 19 Jan 2018 09:07:19 -0600 Subject: [PATCH 046/228] Change ASSERT(false) to DEBUGPANIC(). --- sched/semaphore/sem_post.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sched/semaphore/sem_post.c b/sched/semaphore/sem_post.c index a550c0aab4..f20cb68c77 100644 --- a/sched/semaphore/sem_post.c +++ b/sched/semaphore/sem_post.c @@ -169,7 +169,7 @@ int nxsem_post(FAR sem_t *sem) { /* This should not happen. */ - ASSERT(false); + DEBUGPANIC(); } } -- GitLab From e8e8914cabb0a2bcf069381e01e2e44d7e8f69a3 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 20 Jan 2018 07:11:33 -0600 Subject: [PATCH 047/228] Documentation: Fix copy/paste error in NX graphics document. Noted by Henjiu Kang. --- Documentation/NXGraphicsSubsystem.html | 4 ++-- configs/flipnclick-pic32mz/README.txt | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Documentation/NXGraphicsSubsystem.html b/Documentation/NXGraphicsSubsystem.html index 3a58de35fc..efb8cbf1fe 100644 --- a/Documentation/NXGraphicsSubsystem.html +++ b/Documentation/NXGraphicsSubsystem.html @@ -12,7 +12,7 @@

      NX Graphics Subsystem

      -

      Last Updated: October 17, 2017

      +

      Last Updated: January 21, 2018

      @@ -542,7 +542,7 @@ void nxgl_yuv2rgb(uint8_t y, uint8_t u, uint8_t v, uint8_t *r, uint8_t *g, uint8

    Description: - Convert 8-bit RGB triplet to 8-bit YUV triplet. + Convert 8-bit YUV triplet to 8-bit RGB triplet.

    2.2.3 nxgl_rectcopy()

    diff --git a/configs/flipnclick-pic32mz/README.txt b/configs/flipnclick-pic32mz/README.txt index 000cda2fcc..3a1c3575d6 100644 --- a/configs/flipnclick-pic32mz/README.txt +++ b/configs/flipnclick-pic32mz/README.txt @@ -46,7 +46,8 @@ On Board Debug Support There is a simple application available at Mikroe that will allow you to write .hex files via the USB HID bootloader. However, in order to use the bootloader, you will have to control the memory map so that the - downloaded code does not clobber the bootloader. + downloaded code does not clobber the bootloader code FLASH, data + memory, exception vectors, etc. At this point, I have found no documentation describing how to build the code outside of the Mikroe toolchain for use with the Mikroe -- GitLab From 82cc0ead67e74225b0d006762df1372b956a1642 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 20 Jan 2018 07:44:35 -0600 Subject: [PATCH 048/228] sched/sched: Fix some priority inheritance related issues noted during review of logic. Also add some REVISIT comments for some issues noted in the design. --- sched/sched/sched_sporadic.c | 55 ++++++++++++++++++++++++++---------- 1 file changed, 40 insertions(+), 15 deletions(-) diff --git a/sched/sched/sched_sporadic.c b/sched/sched/sched_sporadic.c index dda7a355b8..35984b7242 100644 --- a/sched/sched/sched_sporadic.c +++ b/sched/sched/sched_sporadic.c @@ -129,7 +129,19 @@ static int sporadic_set_lowpriority(FAR struct tcb_s *tcb) #ifdef CONFIG_PRIORITY_INHERITANCE /* If the priority was boosted above the higher priority, than just - * reset the base priority. + * reset the base priority and continue to run at the boosted priority. + * + * REVISIT: There is a logic flaw here... If the priority was NOT + * boosted above the hi_priority, then it still may still need to + * boosted with respect to the lo_priority. If the highest priority + * thread waiting on a semaphore held by the sporadic thread is greater + * than the low priority (but less than the hi_priority), the new + * sched_priority should be set to that priority, not to the lo_priority + * + * In order to do this we would need a list of all semaphores held by + * the thread. We would need to select the highest priority from among + * all tasks waiting for the semaphores. Unfortunately, at present we + * know nothing about the semaphores held by the sporadic thread. */ if (tcb->sched_priority > tcb->base_priority) @@ -140,18 +152,20 @@ static int sporadic_set_lowpriority(FAR struct tcb_s *tcb) tcb->base_priority = tcb->low_priority; } + else #endif - - /* Otherwise drop the priority of thread, possible causing a context - * switch. - */ - - ret = sched_reprioritize(tcb, sporadic->low_priority); - if (ret < 0) { - int errcode = get_errno(); - serr("ERROR: sched_reprioritize failed: %d\n", errcode); - return -errcode; + /* Otherwise drop the priority of thread, possible causing a context + * switch. + */ + + ret = sched_reprioritize(tcb, sporadic->low_priority); + if (ret < 0) + { + int errcode = get_errno(); + serr("ERROR: sched_reprioritize failed: %d\n", errcode); + return -errcode; + } } return OK; @@ -188,16 +202,27 @@ static int sporadic_set_hipriority(FAR struct tcb_s *tcb) #ifdef CONFIG_PRIORITY_INHERITANCE /* If the priority was boosted above the higher priority, than just * reset the base priority. + * + * First, was the priority boosted above the lo_priority which should be + * the same as the base_priority here? (This is an unnecessary test. + * sched_priority > hi_priority would be sufficient). */ if (tcb->sched_priority > tcb->base_priority) { - /* Boosted... Do we still need to reprioritize? */ + /* Boosted... Do we still need to reprioritize? If we were boosted to + * a priority above the hi_priority then we do not need to do anything + * except to adjust the base_priority + * + * REVISIT: This logic is probably okay. But may lead to problems + * when the hi_priority is resumed. See REVISIT comments in + * sporadic_set_lowpriority(). + */ - if (sporadic->hi_priority < tcb->base_priority) + if (tcb->sched_priority > sporadic->hi_priority) { - /* No.. the current execution priority is lower than the - * boosted priority. Just reset the base priority. + /* No.. the new execution priority is lower than the boosted + * priority. Just reset the base priority. */ tcb->base_priority = sporadic->hi_priority; -- GitLab From bcffeae4fd06b7e937dfc884b6e9dc8539300fe9 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 20 Jan 2018 12:59:56 -0600 Subject: [PATCH 049/228] Update README and some comments --- README.txt | 19 +++++++++++++++++++ sched/sched/sched_sporadic.c | 8 ++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/README.txt b/README.txt index 4dfd513a7f..719fe60d17 100644 --- a/README.txt +++ b/README.txt @@ -1422,6 +1422,22 @@ Installing GNUWin32 CYGWIN BUILD PROBLEMS ^^^^^^^^^^^^^^^^^^^^^ +Performance +----------- + + Build performance under Cygwin is really not so bad, certainly not as good + as a Linux build. However, often you will find that the performance is + not just bad but terrible. If you are seeing awful performance.. like two + or three compilations per second.. the culprit is usually your Windows + Anti-Virus protection interfering with the build tool program execution. + + I use Cygwin quite often and I use Windows Defender. In order to get good + build performance, I routinely keep the Windows Defender "Virus & Threat + Protections Settings" screen up: I disable "Real-Time Protection" just + before entering 'make' then turn "Real-Time Protection" back on when the + build completes. With this additional nuisance step, I find that build + performance under Cygwin is completely acceptable. + Strange Path Problems --------------------- @@ -1475,6 +1491,7 @@ Window Native Toolchain Issues if you are using a native Windows toolchain. That bring us to #3: General Pre-built Toolchain Issues +---------------------------------- To continue with the list of "Window Native Toolchain Issues" we can add the following. These, however, are really just issues that you will have @@ -1528,6 +1545,7 @@ General Pre-built Toolchain Issues binutils and possibly different ABIs. Building Original Linux Boards in Cygwin +---------------------------------------- Some default board configurations are set to build under Linux and others to build under Windows with Cygwin. Various default toolchains may also @@ -1546,6 +1564,7 @@ Building Original Linux Boards in Cygwin ("Run As" option, right button) you find errors like "Permission denied". Recovering from Bad Configurations +---------------------------------- Many people make the mistake of configuring NuttX with the "canned" configuration and then just typing 'make' with disastrous consequences; diff --git a/sched/sched/sched_sporadic.c b/sched/sched/sched_sporadic.c index 35984b7242..90206c486e 100644 --- a/sched/sched/sched_sporadic.c +++ b/sched/sched/sched_sporadic.c @@ -138,10 +138,10 @@ static int sporadic_set_lowpriority(FAR struct tcb_s *tcb) * than the low priority (but less than the hi_priority), the new * sched_priority should be set to that priority, not to the lo_priority * - * In order to do this we would need a list of all semaphores held by - * the thread. We would need to select the highest priority from among - * all tasks waiting for the semaphores. Unfortunately, at present we - * know nothing about the semaphores held by the sporadic thread. + * In order to do this we would need to know the highest priority from + * among all tasks waiting for the all semaphores held by the sporadic + * task. Perhaps that information could be retained by the priority + * inheritance logic for use here? */ if (tcb->sched_priority > tcb->base_priority) -- GitLab From d0ae325c15cdecec81666af2e4fda34eaaf88f18 Mon Sep 17 00:00:00 2001 From: Fanda Vacek Date: Sat, 20 Jan 2018 23:00:47 +0100 Subject: [PATCH 050/228] Issue #85: /dev/userleds is not working for nucleo-l432kc fixed --- configs/nucleo-l432kc/README.txt | 2 +- configs/nucleo-l432kc/include/board.h | 4 ++-- configs/nucleo-l432kc/src/nucleo-l432kc.h | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/configs/nucleo-l432kc/README.txt b/configs/nucleo-l432kc/README.txt index 33ebc530cd..b68e68ebbd 100644 --- a/configs/nucleo-l432kc/README.txt +++ b/configs/nucleo-l432kc/README.txt @@ -324,7 +324,7 @@ Hardware ---- The Nucleo F401RE and Nucleo F411RE provide a single user LED, LD2. LD2 is the green LED connected to Arduino signal D13 corresponding to MCU I/O - PA5 (pin 21) or PB13 (pin 34) depending on the STM32target. + PB3 (pin 26). - When the I/O is HIGH value, the LED is on. - When the I/O is LOW, the LED is off. diff --git a/configs/nucleo-l432kc/include/board.h b/configs/nucleo-l432kc/include/board.h index dbe6dbe48f..529accb653 100644 --- a/configs/nucleo-l432kc/include/board.h +++ b/configs/nucleo-l432kc/include/board.h @@ -147,8 +147,8 @@ /* LEDs * * The Nucleo l476RG board provides a single user LED, LD2. LD2 - * is the green LED connected to Arduino signal D13 corresponding to MCU I/O - * PA5 (pin 21) or PB13 (pin 34) depending on the STM32 target. + * is the green LED connected to Arduino signal D13 corresponding to + * MCU I/O PB3 (pin 26). * * - When the I/O is HIGH value, the LED is on. * - When the I/O is LOW, the LED is off. diff --git a/configs/nucleo-l432kc/src/nucleo-l432kc.h b/configs/nucleo-l432kc/src/nucleo-l432kc.h index 9ce05bc83d..e5c34816bb 100644 --- a/configs/nucleo-l432kc/src/nucleo-l432kc.h +++ b/configs/nucleo-l432kc/src/nucleo-l432kc.h @@ -77,7 +77,7 @@ #endif /* LED. User LD2: the green LED is a user LED connected to Arduino signal D13 - * corresponding to MCU I/O PA5 (pin 21) or PB13 (pin 34) depending on the STM32 + * corresponding to MCU I/O PB3 (pin 26) * target. * * - When the I/O is HIGH value, the LED is on. @@ -85,7 +85,7 @@ */ #define GPIO_LD2 \ - (GPIO_PORTA | GPIO_PIN5 | GPIO_OUTPUT_CLEAR | GPIO_OUTPUT | GPIO_PULLUP | \ + (GPIO_PORTB | GPIO_PIN3 | GPIO_OUTPUT_CLEAR | GPIO_OUTPUT | GPIO_PULLUP | \ GPIO_SPEED_50MHz) #define LED_DRIVER_PATH "/dev/userleds" -- GitLab From f153df28d30733588e98122775816a9700dfecda Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 20 Jan 2018 16:16:35 -0600 Subject: [PATCH 051/228] configs/nucleo-l432kc: Fix numerous cloning errors/typos. --- TODO | 4 ++-- configs/nucleo-l432kc/README.txt | 19 ++++++++----------- configs/nucleo-l432kc/include/board.h | 4 ++-- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/TODO b/TODO index 3d92fd7ee2..19b328e54d 100644 --- a/TODO +++ b/TODO @@ -745,7 +745,7 @@ o Kernel/Protected Build Title: USER MODE TASKS CAN MODIFY PRIVILEGED TASKS Description: Certain interfaces, such as sched_setparam(), sched_setscheduler(), etc. can be used by user mode tasks to - modify the behavior of priviledged kernel threads. + modify the behavior of privileged kernel threads. For a truly secure system. Privileges need to be checked in every interface that permits one thread to modify the properties of another thread. @@ -1282,7 +1282,7 @@ o Network (net/, drivers/net) however, because its priority is low and so it is blocked from execution. - In the mean time, the remote host sends a - packet which is presumeably caught in the read-ahead buffer. + packet which is presumably caught in the read-ahead buffer. - Then the remote host closes the socket. Nothing happens on the target side because net_start_monitor() has not yet been called. diff --git a/configs/nucleo-l432kc/README.txt b/configs/nucleo-l432kc/README.txt index b68e68ebbd..43eacb4391 100644 --- a/configs/nucleo-l432kc/README.txt +++ b/configs/nucleo-l432kc/README.txt @@ -230,12 +230,10 @@ NuttX EABI "buildroot" Toolchain 1. You must have already configured Nuttx in /nuttx. - $ (cd tools; ./configure.sh nucleo-f4x1re/f401-nsh) + $ tools/configure.sh nucleo-f432kc/nsh $ make qconfig $ V=1 make context all 2>&1 | tee mout - Use the f411-nsh configuration if you have the Nucleo-F411RE board. - 2. Download the latest buildroot package into 3. unpack the buildroot tarball. The resulting directory may @@ -298,14 +296,13 @@ NXFLAT Toolchain mbed ==== - The Nucleo-F401RE includes boot loader from mbed: + The Nucleo-F432KC includes boot loader from mbed: - https://mbed.org/platforms/ST-Nucleo-F401RE/ https://mbed.org/handbook/Homepage Using the mbed loader: - 1. Connect the Nucleo-F4x1RE to the host PC using the USB connector. + 1. Connect the Nucleo-F432kc to the host PC using the USB connector. 2. A new file system will appear called NUCLEO; open it with Windows Explorer (assuming that you are using Windows). 3. Drag and drop nuttx.bin into the MBED window. This will load the @@ -322,7 +319,7 @@ Hardware LEDs ---- - The Nucleo F401RE and Nucleo F411RE provide a single user LED, LD2. LD2 + The Nucleo F401RE and Nucleo F432KC provide a single user LED, LD2. LD2 is the green LED connected to Arduino signal D13 corresponding to MCU I/O PB3 (pin 26). @@ -367,7 +364,7 @@ Serial Consoles TTL to RS-232 converter connection: - Nucleo CN10 STM32F4x1RE + Nucleo CN10 STM32F432KC ----------- ------------ Pin 21 PA9 USART1_RX *Warning you make need to reverse RX/TX on Pin 33 PA10 USART1_TX some RS-232 converters @@ -399,7 +396,7 @@ Serial Consoles TTL to RS-232 converter connection: - Nucleo CN9 STM32F4x1RE + Nucleo CN9 STM32F432KC ----------- ------------ Pin 1 PA3 USART2_RX *Warning you make need to reverse RX/TX on Pin 2 PA2 USART2_TX some RS-232 converters @@ -457,7 +454,7 @@ Configurations nsh: --------- Configures the NuttShell (nsh) located at apps/examples/nsh for the - Nucleo-F401RE board. The Configuration enables the serial interfaces + Nucleo-F432KC board. The Configuration enables the serial interfaces on UART2. Support for builtin applications is enabled, but in the base configuration no builtin applications are selected (see NOTES below). @@ -484,7 +481,7 @@ Configurations Consoles). I have been using a TTL-to-RS-232 converter connected as shown below: - Nucleo CN10 STM32F4x1RE + Nucleo CN10 STM32F432KC ----------- ------------ Pin 21 PA9 USART1_RX *Warning you make need to reverse RX/TX on Pin 33 PA10 USART1_TX some RS-232 converters diff --git a/configs/nucleo-l432kc/include/board.h b/configs/nucleo-l432kc/include/board.h index 529accb653..3e7e90c453 100644 --- a/configs/nucleo-l432kc/include/board.h +++ b/configs/nucleo-l432kc/include/board.h @@ -146,7 +146,7 @@ /* LEDs * - * The Nucleo l476RG board provides a single user LED, LD2. LD2 + * The Nucleo l432kc board provides a single user LED, LD2. LD2 * is the green LED connected to Arduino signal D13 corresponding to * MCU I/O PB3 (pin 26). * @@ -266,4 +266,4 @@ void stm32l4_board_initialize(void); #endif #endif /* __ASSEMBLY__ */ -#endif /* __CONFIGS_NUCLEO_F476RG_INCLUDE_BOARD_H */ +#endif /* __CONFIGS_NUCLEO_F432KC_INCLUDE_BOARD_H */ -- GitLab From 0c034c8dd34f8111d7d24e2bc967c9c69f404b3f Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sun, 21 Jan 2018 07:47:13 -0600 Subject: [PATCH 052/228] Update TODO list --- TODO | 81 +++++++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 67 insertions(+), 14 deletions(-) diff --git a/TODO b/TODO index 19b328e54d..4d46a3e5b0 100644 --- a/TODO +++ b/TODO @@ -1,15 +1,15 @@ -NuttX TODO List (Last updated January 3, 2018) +NuttX TODO List (Last updated January 21, 2018) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This file summarizes known NuttX bugs, limitations, inconsistencies with standards, things that could be improved, and ideas for enhancements. This -TODO list does not include issues associated with individual boar ports. See +TODO list does not include issues associated with individual board ports. See also the individual README.txt files in the configs/ sub-directories for issues related to each board port. nuttx/: - (12) Task/Scheduler (sched/) + (14) Task/Scheduler (sched/) (1) SMP (1) Memory Management (mm/) (0) Power Management (drivers/pm) @@ -47,7 +47,7 @@ o Task/Scheduler (sched/) Status: Closed. No, this behavior will not be implemented. Priority: Medium, required for good emulation of process/pthread model. The current behavior allows for the main thread of a task to - exit() and any child pthreads will perist. That does raise + exit() and any child pthreads will persist. That does raise some issues: The main thread is treated much like just-another- pthread but must follow the semantics of a task or a process. That results in some inconsistencies (for example, with robust @@ -124,7 +124,7 @@ o Task/Scheduler (sched/) The fix for all of these issues it to have the callbacks run on the caller's thread as is currently done with signal handlers. Signals are delivered differently in - PROTECTED and KERNEL modes: The deliver is involes a + PROTECTED and KERNEL modes: The delivery involves a signal handling trampoline function in the user address space and two signal handlers: One to call the signal handler trampoline in user mode (SYS_signal_handler) and @@ -198,7 +198,7 @@ o Task/Scheduler (sched/) Description: The internal NuttX logic uses the same interfaces as does the application. That sometime produces a problem because there is "overloaded" functionality in those user interfaces - that are not desireable. + that are not desirable. For example, having cancellation points hidden inside of the OS can cause non-cancellation point interfaces to behave @@ -327,6 +327,59 @@ o Task/Scheduler (sched/) Status: Open Priority: Low, only needed for more complete debug. + Title: PRIORITY INHERITANCE WITH SPORADIC SCHEDULER + Description: The sporadic scheduler manages CPU utilization by a task by + alternating between a high and a low priority. In either + state, it may have its priority boosted. However, under + some circumstances, it is impossible in the current design to + switch to the correct correct priority if a semaphore is + participating in priority inheritance: + + There is an when switching from the high to the low priority + state. If the priority was NOT boosted above the higher + priority, it still may still need to boosted with respect to + the lower priority. If the highest priority thread waiting + on a semaphore held by the sporadic thread is higher in + priority than the low priority but less than the higher + priority, then new thread priority should be set to that + middle priority, not to the lower priority + + In order to do this we would need to know the highest + priority from among all tasks waiting for the all semaphores + held by the sporadic task. That information could be + retained by the priority inheritance logic for use by the + sporadic scheduler. The boost priority could be retained in + a new field of the TCB (say, pend_priority). That + pend_priority could then be used when switching from the + higher to the lower priority. + Status: Open + Priority: Low. Does anyone actually use the sporadic scheduler? + + Title: SIMPLIFY SPORADIC SCHEDULER DESIGN + Description: I have been planning to re-implement sporadic scheduling for + some time. I believe that the current implementation is + unnecessarily complex. There is no clear statement for the + requirements of sporadic scheduling that I could find, so I + based the design on some behaviors of another OS that I saw + published (QNX as I recall). + + But I think that the bottom line requirement for sporadic + scheduling is that is it should make a best attempt to + control a fixed percentage of CPU bandwidth for a task in + during an interval only by modifying it is priority between + a low and a high priority. The current design involves + several timers: A "budget" timer plus a variable number of + "replenishment" timers and a lot of nonsense to duplicate QNX + behavior that I think I not necessary. + + It think that the sporadic scheduler could be re-implemented + with only the single "budget" timer. Instead of starting a + new "replenishment" timer when the task is resumed, that + single timer could just be extended. + Status: Open + Priority: Low. This is an enhancement. And does anyone actually use + the sporadic scheduler? + o SMP ^^^ @@ -572,7 +625,7 @@ o pthreads (sched/pthreads) group structure. I am, however, hesitant to make this change: In the FLAT build model, there is nothing that prevents people from accessing the inter-thread controls from threads in - differnt task groups. Making this change, while correct, + different task groups. Making this change, while correct, might introduce subtle bugs in code by people who are not using NuttX correctly. Status: Open @@ -1838,7 +1891,7 @@ o File system / Generic drivers (fs/, drivers/) (using pctl() instead sysctl()). My objective was to be able to control the number of available file descriptors on a task- by-task basis. The complexity due to the partitioning of - desciptor space in a range for file descriptors and a range + descriptor space in a range for file descriptors and a range for socket descriptors made this feature nearly impossible to implement. Status: Open @@ -1920,8 +1973,8 @@ o File system / Generic drivers (fs/, drivers/) 4) When comparing the checksum in the long file name entry with the checksum of the short file name, the checksum fails and the entire directory sequence is - ignored by readder() logic. This the file does not - appear in the 'ls'. + ignored by readdir() logic. This is why the file does + not appear in the 'ls'. o Graphics Subsystem (graphics/) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -2014,7 +2067,7 @@ o Graphics Subsystem (graphics/) Title: LOW-RES FRAMEBUFFER RENDERERING Description: There are obvious issues in the low-res, < 8 BPP, implemenation of - the framebuffer rendereing logic of graphics/nxglib/fb. I see two + the framebuffer rendering logic of graphics/nxglib/fb. I see two obvious problems in reviewing nxglib_copyrectangle(): 1. The masking logic might work 1 BPP, but is insufficient for other @@ -2026,7 +2079,7 @@ o Graphics Subsystem (graphics/) derives from nxglib_copyrectangle() and all of those issues have been resolved in that file. - Other frambuffer rendering functions probably have similary issues. + Other frambuffer rendering functions probably have similar issues. Status: Open Priority: Low. It is not surprising that there would be bugs in this logic: I have never encountered a hardware framebuffer with sub-byte pixel @@ -2279,11 +2332,11 @@ o Modbus (apps/modbus) Title: MODBUS NOT USABLE WITH USB SERIAL Description: Modbus can be used with USB serial, however, if the USB - serial connectiont is lost, Modbus will hang in an infinite + serial connection is lost, Modbus will hang in an infinite loop. This is a problem in the handling of select() and read() - and could probabaly resolved by studying the Modbus error + and could probably resolved by studying the Modbus error handling. A more USB-friendly solution would be to: (1) Re-connect and -- GitLab From 9916ca89e6fb8dae1cc0f5c22201704ed8de96f7 Mon Sep 17 00:00:00 2001 From: Fanda Vacek Date: Sun, 21 Jan 2018 19:06:22 +0100 Subject: [PATCH 053/228] NUCLEO F432KC typo fixed, correct name is L432KC Just README.txt and comments affected, no changes in the code --- configs/nucleo-l432kc/README.txt | 16 ++++++++-------- configs/nucleo-l432kc/include/board.h | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/configs/nucleo-l432kc/README.txt b/configs/nucleo-l432kc/README.txt index 43eacb4391..a922e17638 100644 --- a/configs/nucleo-l432kc/README.txt +++ b/configs/nucleo-l432kc/README.txt @@ -230,7 +230,7 @@ NuttX EABI "buildroot" Toolchain 1. You must have already configured Nuttx in /nuttx. - $ tools/configure.sh nucleo-f432kc/nsh + $ tools/configure.sh nucleo-l432kc/nsh $ make qconfig $ V=1 make context all 2>&1 | tee mout @@ -296,13 +296,13 @@ NXFLAT Toolchain mbed ==== - The Nucleo-F432KC includes boot loader from mbed: + The Nucleo-L432KC includes boot loader from mbed: https://mbed.org/handbook/Homepage Using the mbed loader: - 1. Connect the Nucleo-F432kc to the host PC using the USB connector. + 1. Connect the Nucleo-L432kc to the host PC using the USB connector. 2. A new file system will appear called NUCLEO; open it with Windows Explorer (assuming that you are using Windows). 3. Drag and drop nuttx.bin into the MBED window. This will load the @@ -319,7 +319,7 @@ Hardware LEDs ---- - The Nucleo F401RE and Nucleo F432KC provide a single user LED, LD2. LD2 + The Nucleo L432KC provides a single user LED, LD2. LD2 is the green LED connected to Arduino signal D13 corresponding to MCU I/O PB3 (pin 26). @@ -364,7 +364,7 @@ Serial Consoles TTL to RS-232 converter connection: - Nucleo CN10 STM32F432KC + Nucleo CN10 STM32L432KC ----------- ------------ Pin 21 PA9 USART1_RX *Warning you make need to reverse RX/TX on Pin 33 PA10 USART1_TX some RS-232 converters @@ -396,7 +396,7 @@ Serial Consoles TTL to RS-232 converter connection: - Nucleo CN9 STM32F432KC + Nucleo CN9 STM32L432KC ----------- ------------ Pin 1 PA3 USART2_RX *Warning you make need to reverse RX/TX on Pin 2 PA2 USART2_TX some RS-232 converters @@ -454,7 +454,7 @@ Configurations nsh: --------- Configures the NuttShell (nsh) located at apps/examples/nsh for the - Nucleo-F432KC board. The Configuration enables the serial interfaces + Nucleo-L432KC board. The Configuration enables the serial interfaces on UART2. Support for builtin applications is enabled, but in the base configuration no builtin applications are selected (see NOTES below). @@ -481,7 +481,7 @@ Configurations Consoles). I have been using a TTL-to-RS-232 converter connected as shown below: - Nucleo CN10 STM32F432KC + Nucleo CN10 STM32L432KC ----------- ------------ Pin 21 PA9 USART1_RX *Warning you make need to reverse RX/TX on Pin 33 PA10 USART1_TX some RS-232 converters diff --git a/configs/nucleo-l432kc/include/board.h b/configs/nucleo-l432kc/include/board.h index 3e7e90c453..041a755787 100644 --- a/configs/nucleo-l432kc/include/board.h +++ b/configs/nucleo-l432kc/include/board.h @@ -266,4 +266,4 @@ void stm32l4_board_initialize(void); #endif #endif /* __ASSEMBLY__ */ -#endif /* __CONFIGS_NUCLEO_F432KC_INCLUDE_BOARD_H */ +#endif /* __CONFIGS_NUCLEO_L432KC_INCLUDE_BOARD_H */ -- GitLab From 5af7e3de2a43277b0de6e55affcab4253780a6f1 Mon Sep 17 00:00:00 2001 From: Mateusz Szafoni Date: Sun, 21 Jan 2018 18:28:09 +0000 Subject: [PATCH 054/228] Merged in raiden00/nuttx (pull request #579) Master * stm32_hritm: add interface to get timer clock frequency stm32_hrtim: fix timer freq calculation stm32_hrtim: add compar/capture registers significant bits checking stm32_hrtim: minor changes * stm32f334-disco: add buck converter and boost converter logic Approved-by: Gregory Nutt --- arch/arm/src/stm32/stm32_hrtim.c | 415 +++++++++++++------ arch/arm/src/stm32/stm32_hrtim.h | 38 +- configs/stm32f334-disco/include/board.h | 34 +- configs/stm32f334-disco/src/stm32_smps.c | 493 ++++++++++++++++++++--- 4 files changed, 790 insertions(+), 190 deletions(-) diff --git a/arch/arm/src/stm32/stm32_hrtim.c b/arch/arm/src/stm32/stm32_hrtim.c index 44f78bff6f..121b0e2e4f 100644 --- a/arch/arm/src/stm32/stm32_hrtim.c +++ b/arch/arm/src/stm32/stm32_hrtim.c @@ -375,12 +375,13 @@ struct stm32_hrtim_capture_s struct stm32_hrtim_timcmn_s { uint32_t base; /* The base adress of the timer */ - uint32_t pclk; /* The frequency of the peripheral clock + uint64_t fclk; /* The frequency of the peripheral clock * that drives the timer module. */ + uint8_t prescaler:3; /* Prescaler */ uint8_t mode; /* Timer mode */ uint8_t dac:2; /* DAC triggering */ - uint8_t reserved:6; + uint8_t reserved:3; #ifdef CONFIG_STM32_HRTIM_INTERRUPTS uint16_t irq; /* interrupts configuration */ #endif @@ -623,6 +624,8 @@ static uint32_t hrtim_tim_getreg(FAR struct stm32_hrtim_s *priv, uint8_t timer, uint32_t offset); static FAR struct stm32_hrtim_tim_s *hrtim_tim_get(FAR struct stm32_hrtim_s *priv, uint8_t timer); +static FAR struct stm32_hrtim_slave_priv_s *hrtim_slave_get(FAR struct stm32_hrtim_s *priv, + uint8_t timer); static uint32_t hrtim_base_get(FAR struct stm32_hrtim_s *priv, uint8_t timer); /* Configuration */ @@ -665,7 +668,8 @@ static int hrtim_tim_dma_cfg(FAR struct stm32_hrtim_s *priv, uint8_t timer, #ifdef CONFIG_STM32_HRTIM_DEADTIME static int hrtim_deadtime_update(FAR struct hrtim_dev_s *dev, uint8_t timer, uint8_t dt, uint16_t value); -static uint16_t hrtim_deadtime_get(FAR struct hrtim_dev_s *dev, uint8_t dt); +static uint16_t hrtim_deadtime_get(FAR struct hrtim_dev_s *dev, uint8_t timer, + uint8_t dt); static int hrtim_tim_deadtime_cfg(FAR struct stm32_hrtim_s *priv, uint8_t timer); static int hrtim_deadtime_config(FAR struct stm32_hrtim_s *priv); #endif @@ -705,6 +709,7 @@ static int hrtim_per_update(FAR struct hrtim_dev_s *dev, uint8_t timer, static uint16_t hrtim_per_get(FAR struct hrtim_dev_s *dev, uint8_t timer); static uint16_t hrtim_cmp_get(FAR struct hrtim_dev_s *dev, uint8_t timer, uint8_t index); +static uint64_t hrtim_fclk_get(FAR struct hrtim_dev_s *dev, uint8_t timer); static int hrtim_tim_reset_set(FAR struct stm32_hrtim_s *priv, uint8_t timer, uint32_t reset); static int hrtim_reset_config(FAR struct stm32_hrtim_s *priv); @@ -753,20 +758,21 @@ static struct stm32_hrtim_tim_s g_master = /* If MASTER is disabled, we need only MASTER base */ #ifdef CONFIG_STM32_HRTIM_MASTER - .pclk = HRTIM_CLOCK/(HRTIM_MASTER_PRESCALER+1), - .mode = HRTIM_MASTER_MODE, + .fclk = HRTIM_CLOCK/(1<priv; + +errout: + return slave; +} + /**************************************************************************** * Name: hrtim_base_get * @@ -2049,7 +2108,7 @@ static void hrtim_dumpregs(FAR struct stm32_hrtim_s *priv, uint8_t timer, * priv - A reference to the HRTIM structure * * Returned Value: - * 0 on success, a negated errno value on failure + * 0 on success, a negated errno value on failure * ****************************************************************************/ @@ -2093,7 +2152,7 @@ static int hrtim_dll_cal(FAR struct stm32_hrtim_s *priv) * timer - An HRTIM Timer index * * Returned Value: - * 0 on success, a negated errno value on failure + * 0 on success, a negated errno value on failure * ****************************************************************************/ @@ -2182,7 +2241,7 @@ errout: * priv - A reference to the HRTIM structure * * Returned Value: - * 0 on success, a negated errno value on failure + * 0 on success, a negated errno value on failure * ****************************************************************************/ @@ -2264,7 +2323,7 @@ errout: * priv - A reference to the HRTIM structure * * Returned Value: - * 0 on success, a negated errno value on failure + * 0 on success, a negated errno value on failure * ****************************************************************************/ @@ -2467,7 +2526,7 @@ static int hrtim_gpios_config(FAR struct stm32_hrtim_s *priv) * capture - capture trigers configuration * * Returned Value: - * None + * 0 on success, a negated errno value on failure * ****************************************************************************/ @@ -2478,7 +2537,9 @@ static int hrtim_tim_capture_cfg(FAR struct stm32_hrtim_s *priv, int ret = OK; uint32_t offset = 0; - if (timer == HRTIM_TIMER_MASTER) + /* Sanity checking */ + + if (timer == HRTIM_TIMER_MASTER || timer == HRTIM_TIMER_COMMON) { ret = -EINVAL; goto errout; @@ -2521,7 +2582,7 @@ errout: * priv - A reference to the HRTIM block * * Returned Value: - * None + * 0 on success, a negated errno value on failure * ****************************************************************************/ @@ -2574,7 +2635,7 @@ static int hrtim_capture_config(FAR struct stm32_hrtim_s *priv) * index - Capture register index * * Returned Value: - * None + * Timer Capture value on success, 0 on failure * ****************************************************************************/ @@ -2623,7 +2684,7 @@ errout: * priv - A reference to the HRTIM structure * * Returned Value: - * 0 on success, a negated errno value on failure + * 0 on success, a negated errno value on failure * ****************************************************************************/ @@ -2645,37 +2706,26 @@ static int hrtim_synch_config(FAR struct stm32_hrtim_s *priv) * priv - A reference to the HRTIM structure * * Returned Value: - * 0 on success, a negated errno value on failure + * 0 on success, a negated errno value on failure * ****************************************************************************/ #if defined(CONFIG_STM32_HRTIM_PWM) static int hrtim_tim_outputs_config(FAR struct stm32_hrtim_s *priv, uint8_t timer) { - FAR struct stm32_hrtim_tim_s* tim; FAR struct stm32_hrtim_slave_priv_s* slave; uint32_t regval = 0; int ret = OK; - /* Master Timer has no outputs */ - - if (timer == HRTIM_TIMER_MASTER) - { - ret = -EINVAL; - goto errout; - } - - /* Get Timer data strucutre */ + /* Get Slave Timer data structure */ - tim = hrtim_tim_get(priv, timer); - if (tim == NULL) + slave = hrtim_slave_get(priv, timer); + if (slave == NULL) { ret = -EINVAL; goto errout; } - slave = (struct stm32_hrtim_slave_priv_s*)tim->priv; - /* Configure CH1 SET events */ regval = slave->pwm.ch1.set; @@ -2773,7 +2823,7 @@ errout: * priv - A reference to the HRTIM structure * * Returned Value: - * 0 on success, a negated errno value on failure + * 0 on success, a negated errno value on failure * ****************************************************************************/ @@ -2848,7 +2898,7 @@ errout: * state - Enable/disable operation * * Returned Value: - * 0 on success, a negated errno value on failure + * 0 on success, a negated errno value on failure * ****************************************************************************/ @@ -3009,7 +3059,6 @@ static int hrtim_output_set_set(FAR struct hrtim_dev_s *dev, uint16_t output, uint32_t set) { FAR struct stm32_hrtim_s *priv = (FAR struct stm32_hrtim_s *)dev->hd_priv; - FAR struct stm32_hrtim_tim_s* tim; FAR struct stm32_hrtim_slave_priv_s* slave; uint8_t timer = 0; int ret = OK; @@ -3018,17 +3067,15 @@ static int hrtim_output_set_set(FAR struct hrtim_dev_s *dev, uint16_t output, timer = output_tim_index_get(output); - /* Get Timer data strucutre */ + /* Get Slave Timer data strucutre */ - tim = hrtim_tim_get(priv, timer); - if (tim == NULL) + slave = hrtim_slave_get(priv, timer); + if (slave == NULL) { ret = -EINVAL; goto errout; } - slave = (struct stm32_hrtim_slave_priv_s*)tim->priv; - /* Set new SET value */ switch (output_tim_ch_get(output)) @@ -3065,7 +3112,6 @@ static int hrtim_output_rst_set(FAR struct hrtim_dev_s *dev, uint16_t output, uint32_t rst) { FAR struct stm32_hrtim_s *priv = (FAR struct stm32_hrtim_s *)dev->hd_priv; - FAR struct stm32_hrtim_tim_s* tim; FAR struct stm32_hrtim_slave_priv_s* slave; uint8_t timer = 0; int ret = OK; @@ -3074,17 +3120,15 @@ static int hrtim_output_rst_set(FAR struct hrtim_dev_s *dev, uint16_t output, timer = output_tim_index_get(output); - /* Get Timer data strucutre */ + /* Get Salve Timer data strucutre */ - tim = hrtim_tim_get(priv, timer); - if (tim == NULL) + slave = hrtim_slave_get(priv, timer); + if (slave == NULL) { ret = -EINVAL; goto errout; } - slave = (struct stm32_hrtim_slave_priv_s*)tim->priv; - /* Set new RST value */ switch (output_tim_ch_get(output)) @@ -3124,7 +3168,7 @@ errout: * priv - A reference to the HRTIM structure * * Returned Value: - * 0 on success, a negated errno value on failure + * 0 on success, a negated errno value on failure * ****************************************************************************/ @@ -3172,7 +3216,7 @@ static int hrtim_adc_config(FAR struct stm32_hrtim_s *priv) * dac - DAC synchronisation event configuration * * Returned Value: - * 0 on success, a negated errno value on failure + * 0 on success, a negated errno value on failure * ****************************************************************************/ @@ -3203,7 +3247,7 @@ static int hrtim_tim_dac_cfg(FAR struct stm32_hrtim_s *priv, uint8_t timer, * priv - A reference to the HRTIM structure * * Returned Value: - * 0 on success, a negated errno value on failure + * 0 on success, a negated errno value on failure * ****************************************************************************/ @@ -3268,6 +3312,14 @@ static int hrtim_tim_dma_cfg(FAR struct stm32_hrtim_s *priv, uint8_t timer, int ret = OK; uint32_t regval = 0; + /* Sanity checking */ + + if (timer == HRTIM_TIMER_COMMON) + { + ret = -EINVAL; + goto errout; + } + if (timer == HRTIM_TIMER_MASTER) { /* Master support first 7 DMA requests */ @@ -3397,7 +3449,8 @@ errout: * Name: hrtim_deadtime_get ****************************************************************************/ -static uint16_t hrtim_deadtime_get(FAR struct hrtim_dev_s *dev, uint8_t dt) +static uint16_t hrtim_deadtime_get(FAR struct hrtim_dev_s *dev, uint8_t timer, + uint8_t dt) { #warning missing logic } @@ -3408,30 +3461,27 @@ static uint16_t hrtim_deadtime_get(FAR struct hrtim_dev_s *dev, uint8_t dt) static int hrtim_tim_deadtime_cfg(FAR struct stm32_hrtim_s *priv, uint8_t timer) { - FAR struct stm32_hrtim_tim_s* tim; FAR struct stm32_hrtim_slave_priv_s* slave; uint32_t regval = 0; int ret = OK; - /* Master Timer has no outputs */ + /* Sanity checking */ - if (timer == HRTIM_TIMER_MASTER) + if (timer == HRTIM_TIMER_MASTER || timer == HRTIM_TIMER_COMMON) { ret = -EINVAL; goto errout; } - /* Get Timer data strucutre */ + /* Get Slave Timer data strucutre */ - tim = hrtim_tim_get(priv, timer); - if (tim == NULL) + slave = hrtim_slave_get(priv, timer); + if (slave == NULL) { ret = -EINVAL; goto errout; } - slave = (struct stm32_hrtim_slave_priv_s*)tim->priv; - /* Configure deadtime prescaler */ regval |= slave->pwm.dt.prescaler << HRTIM_TIMDT_DTPRSC_SHIFT; @@ -3550,7 +3600,7 @@ static int hrtim_deadtime_config(FAR struct stm32_hrtim_s *priv) * state - Enable/disable operation * * Returned Value: - * 0 on success, a negated errno value on failure + * 0 on success, a negated errno value on failure * ****************************************************************************/ @@ -3610,31 +3660,28 @@ errout: static int hrtim_tim_chopper_cfg(FAR struct stm32_hrtim_s *priv, uint8_t timer) { - FAR struct stm32_hrtim_tim_s* tim; FAR struct stm32_hrtim_slave_priv_s* slave; int ret = OK; uint32_t regval = 0; - /* Master Timer has no outputs */ + /* Sanity checking */ - if (timer == HRTIM_TIMER_MASTER) + if (timer == HRTIM_TIMER_MASTER || timer == HRTIM_TIMER_COMMON) { ret = -EINVAL; goto errout; } - /* Get Timer data strucutre */ + /* Get Slave Timer data strucutre */ - tim = hrtim_tim_get(priv, timer); - if (tim == NULL) + slave = hrtim_slave_get(priv, timer); + if (slave == NULL) { ret = -EINVAL; goto errout; } - slave = (struct stm32_hrtim_slave_priv_s*)tim->priv; - /* Configure start pulsewidth */ regval |= slave->pwm.chp.start_pulse << HRTIM_TIMCHP_STRTPW_SHIFT; @@ -3891,19 +3938,22 @@ static int hrtim_burst_config(FAR struct stm32_hrtim_s *priv) * timer - timer index * * Returned Value: - * 0 on success, a negated errno value on failure + * 0 on success, a negated errno value on failure * ****************************************************************************/ static int hrtim_tim_faults_cfg(FAR struct stm32_hrtim_s *priv, uint8_t timer) { - FAR struct stm32_hrtim_tim_s *tim; FAR struct stm32_hrtim_slave_priv_s *slave; uint32_t regval = 0; + int ret = OK; - tim = hrtim_tim_get(priv, timer); - - slave = tim->priv; + slave = hrtim_slave_get(priv, timer); + if (slave == NULL) + { + ret = -EINVAL; + goto errout; + } /* Get lock configuration */ @@ -3917,7 +3967,8 @@ static int hrtim_tim_faults_cfg(FAR struct stm32_hrtim_s *priv, uint8_t timer) hrtim_tim_putreg(priv, timer, STM32_HRTIM_TIM_FLTR_OFFSET, regval); - return OK; +errout: + return ret; } /**************************************************************************** @@ -3931,7 +3982,7 @@ static int hrtim_tim_faults_cfg(FAR struct stm32_hrtim_s *priv, uint8_t timer) * index - Fault index * * Returned Value: - * 0 on success, a negated errno value on failure + * 0 on success, a negated errno value on failure * ****************************************************************************/ @@ -4073,7 +4124,7 @@ errout: * priv - A reference to the HRTIM structure * * Returned Value: - * 0 on success, a negated errno value on failure + * 0 on success, a negated errno value on failure * ****************************************************************************/ @@ -4147,7 +4198,7 @@ static int hrtim_faults_config(FAR struct stm32_hrtim_s *priv) * index - External Event index * * Returned Value: - * 0 on success, a negated errno value on failure + * 0 on success, a negated errno value on failure * ****************************************************************************/ @@ -4322,7 +4373,7 @@ errout: * priv - A reference to the HRTIM structure * * Returned Value: - * 0 on success, a negated errno value on failure + * 0 on success, a negated errno value on failure * ****************************************************************************/ @@ -4392,7 +4443,7 @@ static int hrtim_events_config(FAR struct stm32_hrtim_s *priv) * priv - A reference to the HRTIM structure * * Returned Value: - * 0 on success, a negated errno value on failure + * 0 on success, a negated errno value on failure * ****************************************************************************/ @@ -4483,7 +4534,7 @@ static void hrtim_tim_mode_set(FAR struct stm32_hrtim_s *priv, uint8_t timer, * priv - A reference to the HRTIM structure * * Returned Value: - * None + * None * ****************************************************************************/ @@ -4514,6 +4565,77 @@ static void hrtim_mode_config(FAR struct stm32_hrtim_s *priv) #endif } +/**************************************************************************** + * Name: hrtim_cmpcap_mask_get + * + * Description: + * This function returns not significant bits in counter/capture + * regsiters for given HRTIM Timer index. + * + * Input Parameters: + * priv - A reference to the HRTIM structure + * timer - HRTIM Timer index + * + * Returned Value: + * Not significant bits for counter/capture registers + * + ****************************************************************************/ + +static uint8_t hrtim_cmpcap_mask_get(FAR struct stm32_hrtim_s *priv, + uint8_t timer) +{ + FAR struct stm32_hrtim_tim_s* tim; + uint8_t mask = 0; + + /* Get Timer data strucutre */ + + tim = hrtim_tim_get(priv, timer); + if (tim == NULL) + { + mask = 0; + goto errout; + } + + /* Not significant bits depens on timer prescaler */ + + switch(tim->tim.prescaler) + { + case HRTIM_PRESCALER_1: + { + mask = 0b11111; + break; + } + case HRTIM_PRESCALER_2: + { + mask = 0b1111; + break; + } + case HRTIM_PRESCALER_4: + { + mask = 0b111; + break; + } + case HRTIM_PRESCALER_8: + { + mask = 0b11; + break; + } + case HRTIM_PRESCALER_16: + { + mask = 0b1; + break; + } + default: + { + mask = 0; + break; + } + } + +errout: + return mask; +} + /**************************************************************************** * Name: hrtim_cmp_update * @@ -4527,7 +4649,7 @@ static void hrtim_mode_config(FAR struct stm32_hrtim_s *priv) * cmp - New compare register value * * Returned Value: - * Zero on success; a negated errno value on failure + * 0 on success, a negated errno value on failure * ****************************************************************************/ @@ -4537,6 +4659,7 @@ static int hrtim_cmp_update(FAR struct hrtim_dev_s *dev, uint8_t timer, FAR struct stm32_hrtim_s *priv = (FAR struct stm32_hrtim_s *)dev->hd_priv; int ret = OK; uint32_t offset = 0; + uint8_t mask = 0; switch (index) { @@ -4571,6 +4694,16 @@ static int hrtim_cmp_update(FAR struct hrtim_dev_s *dev, uint8_t timer, } } + /* REVISIT: what should we do if cmp value is not significant ? + * At this moment we set compare register to the nearest significant value. + */ + + mask = hrtim_cmpcap_mask_get(priv, timer); + if (cmp <= mask) + { + cmp = mask + 1; + } + hrtim_tim_putreg(priv, timer, offset, cmp); errout: @@ -4589,7 +4722,7 @@ errout: * per - New period register value * * Returned Value: - * Zero on success; a negated errno value on failure + * 0 on success; a negated errno value on failure * ****************************************************************************/ @@ -4613,7 +4746,7 @@ static int hrtim_per_update(FAR struct hrtim_dev_s *dev, uint8_t timer, * timer - HRTIM Timer index * * Returned Value: - * Zero on success; a negated errno value on failure + * Timer period value * ****************************************************************************/ @@ -4636,7 +4769,7 @@ static uint16_t hrtim_per_get(FAR struct hrtim_dev_s *dev, uint8_t timer) * index - Compare register timer * * Returned Value: - * Zero on success; a negated errno value on failure + * Timer compare value * ****************************************************************************/ @@ -4686,6 +4819,42 @@ errout: return cmpx; } +/**************************************************************************** + * Name: hrtim_fclk_get + * + * Description: + * Get HRTIM Timer clock value + * + * Input parameters: + * dev - HRTIM device structure + * timer - HRTIM Timer index + * + * Returned Value: + * Timer clock value + * + ****************************************************************************/ + +static uint64_t hrtim_fclk_get(FAR struct hrtim_dev_s *dev, uint8_t timer) +{ + FAR struct stm32_hrtim_s *priv = (FAR struct stm32_hrtim_s *)dev->hd_priv; + FAR struct stm32_hrtim_tim_s *tim; + uint64_t fclk = 0; + + /* Get Slave Timer data structure */ + + tim = hrtim_tim_get(priv, timer); + if (tim == NULL) + { + fclk = 0; + goto errout; + } + + fclk = tim->tim.fclk; + +errout: + return fclk; +} + /**************************************************************************** * Name: hrtim_tim_reset_set * @@ -4707,7 +4876,9 @@ static int hrtim_tim_reset_set(FAR struct stm32_hrtim_s *priv, uint8_t timer, { int ret = OK; - if (timer == HRTIM_TIMER_MASTER) + /* Sanity checking */ + + if (timer == HRTIM_TIMER_MASTER || timer == HRTIM_TIMER_COMMON) { ret = -EINVAL; goto errout; @@ -4811,7 +4982,7 @@ static int hrtim_update_config(FAR struct stm32_hrtim_s *priv) * priv - A reference to the HRTIM structure * * Returned Value: - * 0 on success, a negated errno value on failure + * 0 on success, a negated errno value on failure * ****************************************************************************/ diff --git a/arch/arm/src/stm32/stm32_hrtim.h b/arch/arm/src/stm32/stm32_hrtim.h index 40ffe37b8d..da02364460 100644 --- a/arch/arm/src/stm32/stm32_hrtim.h +++ b/arch/arm/src/stm32/stm32_hrtim.h @@ -187,7 +187,7 @@ # error "APB2 prescaler factor can not be greater than 2" # else # define HRTIM_HAVE_CLK_FROM_PLL 1 -# define HRTIM_CLOCK 2*STM32_PLL_FREQUENCY +# define HRTIM_MAIN_CLOCK 2*STM32_PLL_FREQUENCY # endif # else # error "Clock system must be set to PLL" @@ -195,19 +195,27 @@ #else # error "Not supported yet: system freezes when no PLL selected." # define HRTIM_HAVE_CLK_FROM_APB2 1 -# if STM32_RCC_CFGR_PPRE2 == RCC_CFGR_PPRE2_HCLK -# define HRTIM_CLOCK STM32_PCLK2_FREQUENCY +# if STM32_RCC_CFGR_PPRE2 == RCC_CFGR_PPRE2_HCLK +# define HRTIM_MAIN_CLOCK STM32_PCLK2_FREQUENCY # else -# define HRTIM_CLOCK 2*STM32_PCLK2_FREQUENCY +# define HRTIM_MAIN_CLOCK 2*STM32_PCLK2_FREQUENCY # endif #endif +/* High-resolution equivalent clock */ + +#define HRTIM_CLOCK (HRTIM_MAIN_CLOCK*32ull) + /* Helpers **************************************************************************/ #define HRTIM_CMP_SET(hrtim, tim, index, cmp) \ (hrtim)->hd_ops->cmp_update(hrtim, tim, index, cmp) #define HRTIM_PER_SET(hrtim, tim, per) \ (hrtim)->hd_ops->per_update(hrtim, tim, per) +#define HRTIM_PER_GET(hrtim, tim) \ + (hrtim)->hd_ops->per_get(hrtim, tim) +#define HRTIM_FCLK_GET(hrtim, tim) \ + (hrtim)->hd_ops->fclk_get(hrtim, tim) #define HRTIM_OUTPUTS_ENABLE(hrtim, outputs, state) \ (hrtim)->hd_ops->outputs_enable(hrtim, outputs, state) #define HRTIM_OUTPUT_SET_SET(hrtim, output, set) \ @@ -225,6 +233,11 @@ #define HRTIM_DEADTIME_UPDATE(hrtim, tim, dt, val) \ (hrtim)->hd_ops->deadtime_update(hrtim, tim, dt, val) +#define HRTIM_PER_MAX 0xFFFF +#define HRTIM_CMP_MAX 0xFFFF +#define HRTIM_CPT_MAX 0xFFFF +#define HRTIM_REP_MAX 0xFF + /************************************************************************************ * Public Types ************************************************************************************/ @@ -384,14 +397,14 @@ enum stm32_hrtim_tim_rst_e enum stm32_hrtim_tim_prescaler_e { - HRTIM_PRESCALER_1, - HRTIM_PRESCALER_2, - HRTIM_PRESCALER_4, - HRTIM_PRESCALER_8, - HRTIM_PRESCALER_16, - HRTIM_PRESCALER_32, - HRTIM_PRESCALER_64, - HRTIM_PRESCALER_128 + HRTIM_PRESCALER_1, /* CKPSC = 0 */ + HRTIM_PRESCALER_2, /* CKPSC = 1 */ + HRTIM_PRESCALER_4, /* CKPSC = 2 */ + HRTIM_PRESCALER_8, /* CKPSC = 3 */ + HRTIM_PRESCALER_16, /* CKPSC = 4 */ + HRTIM_PRESCALER_32, /* CKPSC = 5 */ + HRTIM_PRESCALER_64, /* CKPSC = 6 */ + HRTIM_PRESCALER_128 /* CKPSC = 7 */ }; /* HRTIM Timer Master/Slave mode */ @@ -971,6 +984,7 @@ struct stm32_hrtim_ops_s uint16_t (*per_get)(FAR struct hrtim_dev_s *dev, uint8_t timer); uint16_t (*cmp_get)(FAR struct hrtim_dev_s *dev, uint8_t timer, uint8_t index); + uint64_t (*fclk_get)(FAR struct hrtim_dev_s *dev, uint8_t timer); #ifdef CONFIG_STM32_HRTIM_INTERRUPTS void (*irq_ack)(FAR struct hrtim_dev_s *dev, uint8_t timer, int source); #endif diff --git a/configs/stm32f334-disco/include/board.h b/configs/stm32f334-disco/include/board.h index 115b02abd4..c138e01cab 100644 --- a/configs/stm32f334-disco/include/board.h +++ b/configs/stm32f334-disco/include/board.h @@ -277,12 +277,42 @@ /* HRTIM configuration ******************************************************/ -#define HRTIM_TIMA_PRESCALER HRTIM_PRESCALER_32 +/* Timer A configuration - Buck operations */ + +#define HRTIM_TIMA_PRESCALER HRTIM_PRESCALER_1 #define HRTIM_TIMA_MODE HRTIM_MODE_CONT -#define HRTIM_TIMB_PRESCALER HRTIM_PRESCALER_32 +#define HRTIM_TIMA_CH1_SET HRTIM_OUT_SET_NONE +#define HRTIM_TIMA_CH1_RST HRTIM_OUT_RST_NONE +#define HRTIM_TIMA_CH2_SET HRTIM_OUT_SET_NONE +#define HRTIM_TIMA_CH2_RST HRTIM_OUT_RST_NONE + +#define HRTIM_TIMA_DT_FSLOCK HRTIM_DT_LOCK +#define HRTIM_TIMA_DT_RSLOCK HRTIM_DT_LOCK +#define HRTIM_TIMA_DT_FVLOCK HRTIM_DT_RW +#define HRTIM_TIMA_DT_RVLOCK HRTIM_DT_RW +#define HRTIM_TIMA_DT_FSIGN HRTIM_DT_SIGN_POSITIVE +#define HRTIM_TIMA_DT_RSIGN HRTIM_DT_SIGN_POSITIVE +#define HRTIM_TIMA_DT_PRESCALER HRTIM_DEADTIME_PRESCALER_1 + +/* Timer B configuration - Boost operations */ + +#define HRTIM_TIMB_PRESCALER HRTIM_PRESCALER_1 #define HRTIM_TIMB_MODE HRTIM_MODE_CONT +#define HRTIM_TIMB_CH1_SET HRTIM_OUT_SET_NONE +#define HRTIM_TIMB_CH1_RST HRTIM_OUT_RST_NONE +#define HRTIM_TIMB_CH2_SET HRTIM_OUT_SET_NONE +#define HRTIM_TIMB_CH2_RST HRTIM_OUT_RST_NONE + +#define HRTIM_TIMB_DT_FSLOCK HRTIM_DT_LOCK +#define HRTIM_TIMB_DT_RSLOCK HRTIM_DT_LOCK +#define HRTIM_TIMB_DT_FVLOCK HRTIM_DT_RW +#define HRTIM_TIMB_DT_RVLOCK HRTIM_DT_RW +#define HRTIM_TIMB_DT_FSIGN HRTIM_DT_SIGN_POSITIVE +#define HRTIM_TIMB_DT_RSIGN HRTIM_DT_SIGN_POSITIVE +#define HRTIM_TIMB_DT_PRESCALER HRTIM_DEADTIME_PRESCALER_1 + #define HRTIM_ADC_TRG2 HRTIM_ADCTRG24_AC4 /* DMA channels *************************************************************/ diff --git a/configs/stm32f334-disco/src/stm32_smps.c b/configs/stm32f334-disco/src/stm32_smps.c index 952af64c1b..b1ae43e216 100644 --- a/configs/stm32f334-disco/src/stm32_smps.c +++ b/configs/stm32f334-disco/src/stm32_smps.c @@ -105,8 +105,8 @@ /* ADC1 injected channels numeration */ -#define VIN_ADC_INJ_CHANNEL 0 -#define VOUT_ADC_INJ_CHANNEL 1 +#define V_IN_ADC_INJ_CHANNEL 0 +#define V_OUT_ADC_INJ_CHANNEL 1 /* Voltage reference for ADC */ @@ -118,11 +118,11 @@ /* Input voltage convertion ratio - 6.8k/(6.8k + 27k) */ -#define VIN_RATIO (float)((float)(6800+27000)/(float)6800) +#define V_IN_RATIO (float)((float)(6800+27000)/(float)6800) /* Output voltage convertion ratio - 3.3k/(3.3k + 13.3k) */ -#define VOUT_RATIO (float)((float)(3300+13300)/(float)3300) +#define V_OUT_RATIO (float)((float)(3300+13300)/(float)3300) /* Some absolute limits */ @@ -130,6 +130,61 @@ #define SMPS_ABSOLUTE_OUT_VOLTAGE_LIMIT_mV 15000 #define SMPS_ABSOLUTE_IN_VOLTAGE_LIMIT_mV 15000 +#if CONFIG_EXAMPLES_SMPS_OUT_CURRENT_LIMIT > SMPS_ABSOLUTE_OUT_CURRENT_LIMIT_mA +# error "Output current limit great than absolute limit!" +#endif +#if CONFIG_EXAMPLES_SMPS_OUT_VOLTAGE_LIMIT > SMPS_ABSOLUTE_OUT_VOLTAGE_LIMIT_mV +# error "Output voltage limit greater than absolute limit!" +#endif +#if CONFIG_EXAMPLES_SMPS_IN_VOLTAGE_LIMIT > SMPS_ABSOLUTE_IN_VOLTAGE_LIMIT_mV +# error "Input voltage limit greater than absolute limit!" +#endif + +/* Maximum output voltage for boost conveter in float */ + +#define BOOST_VOLT_MAX ((float)CONFIG_EXAMPLES_SMPS_OUT_VOLTAGE_LIMIT/1000.0) + +/* Current limit table dimmension */ + +#define SMPS_CURRENT_LIMIT_TAB_DIM 15 + +/* At this time only PID controller implemented */ + +#define SMPS_CONTROLLER_PID 1 + +/* Converter's finite accuracy */ + +#define SMPS_VOLTAGE_ACCURACY ((float)0.01) + +/* Buck-boost mode threshold */ + +#define SMPS_BUCKBOOST_RANGE ((float)0.5) + +/* PID controller configuration */ + +#define PID_KP ((float)1.0) +#define PID_KI ((float)0.1) +#define PID_KD ((float)0.0) + +/* Converter frequncies: + * - TIMA_PWM_FREQ - buck converter 250kHz + * - TIMB_PWM_FREQ - boost converter 250kHz + */ + +#define TIMA_PWM_FREQ 250000 +#define TIMB_PWM_FREQ 250000 + +/* Deadtime configuration */ + +#define DT_RISING 0x0A0 +#define DT_FALLING 0x0A0 + +/* Helper macros */ + +#define HRTIM_ALL_OUTPUTS_ENABLE(hrtim, state) \ + HRTIM_OUTPUTS_ENABLE(hrtim, HRTIM_OUT_TIMA_CH1|HRTIM_OUT_TIMA_CH2| \ + HRTIM_OUT_TIMB_CH1|HRTIM_OUT_TIMB_CH2, state); + /**************************************************************************** * Private Types ****************************************************************************/ @@ -138,6 +193,7 @@ enum converter_mode_e { + CONVERTER_MODE_INIT, /* Initial mode */ CONVERTER_MODE_BUCK, /* Buck mode operations (V_in > V_out) */ CONVERTER_MODE_BOOST, /* Boost mode operations (V_in < V_out) */ CONVERTER_MODE_BUCKBOOST, /* Buck-boost operations (V_in near V_out)*/ @@ -159,11 +215,13 @@ struct smps_lower_dev_s struct smps_priv_s { uint8_t conv_mode; /* Converter mode */ - uint16_t vin_raw; /* Voltage input RAW value */ - uint16_t vout_raw; /* Voltage output RAW value */ - float vin; /* Voltage input real value in V */ - float vout; /* Voltage output real value in V */ + uint16_t v_in_raw; /* Voltage input RAW value */ + uint16_t v_out_raw; /* Voltage output RAW value */ + float v_in; /* Voltage input real value in V */ + float v_out; /* Voltage output real value in V */ bool running; /* Running flag */ + float state[3]; /* Controller state vartiables */ + float *c_limit_tab; /* Current limit tab */ }; /**************************************************************************** @@ -215,8 +273,9 @@ struct smps_ops_s g_smps_ops = struct smps_dev_s g_smps_dev = { - .ops = &g_smps_ops, - .priv = &g_smps + .ops = &g_smps_ops, + .priv = &g_smps, + .lower = NULL }; /* ADC configuration: @@ -232,16 +291,16 @@ struct smps_dev_s g_smps_dev = * Transistors configuration in boost mode: * - T4 - ON * - T11 - OFF - * - T5 and T15 - boost operation + * - T5 and T12 - boost operation * Transistors configuration in buck-boost mode: * - T4, T11 - buck operation - * - T5 and T15 - boost operation + * - T5 and T12 - boost operation * * HRTIM outputs configuration: * - T4 -> PA8 -> HRTIM_CHA1 * - T5 -> PA11 -> HRTIM_CHB2 * - T11 -> PA9 -> HRTIM_CHA2 - * - T15 -> PA10 -> HRTIM_CHB1 + * - T12 -> PA10 -> HRTIM_CHB1 * */ @@ -257,8 +316,8 @@ static const uint8_t g_adc1chan[ADC1_NCHANNELS] = static const uint32_t g_adc1pins[ADC1_NCHANNELS] = { - GPIO_ADC1_IN2, /* PA1 - VIN */ - GPIO_ADC1_IN4, /* PA3 - VOUT */ + GPIO_ADC1_IN2, /* PA1 - V_IN */ + GPIO_ADC1_IN4, /* PA3 - V_OUT */ }; /**************************************************************************** @@ -290,7 +349,7 @@ static int smps_shutdown(FAR struct smps_dev_s *dev) * Description: * * Returned Value: - * 0 on success, a negated errno value on failure + * 0 on success, a negated errno value on failure * ****************************************************************************/ @@ -300,6 +359,7 @@ static int smps_setup(FAR struct smps_dev_s *dev) FAR struct smps_s *smps = (FAR struct smps_s *)dev->priv; FAR struct hrtim_dev_s *hrtim = NULL; FAR struct adc_dev_s *adc = NULL; + FAR struct smps_priv_s *priv; /* Initialize smps structure */ @@ -321,6 +381,8 @@ static int smps_setup(FAR struct smps_dev_s *dev) printf("ERROR: failed to get ADC lower level interface"); } + /* TODO: create current limit table */ + errout: return OK; } @@ -331,28 +393,89 @@ static int smps_start(FAR struct smps_dev_s *dev) FAR struct stm32_adc_dev_s *stm32_adc = (FAR struct stm32_adc_dev_s *) lower->adc->ad_priv; FAR struct smps_s *smps = (FAR struct smps_s *)dev->priv; + FAR struct smps_priv_s *priv = (struct smps_priv_s *)smps->priv; FAR struct hrtim_dev_s *hrtim = lower->hrtim; + volatile uint64_t per = 0; + uint64_t fclk = 0; + int ret = OK; - /* Stop HRTIM PWM */ + /* Disable HRTIM outputs */ + + HRTIM_ALL_OUTPUTS_ENABLE(hrtim, false); + + /* Reset SMPS private structure */ + + memset(priv, 0, sizeof(struct smps_priv_s)); + + /* Get TIMA period value for given frequency */ + + fclk = HRTIM_FCLK_GET(hrtim, HRTIM_TIMER_TIMA); + per = fclk/TIMA_PWM_FREQ; + if (per > HRTIM_PER_MAX) + { + printf("ERROR: can not achieve tima pwm freq=%u if fclk=%llu\n", + (uint32_t)TIMA_PWM_FREQ, (uint64_t)fclk); + ret = -EINVAL; + goto errout; + } - HRTIM_OUTPUTS_ENABLE(hrtim, HRTIM_OUT_TIMA_CH1, false); - HRTIM_OUTPUTS_ENABLE(hrtim, HRTIM_OUT_TIMA_CH2, false); + /* Set TIMA period value */ - HRTIM_OUTPUTS_ENABLE(hrtim, HRTIM_OUT_TIMB_CH1, false); - HRTIM_OUTPUTS_ENABLE(hrtim, HRTIM_OUT_TIMB_CH2, false); + HRTIM_PER_SET(hrtim, HRTIM_TIMER_TIMA, (uint16_t)per); + + /* Get TIMB period value for given frequency */ + + fclk = HRTIM_FCLK_GET(hrtim, HRTIM_TIMER_TIMB); + per = fclk/TIMB_PWM_FREQ; + if (per > HRTIM_PER_MAX) + { + printf("ERROR: can not achieve timb pwm freq=%u if fclk=%llu\n", + (uint32_t)TIMB_PWM_FREQ, (uint64_t)fclk); + ret = -EINVAL; + goto errout; + } - /* 1 period is 4us - 100% time */ + /* Set TIMB period value */ - HRTIM_PER_SET(hrtim, HRTIM_TIMER_TIMA, 18432); - HRTIM_PER_SET(hrtim, HRTIM_TIMER_TIMB, 18432); + HRTIM_PER_SET(hrtim, HRTIM_TIMER_TIMB, (uint16_t)per); /* ADC trigger on TIMA CMP4 */ HRTIM_CMP_SET(hrtim, HRTIM_TIMER_TIMA, HRTIM_CMP4, 10000); + /* Configure TIMER A and TIMER B deadtime mode + * + * NOTE: In deadtime mode we have to configure output 1 only (SETx1, RSTx1), + * output 2 configuration is not significant. + */ + + HRTIM_DEADTIME_UPDATE(hrtim, HRTIM_TIMER_TIMA, HRTIM_DT_EDGE_RISING, DT_RISING); + HRTIM_DEADTIME_UPDATE(hrtim, HRTIM_TIMER_TIMA, HRTIM_DT_EDGE_FALLING, DT_FALLING); + HRTIM_DEADTIME_UPDATE(hrtim, HRTIM_TIMER_TIMB, HRTIM_DT_EDGE_RISING, DT_RISING); + HRTIM_DEADTIME_UPDATE(hrtim, HRTIM_TIMER_TIMB, HRTIM_DT_EDGE_FALLING, DT_FALLING); + + /* Set T4 and T12 to a low state. + * Deadtime mode force T11 and T5 to a high state. + */ + + HRTIM_OUTPUT_SET_SET(hrtim, HRTIM_OUT_TIMA_CH1, HRTIM_OUT_SET_NONE); + HRTIM_OUTPUT_RST_SET(hrtim, HRTIM_OUT_TIMA_CH1, HRTIM_OUT_RST_PER); + + HRTIM_OUTPUT_SET_SET(hrtim, HRTIM_OUT_TIMB_CH1, HRTIM_OUT_SET_NONE); + HRTIM_OUTPUT_RST_SET(hrtim, HRTIM_OUT_TIMB_CH1, HRTIM_OUT_RST_PER); + + /* Set running flag */ + + priv->running = true; + + HRTIM_ALL_OUTPUTS_ENABLE(hrtim, true); + /* Enable ADC interrupts */ stm32_adc->ops->int_en(stm32_adc, ADC_INT_JEOS); + +errout: + return ret; } static int smps_stop(FAR struct smps_dev_s *dev) @@ -366,11 +489,7 @@ static int smps_stop(FAR struct smps_dev_s *dev) /* Disable HRTIM outputs */ - HRTIM_OUTPUTS_ENABLE(hrtim, HRTIM_OUT_TIMA_CH1, false); - HRTIM_OUTPUTS_ENABLE(hrtim, HRTIM_OUT_TIMA_CH2, false); - - HRTIM_OUTPUTS_ENABLE(hrtim, HRTIM_OUT_TIMB_CH1, false); - HRTIM_OUTPUTS_ENABLE(hrtim, HRTIM_OUT_TIMB_CH2, false); + HRTIM_ALL_OUTPUTS_ENABLE(hrtim, false); /* Disable ADC interrupts */ @@ -459,27 +578,27 @@ static int smps_limits_set(FAR struct smps_dev_s *dev, goto errout; } - if (limits->v_out * 1000 > SMPS_ABSOLUTE_OUT_VOLTAGE_LIMIT_mV) + if (limits->v_out * 1000 > CONFIG_EXAMPLES_SMPS_OUT_VOLTAGE_LIMIT) { - limits->v_out = (float)SMPS_ABSOLUTE_OUT_VOLTAGE_LIMIT_mV/1000.0; + limits->v_out = (float)CONFIG_EXAMPLES_SMPS_OUT_VOLTAGE_LIMIT/1000.0; printf("SMPS output voltage limiit > SMPS absoulute output voltage limit." - " Set output voltage limit to %d.\n", + " Set output voltage limit to %.2f.\n", limits->v_out); } - if (limits->v_in * 1000 > SMPS_ABSOLUTE_IN_VOLTAGE_LIMIT_mV) + if (limits->v_in * 1000 > CONFIG_EXAMPLES_SMPS_IN_VOLTAGE_LIMIT) { - limits->v_in = (float)SMPS_ABSOLUTE_IN_VOLTAGE_LIMIT_mV/1000.0; + limits->v_in = (float)CONFIG_EXAMPLES_SMPS_IN_VOLTAGE_LIMIT/1000.0; printf("SMPS input voltage limiit > SMPS absoulute input voltage limit." - " Set input voltage limit to %d.\n", + " Set input voltage limit to %.2f.\n", limits->v_in); } - if (limits->i_out * 1000 > SMPS_ABSOLUTE_OUT_CURRENT_LIMIT_mA) + if (limits->i_out * 1000 > CONFIG_EXAMPLES_SMPS_OUT_CURRENT_LIMIT) { - limits->i_out = (float)SMPS_ABSOLUTE_OUT_CURRENT_LIMIT_mA/1000.0; + limits->i_out = (float)CONFIG_EXAMPLES_SMPS_OUT_CURRENT_LIMIT/1000.0; printf("SMPS output current limiit > SMPS absoulute output current limit." - " Set output current limit to %d.\n", + " Set output current limit to %.2f.\n", limits->i_out); } @@ -510,8 +629,8 @@ static int smps_state_get(FAR struct smps_dev_s *dev, /* Copy localy stored feedbacks data to status structure */ - smps->state.fb.v_in = g_smps_priv.vin; - smps->state.fb.v_out = g_smps_priv.vout; + smps->state.fb.v_in = g_smps_priv.v_in; + smps->state.fb.v_out = g_smps_priv.v_out; /* Return state structure to caller */ @@ -544,36 +663,302 @@ static int smps_ioctl(FAR struct smps_dev_s *dev, int cmd, unsigned long arg) return OK; } +/**************************************************************************** + * Name: pid_controller + ****************************************************************************/ + +static float pid_controller(struct smps_priv_s *priv, float err) +{ + float out; + float A0 = PID_KP + PID_KD + PID_KI; + float A1 = -PID_KP - 2.0*PID_KD; + float A2 = PID_KD; + + /* Get PID controller output */ + + out = (A0 * err) + (A1 * priv->state[0]) + (A2 * priv->state[1]) + priv->state[2]; + + /* Store PID contrroller variables */ + + priv->state[1] = priv->state[0]; + priv->state[0] = err; + priv->state[2] = out; + + return out; +} + +/**************************************************************************** + * Name: smps_controller + ****************************************************************************/ + +static float smps_controller(struct smps_priv_s *priv, float err) +{ +#ifdef SMPS_CONTROLLER_PID + return pid_controller(priv, err); +#else +# error "At this time only PID controller implemented" +#endif +} + +/**************************************************************************** + * Name: smps_duty_set + ****************************************************************************/ + +static void smps_duty_set(struct smps_priv_s *priv, struct smps_lower_dev_s *lower, + float out) +{ + FAR struct hrtim_dev_s *hrtim = lower->hrtim; + uint8_t mode = priv->conv_mode; + uint16_t cmp = 0; + float duty = 0.0; + uint16_t per = 0; + + switch (mode) + { + case CONVERTER_MODE_INIT: + { + /* Do nothing */ + + break; + } + + case CONVERTER_MODE_BUCK: + { + if (out >= priv->v_in) out = priv->v_in; + if (out < 0.0) out = 0.0; + + duty = out/priv->v_in; + +#warning TODO: current limit in buck mode + + per = HRTIM_PER_GET(hrtim, HRTIM_TIMER_TIMA); + + cmp = (uint16_t)(per * duty); + + if (cmp > per-30) cmp = per - 30; + + /* Set T4 duty cycle. T11 is complementary to T4 */ + + HRTIM_CMP_SET(hrtim, HRTIM_TIMER_TIMA, HRTIM_CMP1, cmp); + + break; + } + + case CONVERTER_MODE_BOOST: + { + per = HRTIM_PER_GET(hrtim, HRTIM_TIMER_TIMA); + + + if (out < priv->v_in) out = priv->v_in; + if (out >= BOOST_VOLT_MAX) out = BOOST_VOLT_MAX; + + duty = 1.0 - priv->v_in/out; + +#warning TODO: current limit in boost mode + + cmp = (uint16_t)(per * duty); + + /* Set T12 duty cycle. T5 is complementary to T12 */ + + HRTIM_CMP_SET(hrtim, HRTIM_TIMER_TIMB, HRTIM_CMP1, cmp); + + break; + } + + case CONVERTER_MODE_BUCKBOOST: + { + /* do something */ + +#warning TODO: buck boost mode + + break; + } + + default: + { + printf("ERROR: unknown converter mode %d!\n", mode); + break; + } + } +} + +/**************************************************************************** + * Name: smps_conv_mode_set + * + * Description: + * Change converter mode (buck/boost/buck-boost). + * + * Returned Value: + * None + * + ****************************************************************************/ + +static void smps_conv_mode_set(struct smps_priv_s *priv, struct smps_lower_dev_s *lower, + uint8_t mode) +{ + FAR struct hrtim_dev_s *hrtim = lower->hrtim; + + /* Disable all outputs */ + + HRTIM_ALL_OUTPUTS_ENABLE(hrtim, false); + + switch (mode) + { + case CONVERTER_MODE_INIT: + { + + break; + } + + case CONVERTER_MODE_BUCK: + { + /* Set T12 low (T5 high) on the next PER */ + + HRTIM_OUTPUT_SET_SET(hrtim, HRTIM_OUT_TIMB_CH1, HRTIM_OUT_SET_NONE); + HRTIM_OUTPUT_RST_SET(hrtim, HRTIM_OUT_TIMB_CH1, HRTIM_OUT_RST_PER); + + + /* Set T4 to a high state on PER and reset on CMP1. + T11 is complementary to T4. */ + + HRTIM_OUTPUT_SET_SET(hrtim, HRTIM_OUT_TIMA_CH1, HRTIM_OUT_SET_PER); + HRTIM_OUTPUT_RST_SET(hrtim, HRTIM_OUT_TIMA_CH1, HRTIM_OUT_RST_CMP1); + + break; + } + + case CONVERTER_MODE_BOOST: + { + /* Set T4 high (T11 low) on the next PER */ + + HRTIM_OUTPUT_SET_SET(hrtim, HRTIM_OUT_TIMA_CH1, HRTIM_OUT_SET_PER); + HRTIM_OUTPUT_RST_SET(hrtim, HRTIM_OUT_TIMA_CH1, HRTIM_OUT_RST_NONE); + + /* Set T12 to a high state on PER and reset on CMP1. + T5 is complementary to T12. */ + + HRTIM_OUTPUT_SET_SET(hrtim, HRTIM_OUT_TIMB_CH1, HRTIM_OUT_SET_PER); + HRTIM_OUTPUT_RST_SET(hrtim, HRTIM_OUT_TIMB_CH1, HRTIM_OUT_RST_CMP1); + + break; + } + + case CONVERTER_MODE_BUCKBOOST: + { + /* Set T4 to a high state on PER and reset on CMP1. + T11 is complementary to T4. */ + + HRTIM_OUTPUT_SET_SET(hrtim, HRTIM_OUT_TIMA_CH1, HRTIM_OUT_SET_PER); + HRTIM_OUTPUT_RST_SET(hrtim, HRTIM_OUT_TIMA_CH1, HRTIM_OUT_RST_CMP1); + + /* Set T12 to a high state on PER and reset on CMP1. + T5 is complementary to T12. */ + + HRTIM_OUTPUT_SET_SET(hrtim, HRTIM_OUT_TIMB_CH1, HRTIM_OUT_SET_PER); + HRTIM_OUTPUT_RST_SET(hrtim, HRTIM_OUT_TIMB_CH1, HRTIM_OUT_RST_CMP1); + + break; + } + + default: + { + printf("ERROR: unknown converter mode %d!\n", mode); + break; + } + } + + /* Set mode in private data */ + + priv->conv_mode = mode; + + /* Enable outputs */ + + HRTIM_ALL_OUTPUTS_ENABLE(hrtim, true); + +} + +/**************************************************************************** + * Name: adc12_handler + ****************************************************************************/ + static void adc12_handler(void) { - FAR struct smps_lower_dev_s *lower = g_smps_dev.lower; - FAR struct stm32_adc_dev_s *stm32_adc = + FAR struct smps_dev_s *dev = &g_smps_dev; + FAR struct smps_s *smps = (FAR struct smps_s *)dev->priv; + FAR struct smps_priv_s *priv = (struct smps_priv_s *)smps->priv; + FAR struct smps_lower_dev_s *lower = dev->lower; + FAR struct stm32_adc_dev_s *adc = (FAR struct stm32_adc_dev_s*)lower->adc->ad_priv; + uint32_t pending; float ref = ADC_REF_VOLTAGE; float bit = ADC_VAL_MAX; - uint32_t pending; + float err; + float out; + uint8_t mode; - pending = stm32_adc->ops->int_get(stm32_adc); + pending = adc->ops->int_get(adc); - if (pending & ADC_INT_JEOC) + if (pending & ADC_INT_JEOC && priv->running == true) { /* Get raw ADC values */ - g_smps_priv.vout_raw = stm32_adc->ops->inj_get(stm32_adc, VOUT_ADC_INJ_CHANNEL); - g_smps_priv.vin_raw = stm32_adc->ops->inj_get(stm32_adc, VIN_ADC_INJ_CHANNEL); + priv->v_out_raw = adc->ops->inj_get(adc, V_OUT_ADC_INJ_CHANNEL); + priv->v_in_raw = adc->ops->inj_get(adc, V_IN_ADC_INJ_CHANNEL); /* Convert raw values to real values */ - g_smps_priv.vout = (g_smps_priv.vout_raw * ref / bit) * VOUT_RATIO; - g_smps_priv.vin = (g_smps_priv.vin_raw * ref / bit) * VIN_RATIO; + priv->v_out = (priv->v_out_raw * ref / bit) * V_OUT_RATIO; + priv->v_in = (priv->v_in_raw * ref / bit) * V_IN_RATIO; + + /* According to measured voltages we set converter in appropriate mode */ + + if (smps->param.v_out > (priv->v_in+SMPS_BUCKBOOST_RANGE)) + { + /* Desired output voltage greather than input voltage - set boost converter */ + + mode = CONVERTER_MODE_BOOST; + } + + else if (smps->param.v_out < (priv->v_in-SMPS_BUCKBOOST_RANGE)) + { + /* Desired output voltage lower than input voltage - set buck converter */ + + mode = CONVERTER_MODE_BUCK; + } + + else + { + /* Desired output voltage close to input voltage - set buck-boost converter */ + + mode = CONVERTER_MODE_BUCKBOOST; + } + + /* Configure converter to the new mode if needed */ + + if (priv->conv_mode != mode) + { + smps_conv_mode_set(priv, lower, mode); + } + + /* Get regualtor error */ + + err = smps->param.v_out - priv->v_out; + + if (err >= SMPS_VOLTAGE_ACCURACY || err <= (-SMPS_VOLTAGE_ACCURACY)) + { + /* PID controller */ + + out = smps_controller(priv, err); -#warning "missing regulator logic!" + /* Update duty cycle */ + smps_duty_set(priv, lower, out); + } } /* Clear pending */ - stm32_adc->ops->int_ack(stm32_adc, pending); + adc->ops->int_ack(adc, pending); } /**************************************************************************** @@ -584,12 +969,12 @@ static void adc12_handler(void) * Name: stm32_smps_setup * * Description: - * Initialize SMPS driver. + * Initialize SMPS driver. * - * This function should be call by board_app_initialize(). + * This function should be call by board_app_initialize(). * * Returned Value: - * 0 on success, a negated errno value on failure + * 0 on success, a negated errno value on failure * ****************************************************************************/ -- GitLab From 83a87e08e8ed1e24204694a13e1880235404421b Mon Sep 17 00:00:00 2001 From: Juha Niskanen Date: Mon, 22 Jan 2018 07:14:32 -0600 Subject: [PATCH 055/228] fs/userfs: use correct req type in userfs_truncate, remove use of undeclared buf --- fs/userfs/fs_userfs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/userfs/fs_userfs.c b/fs/userfs/fs_userfs.c index bf91d58c1e..3cb7a10b21 100644 --- a/fs/userfs/fs_userfs.c +++ b/fs/userfs/fs_userfs.c @@ -944,7 +944,7 @@ static int userfs_truncate(FAR struct file *filep, off_t length) /* Construct and send the request to the server */ req = (FAR struct userfs_truncate_request_s *)priv->iobuffer; - req->req = USERFS_REQ_FSTAT; + req->req = USERFS_REQ_TRUNCATE; req->openinfo = filep->f_priv; req->length = length; @@ -986,7 +986,6 @@ static int userfs_truncate(FAR struct file *filep, off_t length) /* Return the result of truncate operation */ - DEBUGASSERT(buf != NULL); return resp->ret; } -- GitLab From 6ae6ecc958d207fcab26e0811bfa07a1744ca9ac Mon Sep 17 00:00:00 2001 From: David Alessio Date: Mon, 22 Jan 2018 13:20:35 +0000 Subject: [PATCH 056/228] Merged in david_alessio/nuttx/refactor-pll-setup (pull request #581) Refactor pll setup * fix typo in #def * refactor PLL setup code... * refactored PLL/CLK config, easier, checks for correctness * call go_os_start if STACK_COLORIZED * smarter config of EXTCLK output freq * cosmetic Approved-by: Gregory Nutt --- arch/arm/src/xmc4/chip/xmc4_scu.h | 2 +- arch/arm/src/xmc4/xmc4_clockconfig.c | 37 ++++- arch/arm/src/xmc4/xmc4_start.c | 8 + configs/xmc4500-relax/include/board.h | 219 +++++++++++++------------- 4 files changed, 148 insertions(+), 118 deletions(-) diff --git a/arch/arm/src/xmc4/chip/xmc4_scu.h b/arch/arm/src/xmc4/chip/xmc4_scu.h index 2d22084252..afa4d0f8a7 100644 --- a/arch/arm/src/xmc4/chip/xmc4_scu.h +++ b/arch/arm/src/xmc4/chip/xmc4_scu.h @@ -938,7 +938,7 @@ #define SCU_SLEEPCR_SYSSEL (1 << 0) /* Bit 0: System Clock Selection Value */ # define SCU_SLEEPCR_SYSSEL_OFI (0) /* 0=fOFI */ -# define SCU_SLEEPCR_SYSSEL_ PLL (1 << 0) /* 1=fPLL */ +# define SCU_SLEEPCR_SYSSEL_FPLL (1 << 0) /* 1=fPLL */ #define SCU_SLEEPCR_USBCR (1 << 16) /* Bit 6: USB Clock Control in Sleep Mode */ #define SCU_SLEEPCR_MMCCR (1 << 17) /* Bit 17: MMC Clock Control in Sleep Mode */ #define SCU_SLEEPCR_ETH0CR (1 << 18) /* Bit 18: Ethernet Clock Control in Sleep Mode */ diff --git a/arch/arm/src/xmc4/xmc4_clockconfig.c b/arch/arm/src/xmc4/xmc4_clockconfig.c index eeb71dbe0b..9d6cc0621e 100644 --- a/arch/arm/src/xmc4/xmc4_clockconfig.c +++ b/arch/arm/src/xmc4/xmc4_clockconfig.c @@ -58,6 +58,7 @@ #include "up_arch.h" #include "chip/xmc4_scu.h" #include "xmc4_clockconfig.h" +#include "chip/xmc4_ports.h" #include @@ -105,7 +106,7 @@ #define CLKSET_VALUE (0x00000000) #define USBCLKCR_VALUE (0x00010000) -#if BOARD_PBDIV == 1 +#if BOARD_PLL_PBDIV == 1 # define PBCLKCR_VALUE SCU_PBCLKCR_PBDIV_FCPU #else /* BOARD_PBDIV == 2 */ # define PBCLKCR_VALUE SCU_PBCLKCR_PBDIV_DIV2 @@ -387,8 +388,8 @@ void xmc4_clock_configure(void) /* Setup fSYS clock */ - regval = (BOARD_ENABLE_PLL << SCU_SYSCLKCR_SYSSEL); - regval |= SCU_SYSCLKCR_SYSDIV(BOARD_SYSDIV); + regval = (BOARD_ENABLE_PLL ? SCU_SYSCLKCR_SYSSEL : 0); + regval |= SCU_SYSCLKCR_SYSDIV(BOARD_PLL_SYSDIV); putreg32(regval, XMC4_SCU_SYSCLKCR); /* Setup peripheral clock divider */ @@ -411,7 +412,7 @@ void xmc4_clock_configure(void) /* Setup EBU clock */ - regval = SCU_EBUCLKCR_EBUDIV(BOARD_EBUDIV); + regval = SCU_EBUCLKCR_EBUDIV(BOARD_PLL_EBUDIV); putreg32(regval, XMC4_SCU_EBUCLKCR); #ifdef BOARD_ENABLE_USBPLL @@ -423,7 +424,7 @@ void xmc4_clock_configure(void) /* Setup EXT */ regval = (BOARD_EXT_SOURCE << SCU_EXTCLKCR_ECKSEL_SHIFT); - regval |= SCU_EXTCLKCR_ECKDIV(BOARD_EXTDIV); + regval |= SCU_EXTCLKCR_ECKDIV(BOARD_PLL_ECKDIV); putreg32(regval, XMC4_SCU_EXTCLKCR); #if BOARD_ENABLE_PLL @@ -561,4 +562,30 @@ void xmc4_clock_configure(void) /* Enable selected clocks */ putreg32(CLKSET_VALUE, XMC4_SCU_CLKSET); + +#if BOARD_PLL_CLOCKSRC_XTAL == 1 + regval = SCU_SLEEPCR_SYSSEL_FPLL; + putreg32(regval, XMC4_SCU_SLEEPCR); +#endif /* BOARD_PLL_CLOCKSRC_XTAL == 1 */ + +#if BOARD_EXTCKL_ENABLE +#if BOARD_EXTCLK_PIN == EXTCLK_PIN_P0_8 + /* enable EXTCLK output on P0.8 */ + regval = getreg32(XMC4_PORT0_HWSEL); + regval &= ~PORT_HWSEL_HW8_MASK; + putreg32(regval, XMC4_PORT0_HWSEL); + + regval = getreg32(XMC4_PORT0_PDR1); + regval &= ~PORT_PDR1_PD8_MASK; + putreg32(regval, XMC4_PORT0_PDR1); + + regval = getreg32(XMC4_PORT0_IOCR8); + regval &= ~PORT_IOCR8_PC8_MASK; + regval |= PORT_IOCR8_PC8(0x11); /* push-pull output, alt func 1 */ + putreg32(regval, XMC4_PORT0_IOCR8); +#else + /* enable EXTCLK output on P1.15 */ +# warn "Not yet implemented" +#endif +#endif } diff --git a/arch/arm/src/xmc4/xmc4_start.c b/arch/arm/src/xmc4/xmc4_start.c index d1a1b4a1c3..5e65aecaac 100644 --- a/arch/arm/src/xmc4/xmc4_start.c +++ b/arch/arm/src/xmc4/xmc4_start.c @@ -396,9 +396,17 @@ void __start(void) /* Then start NuttX */ +#ifdef CONFIG_STACK_COLORATION + /* Set the IDLE stack to the coloration value and jump into os_start() */ + + go_os_start((FAR void *)&_ebss, CONFIG_IDLETHREAD_STACKSIZE); +#else + /* Call os_start() */ + os_start(); /* Shouldn't get here */ for (; ; ); +#endif } diff --git a/configs/xmc4500-relax/include/board.h b/configs/xmc4500-relax/include/board.h index 7190d1c939..0dfd182eb6 100644 --- a/configs/xmc4500-relax/include/board.h +++ b/configs/xmc4500-relax/include/board.h @@ -82,158 +82,153 @@ #define BOARD_XTAL_FREQUENCY 12000000 /* 12MHz XTAL */ #undef BOARD_RTC_XTAL_FRQUENCY /* 32.768KHz RTC XTAL not available on the Relax Lite */ - -#if defined(BOARD_FCPU_144MHZ) -/* Default clock initialization - * - * fXTAL = 12Mhz - * -> fPLL = (fXTAL / (2 * 1) * 48) = 288MHz - * -> fSYS = (fPLL / 1) = 288MHz - * -> fCPU = (fSYS / 2) = 144MHz - * -> fPERIPH = (fCPU / 1) = 144MHz - * -> fCCU = (fSYS / 2) = 144MHz - * -> fETH = 72MHz (REVISIT) - * -> fUSB = 48MHz (REVISIT) - * -> fEBU = 72MHz (REVISIT) - * - * fUSBPLL Disabled, only enabled if SCU_CLK_USBCLKCR_USBSEL_USBPLL is selected - * - * fOFI = 24MHz - * -> fWDT = 24MHz (REVISIT) +/* + * TODO: enable the RTC osc, use RTC for time/date */ /* Select the external crystal as the PLL clock source */ -# define BOARD_PLL_CLOCKSRC_XTAL 1 /* PLL Clock source == external crystal */ +# define BOARD_PLL_CLOCKSRC_XTAL 1 /* PLL Clock source == extnernal crystal */ # undef BOARD_PLL_CLOCKSRC_OFI /* PLL Clock source != internal fast oscillator */ /* PLL Configuration: * - * fPLL = (fPLLSRC / (pdiv * k2div) * ndiv + * fXTAL = 12Mhz + * 260 MHz <= fVCO <= 520 MHz * - * fPLL = (12000000 / (2 * 1)) * 48 - * = 288MHz + * fVCO = fXTAL * ndiv / pdiv + * fPLL = fVCO / k2div + * fSYS = fPLL / sysdiv + * fETH = fSYS / 2 (fixed div by 2) + * fCCU = fSYS / ccudiv (div by 1 or 2) + * fCPU = fSYS / cpudiv (div by 1 or 2) + * fPERIPH = fCPU / pbdiv (div by 1 or 2) */ -# define BOARD_ENABLE_PLL 1 -# define BOARD_PLL_PDIV 2 -# define BOARD_PLL_NDIV 48 -# define BOARD_PLL_K2DIV 1 -# define BOARD_PLL_FREQUENCY 288000000 +# define BOARD_ENABLE_PLL 1 /* enable the PLL */ +# define CPU_FREQ 120 /* MHz */ + +/* TODO: Automate PLL calculations */ -/* System frequency, fSYS, is divided down from PLL output */ +#if CPU_FREQ == 120 +/* + * 120 MHz + * + * fVCO = 12MHz * 40 / 2 = 480MHz + * fPLL = 480MHz / 2 = 240MHz + * fSYS = fPLL / 2 = 120MHz + * fCCU = fSYS / 2 = 60MHz + * fCPU = fSYS / 1 = 120MHz + * fPB = fCPU / 2 = 60MHz + * fETH = fSYS / 2 = 60MHz + */ -# define BOARD_SYSDIV 1 /* PLL Output divider to get fSYS */ -# define BOARD_SYS_FREQUENCY 288000000 +# define BOARD_PLL_NDIV 40 +# define BOARD_PLL_PDIV 1 +# define BOARD_PLL_K2DIV 4 +# define BOARD_PLL_SYSDIV 1 +# define BOARD_PLL_CPUDIV 1 +# define BOARD_PLL_PBDIV 2 +# define BOARD_PLL_CCUDIV 2 +# define BOARD_PLL_EBUDIV 4 + +#elif CPU_FREQ == 144 +/* + * 144 MHz + * + * fVCO = 12MHz * 36 / 1 = 432MHz + * fPLL = 432MHz / 3 = 144MHz + * fSYS = fPLL / 1 = 144MHz + * fCCU = fSYS / 2 = 72MHz + * fCPU = fSYS / 1 = 144MHz + * fPB = fCPU / 2 = 72MHz + * fETH = fSYS / 2 = 72MHz + */ -/* CPU frequency, fCPU, may be divided down from system frequency */ +# define BOARD_PLL_NDIV 36 +# define BOARD_PLL_PDIV 1 +# define BOARD_PLL_K2DIV 3 +# define BOARD_PLL_SYSDIV 1 +# define BOARD_PLL_CPUDIV 1 +# define BOARD_PLL_PBDIV 2 +# define BOARD_PLL_CCUDIV 2 +# define BOARD_PLL_EBUDIV 2 -# define BOARD_CPUDIV_ENABLE 1 /* Enable PLL divide by 2 for fCPU */ -# define BOARD_CPU_FREQUENCY 144000000 +#else +# error "Illegal or Unsupported CPU Frequency" +#endif -/* CCU frequency may be divided down from system frequency */ -# define BOARD_CCUDIV_ENABLE 1 /* Enable PLL div by 2 */ -# define BOARD_CCU_FREQUENCY 144000000 +# define BOARD_CCUDIV_ENABLE (BOARD_PLL_CCUDIV - 1) +# define BOARD_CPUDIV_ENABLE (BOARD_PLL_CPUDIV - 1) -/* Watchdog clock settings */ +# define BOARD_VCO_FREQUENCY (BOARD_XTAL_FREQUENCY * BOARD_PLL_NDIV / BOARD_PLL_PDIV) +# define BOARD_PLL_FREQUENCY (BOARD_VCO_FREQUENCY / BOARD_PLL_K2DIV) +# define BOARD_SYS_FREQUENCY (BOARD_PLL_FREQUENCY / BOARD_PLL_SYSDIV) +# define BOARD_CCU_FREQUENCY (BOARD_SYS_FREQUENCY / BOARD_PLL_CCUDIV) +# define BOARD_CPU_FREQUENCY (BOARD_SYS_FREQUENCY / BOARD_PLL_CPUDIV) +# define BOARD_PERIPH_FREQUENCY (BOARD_CPU_FREQUENCY / BOARD_PLL_PBDIV) +# define BOARD_ETH_FREQUENCY (BOARD_SYS_FREQUENCY / 2) # define BOARD_WDT_SOURCE WDT_CLKSRC_FOFI # define BOARD_WDTDIV 1 # define BOARD_WDT_FREQUENCY 24000000 -/* EBU frequency may be divided down from system frequency */ - -# define BOARD_EBUDIV 2 /* fSYS / 2 */ -# define BOARD_EBU_FREQUENCY 72000000 - -/* EXT clock settings */ - # define BOARD_EXT_SOURCE EXT_CLKSRC_FPLL -# define BOARD_EXTDIV 289 /* REVISIT */ -# define BOARD_EXT_FREQUENCY 498270 /* REVISIT */ +# define BOARD_PLL_ECKDIV 480 /* [1,512] */ -/* The peripheral clock, fPERIPH, derives from fCPU with no division */ +# define kHz_1 1000 +# define MHz_1 (kHz_1 * kHz_1) +# define MHz_50 ( 50 * MHz_1) +# define MHz_260 (260 * MHz_1) +# define MHz_520 (520 * MHz_1) -# define BOARD_PBDIV 1 /* No division */ -# define BOARD_PERIPH_FREQUENCY 144000000 + /* range check VCO frequency */ +# if (BOARD_VCO_FREQUENCY < MHz_260) +# error "VCO freq must be >= 260 MHz" +# endif -#elif defined(BOARD_FCPU_120MHZ) -/* Default clock initialization - * - * fXTAL = 12Mhz - * -> fPLL = (fXTAL / (2 * 4) * 80) = 120 - * -> fSYS = (fPLL / 1) = 120MHz - * -> fCPU = (fSYS / 1) = 120MHz - * -> fPERIPH = (fCPU / 1) = 120MHz - * -> fCCU = (fSYS / 1) = 120MHz - * -> fETH = 60MHz (REVISIT) - * -> fUSB = 48MHz (REVISIT) - * -> fEBU = 60MHz (REVISIT) - * - * fUSBPLL Disabled, only enabled if SCU_CLK_USBCLKCR_USBSEL_USBPLL is selected - * - * fOFI = 24MHz - * -> fWDT = 24MHz (REVISIT) - */ +# if (BOARD_VCO_FREQUENCY > MHz_520) +# error "VCO freq must be <= 520 MHz" +# endif -/* Select the external crystal as the PLL clock source */ - -# define BOARD_PLL_CLOCKSRC_XTAL 1 /* PLL Clock source == extnernal crystal */ -# undef BOARD_PLL_CLOCKSRC_OFI /* PLL Clock source != internal fast oscillator */ - -/* PLL Configuration: - * - * fPLL = (fPLLSRC / (pdiv * k2div) * ndiv - * - * fPLL = (12000000 / (2 * 4)) * 80 - * = 120MHz - */ - -# define BOARD_ENABLE_PLL 1 -# define BOARD_PLL_PDIV 2 -# define BOARD_PLL_NDIV 80 -# define BOARD_PLL_K2DIV 4 -# define BOARD_PLL_FREQUENCY 120000000 - -/* System frequency, fSYS, is divided down from PLL output */ + /* range check Ethernet MAC frequency */ +# if (BOARD_ETH_FREQUENCY <= MHz_50) +# error "ETH freq must be > 50 MHz" +# endif -# define BOARD_SYSDIV 1 /* No division */ -# define BOARD_SYS_FREQUENCY 120000000 -/* CPU frequency, fCPU, may be divided down from system frequency */ -# define BOARD_CPUDIV_ENABLE 0 /* No divison */ -# define BOARD_CPU_FREQUENCY 120000000 - -/* CCU frequency may be divided down from system frequency */ - -# define BOARD_CCUDIV_ENABLE 0 /* No divison */ -# define BOARD_CCU_FREQUENCY 120000000 - -/* Watchdog clock setting */ - -# define BOARD_WDT_SOURCE WDT_CLKSRC_FOFI -# define BOARD_WDTDIV 1 -# define BOARD_WDT_FREQUENCY 24000000 +/* check ccudiv cpudiv pbdiv against Table 11-5 + * of XMC4500 User Manual + */ +#define CLKDIV_INDEX (4 * (BOARD_PLL_CCUDIV-1) + \ + 2 * (BOARD_PLL_CPUDIV-1) + \ + (BOARD_PLL_PBDIV-1) ) -/* EBU frequency may be divided down from system frequency */ +#if (CLKDIV_INDEX == 3) || (CLKDIV_INDEX == 4) || (CLKDIV_INDEX > 6) +# error "Illegal combination of dividers! Ref: Table 11-5 of UM" +#endif -# define BOARD_EBUDIV 2 /* fSYS/2 */ -# define BOARD_EBU_FREQUENCY 60000000 /* EXT clock settings */ +#define BOARD_EXTCKL_ENABLE 1 /* 0 disables output */ +#if BOARD_EXTCKL_ENABLE +# define EXTCLK_PIN_P0_8 8 +# define EXTCLK_PIN_P1_15 15 +# define BOARD_EXTCLK_PIN EXTCLK_PIN_P0_8 # define BOARD_EXT_SOURCE EXT_CLKSRC_FPLL -# define BOARD_EXTDIV 289 /* REVISIT */ -# define BOARD_EXT_FREQUENCY 415225 /* REVISIT */ +# define BOARD_EXT_FREQUENCY (250 * kHz_1) /* Desired output freq */ +# define BOARD_EXTDIV (BOARD_PLL_FREQUENCY / BOARD_EXT_FREQUENCY) -/* The peripheral clock, fPERIPH, derives from fCPU with no division */ - -# define BOARD_PBDIV 1 /* No division */ -# define BOARD_PERIPH_FREQUENCY 120000000 +/* range check EXTDIV */ +# if BOARD_EXTDIV > 512 +# error "EXTCLK Divisor out of range!" +# endif #endif + /* Standby clock source selection * * BOARD_STDBY_CLOCKSRC_OSI - Internal 32.768KHz slow oscillator -- GitLab From a8b6be4aafea0c9e87cab6b82a2b1be9eea0294f Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 22 Jan 2018 08:17:31 -0600 Subject: [PATCH 057/228] The existence of the network driver ioctl() method should depend on CONFIG_NETDEV_IOCTL rather than CONFIG_NETDEV_PHY_IOCTL. The former enables the method, the later enables a subset of possible driver IOCTLs. This change should be basically a no-operation. The affected ioctl methods only support those subset of driver IOCTLs selected by CONFIG_NETDEV_PHY_IOCTL and the network logic will tolerate a nul ioctl method. --- arch/arm/src/c5471/c5471_ethernet.c | 2 +- arch/arm/src/kinetis/kinetis_enet.c | 70 +++++------ arch/arm/src/lpc17xx/lpc17_ethernet.c | 2 +- arch/arm/src/lpc43xx/lpc43_ethernet.c | 16 +-- arch/arm/src/lpc54xx/lpc54_ethernet.c | 4 + arch/arm/src/sam34/sam_emac.c | 110 +++++++++--------- arch/arm/src/sama5/sam_emaca.c | 110 +++++++++--------- arch/arm/src/sama5/sam_emacb.c | 106 +++++++++-------- arch/arm/src/sama5/sam_gmac.c | 104 +++++++++-------- arch/arm/src/samv7/sam_emac.c | 108 ++++++++--------- arch/arm/src/stm32/stm32_eth.c | 82 ++++++------- arch/arm/src/stm32f7/stm32_ethernet.c | 14 ++- arch/arm/src/tiva/tm4c_ethernet.c | 80 ++++++------- arch/hc/src/m9s12/m9s12_ethernet.c | 2 +- arch/mips/src/pic32mx/pic32mx-ethernet.c | 2 +- arch/mips/src/pic32mz/pic32mz-ethernet.c | 2 +- arch/misoc/src/common/misoc_net.c | 2 +- arch/z80/src/ez80/ez80_emac.c | 2 +- drivers/net/dm90x0.c | 2 +- drivers/net/enc28j60.c | 2 +- drivers/net/encx24j600.c | 2 +- drivers/net/ftmac100.c | 2 +- drivers/net/tun.c | 2 +- .../wireless/ieee802154/xbee/xbee_netdev.c | 2 +- .../wireless/spirit/drivers/spirit_netdev.c | 2 +- wireless/ieee802154/mac802154_netdev.c | 2 +- 26 files changed, 435 insertions(+), 399 deletions(-) diff --git a/arch/arm/src/c5471/c5471_ethernet.c b/arch/arm/src/c5471/c5471_ethernet.c index b98fd6ecac..f38497a37e 100644 --- a/arch/arm/src/c5471/c5471_ethernet.c +++ b/arch/arm/src/c5471/c5471_ethernet.c @@ -2447,7 +2447,7 @@ void up_netinitialize(void) #endif g_c5471[0].c_dev.d_private = (void *)g_c5471; /* Used to recover private state from dev */ - /* Create a watchdog for timing polling for and timing of transmisstions */ + /* Create a watchdog for timing polling for and timing of transmissions */ g_c5471[0].c_txpoll = wd_create(); /* Create periodic poll timer */ g_c5471[0].c_txtimeout = wd_create(); /* Create TX timeout timer */ diff --git a/arch/arm/src/kinetis/kinetis_enet.c b/arch/arm/src/kinetis/kinetis_enet.c index 8f51cc6a7b..4a7e1ba7ca 100644 --- a/arch/arm/src/kinetis/kinetis_enet.c +++ b/arch/arm/src/kinetis/kinetis_enet.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/kinetis/kinetis_enet.c * - * Copyright (C) 2011-2012, 2014-2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2011-2012, 2014-2018 Gregory Nutt. All rights reserved. * Authors: Gregory Nutt * David Sidrane * @@ -310,7 +310,7 @@ static int kinetis_addmac(struct net_driver_s *dev, static int kinetis_rmmac(struct net_driver_s *dev, FAR const uint8_t *mac); #endif -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL static int kinetis_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg); #endif @@ -1449,48 +1449,52 @@ static int kinetis_rmmac(struct net_driver_s *dev, FAR const uint8_t *mac) * ****************************************************************************/ -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL static int kinetis_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg) { - int ret; +#ifdef CONFIG_NETDEV_PHY_IOCTL FAR struct kinetis_driver_s *priv = (FAR struct kinetis_driver_s *)dev->d_private; +#endif + int ret; switch (cmd) - { - case SIOCGMIIPHY: /* Get MII PHY address */ { - struct mii_ioctl_data_s *req = - (struct mii_ioctl_data_s *)((uintptr_t)arg); - req->phy_id = priv->phyaddr; - ret = OK; - } - break; +#ifdef CONFIG_NETDEV_PHY_IOCTL + case SIOCGMIIPHY: /* Get MII PHY address */ + { + struct mii_ioctl_data_s *req = + (struct mii_ioctl_data_s *)((uintptr_t)arg); + req->phy_id = priv->phyaddr; + ret = OK; + } + break; - case SIOCGMIIREG: /* Get register from MII PHY */ - { - struct mii_ioctl_data_s *req = - (struct mii_ioctl_data_s *)((uintptr_t)arg); - ret = kinetis_readmii(priv, req->phy_id, req->reg_num, &req->val_out); - } - break; + case SIOCGMIIREG: /* Get register from MII PHY */ + { + struct mii_ioctl_data_s *req = + (struct mii_ioctl_data_s *)((uintptr_t)arg); + ret = kinetis_readmii(priv, req->phy_id, req->reg_num, &req->val_out); + } + break; - case SIOCSMIIREG: /* Set register in MII PHY */ - { - struct mii_ioctl_data_s *req = - (struct mii_ioctl_data_s *)((uintptr_t)arg); - ret = kinetis_writemii(priv, req->phy_id, req->reg_num, req->val_in); - } - break; + case SIOCSMIIREG: /* Set register in MII PHY */ + { + struct mii_ioctl_data_s *req = + (struct mii_ioctl_data_s *)((uintptr_t)arg); + ret = kinetis_writemii(priv, req->phy_id, req->reg_num, req->val_in); + } + break; +#endif /* ifdef CONFIG_NETDEV_PHY_IOCTL */ - default: - ret = -ENOTTY; - break; - } + default: + ret = -ENOTTY; + break; + } return ret; } -#endif /* CONFIG_NETDEV_PHY_IOCTL */ +#endif /* CONFIG_NETDEV_IOCTL */ /**************************************************************************** * Function: kinetis_initmii @@ -2127,12 +2131,12 @@ int kinetis_netinitialize(int intf) priv->dev.d_addmac = kinetis_addmac; /* Add multicast MAC address */ priv->dev.d_rmmac = kinetis_rmmac; /* Remove multicast MAC address */ #endif -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL priv->dev.d_ioctl = kinetis_ioctl; /* Support PHY ioctl() calls */ #endif priv->dev.d_private = (void *)g_enet; /* Used to recover private state from dev */ - /* Create a watchdog for timing polling for and timing of transmisstions */ + /* Create a watchdog for timing polling for and timing of transmissions */ priv->txpoll = wd_create(); /* Create periodic poll timer */ priv->txtimeout = wd_create(); /* Create TX timeout timer */ diff --git a/arch/arm/src/lpc17xx/lpc17_ethernet.c b/arch/arm/src/lpc17xx/lpc17_ethernet.c index dd1c05d0d1..196b15bab8 100644 --- a/arch/arm/src/lpc17xx/lpc17_ethernet.c +++ b/arch/arm/src/lpc17xx/lpc17_ethernet.c @@ -3056,7 +3056,7 @@ static inline int lpc17_ethinitialize(int intf) priv->lp_irq = ??; /* Ethernet controller IRQ number */ #endif - /* Create a watchdog for timing polling for and timing of transmisstions */ + /* Create a watchdog for timing polling for and timing of transmissions */ priv->lp_txpoll = wd_create(); /* Create periodic poll timer */ priv->lp_txtimeout = wd_create(); /* Create TX timeout timer */ diff --git a/arch/arm/src/lpc43xx/lpc43_ethernet.c b/arch/arm/src/lpc43xx/lpc43_ethernet.c index f5a9cb1e58..e598178811 100644 --- a/arch/arm/src/lpc43xx/lpc43_ethernet.c +++ b/arch/arm/src/lpc43xx/lpc43_ethernet.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/lpc43/lpc43_eth.c * - * Copyright (C) 2011-2015, 2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2011-2015, 2017-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -621,7 +621,7 @@ static int lpc43_addmac(struct net_driver_s *dev, FAR const uint8_t *mac); #ifdef CONFIG_NET_IGMP static int lpc43_rmmac(struct net_driver_s *dev, FAR const uint8_t *mac); #endif -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL static int lpc43_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg); #endif @@ -2744,16 +2744,17 @@ static void lpc43_rxdescinit(FAR struct lpc43_ethmac_s *priv) * ****************************************************************************/ -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL static int lpc43_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg) { -#ifdef CONFIG_ARCH_PHY_INTERRUPT +#if defined(CONFIG_NETDEV_PHY_IOCTL) && defined(CONFIG_ARCH_PHY_INTERRUPT) FAR struct lpc43_ethmac_s *priv = (FAR struct lpc43_ethmac_s *)dev->d_private; #endif int ret; switch (cmd) { +#ifdef CONFIG_NETDEV_PHY_IOCTL #ifdef CONFIG_ARCH_PHY_INTERRUPT case SIOCMIINOTIFY: /* Set up for PHY event notifications */ { @@ -2791,6 +2792,7 @@ static int lpc43_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg) ret = lpc43_phywrite(req->phy_id, req->reg_num, req->val_in); } break; +#endif /* ifdef CONFIG_NETDEV_PHY_IOCTL */ default: ret = -ENOTTY; @@ -2799,7 +2801,7 @@ static int lpc43_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg) return ret; } -#endif /* CONFIG_NETDEV_PHY_IOCTL */ +#endif /* CONFIG_NETDEV_IOCTL */ /**************************************************************************** * Function: lpc43_phyintenable @@ -3823,12 +3825,12 @@ static inline int lpc43_ethinitialize(void) priv->dev.d_addmac = lpc43_addmac; /* Add multicast MAC address */ priv->dev.d_rmmac = lpc43_rmmac; /* Remove multicast MAC address */ #endif -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL priv->dev.d_ioctl = lpc43_ioctl; /* Support PHY ioctl() calls */ #endif priv->dev.d_private = (void *)&g_lpc43ethmac; /* Used to recover private state from dev */ - /* Create a watchdog for timing polling for and timing of transmisstions */ + /* Create a watchdog for timing polling for and timing of transmission */ priv->txpoll = wd_create(); /* Create periodic poll timer */ priv->txtimeout = wd_create(); /* Create TX timeout timer */ diff --git a/arch/arm/src/lpc54xx/lpc54_ethernet.c b/arch/arm/src/lpc54xx/lpc54_ethernet.c index d89317247d..dde91da5c1 100644 --- a/arch/arm/src/lpc54xx/lpc54_ethernet.c +++ b/arch/arm/src/lpc54xx/lpc54_ethernet.c @@ -2392,13 +2392,16 @@ static int lpc54_eth_rmmac(struct net_driver_s *dev, const uint8_t *mac) static int lpc54_eth_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg) { +#ifdef CONFIG_NETDEV_PHY_IOCTL struct lpc54_ethdriver_s *priv = (struct lpc54_ethdriver_s *)dev->d_private; +#endif int ret; /* Decode and dispatch the driver-specific IOCTL command */ switch (cmd) { +#ifdef CONFIG_NETDEV_PHY_IOCTL case SIOCGMIIPHY: /* Get MII PHY address */ { struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); @@ -2422,6 +2425,7 @@ static int lpc54_eth_ioctl(struct net_driver_s *dev, int cmd, ret = OK } break; +#endif /* ifdef CONFIG_NETDEV_PHY_IOCTL */ default: nerr("ERROR: Unrecognized IOCTL command: %d\n", command); diff --git a/arch/arm/src/sam34/sam_emac.c b/arch/arm/src/sam34/sam_emac.c index c45ea9f383..88d43258d5 100644 --- a/arch/arm/src/sam34/sam_emac.c +++ b/arch/arm/src/sam34/sam_emac.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/sam34/sam_emac.c * - * Copyright (C) 2014-2015, 2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2014-2015, 2017-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * This logic derives from the SAM34D3 Ethernet driver. @@ -408,7 +408,7 @@ static int sam_addmac(struct net_driver_s *dev, const uint8_t *mac); static int sam_rmmac(struct net_driver_s *dev, const uint8_t *mac); #endif -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL static int sam_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg); #endif @@ -2309,86 +2309,90 @@ static int sam_rmmac(struct net_driver_s *dev, const uint8_t *mac) * ****************************************************************************/ -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL static int sam_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg) { +#ifdef CONFIG_NETDEV_PHY_IOCTL struct sam_emac_s *priv = (struct sam_emac_s *)dev->d_private; +#endif int ret; switch (cmd) - { -#ifdef CONFIG_ARCH_PHY_INTERRUPT - case SIOCMIINOTIFY: /* Set up for PHY event notifications */ { - struct mii_iotcl_notify_s *req = (struct mii_iotcl_notify_s *)((uintptr_t)arg); - - ret = phy_notify_subscribe(dev->d_ifname, req->pid, req->signo, req->arg); - if (ret == OK) +#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_ARCH_PHY_INTERRUPT + case SIOCMIINOTIFY: /* Set up for PHY event notifications */ { - /* Enable PHY link up/down interrupts */ + struct mii_iotcl_notify_s *req = (struct mii_iotcl_notify_s *)((uintptr_t)arg); - ret = sam_phyintenable(priv); + ret = phy_notify_subscribe(dev->d_ifname, req->pid, req->signo, req->arg); + if (ret == OK) + { + /* Enable PHY link up/down interrupts */ + + ret = sam_phyintenable(priv); + } } - } - break; + break; #endif - case SIOCGMIIPHY: /* Get MII PHY address */ - { - struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); - req->phy_id = priv->phyaddr; - ret = OK; - } - break; + case SIOCGMIIPHY: /* Get MII PHY address */ + { + struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); + req->phy_id = priv->phyaddr; + ret = OK; + } + break; - case SIOCGMIIREG: /* Get register from MII PHY */ - { - struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); - uint32_t regval; + case SIOCGMIIREG: /* Get register from MII PHY */ + { + struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); + uint32_t regval; - /* Enable management port */ + /* Enable management port */ - regval = sam_getreg(priv, SAM_EMAC_NCR); - sam_putreg(priv, SAM_EMAC_NCR, regval | EMAC_NCR_MPE); + regval = sam_getreg(priv, SAM_EMAC_NCR); + sam_putreg(priv, SAM_EMAC_NCR, regval | EMAC_NCR_MPE); - /* Read from the requested register */ + /* Read from the requested register */ - ret = sam_phyread(priv, req->phy_id, req->reg_num, &req->val_out); + ret = sam_phyread(priv, req->phy_id, req->reg_num, &req->val_out); - /* Disable management port (probably) */ + /* Disable management port (probably) */ - sam_putreg(priv, SAM_EMAC_NCR, regval); - } - break; + sam_putreg(priv, SAM_EMAC_NCR, regval); + } + break; - case SIOCSMIIREG: /* Set register in MII PHY */ - { - struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); - uint32_t regval; + case SIOCSMIIREG: /* Set register in MII PHY */ + { + struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); + uint32_t regval; - /* Enable management port */ + /* Enable management port */ - regval = sam_getreg(priv, SAM_EMAC_NCR); - sam_putreg(priv, SAM_EMAC_NCR, regval | EMAC_NCR_MPE); + regval = sam_getreg(priv, SAM_EMAC_NCR); + sam_putreg(priv, SAM_EMAC_NCR, regval | EMAC_NCR_MPE); - /* Write to the requested register */ + /* Write to the requested register */ - ret = sam_phywrite(priv, req->phy_id, req->reg_num, req->val_in); + ret = sam_phywrite(priv, req->phy_id, req->reg_num, req->val_in); - /* Disable management port (probably) */ + /* Disable management port (probably) */ - sam_putreg(priv, SAM_EMAC_NCR, regval); - } - break; + sam_putreg(priv, SAM_EMAC_NCR, regval); + } + break; +#endif /* ifdef CONFIG_NETDEV_PHY_IOCTL */ - default: - ret = -ENOTTY; - break; - } + default: + ret = -ENOTTY; + break; + } return ret; } -#endif /* CONFIG_NETDEV_PHY_IOCTL */ +#endif /* CONFIG_NETDEV_IOCTL */ /**************************************************************************** * Function: sam_phydump @@ -3630,7 +3634,7 @@ void up_netinitialize(void) priv->dev.d_addmac = sam_addmac; /* Add multicast MAC address */ priv->dev.d_rmmac = sam_rmmac; /* Remove multicast MAC address */ #endif -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL priv->dev.d_ioctl = sam_ioctl; /* Support PHY ioctl() calls */ #endif priv->dev.d_private = (void *)&g_emac; /* Used to recover private state from dev */ diff --git a/arch/arm/src/sama5/sam_emaca.c b/arch/arm/src/sama5/sam_emaca.c index 1648cab525..3a011a5b7c 100644 --- a/arch/arm/src/sama5/sam_emaca.c +++ b/arch/arm/src/sama5/sam_emaca.c @@ -4,7 +4,7 @@ * 10/100 Base-T Ethernet driver for the SAMA5D3. Denoted as 'A' to * distinguish it from the SAMA5D4 EMAC driver. * - * Copyright (C) 2013-2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2013-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * References: @@ -413,7 +413,7 @@ static int sam_addmac(struct net_driver_s *dev, const uint8_t *mac); static int sam_rmmac(struct net_driver_s *dev, const uint8_t *mac); #endif -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL static int sam_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg); #endif @@ -2345,86 +2345,90 @@ static int sam_rmmac(struct net_driver_s *dev, const uint8_t *mac) * ****************************************************************************/ -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL static int sam_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg) { +#ifdef CONFIG_NETDEV_PHY_IOCTL struct sam_emac_s *priv = (struct sam_emac_s *)dev->d_private; +#endif int ret; switch (cmd) - { -#ifdef CONFIG_ARCH_PHY_INTERRUPT - case SIOCMIINOTIFY: /* Set up for PHY event notifications */ { - struct mii_iotcl_notify_s *req = (struct mii_iotcl_notify_s *)((uintptr_t)arg); - - ret = phy_notify_subscribe(dev->d_ifname, req->pid, req->signo, req->arg); - if (ret == OK) +#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_ARCH_PHY_INTERRUPT + case SIOCMIINOTIFY: /* Set up for PHY event notifications */ { - /* Enable PHY link up/down interrupts */ + struct mii_iotcl_notify_s *req = (struct mii_iotcl_notify_s *)((uintptr_t)arg); - ret = sam_phyintenable(priv); + ret = phy_notify_subscribe(dev->d_ifname, req->pid, req->signo, req->arg); + if (ret == OK) + { + /* Enable PHY link up/down interrupts */ + + ret = sam_phyintenable(priv); + } } - } - break; + break; #endif - case SIOCGMIIPHY: /* Get MII PHY address */ - { - struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); - req->phy_id = priv->phyaddr; - ret = OK; - } - break; + case SIOCGMIIPHY: /* Get MII PHY address */ + { + struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); + req->phy_id = priv->phyaddr; + ret = OK; + } + break; - case SIOCGMIIREG: /* Get register from MII PHY */ - { - struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); - uint32_t regval; + case SIOCGMIIREG: /* Get register from MII PHY */ + { + struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); + uint32_t regval; - /* Enable management port */ + /* Enable management port */ - regval = sam_getreg(priv, SAM_EMAC_NCR); - sam_putreg(priv, SAM_EMAC_NCR, regval | EMAC_NCR_MPE); + regval = sam_getreg(priv, SAM_EMAC_NCR); + sam_putreg(priv, SAM_EMAC_NCR, regval | EMAC_NCR_MPE); - /* Read from the requested register */ + /* Read from the requested register */ - ret = sam_phyread(priv, req->phy_id, req->reg_num, &req->val_out); + ret = sam_phyread(priv, req->phy_id, req->reg_num, &req->val_out); - /* Disable management port (probably) */ + /* Disable management port (probably) */ - sam_putreg(priv, SAM_EMAC_NCR, regval); - } - break; + sam_putreg(priv, SAM_EMAC_NCR, regval); + } + break; - case SIOCSMIIREG: /* Set register in MII PHY */ - { - struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); - uint32_t regval; + case SIOCSMIIREG: /* Set register in MII PHY */ + { + struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); + uint32_t regval; - /* Enable management port */ + /* Enable management port */ - regval = sam_getreg(priv, SAM_EMAC_NCR); - sam_putreg(priv, SAM_EMAC_NCR, regval | EMAC_NCR_MPE); + regval = sam_getreg(priv, SAM_EMAC_NCR); + sam_putreg(priv, SAM_EMAC_NCR, regval | EMAC_NCR_MPE); - /* Write to the requested register */ + /* Write to the requested register */ - ret = sam_phywrite(priv, req->phy_id, req->reg_num, req->val_in); + ret = sam_phywrite(priv, req->phy_id, req->reg_num, req->val_in); - /* Disable management port (probably) */ + /* Disable management port (probably) */ - sam_putreg(priv, SAM_EMAC_NCR, regval); - } - break; + sam_putreg(priv, SAM_EMAC_NCR, regval); + } + break; +#endif /* CONFIG_NETDEV_PHY_IOCTL */ - default: - ret = -ENOTTY; - break; - } + default: + ret = -ENOTTY; + break; + } return ret; } -#endif /* CONFIG_NETDEV_PHY_IOCTL */ +#endif /* CONFIG_NETDEV_IOCTL */ /**************************************************************************** * Function: sam_phydump @@ -3672,7 +3676,7 @@ int sam_emac_initialize(void) priv->dev.d_addmac = sam_addmac; /* Add multicast MAC address */ priv->dev.d_rmmac = sam_rmmac; /* Remove multicast MAC address */ #endif -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL priv->dev.d_ioctl = sam_ioctl; /* Support PHY ioctl() calls */ #endif priv->dev.d_private = (void *)&g_emac; /* Used to recover private state from dev */ diff --git a/arch/arm/src/sama5/sam_emacb.c b/arch/arm/src/sama5/sam_emacb.c index c9fb251aca..9f6f366e24 100644 --- a/arch/arm/src/sama5/sam_emacb.c +++ b/arch/arm/src/sama5/sam_emacb.c @@ -507,7 +507,7 @@ static int sam_addmac(struct net_driver_s *dev, const uint8_t *mac); static int sam_rmmac(struct net_driver_s *dev, const uint8_t *mac); #endif -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL static int sam_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg); #endif @@ -2715,79 +2715,83 @@ static int sam_rmmac(struct net_driver_s *dev, const uint8_t *mac) #ifdef CONFIG_NETDEV_PHY_IOCTL static int sam_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg) { +#ifdef CONFIG_NETDEV_PHY_IOCTL struct sam_emac_s *priv = (struct sam_emac_s *)dev->d_private; +#endif int ret; switch (cmd) - { -#ifdef CONFIG_ARCH_PHY_INTERRUPT - case SIOCMIINOTIFY: /* Set up for PHY event notifications */ { - struct mii_iotcl_notify_s *req = (struct mii_iotcl_notify_s *)((uintptr_t)arg); +#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_ARCH_PHY_INTERRUPT + case SIOCMIINOTIFY: /* Set up for PHY event notifications */ + { + struct mii_iotcl_notify_s *req = (struct mii_iotcl_notify_s *)((uintptr_t)arg); - ret = phy_notify_subscribe(dev->d_ifname, req->pid, req->signo, req->arg); - if (ret == OK) - { - /* Enable PHY link up/down interrupts */ + ret = phy_notify_subscribe(dev->d_ifname, req->pid, req->signo, req->arg); + if (ret == OK) + { + /* Enable PHY link up/down interrupts */ - ret = sam_phyintenable(priv); + ret = sam_phyintenable(priv); + } } - } - break; + break; #endif - case SIOCGMIIPHY: /* Get MII PHY address */ - { - struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); - req->phy_id = priv->phyaddr; - ret = OK; - } - break; + case SIOCGMIIPHY: /* Get MII PHY address */ + { + struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); + req->phy_id = priv->phyaddr; + ret = OK; + } + break; - case SIOCGMIIREG: /* Get register from MII PHY */ - { - struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); - uint32_t regval; + case SIOCGMIIREG: /* Get register from MII PHY */ + { + struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); + uint32_t regval; - /* Enable management port */ + /* Enable management port */ - regval = sam_getreg(priv, SAM_EMAC_NCR_OFFSET); - sam_putreg(priv, SAM_EMAC_NCR_OFFSET, regval | EMAC_NCR_MPE); + regval = sam_getreg(priv, SAM_EMAC_NCR_OFFSET); + sam_putreg(priv, SAM_EMAC_NCR_OFFSET, regval | EMAC_NCR_MPE); - /* Read from the requested register */ + /* Read from the requested register */ - ret = sam_phyread(priv, req->phy_id, req->reg_num, &req->val_out); + ret = sam_phyread(priv, req->phy_id, req->reg_num, &req->val_out); - /* Disable management port (probably) */ + /* Disable management port (probably) */ - sam_putreg(priv, SAM_EMAC_NCR_OFFSET, regval); - } - break; + sam_putreg(priv, SAM_EMAC_NCR_OFFSET, regval); + } + break; - case SIOCSMIIREG: /* Set register in MII PHY */ - { - struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); - uint32_t regval; + case SIOCSMIIREG: /* Set register in MII PHY */ + { + struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); + uint32_t regval; - /* Enable management port */ + /* Enable management port */ - regval = sam_getreg(priv, SAM_EMAC_NCR_OFFSET); - sam_putreg(priv, SAM_EMAC_NCR_OFFSET, regval | EMAC_NCR_MPE); + regval = sam_getreg(priv, SAM_EMAC_NCR_OFFSET); + sam_putreg(priv, SAM_EMAC_NCR_OFFSET, regval | EMAC_NCR_MPE); - /* Write to the requested register */ + /* Write to the requested register */ - ret = sam_phywrite(priv, req->phy_id, req->reg_num, req->val_in); + ret = sam_phywrite(priv, req->phy_id, req->reg_num, req->val_in); - /* Disable management port (probably) */ + /* Disable management port (probably) */ - sam_putreg(priv, SAM_EMAC_NCR_OFFSET, regval); - } - break; + sam_putreg(priv, SAM_EMAC_NCR_OFFSET, regval); + } + break; +#endif /* CONFIG_NETDEV_PHY_IOCTL */ - default: - ret = -ENOTTY; - break; - } + default: + ret = -ENOTTY; + break; + } return ret; } @@ -4357,9 +4361,9 @@ int sam_emac_initialize(int intf) priv->dev.d_addmac = sam_addmac; /* Add multicast MAC address */ priv->dev.d_rmmac = sam_rmmac; /* Remove multicast MAC address */ #endif -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL priv->dev.d_ioctl = sam_ioctl; /* Support PHY ioctl() calls */ -#ifdef CONFIG_ARCH_PHY_INTERRUPT +#if defined(CONFIG_NETDEV_PHY_IOCTL) && defined(CONFIG_ARCH_PHY_INTERRUPT) priv->phytype = phytype; /* Type of PHY on port */ #endif #endif diff --git a/arch/arm/src/sama5/sam_gmac.c b/arch/arm/src/sama5/sam_gmac.c index d909962190..d70a40c5a3 100644 --- a/arch/arm/src/sama5/sam_gmac.c +++ b/arch/arm/src/sama5/sam_gmac.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/sama5/sam_gmac.c * - * Copyright (C) 2013-2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2013-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * References: @@ -338,7 +338,7 @@ static int sam_addmac(struct net_driver_s *dev, const uint8_t *mac); static int sam_rmmac(struct net_driver_s *dev, const uint8_t *mac); #endif -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL static int sam_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg); #endif @@ -2300,82 +2300,86 @@ static int sam_rmmac(struct net_driver_s *dev, const uint8_t *mac) * ****************************************************************************/ -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL static int sam_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg) { +#ifdef CONFIG_NETDEV_PHY_IOCTL struct sam_gmac_s *priv = (struct sam_gmac_s *)dev->d_private; +#endif int ret; switch (cmd) - { -#ifdef CONFIG_ARCH_PHY_INTERRUPT - case SIOCMIINOTIFY: /* Set up for PHY event notifications */ { - struct mii_iotcl_notify_s *req = (struct mii_iotcl_notify_s *)((uintptr_t)arg); - - ret = phy_notify_subscribe(dev->d_ifname, req->pid, req->signo, req->arg); - if (ret == OK) +#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_ARCH_PHY_INTERRUPT + case SIOCMIINOTIFY: /* Set up for PHY event notifications */ { - /* Enable PHY link up/down interrupts */ + struct mii_iotcl_notify_s *req = (struct mii_iotcl_notify_s *)((uintptr_t)arg); - ret = sam_phyintenable(priv); + ret = phy_notify_subscribe(dev->d_ifname, req->pid, req->signo, req->arg); + if (ret == OK) + { + /* Enable PHY link up/down interrupts */ + + ret = sam_phyintenable(priv); + } } - } - break; + break; #endif - case SIOCGMIIPHY: /* Get MII PHY address */ - { - struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); - req->phy_id = priv->phyaddr; - ret = OK; - } - break; + case SIOCGMIIPHY: /* Get MII PHY address */ + { + struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); + req->phy_id = priv->phyaddr; + ret = OK; + } + break; - case SIOCGMIIREG: /* Get register from MII PHY */ - { - struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); + case SIOCGMIIREG: /* Get register from MII PHY */ + { + struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); - /* Enable the management port */ + /* Enable the management port */ - sam_enablemdio(priv); + sam_enablemdio(priv); - /* Read from the requested register */ + /* Read from the requested register */ - ret = sam_phyread(priv, req->phy_id, req->reg_num, &req->val_out); + ret = sam_phyread(priv, req->phy_id, req->reg_num, &req->val_out); - /* Disable the management port */ + /* Disable the management port */ - sam_disablemdio(priv); - } - break; + sam_disablemdio(priv); + } + break; - case SIOCSMIIREG: /* Set register in MII PHY */ - { - struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); + case SIOCSMIIREG: /* Set register in MII PHY */ + { + struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); - /* Enable the management port */ + /* Enable the management port */ - sam_enablemdio(priv); + sam_enablemdio(priv); - /* Write to the requested register */ + /* Write to the requested register */ - ret = sam_phywrite(priv, req->phy_id, req->reg_num, req->val_in); + ret = sam_phywrite(priv, req->phy_id, req->reg_num, req->val_in); - /* Disable the management port */ + /* Disable the management port */ - sam_disablemdio(priv); - } - break; + sam_disablemdio(priv); + } + break; +#endif /* CONFIG_NETDEV_PHY_IOCTL */ - default: - ret = -ENOTTY; - break; - } + default: + ret = -ENOTTY; + break; + } return ret; } -#endif /* CONFIG_NETDEV_PHY_IOCTL */ +#endif /* CONFIG_NETDEV_IOCTL */ /**************************************************************************** * Function: sam_phydump @@ -3744,12 +3748,12 @@ int sam_gmac_initialize(void) priv->dev.d_addmac = sam_addmac; /* Add multicast MAC address */ priv->dev.d_rmmac = sam_rmmac; /* Remove multicast MAC address */ #endif -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL priv->dev.d_ioctl = sam_ioctl; /* Support PHY ioctl() calls */ #endif priv->dev.d_private = (void *)&g_gmac; /* Used to recover private state from dev */ - /* Create a watchdog for timing polling for and timing of transmisstions */ + /* Create a watchdog for timing polling for and timing of transmissions */ priv->txpoll = wd_create(); if (!priv->txpoll) diff --git a/arch/arm/src/samv7/sam_emac.c b/arch/arm/src/samv7/sam_emac.c index 3496331898..94c5956b2b 100644 --- a/arch/arm/src/samv7/sam_emac.c +++ b/arch/arm/src/samv7/sam_emac.c @@ -2,7 +2,7 @@ * arch/arm/src/samv7/sam_emac.c * 10/100 Base-T Ethernet driver for the SAMV71. * - * Copyright (C) 2015, 2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2015, 2017-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * This logic derives from the SAMA5 Ethernet driver which, in turn, derived @@ -622,7 +622,7 @@ static int sam_addmac(struct net_driver_s *dev, const uint8_t *mac); static int sam_rmmac(struct net_driver_s *dev, const uint8_t *mac); #endif -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL static int sam_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg); #endif @@ -3196,86 +3196,90 @@ static int sam_rmmac(struct net_driver_s *dev, const uint8_t *mac) * ****************************************************************************/ -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL static int sam_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg) { +#ifdef CONFIG_NETDEV_PHY_IOCTL struct sam_emac_s *priv = (struct sam_emac_s *)dev->d_private; +#endif int ret; switch (cmd) - { + { +#ifdef CONFIG_NETDEV_PHY_IOCTL #ifdef CONFIG_ARCH_PHY_INTERRUPT case SIOCMIINOTIFY: /* Set up for PHY event notifications */ { - struct mii_iotcl_notify_s *req = (struct mii_iotcl_notify_s *)((uintptr_t)arg); + struct mii_iotcl_notify_s *req = (struct mii_iotcl_notify_s *)((uintptr_t)arg); - ret = phy_notify_subscribe(dev->d_ifname, req->pid, req->signo, req->arg); - if (ret == OK) - { - /* Enable PHY link up/down interrupts */ + ret = phy_notify_subscribe(dev->d_ifname, req->pid, req->signo, req->arg); + if (ret == OK) + { + /* Enable PHY link up/down interrupts */ - ret = sam_phyintenable(priv); + ret = sam_phyintenable(priv); + } } - } - break; + break; #endif - case SIOCGMIIPHY: /* Get MII PHY address */ - { - struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); - req->phy_id = priv->phyaddr; - ret = OK; - } - break; + case SIOCGMIIPHY: /* Get MII PHY address */ + { + struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); + req->phy_id = priv->phyaddr; + ret = OK; + } + break; - case SIOCGMIIREG: /* Get register from MII PHY */ - { - struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); - uint32_t regval; + case SIOCGMIIREG: /* Get register from MII PHY */ + { + struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); + uint32_t regval; - /* Enable management port */ + /* Enable management port */ - regval = sam_getreg(priv, SAM_EMAC_NCR_OFFSET); - sam_putreg(priv, SAM_EMAC_NCR_OFFSET, regval | EMAC_NCR_MPE); + regval = sam_getreg(priv, SAM_EMAC_NCR_OFFSET); + sam_putreg(priv, SAM_EMAC_NCR_OFFSET, regval | EMAC_NCR_MPE); - /* Read from the requested register */ + /* Read from the requested register */ - ret = sam_phyread(priv, req->phy_id, req->reg_num, &req->val_out); + ret = sam_phyread(priv, req->phy_id, req->reg_num, &req->val_out); - /* Disable management port (probably) */ + /* Disable management port (probably) */ - sam_putreg(priv, SAM_EMAC_NCR_OFFSET, regval); - } - break; + sam_putreg(priv, SAM_EMAC_NCR_OFFSET, regval); + } + break; - case SIOCSMIIREG: /* Set register in MII PHY */ - { - struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); - uint32_t regval; + case SIOCSMIIREG: /* Set register in MII PHY */ + { + struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); + uint32_t regval; - /* Enable management port */ + /* Enable management port */ - regval = sam_getreg(priv, SAM_EMAC_NCR_OFFSET); - sam_putreg(priv, SAM_EMAC_NCR_OFFSET, regval | EMAC_NCR_MPE); + regval = sam_getreg(priv, SAM_EMAC_NCR_OFFSET); + sam_putreg(priv, SAM_EMAC_NCR_OFFSET, regval | EMAC_NCR_MPE); - /* Write to the requested register */ + /* Write to the requested register */ - ret = sam_phywrite(priv, req->phy_id, req->reg_num, req->val_in); + ret = sam_phywrite(priv, req->phy_id, req->reg_num, req->val_in); - /* Disable management port (probably) */ + /* Disable management port (probably) */ - sam_putreg(priv, SAM_EMAC_NCR_OFFSET, regval); - } - break; + sam_putreg(priv, SAM_EMAC_NCR_OFFSET, regval); + } + break; +#endif /* CONFIG_NETDEV_PHY_IOCTL */ - default: - ret = -ENOTTY; - break; - } + default: + ret = -ENOTTY; + break; + } return ret; } -#endif /* CONFIG_NETDEV_PHY_IOCTL */ +#endif /* CONFIG_NETDEV_IOCTL */ /**************************************************************************** * Function: sam_phydump @@ -5017,9 +5021,9 @@ int sam_emac_initialize(int intf) priv->dev.d_addmac = sam_addmac; /* Add multicast MAC address */ priv->dev.d_rmmac = sam_rmmac; /* Remove multicast MAC address */ #endif -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL priv->dev.d_ioctl = sam_ioctl; /* Support PHY ioctl() calls */ -#ifdef CONFIG_ARCH_PHY_INTERRUPT +#if defined(CONFIG_NETDEV_PHY_IOCTL) && defined(CONFIG_ARCH_PHY_INTERRUPT) priv->phytype = phytype; /* Type of PHY on port */ #endif #endif diff --git a/arch/arm/src/stm32/stm32_eth.c b/arch/arm/src/stm32/stm32_eth.c index 62e44a0ff2..0c2aac1311 100644 --- a/arch/arm/src/stm32/stm32_eth.c +++ b/arch/arm/src/stm32/stm32_eth.c @@ -721,7 +721,7 @@ static int stm32_addmac(struct net_driver_s *dev, FAR const uint8_t *mac); #ifdef CONFIG_NET_IGMP static int stm32_rmmac(struct net_driver_s *dev, FAR const uint8_t *mac); #endif -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL static int stm32_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg); #endif @@ -2847,62 +2847,64 @@ static void stm32_rxdescinit(FAR struct stm32_ethmac_s *priv) * ****************************************************************************/ -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL static int stm32_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg) { -#ifdef CONFIG_ARCH_PHY_INTERRUPT +#if defined(CONFIG_NETDEV_PHY_IOCTL) && defined(CONFIG_ARCH_PHY_INTERRUPT) FAR struct stm32_ethmac_s *priv = (FAR struct stm32_ethmac_s *)dev->d_private; #endif int ret; switch (cmd) - { -#ifdef CONFIG_ARCH_PHY_INTERRUPT - case SIOCMIINOTIFY: /* Set up for PHY event notifications */ { - struct mii_iotcl_notify_s *req = (struct mii_iotcl_notify_s *)((uintptr_t)arg); - - ret = phy_notify_subscribe(dev->d_ifname, req->pid, req->signo, req->arg); - if (ret == OK) +#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_ARCH_PHY_INTERRUPT + case SIOCMIINOTIFY: /* Set up for PHY event notifications */ { - /* Enable PHY link up/down interrupts */ + struct mii_iotcl_notify_s *req = (struct mii_iotcl_notify_s *)((uintptr_t)arg); - ret = stm32_phyintenable(priv); + ret = phy_notify_subscribe(dev->d_ifname, req->pid, req->signo, req->arg); + if (ret == OK) + { + /* Enable PHY link up/down interrupts */ + + ret = stm32_phyintenable(priv); + } } - } - break; + break; #endif - case SIOCGMIIPHY: /* Get MII PHY address */ - { - struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); - req->phy_id = CONFIG_STM32_PHYADDR; - ret = OK; - } - break; + case SIOCGMIIPHY: /* Get MII PHY address */ + { + struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); + req->phy_id = CONFIG_STM32_PHYADDR; + ret = OK; + } + break; - case SIOCGMIIREG: /* Get register from MII PHY */ - { - struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); - ret = stm32_phyread(req->phy_id, req->reg_num, &req->val_out); - } - break; + case SIOCGMIIREG: /* Get register from MII PHY */ + { + struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); + ret = stm32_phyread(req->phy_id, req->reg_num, &req->val_out); + } + break; - case SIOCSMIIREG: /* Set register in MII PHY */ - { - struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); - ret = stm32_phywrite(req->phy_id, req->reg_num, req->val_in); - } - break; + case SIOCSMIIREG: /* Set register in MII PHY */ + { + struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); + ret = stm32_phywrite(req->phy_id, req->reg_num, req->val_in); + } + break; +#endif /* CONFIG_NETDEV_PHY_IOCTL */ - default: - ret = -ENOTTY; - break; - } + default: + ret = -ENOTTY; + break; + } return ret; } -#endif /* CONFIG_NETDEV_PHY_IOCTL */ +#endif /* CONFIG_NETDEV_IOCTL */ /**************************************************************************** * Function: stm32_phyintenable @@ -4014,12 +4016,12 @@ int stm32_ethinitialize(int intf) priv->dev.d_addmac = stm32_addmac; /* Add multicast MAC address */ priv->dev.d_rmmac = stm32_rmmac; /* Remove multicast MAC address */ #endif -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL priv->dev.d_ioctl = stm32_ioctl; /* Support PHY ioctl() calls */ #endif priv->dev.d_private = (void *)g_stm32ethmac; /* Used to recover private state from dev */ - /* Create a watchdog for timing polling for and timing of transmisstions */ + /* Create a watchdog for timing polling for and timing of transmissions */ priv->txpoll = wd_create(); /* Create periodic poll timer */ priv->txtimeout = wd_create(); /* Create TX timeout timer */ diff --git a/arch/arm/src/stm32f7/stm32_ethernet.c b/arch/arm/src/stm32f7/stm32_ethernet.c index 8c0eddd847..d5337d8f48 100644 --- a/arch/arm/src/stm32f7/stm32_ethernet.c +++ b/arch/arm/src/stm32f7/stm32_ethernet.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/stm32f7/stm32_ethernet.c * - * Copyright (C) 2015-2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2015-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -732,7 +732,7 @@ static int stm32_addmac(struct net_driver_s *dev, const uint8_t *mac); #ifdef CONFIG_NET_IGMP static int stm32_rmmac(struct net_driver_s *dev, const uint8_t *mac); #endif -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL static int stm32_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg); #endif @@ -2958,16 +2958,17 @@ static void stm32_rxdescinit(struct stm32_ethmac_s *priv, * ****************************************************************************/ -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL static int stm32_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg) { -#ifdef CONFIG_ARCH_PHY_INTERRUPT +#if defined(CONFIG_NETDEV_PHY_IOCTL) && defined(CONFIG_ARCH_PHY_INTERRUPT) struct stm32_ethmac_s *priv = (struct stm32_ethmac_s *)dev->d_private; #endif int ret; switch (cmd) { +#ifdef CONFIG_NETDEV_PHY_IOCTL #ifdef CONFIG_ARCH_PHY_INTERRUPT case SIOCMIINOTIFY: /* Set up for PHY event notifications */ { @@ -3005,6 +3006,7 @@ static int stm32_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg) ret = stm32_phywrite(req->phy_id, req->reg_num, req->val_in); } break; +#endif /* CONFIG_NETDEV_PHY_IOCTL */ default: ret = -ENOTTY; @@ -3013,7 +3015,7 @@ static int stm32_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg) return ret; } -#endif /* CONFIG_NETDEV_PHY_IOCTL */ +#endif /* CONFIG_NETDEV_IOCTL */ /**************************************************************************** * Function: stm32_phyintenable @@ -4095,7 +4097,7 @@ int stm32_ethinitialize(int intf) priv->dev.d_addmac = stm32_addmac; /* Add multicast MAC address */ priv->dev.d_rmmac = stm32_rmmac; /* Remove multicast MAC address */ #endif -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL priv->dev.d_ioctl = stm32_ioctl; /* Support PHY ioctl() calls */ #endif priv->dev.d_private = (void *)g_stm32ethmac; /* Used to recover private state from dev */ diff --git a/arch/arm/src/tiva/tm4c_ethernet.c b/arch/arm/src/tiva/tm4c_ethernet.c index 3458db363c..be2dd12350 100644 --- a/arch/arm/src/tiva/tm4c_ethernet.c +++ b/arch/arm/src/tiva/tm4c_ethernet.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/tiva/tm4c_ethernet.c * - * Copyright (C) 2014-2015, 2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2014-2015, 2017-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -733,7 +733,7 @@ static int tiva_addmac(struct net_driver_s *dev, FAR const uint8_t *mac); #ifdef CONFIG_NET_IGMP static int tiva_rmmac(struct net_driver_s *dev, FAR const uint8_t *mac); #endif -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL static int tiva_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg); #endif @@ -2860,59 +2860,61 @@ static void tiva_rxdescinit(FAR struct tiva_ethmac_s *priv) * ****************************************************************************/ -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL static int tiva_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg) { int ret; switch (cmd) - { -#ifdef CONFIG_TIVA_PHY_INTERRUPTS - case SIOCMIINOTIFY: /* Set up for PHY event notifications */ { - struct mii_iotcl_notify_s *req = (struct mii_iotcl_notify_s *)((uintptr_t)arg); - - ret = phy_notify_subscribe(dev->d_ifname, req->pid, req->signo, req->arg); - if (ret == OK) +#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_TIVA_PHY_INTERRUPTS + case SIOCMIINOTIFY: /* Set up for PHY event notifications */ { - /* Enable PHY link up/down interrupts */ + struct mii_iotcl_notify_s *req = (struct mii_iotcl_notify_s *)((uintptr_t)arg); - tiva_phy_intenable(true); + ret = phy_notify_subscribe(dev->d_ifname, req->pid, req->signo, req->arg); + if (ret == OK) + { + /* Enable PHY link up/down interrupts */ + + tiva_phy_intenable(true); + } } - } - break; + break; #endif - case SIOCGMIIPHY: /* Get MII PHY address */ - { - struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); - req->phy_id = CONFIG_TIVA_PHYADDR; - ret = OK; - } - break; + case SIOCGMIIPHY: /* Get MII PHY address */ + { + struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); + req->phy_id = CONFIG_TIVA_PHYADDR; + ret = OK; + } + break; - case SIOCGMIIREG: /* Get register from MII PHY */ - { - struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); - ret = tiva_phyread(req->phy_id, req->reg_num, &req->val_out); - } - break; + case SIOCGMIIREG: /* Get register from MII PHY */ + { + struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); + ret = tiva_phyread(req->phy_id, req->reg_num, &req->val_out); + } + break; - case SIOCSMIIREG: /* Set register in MII PHY */ - { - struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); - ret = tiva_phywrite(req->phy_id, req->reg_num, req->val_in); - } - break; + case SIOCSMIIREG: /* Set register in MII PHY */ + { + struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); + ret = tiva_phywrite(req->phy_id, req->reg_num, req->val_in); + } + break; +#endif /* CONFIG_NETDEV_PHY_IOCTL */ - default: - ret = -ENOTTY; - break; - } + default: + ret = -ENOTTY; + break; + } return ret; } -#endif /* CONFIG_NETDEV_PHY_IOCTL */ +#endif /* CONFIG_NETDEV_IOCTL */ /**************************************************************************** * Function: tiva_phy_intenable @@ -4040,7 +4042,7 @@ int tiva_ethinitialize(int intf) priv->dev.d_addmac = tiva_addmac; /* Add multicast MAC address */ priv->dev.d_rmmac = tiva_rmmac; /* Remove multicast MAC address */ #endif -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL priv->dev.d_ioctl = tiva_ioctl; /* Support PHY ioctl() calls */ #endif priv->dev.d_private = (void *)g_tiva_ethmac; /* Used to recover private state from dev */ diff --git a/arch/hc/src/m9s12/m9s12_ethernet.c b/arch/hc/src/m9s12/m9s12_ethernet.c index 3b3fcf0d74..a56a267c91 100644 --- a/arch/hc/src/m9s12/m9s12_ethernet.c +++ b/arch/hc/src/m9s12/m9s12_ethernet.c @@ -772,7 +772,7 @@ int emac_initialize(int intf) #endif priv->d_dev.d_private = (void*)g_emac; /* Used to recover private state from dev */ - /* Create a watchdog for timing polling for and timing of transmisstions */ + /* Create a watchdog for timing polling for and timing of transmissions */ priv->d_txpoll = wd_create(); /* Create periodic poll timer */ priv->d_txtimeout = wd_create(); /* Create TX timeout timer */ diff --git a/arch/mips/src/pic32mx/pic32mx-ethernet.c b/arch/mips/src/pic32mx/pic32mx-ethernet.c index f436b298b6..d772a8ba14 100644 --- a/arch/mips/src/pic32mx/pic32mx-ethernet.c +++ b/arch/mips/src/pic32mx/pic32mx-ethernet.c @@ -3348,7 +3348,7 @@ static inline int pic32mx_ethinitialize(int intf) priv->pd_irqsrc = ??; /* Ethernet controller IRQ source number */ #endif - /* Create a watchdog for timing polling for and timing of transmisstions */ + /* Create a watchdog for timing polling for and timing of transmissions */ priv->pd_txpoll = wd_create(); /* Create periodic poll timer */ priv->pd_txtimeout = wd_create(); /* Create TX timeout timer */ diff --git a/arch/mips/src/pic32mz/pic32mz-ethernet.c b/arch/mips/src/pic32mz/pic32mz-ethernet.c index 5e1b2f5e04..046b2861e9 100644 --- a/arch/mips/src/pic32mz/pic32mz-ethernet.c +++ b/arch/mips/src/pic32mz/pic32mz-ethernet.c @@ -3384,7 +3384,7 @@ static inline int pic32mz_ethinitialize(int intf) priv->pd_irqsrc = ??; /* Ethernet controller IRQ source number */ #endif - /* Create a watchdog for timing polling for and timing of transmisstions */ + /* Create a watchdog for timing polling for and timing of transmissions */ priv->pd_txpoll = wd_create(); /* Create periodic poll timer */ priv->pd_txtimeout = wd_create(); /* Create TX timeout timer */ diff --git a/arch/misoc/src/common/misoc_net.c b/arch/misoc/src/common/misoc_net.c index a7df365435..595cbbbcff 100644 --- a/arch/misoc/src/common/misoc_net.c +++ b/arch/misoc/src/common/misoc_net.c @@ -1172,7 +1172,7 @@ int misoc_net_initialize(int intf) #endif priv->misoc_net_dev.d_private = (FAR void *)g_misoc_net; /* Used to recover private state from dev */ - /* Create a watchdog for timing polling for and timing of transmisstions */ + /* Create a watchdog for timing polling for and timing of transmissions */ priv->misoc_net_txpoll = wd_create(); /* Create periodic poll timer */ priv->misoc_net_txtimeout = wd_create(); /* Create TX timeout timer */ diff --git a/arch/z80/src/ez80/ez80_emac.c b/arch/z80/src/ez80/ez80_emac.c index 55896c08ff..7ef110f811 100644 --- a/arch/z80/src/ez80/ez80_emac.c +++ b/arch/z80/src/ez80/ez80_emac.c @@ -2537,7 +2537,7 @@ int up_netinitialize(void) #endif priv->dev.d_private = (FAR void*)&g_emac; /* Used to recover private state from dev */ - /* Create a watchdog for timing polling for and timing of transmisstions */ + /* Create a watchdog for timing polling for and timing of transmissions */ priv->txpoll = wd_create(); /* Create periodic poll timer */ priv->txtimeout = wd_create(); /* Create TX timeout timer */ diff --git a/drivers/net/dm90x0.c b/drivers/net/dm90x0.c index b6cfa6dfb7..c55c222a99 100644 --- a/drivers/net/dm90x0.c +++ b/drivers/net/dm90x0.c @@ -1948,7 +1948,7 @@ int dm9x_initialize(void) #endif g_dm9x[0].dm_dev.d_private = (FAR void *)g_dm9x; /* Used to recover private state from dev */ - /* Create a watchdog for timing polling for and timing of transmisstions */ + /* Create a watchdog for timing polling for and timing of transmissions */ g_dm9x[0].dm_txpoll = wd_create(); /* Create periodic poll timer */ g_dm9x[0].dm_txtimeout = wd_create(); /* Create TX timeout timer */ diff --git a/drivers/net/enc28j60.c b/drivers/net/enc28j60.c index 23c4c77067..9c45d4b115 100644 --- a/drivers/net/enc28j60.c +++ b/drivers/net/enc28j60.c @@ -2632,7 +2632,7 @@ int enc_initialize(FAR struct spi_dev_s *spi, #endif priv->dev.d_private = priv; /* Used to recover private state from dev */ - /* Create a watchdog for timing polling for and timing of transmisstions */ + /* Create a watchdog for timing polling for and timing of transmissions */ priv->txpoll = wd_create(); /* Create periodic poll timer */ priv->txtimeout = wd_create(); /* Create TX timeout timer */ diff --git a/drivers/net/encx24j600.c b/drivers/net/encx24j600.c index 5c2b590e2e..31732a0b68 100644 --- a/drivers/net/encx24j600.c +++ b/drivers/net/encx24j600.c @@ -2815,7 +2815,7 @@ int enc_initialize(FAR struct spi_dev_s *spi, #endif priv->dev.d_private = priv; /* Used to recover private state from dev */ - /* Create a watchdog for timing polling for and timing of transmisstions */ + /* Create a watchdog for timing polling for and timing of transmissions */ priv->txpoll = wd_create(); /* Create periodic poll timer */ priv->txtimeout = wd_create(); /* Create TX timeout timer */ diff --git a/drivers/net/ftmac100.c b/drivers/net/ftmac100.c index 9acc93d643..cb7749706f 100644 --- a/drivers/net/ftmac100.c +++ b/drivers/net/ftmac100.c @@ -1554,7 +1554,7 @@ int ftmac100_initialize(int intf) #endif priv->ft_dev.d_private = (FAR void *)g_ftmac100; /* Used to recover private state from dev */ - /* Create a watchdog for timing polling for and timing of transmisstions */ + /* Create a watchdog for timing polling for and timing of transmissions */ priv->ft_txpoll = wd_create(); /* Create periodic poll timer */ priv->ft_txtimeout = wd_create(); /* Create TX timeout timer */ diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 6c5beeba5e..f397f847df 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -891,7 +891,7 @@ static int tun_dev_init(FAR struct tun_device_s *priv, FAR struct file *filep, nxsem_setprotocol(&priv->read_wait_sem, SEM_PRIO_NONE); - /* Create a watchdog for timing polling for and timing of transmisstions */ + /* Create a watchdog for timing polling for and timing of transmissions */ priv->txpoll = wd_create(); /* Create periodic poll timer */ diff --git a/drivers/wireless/ieee802154/xbee/xbee_netdev.c b/drivers/wireless/ieee802154/xbee/xbee_netdev.c index d408d21ec3..1c0c682057 100644 --- a/drivers/wireless/ieee802154/xbee/xbee_netdev.c +++ b/drivers/wireless/ieee802154/xbee/xbee_netdev.c @@ -1392,7 +1392,7 @@ int xbee_netdev_register(XBEEHANDLE xbee) #endif dev->d_private = (FAR void *)priv; /* Used to recover private state from dev */ - /* Create a watchdog for timing polling for and timing of transmisstions */ + /* Create a watchdog for timing polling for and timing of transmissions */ priv->xd_mac = xbee; /* Save the MAC interface instance */ priv->xd_txpoll = wd_create(); /* Create periodic poll timer */ diff --git a/drivers/wireless/spirit/drivers/spirit_netdev.c b/drivers/wireless/spirit/drivers/spirit_netdev.c index 9e9b0655c0..e951f3fe0a 100644 --- a/drivers/wireless/spirit/drivers/spirit_netdev.c +++ b/drivers/wireless/spirit/drivers/spirit_netdev.c @@ -2812,7 +2812,7 @@ int spirit_netdev_initialize(FAR struct spi_dev_s *spi, priv->lower = lower; - /* Create a watchdog for timing polling for and timing of transmisstions */ + /* Create a watchdog for timing polling for and timing of transmissions */ priv->txpoll = wd_create(); /* Create periodic poll timer */ priv->txtimeout = wd_create(); /* Create TX timeout timer */ diff --git a/wireless/ieee802154/mac802154_netdev.c b/wireless/ieee802154/mac802154_netdev.c index 953c37f26d..aa4abe8ab2 100644 --- a/wireless/ieee802154/mac802154_netdev.c +++ b/wireless/ieee802154/mac802154_netdev.c @@ -1400,7 +1400,7 @@ int mac802154netdev_register(MACHANDLE mac) #endif dev->d_private = (FAR void *)priv; /* Used to recover private state from dev */ - /* Create a watchdog for timing polling for and timing of transmisstions */ + /* Create a watchdog for timing polling for and timing of transmissions */ priv->md_mac = mac; /* Save the MAC interface instance */ priv->md_txpoll = wd_create(); /* Create periodic poll timer */ -- GitLab From 12d7125b759b02f50d53bf806376a940e729a071 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 22 Jan 2018 11:11:23 -0600 Subject: [PATCH 058/228] net/tcp: Write buffering logic should not wait for a free buffer if the socket was opened non-blocking. Also, rename the TCP write buffering macros from WRB_* to TCPWB_* to make room in the namespace for write buffering with other protocols. --- TODO | 22 +++---- net/tcp/tcp.h | 37 ++++++------ net/tcp/tcp_send_buffered.c | 117 ++++++++++++++++++++---------------- net/tcp/tcp_wrbuffer_dump.c | 6 +- 4 files changed, 99 insertions(+), 83 deletions(-) diff --git a/TODO b/TODO index 4d46a3e5b0..dd4dca76ac 100644 --- a/TODO +++ b/TODO @@ -332,17 +332,17 @@ o Task/Scheduler (sched/) alternating between a high and a low priority. In either state, it may have its priority boosted. However, under some circumstances, it is impossible in the current design to - switch to the correct correct priority if a semaphore is - participating in priority inheritance: - - There is an when switching from the high to the low priority - state. If the priority was NOT boosted above the higher - priority, it still may still need to boosted with respect to - the lower priority. If the highest priority thread waiting - on a semaphore held by the sporadic thread is higher in - priority than the low priority but less than the higher - priority, then new thread priority should be set to that - middle priority, not to the lower priority + switch to the correct priority if a semaphore held by the + sporadic thread is participating in priority inheritance: + + There is an issue when switching from the high to the low + priority state. If the priority was NOT boosted above the + higher priority, it still may still need to boosted with + respect to the lower priority. If the highest priority + thread waiting on a semaphore held by the sporadic thread is + higher in priority than the low priority but less than the + higher priority, then new thread priority should be set to + that middle priority, not to the lower priority. In order to do this we would need to know the highest priority from among all tasks waiting for the all semaphores diff --git a/net/tcp/tcp.h b/net/tcp/tcp.h index 91e13ffe7b..bf8948da73 100644 --- a/net/tcp/tcp.h +++ b/net/tcp/tcp.h @@ -1,7 +1,7 @@ /**************************************************************************** * net/tcp/tcp.h * - * Copyright (C) 2014-2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2014-2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -77,23 +77,26 @@ #ifdef CONFIG_NET_TCP_WRITE_BUFFERS /* TCP write buffer access macros */ -# define WRB_SEQNO(wrb) ((wrb)->wb_seqno) -# define WRB_PKTLEN(wrb) ((wrb)->wb_iob->io_pktlen) -# define WRB_SENT(wrb) ((wrb)->wb_sent) -# define WRB_NRTX(wrb) ((wrb)->wb_nrtx) -# define WRB_IOB(wrb) ((wrb)->wb_iob) -# define WRB_COPYOUT(wrb,dest,n) (iob_copyout(dest,(wrb)->wb_iob,(n),0)) -# define WRB_COPYIN(wrb,src,n) (iob_copyin((wrb)->wb_iob,src,(n),0,false)) +# define TCPWB_SEQNO(wrb) ((wrb)->wb_seqno) +# define TCPWB_PKTLEN(wrb) ((wrb)->wb_iob->io_pktlen) +# define TCPWB_SENT(wrb) ((wrb)->wb_sent) +# define TCPWB_NRTX(wrb) ((wrb)->wb_nrtx) +# define TCPWB_IOB(wrb) ((wrb)->wb_iob) +# define TCPWB_COPYOUT(wrb,dest,n) (iob_copyout(dest,(wrb)->wb_iob,(n),0)) +# define TCPWB_COPYIN(wrb,src,n) \ + (iob_copyin((wrb)->wb_iob,src,(n),0,false)) +# define TCPWB_TRYCOPYIN(wrb,src,n) \ + (iob_trycopyin((wrb)->wb_iob,src,(n),0,false)) -# define WRB_TRIM(wrb,n) \ - do { (wrb)->wb_iob = iob_trimhead((wrb)->wb_iob,(n)); } while (0) +# define TCPWB_TRIM(wrb,n) \ + do { (wrb)->wb_iob = iob_trimhead((wrb)->wb_iob,(n)); } while (0) #ifdef CONFIG_DEBUG_FEATURES -# define WRB_DUMP(msg,wrb,len,offset) \ +# define TCPWB_DUMP(msg,wrb,len,offset) \ tcp_wrbuffer_dump(msg,wrb,len,offset) -#else -# define WRB_DUMP(msg,wrb,len,offset) -#endif +# else +# define TCPWB_DUMP(msg,wrb,len,offset) +# endif #endif /**************************************************************************** @@ -438,7 +441,7 @@ int tcp_local_ipv6_device(FAR struct tcp_conn_s *conn); * * Description: * Select the network driver to use with the IPv6 TCP transaction based - * on the remotely conected IPv6 address + * on the remotely connected IPv6 address * * Input Parameters: * conn - TCP connection structure. The remotely connected address, raddr, @@ -558,7 +561,7 @@ int tcp_start_monitor(FAR struct socket *psock); * * Description: * Stop monitoring TCP connection changes for a sockets associated with - * a given TCP connection stucture. + * a given TCP connection structure. * * Input Parameters: * conn - The TCP connection of interest @@ -1282,7 +1285,7 @@ ssize_t psock_tcp_send(FAR struct socket *psock, FAR const void *buf, * * Returned Value: * OK - * At least one byte of data could be succesfully written. + * At least one byte of data could be successfully written. * -EWOULDBLOCK * There is no room in the output buffer. * -EBADF diff --git a/net/tcp/tcp_send_buffered.c b/net/tcp/tcp_send_buffered.c index df54f338c3..5abb417e70 100644 --- a/net/tcp/tcp_send_buffered.c +++ b/net/tcp/tcp_send_buffered.c @@ -1,7 +1,7 @@ /**************************************************************************** * net/tcp/tcp_send_buffered.c * - * Copyright (C) 2007-2014, 2016-2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2014, 2016-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * Jason Jiang * @@ -98,8 +98,8 @@ # define BUF_DUMP(msg,buf,len) lib_dumpbuffer(msg,buf,len) #else # define BUF_DUMP(msg,buf,len) -# undef WRB_DUMP -# define WRB_DUMP(msg,wrb,len,offset) +# undef TCPWB_DUMP +# define TCPWB_DUMP(msg,wrb,len,offset) #endif /**************************************************************************** @@ -135,7 +135,7 @@ static void psock_insert_segment(FAR struct tcp_wrbuffer_s *wrb, for (itr = sq_peek(q); itr; itr = sq_next(itr)) { FAR struct tcp_wrbuffer_s *wrb0 = (FAR struct tcp_wrbuffer_s *)itr; - if (WRB_SEQNO(wrb0) < WRB_SEQNO(wrb)) + if (TCPWB_SEQNO(wrb0) < TCPWB_SEQNO(wrb)) { insert = itr; } @@ -417,13 +417,14 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, * the write buffer has been ACKed. */ - if (ackno > WRB_SEQNO(wrb)) + if (ackno > TCPWB_SEQNO(wrb)) { /* Get the sequence number at the end of the data */ - lastseq = WRB_SEQNO(wrb) + WRB_PKTLEN(wrb); + lastseq = TCPWB_SEQNO(wrb) + TCPWB_PKTLEN(wrb); ninfo("ACK: wrb=%p seqno=%u lastseq=%u pktlen=%u ackno=%u\n", - wrb, WRB_SEQNO(wrb), lastseq, WRB_PKTLEN(wrb), ackno); + wrb, TCPWB_SEQNO(wrb), lastseq, TCPWB_PKTLEN(wrb), + ackno); /* Has the entire buffer been ACKed? */ @@ -449,24 +450,24 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, * buffers in the chain. */ - trimlen = ackno - WRB_SEQNO(wrb); - if (trimlen > WRB_SENT(wrb)) + trimlen = ackno - TCPWB_SEQNO(wrb); + if (trimlen > TCPWB_SENT(wrb)) { /* More data has been ACKed then we have sent? */ - trimlen = WRB_SENT(wrb); + trimlen = TCPWB_SENT(wrb); } ninfo("ACK: wrb=%p trim %u bytes\n", wrb, trimlen); - WRB_TRIM(wrb, trimlen); - WRB_SEQNO(wrb) = ackno; - WRB_SENT(wrb) -= trimlen; + TCPWB_TRIM(wrb, trimlen); + TCPWB_SEQNO(wrb) = ackno; + TCPWB_SENT(wrb) -= trimlen; /* Set the new sequence number for what remains */ ninfo("ACK: wrb=%p seqno=%u pktlen=%u\n", - wrb, WRB_SEQNO(wrb), WRB_PKTLEN(wrb)); + wrb, TCPWB_SEQNO(wrb), TCPWB_PKTLEN(wrb)); } } } @@ -477,31 +478,31 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, */ wrb = (FAR struct tcp_wrbuffer_s *)sq_peek(&conn->write_q); - if (wrb && WRB_SENT(wrb) > 0 && ackno > WRB_SEQNO(wrb)) + if (wrb && TCPWB_SENT(wrb) > 0 && ackno > TCPWB_SEQNO(wrb)) { uint32_t nacked; /* Number of bytes that were ACKed */ - nacked = ackno - WRB_SEQNO(wrb); - if (nacked > WRB_SENT(wrb)) + nacked = ackno - TCPWB_SEQNO(wrb); + if (nacked > TCPWB_SENT(wrb)) { /* More data has been ACKed then we have sent? ASSERT? */ - nacked = WRB_SENT(wrb); + nacked = TCPWB_SENT(wrb); } ninfo("ACK: wrb=%p seqno=%u nacked=%u sent=%u ackno=%u\n", - wrb, WRB_SEQNO(wrb), nacked, WRB_SENT(wrb), ackno); + wrb, TCPWB_SEQNO(wrb), nacked, TCPWB_SENT(wrb), ackno); /* Trim the ACKed bytes from the beginning of the write buffer. */ - WRB_TRIM(wrb, nacked); - WRB_SEQNO(wrb) = ackno; - WRB_SENT(wrb) -= nacked; + TCPWB_TRIM(wrb, nacked); + TCPWB_SEQNO(wrb) = ackno; + TCPWB_SENT(wrb) -= nacked; ninfo("ACK: wrb=%p seqno=%u pktlen=%u sent=%u\n", - wrb, WRB_SEQNO(wrb), WRB_PKTLEN(wrb), WRB_SENT(wrb)); + wrb, TCPWB_SEQNO(wrb), TCPWB_PKTLEN(wrb), TCPWB_SENT(wrb)); } } @@ -543,16 +544,16 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, */ wrb = (FAR struct tcp_wrbuffer_s *)sq_peek(&conn->write_q); - ninfo("REXMIT: wrb=%p sent=%u\n", wrb, wrb ? WRB_SENT(wrb) : 0); + ninfo("REXMIT: wrb=%p sent=%u\n", wrb, wrb ? TCPWB_SENT(wrb) : 0); - if (wrb != NULL && WRB_SENT(wrb) > 0) + if (wrb != NULL && TCPWB_SENT(wrb) > 0) { FAR struct tcp_wrbuffer_s *tmp; uint16_t sent; /* Yes.. Reset the number of bytes sent sent from the write buffer */ - sent = WRB_SENT(wrb); + sent = TCPWB_SENT(wrb); if (conn->unacked > sent) { conn->unacked -= sent; @@ -571,16 +572,16 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, conn->sent = 0; } - WRB_SENT(wrb) = 0; + TCPWB_SENT(wrb) = 0; ninfo("REXMIT: wrb=%p sent=%u, conn unacked=%d sent=%d\n", - wrb, WRB_SENT(wrb), conn->unacked, conn->sent); + wrb, TCPWB_SENT(wrb), conn->unacked, conn->sent); /* Increment the retransmit count on this write buffer. */ - if (++WRB_NRTX(wrb) >= TCP_MAXRTX) + if (++TCPWB_NRTX(wrb) >= TCP_MAXRTX) { nwarn("WARNING: Expiring wrb=%p nrtx=%u\n", - wrb, WRB_NRTX(wrb)); + wrb, TCPWB_NRTX(wrb)); /* The maximum retry count as been exhausted. Remove the write * buffer at the head of the queue. @@ -618,7 +619,7 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, /* Reset the number of bytes sent sent from the write buffer */ - sent = WRB_SENT(wrb); + sent = TCPWB_SENT(wrb); if (conn->unacked > sent) { conn->unacked -= sent; @@ -637,16 +638,16 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, conn->sent = 0; } - WRB_SENT(wrb) = 0; + TCPWB_SENT(wrb) = 0; ninfo("REXMIT: wrb=%p sent=%u, conn unacked=%d sent=%d\n", - wrb, WRB_SENT(wrb), conn->unacked, conn->sent); + wrb, TCPWB_SENT(wrb), conn->unacked, conn->sent); /* Free any write buffers that have exceed the retry count */ - if (++WRB_NRTX(wrb) >= TCP_MAXRTX) + if (++TCPWB_NRTX(wrb) >= TCP_MAXRTX) { nwarn("WARNING: Expiring wrb=%p nrtx=%u\n", - wrb, WRB_NRTX(wrb)); + wrb, TCPWB_NRTX(wrb)); /* Return the write buffer to the free list */ @@ -671,7 +672,7 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, * is pulled from the write_q again. */ - ninfo("REXMIT: Moving wrb=%p nrtx=%u\n", wrb, WRB_NRTX(wrb)); + ninfo("REXMIT: Moving wrb=%p nrtx=%u\n", wrb, TCPWB_NRTX(wrb)); psock_insert_segment(wrb, &conn->write_q); } @@ -726,7 +727,7 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, * window size. */ - sndlen = WRB_PKTLEN(wrb) - WRB_SENT(wrb); + sndlen = TCPWB_PKTLEN(wrb) - TCPWB_SENT(wrb); if (sndlen > conn->mss) { sndlen = conn->mss; @@ -738,16 +739,16 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, } ninfo("SEND: wrb=%p pktlen=%u sent=%u sndlen=%u\n", - wrb, WRB_PKTLEN(wrb), WRB_SENT(wrb), sndlen); + wrb, TCPWB_PKTLEN(wrb), TCPWB_SENT(wrb), sndlen); /* Set the sequence number for this segment. If we are * retransmitting, then the sequence number will already * be set for this write buffer. */ - if (WRB_SEQNO(wrb) == (unsigned)-1) + if (TCPWB_SEQNO(wrb) == (unsigned)-1) { - WRB_SEQNO(wrb) = conn->isn + conn->sent; + TCPWB_SEQNO(wrb) = conn->isn + conn->sent; } /* The TCP stack updates sndseq on receipt of ACK *before* @@ -757,7 +758,7 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, * before the packet is sent. */ - tcp_setsequence(conn->sndseq, WRB_SEQNO(wrb) + WRB_SENT(wrb)); + tcp_setsequence(conn->sndseq, TCPWB_SEQNO(wrb) + TCPWB_SENT(wrb)); #ifdef NEED_IPDOMAIN_SUPPORT /* If both IPv4 and IPv6 support are enabled, then we will need to @@ -773,7 +774,7 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, * won't actually happen until the polling cycle completes). */ - devif_iob_send(dev, WRB_IOB(wrb), sndlen, WRB_SENT(wrb)); + devif_iob_send(dev, TCPWB_IOB(wrb), sndlen, TCPWB_SENT(wrb)); /* Remember how much data we send out now so that we know * when everything has been acknowledged. Just increment @@ -795,21 +796,21 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, } ninfo("SEND: wrb=%p nrtx=%u unacked=%u sent=%u\n", - wrb, WRB_NRTX(wrb), conn->unacked, conn->sent); + wrb, TCPWB_NRTX(wrb), conn->unacked, conn->sent); /* Increment the count of bytes sent from this write buffer */ - WRB_SENT(wrb) += sndlen; + TCPWB_SENT(wrb) += sndlen; ninfo("SEND: wrb=%p sent=%u pktlen=%u\n", - wrb, WRB_SENT(wrb), WRB_PKTLEN(wrb)); + wrb, TCPWB_SENT(wrb), TCPWB_PKTLEN(wrb)); /* Remove the write buffer from the write queue if the * last of the data has been sent from the buffer. */ - DEBUGASSERT(WRB_SENT(wrb) <= WRB_PKTLEN(wrb)); - if (WRB_SENT(wrb) >= WRB_PKTLEN(wrb)) + DEBUGASSERT(TCPWB_SENT(wrb) <= TCPWB_PKTLEN(wrb)); + if (TCPWB_SENT(wrb) >= TCPWB_PKTLEN(wrb)) { FAR struct tcp_wrbuffer_s *tmp; @@ -1060,13 +1061,25 @@ ssize_t psock_tcp_send(FAR struct socket *psock, FAR const void *buf, /* Initialize the write buffer */ - WRB_SEQNO(wrb) = (unsigned)-1; - WRB_NRTX(wrb) = 0; - result = WRB_COPYIN(wrb, (FAR uint8_t *)buf, len); + TCPWB_SEQNO(wrb) = (unsigned)-1; + TCPWB_NRTX(wrb) = 0; + + /* Copy the user data into the write buffer. We cannot wait for + * buffer space if the socket was opened non-blocking. + */ + + if (_SS_ISNONBLOCK(psock->s_flags)) + { + result = TCPWB_TRYCOPYIN(wrb, (FAR uint8_t *)buf, len); + } + else + { + result = TCPWB_COPYIN(wrb, (FAR uint8_t *)buf, len); + } /* Dump I/O buffer chain */ - WRB_DUMP("I/O buffer chain", wrb, WRB_PKTLEN(wrb), 0); + TCPWB_DUMP("I/O buffer chain", wrb, TCPWB_PKTLEN(wrb), 0); /* psock_send_eventhandler() will send data in FIFO order from the * conn->write_q @@ -1074,7 +1087,7 @@ ssize_t psock_tcp_send(FAR struct socket *psock, FAR const void *buf, sq_addlast(&wrb->wb_node, &conn->write_q); ninfo("Queued WRB=%p pktlen=%u write_q(%p,%p)\n", - wrb, WRB_PKTLEN(wrb), + wrb, TCPWB_PKTLEN(wrb), conn->write_q.head, conn->write_q.tail); /* Notify the device driver of the availability of TX data */ diff --git a/net/tcp/tcp_wrbuffer_dump.c b/net/tcp/tcp_wrbuffer_dump.c index ad92bfb904..a27bb60253 100644 --- a/net/tcp/tcp_wrbuffer_dump.c +++ b/net/tcp/tcp_wrbuffer_dump.c @@ -1,7 +1,7 @@ /**************************************************************************** * net/tcp/tcp_wrbuffer_dump.c * - * Copyright (C) 2014 Gregory Nutt. All rights reserved. + * Copyright (C) 2014, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -64,8 +64,8 @@ void tcp_wrbuffer_dump(FAR const char *msg, FAR struct tcp_wrbuffer_s *wrb, unsigned int len, unsigned int offset) { syslog(LOG_DEBUG, "%s: wrb=%p segno=%d sent=%d nrtx=%d\n", - msg, wrb, WRB_SEQNO(wrb), WRB_SENT(wrb), WRB_NRTX(wrb)); - iob_dump("I/O Buffer Chain", WRB_IOB(wrb), len, offset); + msg, wrb, TCPWB_SEQNO(wrb), TCPWB_SENT(wrb), TCPWB_NRTX(wrb)); + iob_dump("I/O Buffer Chain", TCPWB_IOB(wrb), len, offset); } #endif /* CONFIG_DEBUG_FEATURES */ -- GitLab From 0406fff8883097c7490eadc4ee56080882cea9bd Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 22 Jan 2018 14:14:32 -0600 Subject: [PATCH 059/228] net/udp: Remove some conditional logic that was true if there is only a single network device, but not true in the multi-device context. --- net/udp/udp_psock_sendto.c | 36 ++++++++---------------------------- 1 file changed, 8 insertions(+), 28 deletions(-) diff --git a/net/udp/udp_psock_sendto.c b/net/udp/udp_psock_sendto.c index 4710fb36d6..ff362a310e 100644 --- a/net/udp/udp_psock_sendto.c +++ b/net/udp/udp_psock_sendto.c @@ -70,36 +70,16 @@ # define NEED_IPDOMAIN_SUPPORT 1 #endif -/* Timeouts on sendto() do not make sense. Each polling cycle from the - * driver is an opportunity to send a packet. If the driver is not polling, - * then the network is not up (and there are no polling cycles to drive - * the timeout). - * - * There is a remote possibility that if there is a lot of other network - * traffic that a UDP sendto could get delayed, but I would not expect this - * generate a timeout. - */ - -#undef CONFIG_NET_SENDTO_TIMEOUT - -/* If supported, the sendto timeout function would depend on socket options - * and a system clock. - */ - -#ifndef CONFIG_NET_SOCKOPTS -# undef CONFIG_NET_SENDTO_TIMEOUT -#endif - /**************************************************************************** * Private Types ****************************************************************************/ struct sendto_s { -#if defined(CONFIG_NET_SENDTO_TIMEOUT) || defined(NEED_IPDOMAIN_SUPPORT) +#if defined(CONFIG_NET_SOCKOPTS) || defined(NEED_IPDOMAIN_SUPPORT) FAR struct socket *st_sock; /* Points to the parent socket structure */ #endif -#ifdef CONFIG_NET_SENDTO_TIMEOUT +#ifdef CONFIG_NET_SOCKOPTS systime_t st_time; /* Last send time for determining timeout */ #endif FAR struct devif_callback_s *st_cb; /* Reference to callback instance */ @@ -130,7 +110,7 @@ struct sendto_s * ****************************************************************************/ -#ifdef CONFIG_NET_SENDTO_TIMEOUT +#ifdef CONFIG_NET_SOCKOPTS static inline int send_timeout(FAR struct sendto_s *pstate) { FAR struct socket *psock; @@ -151,7 +131,7 @@ static inline int send_timeout(FAR struct sendto_s *pstate) return FALSE; } -#endif /* CONFIG_NET_SENDTO_TIMEOUT */ +#endif /* CONFIG_NET_SOCKOPTS */ /**************************************************************************** * Name: sendto_ipselect @@ -254,7 +234,7 @@ static uint16_t sendto_eventhandler(FAR struct net_driver_s *dev, * polling cycle and check again. */ -#ifdef CONFIG_NET_SENDTO_TIMEOUT +#ifdef CONFIG_NET_SOCKOPTS if (send_timeout(pstate)) { /* Yes.. report the timeout */ @@ -263,7 +243,7 @@ static uint16_t sendto_eventhandler(FAR struct net_driver_s *dev, pstate->st_sndlen = -ETIMEDOUT; } else -#endif /* CONFIG_NET_SENDTO_TIMEOUT */ +#endif /* CONFIG_NET_SOCKOPTS */ { /* No timeout. Just wait for the next polling cycle */ @@ -403,7 +383,7 @@ ssize_t psock_udp_sendto(FAR struct socket *psock, FAR const void *buf, state.st_buflen = len; state.st_buffer = buf; -#if defined(CONFIG_NET_SENDTO_TIMEOUT) || defined(NEED_IPDOMAIN_SUPPORT) +#if defined(CONFIG_NET_SOCKOPTS) || defined(NEED_IPDOMAIN_SUPPORT) /* Save the reference to the socket structure if it will be needed for * asynchronous processing. */ @@ -411,7 +391,7 @@ ssize_t psock_udp_sendto(FAR struct socket *psock, FAR const void *buf, state.st_sock = psock; #endif -#ifdef CONFIG_NET_SENDTO_TIMEOUT +#ifdef CONFIG_NET_SOCKOPTS /* Set the initial time for calculating timeouts */ state.st_time = clock_systimer(); -- GitLab From fef255e5be8f2956c8abb99f00aa076668336b66 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 22 Jan 2018 18:32:02 -0600 Subject: [PATCH 060/228] This commit adds an as-of-yet untested implemented of UDP write buffering. Squashed commit of the following: net/udp: Address most of the issues with UDP write buffering. There is a remaining issue with handling one network going down in a multi-network environment. None of this has been test but it is certainly ready for test. Hence, the feature is marked EXPERIMENTAL. net/udp: Some baby steps toward a corrected write buffering design. net/udp: Remove pesky write buffer macros. Eliminate trailing space at the end of lines. net/udp: A little more UDP write buffering logic. Still at least on big gaping hole in the design. net/udp: Undefined CONFIG_NET_SENDTO_TIMEOUT. net/udp: Crude, naive port of the TCP write buffering logic into UDP. This commit is certainly non-functional and is simply a starting point for the implementatin of UDP write buffering. net/udp: Rename udp/udp_psock_sendto.c udp/udp_psock_sendto_unbuffered.c. --- include/nuttx/net/net.h | 4 +- mm/iob/Kconfig | 14 +- net/Kconfig | 8 + net/inet/inet_sockif.c | 2 +- net/net_initialize.c | 4 + net/socket/socket.c | 2 +- net/tcp/Kconfig | 4 +- net/udp/Kconfig | 50 ++ net/udp/Make.defs | 19 +- net/udp/udp.h | 129 ++- net/udp/udp_conn.c | 21 +- net/udp/udp_psock_sendto_buffered.c | 821 ++++++++++++++++++ ...sendto.c => udp_psock_sendto_unbuffered.c} | 11 +- net/udp/udp_wrbuffer.c | 217 +++++ net/udp/udp_wrbuffer_dump.c | 70 ++ 15 files changed, 1354 insertions(+), 22 deletions(-) create mode 100644 net/udp/udp_psock_sendto_buffered.c rename net/udp/{udp_psock_sendto.c => udp_psock_sendto_unbuffered.c} (98%) create mode 100644 net/udp/udp_wrbuffer.c create mode 100644 net/udp/udp_wrbuffer_dump.c diff --git a/include/nuttx/net/net.h b/include/nuttx/net/net.h index fb4de5c473..9e1eec09db 100644 --- a/include/nuttx/net/net.h +++ b/include/nuttx/net/net.h @@ -208,8 +208,8 @@ struct socket FAR const struct sock_intf_s *s_sockif; -#ifdef CONFIG_NET_TCP_WRITE_BUFFERS - /* Callback instance for TCP send */ +#if defined(CONFIG_NET_TCP_WRITE_BUFFERS) || defined(CONFIG_NET_UDP_WRITE_BUFFERS) + /* Callback instance for TCP send() or UDP sendto() */ FAR struct devif_callback_s *s_sndcb; #endif diff --git a/mm/iob/Kconfig b/mm/iob/Kconfig index b64f90e3ce..62893db094 100644 --- a/mm/iob/Kconfig +++ b/mm/iob/Kconfig @@ -16,9 +16,9 @@ if MM_IOB config IOB_NBUFFERS int "Number of pre-allocated I/O buffers" - default 24 if (NET_TCP_WRITE_BUFFERS && !NET_TCP_READAHEAD) || (!NET_TCP_WRITE_BUFFERS && NET_TCP_READAHEAD) - default 36 if NET_TCP_WRITE_BUFFERS && NET_TCP_READAHEAD - default 8 if !NET_TCP_WRITE_BUFFERS && !NET_TCP_READAHEAD + default 24 if (NET_WRITE_BUFFERS && !NET_READAHEAD) || (!NET_WRITE_BUFFERS && NET_READAHEAD) + default 36 if NET_WRITE_BUFFERS && NET_READAHEAD + default 8 if !NET_WRITE_BUFFERS && !NET_READAHEAD ---help--- Each packet is represented by a series of small I/O buffers in a chain. This setting determines the number of preallocated I/O @@ -34,8 +34,8 @@ config IOB_BUFSIZE config IOB_NCHAINS int "Number of pre-allocated I/O buffer chain heads" - default 0 if !NET_TCP_READAHEAD && !NET_UDP_READAHEAD - default 8 if NET_TCP_READAHEAD || NET_UDP_READAHEAD + default 0 if !NET_READAHEAD && !NET_UDP_READAHEAD + default 8 if NET_READAHEAD || NET_UDP_READAHEAD ---help--- These tiny nodes are used as "containers" to support queueing of I/O buffer chains. This will limit the number of I/O transactions @@ -49,8 +49,8 @@ config IOB_NCHAINS config IOB_THROTTLE int "I/O buffer throttle value" - default 0 if !NET_TCP_WRITE_BUFFERS || !NET_TCP_READAHEAD - default 8 if NET_TCP_WRITE_BUFFERS && NET_TCP_READAHEAD + default 0 if !NET_WRITE_BUFFERS || !NET_READAHEAD + default 8 if NET_WRITE_BUFFERS && NET_READAHEAD ---help--- TCP write buffering and read-ahead buffer use the same pool of free I/O buffers. In order to prevent uncontrolled incoming TCP packets diff --git a/net/Kconfig b/net/Kconfig index 48163d26bf..3c4f969486 100644 --- a/net/Kconfig +++ b/net/Kconfig @@ -11,6 +11,14 @@ config ARCH_HAVE_PHY bool default n +config NET_WRITE_BUFFERS + bool + default n + +config NET_READAHEAD + bool + default n + config NET bool "Networking support" default n diff --git a/net/inet/inet_sockif.c b/net/inet/inet_sockif.c index 761a65bb1b..9ab4be7336 100644 --- a/net/inet/inet_sockif.c +++ b/net/inet/inet_sockif.c @@ -1146,7 +1146,7 @@ static ssize_t inet_sendto(FAR struct socket *psock, FAR const void *buf, #if defined(CONFIG_NET_6LOWPAN) /* Try 6LoWPAN UDP packet sendto() */ - nsent = psock_6lowpan_udp_sendto(psock, buf, len, flags, to, tolen); + nsent = psock_6lowpan_udp_sendto(psock, buf, len, flags, to, minlen); #ifdef NET_UDP_HAVE_STACK if (nsent < 0) diff --git a/net/net_initialize.c b/net/net_initialize.c index 4d0105acf7..0447f88dfc 100644 --- a/net/net_initialize.c +++ b/net/net_initialize.c @@ -172,6 +172,10 @@ void net_setup(void) /* Initialize the UDP connection structures */ udp_initialize(); + +#ifdef CONFIG_NET_UDP_WRITE_BUFFERS + udp_wrbuffer_initialize(); +#endif #endif #ifdef CONFIG_NET_IGMP diff --git a/net/socket/socket.c b/net/socket/socket.c index 539ef0b216..caaed28320 100644 --- a/net/socket/socket.c +++ b/net/socket/socket.c @@ -105,7 +105,7 @@ int psock_socket(int domain, int type, int protocol, FAR struct socket *psock) psock->s_domain = domain; psock->s_type = type; psock->s_conn = NULL; -#ifdef CONFIG_NET_TCP_WRITE_BUFFERS +#if defined(CONFIG_NET_TCP_WRITE_BUFFERS) || defined(CONFIG_NET_UDP_WRITE_BUFFERS) psock->s_sndcb = NULL; #endif diff --git a/net/tcp/Kconfig b/net/tcp/Kconfig index 77cebe81fb..c3647ae289 100644 --- a/net/tcp/Kconfig +++ b/net/tcp/Kconfig @@ -70,6 +70,7 @@ config NET_MAX_LISTENPORTS config NET_TCP_READAHEAD bool "Enable TCP/IP read-ahead buffering" default y + select NET_READAHEAD select MM_IOB ---help--- Read-ahead buffers allows buffering of TCP/IP packets when there is no @@ -91,6 +92,7 @@ endif # NET_TCP_READAHEAD config NET_TCP_WRITE_BUFFERS bool "Enable TCP/IP write buffering" default n + select NET_WRITE_BUFFERS select MM_IOB ---help--- Write buffers allows buffering of ongoing TCP/IP packets, providing @@ -105,7 +107,7 @@ config NET_TCP_NWRBCHAINS int "Number of pre-allocated I/O buffer chain heads" default 8 ---help--- - These tiny nodes are used as "containers" to support queueing of + These tiny nodes are used as "containers" to support queuing of TCP write buffers. This setting will limit the number of TCP write operations that can be "in-flight" at any give time. So a good choice for this value would be the same as the maximum number of diff --git a/net/udp/Kconfig b/net/udp/Kconfig index ba710b8629..16d40a72ef 100644 --- a/net/udp/Kconfig +++ b/net/udp/Kconfig @@ -44,7 +44,57 @@ config NET_BROADCAST config NET_UDP_READAHEAD bool "Enable UDP/IP read-ahead buffering" default y + select NET_READAHEAD select MM_IOB +config NET_UDP_WRITE_BUFFERS + bool "Enable UDP/IP write buffering" + default n + select NET_WRITE_BUFFERS + select MM_IOB + depends on EXPERIMENTAL + ---help--- + Write buffers allows buffering of ongoing UDP/IP packets, providing + for higher performance, streamed output. + + You might want to disable UDP/IP write buffering on a highly memory + memory constrained system where there are no performance issues. + +if NET_UDP_WRITE_BUFFERS + +config NET_UDP_NWRBCHAINS + int "Number of pre-allocated I/O buffer chain heads" + default 8 + ---help--- + These tiny nodes are used as "containers" to support queuing of + UDP write buffers. This setting will limit the number of UDP write + operations that can be "in-flight" at any give time. So a good + choice for this value would be the same as the maximum number of + UDP connections. + +config NET_UDP_WRBUFFER_DEBUG + bool "Force write buffer debug" + default n + depends on DEBUG_FEATURES + select IOB_DEBUG + ---help--- + This option will force debug output from UDP write buffer logic, + even without network debug output. This is not normally something + that would want to do but is convenient if you are debugging the + write buffer logic and do not want to get overloaded with other + network-related debug output. + +config NET_UDP_WRBUFFER_DUMP + bool "Force write buffer dump" + default n + depends on DEBUG_NET || NET_UDP_WRBUFFER_DEBUG + select IOB_DEBUG + ---help--- + Dump the contents of the write buffers. You do not want to do this + unless you really want to analyze the write buffer transfers in + detail. + +endif # NET_UDP_WRITE_BUFFERS + endif # NET_UDP && !NET_UDP_NO_STACK endmenu # UDP Networking diff --git a/net/udp/Make.defs b/net/udp/Make.defs index 4b3992911d..5c8918ea9a 100644 --- a/net/udp/Make.defs +++ b/net/udp/Make.defs @@ -1,7 +1,7 @@ ############################################################################ # net/udp/Make.defs # -# Copyright (C) 2014-2015 Gregory Nutt. All rights reserved. +# Copyright (C) 2014-2015, 2018 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -40,7 +40,13 @@ ifneq ($(CONFIG_NET_UDP_NO_STACK),y) # Socket layer -NET_CSRCS += udp_psock_send.c udp_psock_sendto.c +NET_CSRCS += udp_psock_send.c + +ifeq ($(CONFIG_NET_UDP_WRITE_BUFFERS),y) +SOCK_CSRCS += udp_psock_sendto_buffered.c +else +SOCK_CSRCS += udp_psock_sendto_unbuffered.c +endif ifneq ($(CONFIG_DISABLE_POLL),y) ifeq ($(CONFIG_NET_UDP_READAHEAD),y) @@ -53,6 +59,15 @@ endif NET_CSRCS += udp_conn.c udp_devpoll.c udp_send.c udp_input.c udp_finddev.c NET_CSRCS += udp_callback.c udp_ipselect.c +# UDP write buffering + +ifeq ($(CONFIG_NET_UDP_WRITE_BUFFERS),y) +NET_CSRCS += udp_wrbuffer.c +ifeq ($(CONFIG_DEBUG_FEATURES),y) +NET_CSRCS += udp_wrbuffer_dump.c +endif +endif + # Include UDP build support DEPPATH += --dep-path udp diff --git a/net/udp/udp.h b/net/udp/udp.h index cb6ca378f5..ee591ed078 100644 --- a/net/udp/udp.h +++ b/net/udp/udp.h @@ -1,7 +1,7 @@ /**************************************************************************** * net/udp/udp.h * - * Copyright (C) 2014-2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2014-2015, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -45,6 +45,7 @@ #include #include +#include #include #ifdef CONFIG_NET_UDP_READAHEAD @@ -66,6 +67,17 @@ # define HAVE_UDP_POLL #endif +#ifdef CONFIG_NET_UDP_WRITE_BUFFERS +/* UDP write buffer dump macros */ + +# ifdef CONFIG_DEBUG_FEATURES +# define UDPWB_DUMP(msg,wrb,len,offset) \ + udp_wrbuffer_dump(msg,wrb,len,offset) +# else +# define UDPWB_DUMP(msg,wrb,len,offset) +# endif +#endif + /* Allocate a new UDP data callback */ #define udp_callback_alloc(dev,conn) \ @@ -102,11 +114,38 @@ struct udp_conn_s struct iob_queue_s readahead; /* Read-ahead buffering */ #endif +#ifdef CONFIG_NET_TCP_WRITE_BUFFERS + /* Write buffering + * + * write_q - The queue of unsent I/O buffers. The head of this + * list may be partially sent. FIFO ordering. + */ + + sq_queue_t write_q; /* Write buffering for UDP packets */ + FAR struct net_driver_s *dev; /* Last device */ +#endif + /* Defines the list of UDP callbacks */ FAR struct devif_callback_s *list; }; +/* This structure supports UDP write buffering. It is simply a container + * for a IOB list and associated destination address. + */ + +#ifdef CONFIG_NET_UDP_WRITE_BUFFERS +struct udp_wrbuffer_s +{ + sq_entry_t wb_node; /* Supports a singly linked list */ + union ip_addr_u wb_dest; /* Destination address */ +#ifdef CONFIG_NET_SOCKOPTS + systime_t wb_start; /* Start time for timeout calculation */ +#endif + struct iob_s *wb_iob; /* Head of the I/O buffer chain */ +}; +#endif + /**************************************************************************** * Public Data ****************************************************************************/ @@ -291,6 +330,92 @@ void udp_poll(FAR struct net_driver_s *dev, FAR struct udp_conn_s *conn); void udp_send(FAR struct net_driver_s *dev, FAR struct udp_conn_s *conn); +/**************************************************************************** + * Name: udp_wrbuffer_initialize + * + * Description: + * Initialize the list of free write buffers + * + * Assumptions: + * Called once early initialization. + * + ****************************************************************************/ + +#ifdef CONFIG_NET_UDP_WRITE_BUFFERS +void udp_wrbuffer_initialize(void); +#endif /* CONFIG_NET_UDP_WRITE_BUFFERS */ + +/**************************************************************************** + * Name: udp_wrbuffer_alloc + * + * Description: + * Allocate a UDP write buffer by taking a pre-allocated buffer from + * the free list. This function is called from UDP logic when a buffer + * of UDP data is about to sent + * + * Input parameters: + * None + * + * Assumptions: + * Called from user logic with the network locked. + * + ****************************************************************************/ + +#ifdef CONFIG_NET_UDP_WRITE_BUFFERS +struct udp_wrbuffer_s; + +FAR struct udp_wrbuffer_s *udp_wrbuffer_alloc(void); +#endif /* CONFIG_NET_UDP_WRITE_BUFFERS */ + +/**************************************************************************** + * Name: udp_wrbuffer_release + * + * Description: + * Release a UDP write buffer by returning the buffer to the free list. + * This function is called from user logic after it is consumed the + * buffered data. + * + * Assumptions: + * Called from network stack logic with the network stack locked + * + ****************************************************************************/ + +#ifdef CONFIG_NET_UDP_WRITE_BUFFERS +void udp_wrbuffer_release(FAR struct udp_wrbuffer_s *wrb); +#endif /* CONFIG_NET_UDP_WRITE_BUFFERS */ + +/**************************************************************************** + * Name: udp_wrbuffer_test + * + * Description: + * Check if there is room in the write buffer. Does not reserve any space. + * + * Assumptions: + * None. + * + ****************************************************************************/ + +#ifdef CONFIG_NET_UDP_WRITE_BUFFERS +int udp_wrbuffer_test(void); +#endif /* CONFIG_NET_UDP_WRITE_BUFFERS */ + +/**************************************************************************** + * Name: udp_wrbuffer_dump + * + * Description: + * Dump the contents of a write buffer. + * + ****************************************************************************/ + +#ifdef CONFIG_NET_UDP_WRITE_BUFFERS +#ifdef CONFIG_DEBUG_FEATURES +void udp_wrbuffer_dump(FAR const char *msg, FAR struct udp_wrbuffer_s *wrb, + unsigned int len, unsigned int offset); +#else +# define udp_wrbuffer_dump(msg,wrb) +#endif +#endif /* CONFIG_NET_UDP_WRITE_BUFFERS */ + /**************************************************************************** * Name: udp_ipv4_input * @@ -495,7 +620,7 @@ int udp_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds); * Teardown monitoring of events on an UDP/IP socket * * Input Parameters: - * psock - The TCP/IP socket of interest + * psock - The UDP/IP socket of interest * fds - The structure describing the events to be monitored, OR NULL if * this is a request to stop monitoring events. * diff --git a/net/udp/udp_conn.c b/net/udp/udp_conn.c index 97037c444f..61e67028f6 100644 --- a/net/udp/udp_conn.c +++ b/net/udp/udp_conn.c @@ -1,7 +1,8 @@ /**************************************************************************** * net/udp/udp_conn.c * - * Copyright (C) 2007-2009, 2011-2012, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011-2012, 2016, 2018 Gregory Nutt. All rights + * reserved. * Author: Gregory Nutt * * Large parts of this file were leveraged from uIP logic: @@ -485,6 +486,11 @@ FAR struct udp_conn_s *udp_alloc(uint8_t domain) conn->lport = 0; conn->ttl = IP_TTL; +#ifdef CONFIG_NET_TCP_WRITE_BUFFERS + /* Initialize the write buffer lists */ + + sq_init(&conn->write_q); +#endif /* Enqueue the connection into the active list */ dq_addlast(&conn->node, &g_active_udp_connections); @@ -505,6 +511,10 @@ FAR struct udp_conn_s *udp_alloc(uint8_t domain) void udp_free(FAR struct udp_conn_s *conn) { +#ifdef CONFIG_NET_UDP_WRITE_BUFFERS + FAR struct udp_wrbuffer_s *wrbuffer; +#endif + /* The free list is protected by a semaphore (that behaves like a mutex). */ DEBUGASSERT(conn->crefs == 0); @@ -522,6 +532,15 @@ void udp_free(FAR struct udp_conn_s *conn) iob_free_queue(&conn->readahead); #endif +#ifdef CONFIG_NET_UDP_WRITE_BUFFERS + /* Release any write buffers attached to the connection */ + + while ((wrbuffer = (struct udp_wrbuffer_s *)sq_remfirst(&conn->write_q)) != NULL) + { + udp_wrbuffer_release(wrbuffer); + } +#endif + /* Free the connection */ dq_addlast(&conn->node, &g_free_udp_connections); diff --git a/net/udp/udp_psock_sendto_buffered.c b/net/udp/udp_psock_sendto_buffered.c new file mode 100644 index 0000000000..3f5e5305b4 --- /dev/null +++ b/net/udp/udp_psock_sendto_buffered.c @@ -0,0 +1,821 @@ +/**************************************************************************** + * net/udp/udp_send_buffered.c + * + * Copyright (C) 2018 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#if defined(CONFIG_NET) && defined(CONFIG_NET_UDP) && \ + defined(CONFIG_NET_UDP_WRITE_BUFFERS) + +#if defined(CONFIG_DEBUG_FEATURES) && defined(CONFIG_NET_UDP_WRBUFFER_DEBUG) +/* Force debug output (from this file only) */ + +# undef CONFIG_DEBUG_NET +# define CONFIG_DEBUG_NET 1 +#endif + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "netdev/netdev.h" +#include "socket/socket.h" +#include "inet/inet.h" +#include "arp/arp.h" +#include "icmpv6/icmpv6.h" +#include "neighbor/neighbor.h" +#include "udp/udp.h" +#include "devif/devif.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ +/* If both IPv4 and IPv6 support are both enabled, then we will need to build + * in some additional domain selection support. + */ + +#if defined(CONFIG_NET_IPv4) && defined(CONFIG_NET_IPv6) +# define NEED_IPDOMAIN_SUPPORT 1 +#endif + +#define UDPIPv4BUF ((struct udp_hdr_s *)&dev->d_buf[NET_LL_HDRLEN(dev) + IPv4_HDRLEN]) +#define UDPIPv6BUF ((struct udp_hdr_s *)&dev->d_buf[NET_LL_HDRLEN(dev) + IPv6_HDRLEN]) + +/* Debug */ + +#ifdef CONFIG_NET_UDP_WRBUFFER_DUMP +# define BUF_DUMP(msg,buf,len) lib_dumpbuffer(msg,buf,len) +#else +# define BUF_DUMP(msg,buf,len) +# undef UDPWB_DUMP +# define UDPWB_DUMP(msg,wrb,len,offset) +#endif + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +static inline void sendto_netdev_down(FAR struct socket *psock, + FAR struct udp_conn_s *conn); + +#ifdef NEED_IPDOMAIN_SUPPORT +static inline void sendto_ipselect(FAR struct net_driver_s *dev, + FAR struct udp_conn_s *conn); +#endif +#ifdef CONFIG_NET_ETHERNET +static inline bool sendto_addrcheck(FAR struct udp_conn_s *conn, + FAR struct net_driver_s *dev); +#else +# define sendto_addrcheck(c,d) (true) +#endif +#ifdef CONFIG_NET_SOCKOPTS +static inline int sendto_timeout(FAR struct socket *psock, + FAR struct udp_conn_s *conn); +#endif +static int sendto_next_transfer(FAR struct socket *psock, + FAR struct udp_conn_s *conn); +static uint16_t sendto_eventhandler(FAR struct net_driver_s *dev, + FAR void *pvconn, FAR void *pvpriv, + uint16_t flags); +static inline void sendto_txnotify(FAR struct socket *psock, + FAR struct udp_conn_s *conn); + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: sendto_netdev_down + * + * Description: + * The network device is down. Free all write buffers. + * REVISIT: Should only free write buffers associated with the device + * that went down. + * + * Parameters: + * psock The socket structure + * conn The connection structure associated with the socket + * + * Returned Value: + * None + * + ****************************************************************************/ + +static inline void sendto_netdev_down(FAR struct socket *psock, + FAR struct udp_conn_s *conn) +{ + FAR sq_entry_t *entry; + FAR sq_entry_t *next; + + /* Do not allow any further callbacks */ + + if (psock->s_sndcb != NULL) + { + psock->s_sndcb->flags = 0; + psock->s_sndcb->event = NULL; + } + + /* Free all queued write buffers */ + + for (entry = sq_peek(&conn->write_q); entry; entry = next) + { + next = sq_next(entry); + udp_wrbuffer_release((FAR struct udp_wrbuffer_s *)entry); + } + + /* Reset write buffering variables */ + + sq_init(&conn->write_q); +} + +/**************************************************************************** + * Name: sendto_ipselect + * + * Description: + * If both IPv4 and IPv6 support are enabled, then we will need to select + * which one to use when generating the outgoing packet. If only one + * domain is selected, then the setup is already in place and we need do + * nothing. + * + * Parameters: + * dev - The structure of the network driver that caused the event + * psock - Socket state structure + * + * Returned Value: + * None + * + * Assumptions: + * The network is locked + * + ****************************************************************************/ + +#ifdef NEED_IPDOMAIN_SUPPORT +static inline void sendto_ipselect(FAR struct net_driver_s *dev, + FAR struct udp_conn_s *conn) +{ + /* Which domain the socket support */ + + if (conn->domain == PF_INET) + { + /* Select the IPv4 domain */ + + udp_ipv4_select(dev); + } + else /* if (conn->domain == PF_INET6) */ + { + /* Select the IPv6 domain */ + + DEBUGASSERT(conn->domain == PF_INET6); + udp_ipv6_select(dev); + } +} +#endif + +/**************************************************************************** + * Name: sendto_addrcheck + * + * Description: + * Check if the destination IP address is in the IPv4 ARP or IPv6 Neighbor + * tables. If not, then the send won't actually make it out... it will be + * replaced with an ARP request (IPv4) or a Neighbor Solicitation (IPv6). + * + * NOTE 1: This could be an expensive check if there are a lot of + * entries in the ARP or Neighbor tables. + * + * NOTE 2: If we are actually harvesting IP addresses on incoming IP + * packets, then this check should not be necessary; the MAC mapping + * should already be in the ARP table in many cases (IPv4 only). + * + * NOTE 3: If CONFIG_NET_ARP_SEND then we can be assured that the IP + * address mapping is already in the ARP table. + * + * Parameters: + * conn - The UDP connection structure + * dev - Polling network device + * + * Returned Value: + * true - The Ethernet MAC address is in the ARP or Neighbor table (OR + * the network device is not Ethernet). + * + * Assumptions: + * The network is locked + * + ****************************************************************************/ + +#ifdef CONFIG_NET_ETHERNET +static inline bool sendto_addrcheck(FAR struct udp_conn_s *conn, + FAR struct net_driver_s *dev) +{ + /* REVISIT: Could the MAC address not also be in a routing table? */ + + if (dev->d_lltype != NET_LL_ETHERNET) + { + return true; + } + +#ifdef CONFIG_NET_IPv4 +#ifdef CONFIG_NET_IPv6 + if (conn->domain == PF_INET) +#endif + { +#if !defined(CONFIG_NET_ARP_IPIN) && !defined(CONFIG_NET_ARP_SEND) + return (arp_find(conn->u.ipv4.raddr) != NULL); +#else + return true; +#endif + } +#endif /* CONFIG_NET_IPv4 */ + +#ifdef CONFIG_NET_IPv6 +#ifdef CONFIG_NET_IPv4 + else +#endif + { +#if !defined(CONFIG_NET_ICMPv6_NEIGHBOR) + return (neighbor_findentry(conn->u.ipv6.raddr) != NULL); +#else + return true; +#endif + } +#endif /* CONFIG_NET_IPv6 */ +} +#endif /* CONFIG_NET_ETHERNET */ + +/**************************************************************************** + * Name: sendto_timeout + * + * Description: + * Check for send timeout. + * + * Parameters: + * pstate - sendto state structure + * + * Returned Value: + * TRUE:timeout FALSE:no timeout + * + * Assumptions: + * The network is locked + * + ****************************************************************************/ + +#ifdef CONFIG_NET_SOCKOPTS +static inline int sendto_timeout(FAR struct socket *psock, + FAR struct udp_conn_s *conn) +{ + FAR struct udp_wrbuffer_s *wrb; + + /* Peek at the head of the write queue (without altering the write queue). */ + + wrb = (FAR struct udp_wrbuffer_s *)sq_peek(&conn->write_q); + if (wrb != NULL) + { + /* Check for a timeout configured via setsockopts(SO_SNDTIMEO). + * If none... we well let the send wait forever. + */ + + if (psock->s_sndtimeo != 0) + { + /* Check if the configured timeout has elapsed */ + + return net_timeo(wrb->wb_start, psock->s_sndtimeo); + } + } + + /* No timeout */ + + return FALSE; +} +#endif /* CONFIG_NET_SOCKOPTS */ + +/**************************************************************************** + * Name: sendto_next_transfer + * + * Description: + * Setup for the next packet transfer + * + * Parameters: + * psock - Socket state structure + * conn - The UDP connection structure + * + * Returned Value: + * None + * + ****************************************************************************/ + +static int sendto_next_transfer(FAR struct socket *psock, + FAR struct udp_conn_s *conn) +{ + FAR struct udp_wrbuffer_s *wrb; + FAR struct net_driver_s *dev; + int ret; + + /* Set the UDP "connection" to the destination address of the write buffer + * at the head of the queue. + */ + + wrb = (FAR struct udp_wrbuffer_s *)sq_peek(&conn->write_q); + DEBUGASSERT(wrb != NULL); + + ret = udp_connect(conn, (FAR const struct sockaddr *)wrb->wb_iob->io_data); + if (ret < 0) + { + nerr("ERROR: udp_connect failed: %d\n", ret); + return ret; + } + + /* Get the device that will handle the remote packet transfers. This + * should never be NULL. + */ + + dev = udp_find_raddr_device(conn); + if (dev == NULL) + { + nerr("ERROR: udp_find_raddr_device failed\n"); + return -ENETUNREACH; + } + + /* If this is not the same device that we used in the last call to + * udp_callback_alloc(), then we need to release and reallocate the old + * callback instance. + */ + + if (psock->s_sndcb != NULL && conn->dev != dev) + { + udp_callback_free(conn->dev, conn, psock->s_sndcb); + psock->s_sndcb = NULL; + } + + /* Allocate resources to receive a callback from this device if the + * callback is not already in place. + */ + + if (psock->s_sndcb == NULL) + { + psock->s_sndcb = udp_callback_alloc(dev, conn); + } + + /* Test if the callback has been allocated */ + + if (psock->s_sndcb == NULL) + { + /* A buffer allocation error occurred */ + + nerr("ERROR: Failed to allocate callback\n"); + return -ENOMEM; + } + + conn->dev = dev; + + /* Set up the callback in the connection */ + + psock->s_sndcb->flags = (UDP_POLL | NETDEV_DOWN); + psock->s_sndcb->priv = (FAR void *)psock; + psock->s_sndcb->event = sendto_eventhandler; + return OK; +} + +/**************************************************************************** + * Name: sendto_eventhandler + * + * Description: + * This function is called to perform the actual send operation when + * polled by the lower, device interfacing layer. + * + * Parameters: + * dev The structure of the network driver that caused the event + * conn The connection structure associated with the socket + * flags Set of events describing why the callback was invoked + * + * Returned Value: + * None + * + * Assumptions: + * The network is locked + * + ****************************************************************************/ + +static uint16_t sendto_eventhandler(FAR struct net_driver_s *dev, + FAR void *pvconn, FAR void *pvpriv, + uint16_t flags) +{ + FAR struct udp_conn_s *conn = (FAR struct udp_conn_s *)pvconn; + FAR struct socket *psock = (FAR struct socket *)pvpriv; + int ret; + + ninfo("flags: %04x\n", flags); + + /* Check if the network device has gone down */ + + if ((flags & NETDEV_DOWN) != 0) + { + ninfo("Device down: %04x\n", flags); + + /* Free write buffers and terminate polling */ + + sendto_netdev_down(psock, conn); + return flags; + } + + /* Check for a normal polling cycle and if the outgoing packet is + * available. It would not be available if it has been claimed by a send + * event serving a different thread -OR- if the output buffer currently + * contains unprocessed incoming data. In these cases we will just have + * to wait for the next polling cycle. + * + * And, of course, we can do nothing if we have no data in the write + * buffers to send. + */ + + if (dev->d_sndlen <= 0 && (flags & UDP_NEWDATA) != 0 && + (flags & UDP_POLL) != 0 && !sq_empty(&conn->write_q)) + { + /* Check if the destination IP address is in the ARP or Neighbor + * table. If not, then the send won't actually make it out... it + * will be replaced with an ARP request or Neighbor Solicitation. + */ + + if (sendto_addrcheck(conn, dev)) + { + FAR struct udp_wrbuffer_s *wrb; + FAR struct udp_wrbuffer_s *tmp; + size_t sndlen; + + /* Peek at the head of the write queue (but don't remove anything + * from the write queue yet). We know from the above test that + * the write_q is not empty. + */ + + wrb = (FAR struct udp_wrbuffer_s *)sq_peek(&conn->write_q); + DEBUGASSERT(wrb != NULL); + + /* Get the amount of data that we can send in the next packet. + * We will send either the remaining data in the buffer I/O + * buffer chain, or as much as will fit given the MSS and current + * window size. + */ + + sndlen = wrb->wb_iob->io_pktlen; + ninfo("wrb=%p sndlen=%u\n", wrb, sndlen); + +#ifdef NEED_IPDOMAIN_SUPPORT + /* If both IPv4 and IPv6 support are enabled, then we will need to + * select which one to use when generating the outgoing packet. + * If only one domain is selected, then the setup is already in + * place and we need do nothing. + */ + + sendto_ipselect(dev, conn); +#endif + /* Then set-up to send that amount of data with the offset + * corresponding to the size of the IP-dependent address structure. + */ + + devif_iob_send(dev, wrb->wb_iob, sndlen, 0); + + /* Remove and free the write buffer from the head of the write + * buffer queue. + */ + + do + { + tmp = (FAR struct udp_wrbuffer_s *)sq_remfirst(&conn->write_q); + DEBUGASSERT(tmp == wrb); + + udp_wrbuffer_release(tmp); + + /* Check if the write queue became empty */ + + if (sq_empty(&conn->write_q)) + { + /* Yes.. stifle any further callbacks until more write + * data is enqueued. + */ + + psock->s_sndcb->flags = 0; + psock->s_sndcb->priv = NULL; + psock->s_sndcb->event = NULL; + ret = OK; + } + else + { + /* Set up for the next packet transfer by setting the + * connection address to the address of the next packet + * now at the header of of the write buffer queue. + */ + + ret = sendto_next_transfer(psock, conn); + } + } + while (ret < 0); + + /* Only one data can be sent by low level driver at once, + * tell the caller stop polling the other connections. + */ + + flags &= ~UDP_POLL; + } + } + +#ifdef CONFIG_NET_SOCKOPTS + /* We cannot send the data now. Check for a timeout. */ + + else if (sendto_timeout(psock, conn)) + { + FAR struct udp_wrbuffer_s *wrb; + + do + { + /* Remove and free the write buffer from the head of the write + * buffer queue. Here we know that the write queue is not empty + * because the entry at the head of the queue just timed out! + */ + + wrb = (FAR struct udp_wrbuffer_s *)sq_remfirst(&conn->write_q); + DEBUGASSERT(wrb != NULL); + + udp_wrbuffer_release(wrb); + + /* Set up for the next packet transfer by setting the connection + * address to the address of the next packet now at the header of the + * write buffer queue. + */ + + ret = sendto_next_transfer(psock, conn); + } + while (ret < 0); + } +#endif /* CONFIG_NET_SOCKOPTS */ + + /* Continue waiting */ + + return flags; +} + +/**************************************************************************** + * Name: sendto_txnotify + * + * Description: + * Notify the appropriate device driver that we are have data ready to + * be send (UDP) + * + * Parameters: + * psock - Socket state structure + * conn - The UDP connection structure + * + * Returned Value: + * None + * + ****************************************************************************/ + +static inline void sendto_txnotify(FAR struct socket *psock, + FAR struct udp_conn_s *conn) +{ +#ifdef CONFIG_NET_IPv4 +#ifdef CONFIG_NET_IPv6 + /* If both IPv4 and IPv6 support are enabled, then we will need to select + * the device driver using the appropriate IP domain. + */ + + if (psock->s_domain == PF_INET) +#endif + { + /* Notify the device driver that send data is available */ + + netdev_ipv4_txnotify(conn->u.ipv4.laddr, conn->u.ipv4.raddr); + } +#endif /* CONFIG_NET_IPv4 */ + +#ifdef CONFIG_NET_IPv6 +#ifdef CONFIG_NET_IPv4 + else /* if (psock->s_domain == PF_INET6) */ +#endif /* CONFIG_NET_IPv4 */ + { + /* Notify the device driver that send data is available */ + + DEBUGASSERT(psock->s_domain == PF_INET6); + netdev_ipv6_txnotify(conn->u.ipv6.laddr, conn->u.ipv6.raddr); + } +#endif /* CONFIG_NET_IPv6 */ +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: psock_udp_sendto + * + * Description: + * This function implements the UDP-specific logic of the standard + * sendto() socket operation. + * + * Input Parameters: + * psock A pointer to a NuttX-specific, internal socket structure + * buf Data to send + * len Length of data to send + * flags Send flags + * to Address of recipient + * tolen The length of the address structure + * + * NOTE: All input parameters were verified by sendto() before this + * function was called. + * + * Returned Value: + * On success, returns the number of characters sent. On error, + * a negated errno value is returned. See the description in + * net/socket/sendto.c for the list of appropriate return value. + * + ****************************************************************************/ + +ssize_t psock_udp_sendto(FAR struct socket *psock, FAR const void *buf, + size_t len, int flags, FAR const struct sockaddr *to, + socklen_t tolen) +{ + FAR struct udp_conn_s *conn; + FAR struct udp_wrbuffer_s *wrb; + int ret = OK; + + /* Make sure that we have the IP address mapping */ + + conn = (FAR struct udp_conn_s *)psock->s_conn; + DEBUGASSERT(conn); + +#if defined(CONFIG_NET_ARP_SEND) || defined(CONFIG_NET_ICMPv6_NEIGHBOR) +#ifdef CONFIG_NET_ARP_SEND +#ifdef CONFIG_NET_ICMPv6_NEIGHBOR + if (psock->s_domain == PF_INET) +#endif + { + /* Make sure that the IP address mapping is in the ARP table */ + + ret = arp_send(conn->u.ipv4.raddr); + } +#endif /* CONFIG_NET_ARP_SEND */ + +#ifdef CONFIG_NET_ICMPv6_NEIGHBOR +#ifdef CONFIG_NET_ARP_SEND + else +#endif + { + /* Make sure that the IP address mapping is in the Neighbor Table */ + + ret = icmpv6_neighbor(conn->u.ipv6.raddr); + } +#endif /* CONFIG_NET_ICMPv6_NEIGHBOR */ + + /* Did we successfully get the address mapping? */ + + if (ret < 0) + { + nerr("ERROR: Not reachable\n"); + return -ENETUNREACH; + } +#endif /* CONFIG_NET_ARP_SEND || CONFIG_NET_ICMPv6_NEIGHBOR */ + + /* Dump the incoming buffer */ + + BUF_DUMP("psock_udp_send", buf, len); + + /* Set the socket state to sending */ + + psock->s_flags = _SS_SETSTATE(psock->s_flags, _SF_SEND); + + if (len > 0) + { + /* Allocate a write buffer. Careful, the network will be momentarily + * unlocked here. + */ + + net_lock(); + wrb = udp_wrbuffer_alloc(); + if (wrb == NULL) + { + /* A buffer allocation error occurred */ + + nerr("ERROR: Failed to allocate write buffer\n"); + ret = -ENOMEM; + goto errout_with_lock; + } + + /* Initialize the write buffer */ + + memcpy(&wrb->wb_dest, to, tolen); + wrb->wb_start = clock_systimer(); + + /* Copy the user data into the write buffer. We cannot wait for + * buffer space if the socket was opened non-blocking. + */ + + if (_SS_ISNONBLOCK(psock->s_flags)) + { + ret = iob_trycopyin(wrb->wb_iob, (FAR uint8_t *)buf, len, 0, false); + } + else + { + ret = iob_copyin(wrb->wb_iob, (FAR uint8_t *)buf, len, 0, false); + } + + if (ret < 0) + { + goto errout_with_wrb; + } + + /* Dump I/O buffer chain */ + + UDPWB_DUMP("I/O buffer chain", wrb, wrb->wb_iob->io_pktlen, 0); + + /* sendto_eventhandler() will send data in FIFO order from the + * conn->write_q + */ + + sq_addlast(&wrb->wb_node, &conn->write_q); + ninfo("Queued WRB=%p pktlen=%u write_q(%p,%p)\n", + wrb, wrb->wb_iob->io_pktlen, + conn->write_q.head, conn->write_q.tail); + + /* Set up for the next packet transfer by setting the connection + * address to the address of the next packet now at the header of the + * write buffer queue. + */ + + ret = sendto_next_transfer(psock, conn); + if (ret < 0) + { + /* REVISIT: An error here is not recoverable */ + + goto errout_with_lock; + } + + /* Notify the device driver of the availability of TX data */ + + sendto_txnotify(psock, conn); + net_unlock(); + } + + /* Set the socket state to idle */ + + psock->s_flags = _SS_SETSTATE(psock->s_flags, _SF_IDLE); + + /* Return the number of bytes that will be sent */ + + return len; + +errout_with_wrb: + udp_wrbuffer_release(wrb); + +errout_with_lock: + net_unlock(); + return ret; +} + +#endif /* CONFIG_NET && CONFIG_NET_UDP && CONFIG_NET_UDP_WRITE_BUFFERS */ diff --git a/net/udp/udp_psock_sendto.c b/net/udp/udp_psock_sendto_unbuffered.c similarity index 98% rename from net/udp/udp_psock_sendto.c rename to net/udp/udp_psock_sendto_unbuffered.c index ff362a310e..809ee2ce9e 100644 --- a/net/udp/udp_psock_sendto.c +++ b/net/udp/udp_psock_sendto_unbuffered.c @@ -1,7 +1,8 @@ /**************************************************************************** - * net/udp/udp_psock_sendto.c + * net/udp/udp_psock_sendto_unbuffered.c * - * Copyright (C) 2007-2009, 2011-2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011-2016, 2018 Gregory Nutt. All rights + * reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -94,7 +95,7 @@ struct sendto_s ****************************************************************************/ /**************************************************************************** - * Name: send_timeout + * Name: sendto_timeout * * Description: * Check for send timeout. @@ -111,7 +112,7 @@ struct sendto_s ****************************************************************************/ #ifdef CONFIG_NET_SOCKOPTS -static inline int send_timeout(FAR struct sendto_s *pstate) +static inline int sendto_timeout(FAR struct sendto_s *pstate) { FAR struct socket *psock; @@ -235,7 +236,7 @@ static uint16_t sendto_eventhandler(FAR struct net_driver_s *dev, */ #ifdef CONFIG_NET_SOCKOPTS - if (send_timeout(pstate)) + if (sendto_timeout(pstate)) { /* Yes.. report the timeout */ diff --git a/net/udp/udp_wrbuffer.c b/net/udp/udp_wrbuffer.c new file mode 100644 index 0000000000..ae8fafd7ff --- /dev/null +++ b/net/udp/udp_wrbuffer.c @@ -0,0 +1,217 @@ +/**************************************************************************** + * net/udp/udp_wrbuffer.c + * + * Copyright (C) 2018 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#if defined(CONFIG_NET) && defined(CONFIG_NET_UDP) && defined(CONFIG_NET_UDP_WRITE_BUFFERS) + +#if defined(CONFIG_DEBUG_FEATURES) && defined(CONFIG_NET_UDP_WRBUFFER_DEBUG) +/* Force debug output (from this file only) */ + +# undef CONFIG_DEBUG_NET +# define CONFIG_DEBUG_NET 1 +#endif + +#include +#include +#include +#include + +#include +#include +#include + +#include "udp/udp.h" + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/* Package all globals used by this logic into a structure */ + +struct wrbuffer_s +{ + /* The semaphore to protect the buffers */ + + sem_t sem; + + /* This is the list of available write buffers */ + + sq_queue_t freebuffers; + + /* These are the pre-allocated write buffers */ + + struct udp_wrbuffer_s buffers[CONFIG_NET_UDP_NWRBCHAINS]; +}; + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/* This is the state of the global write buffer resource */ + +static struct wrbuffer_s g_wrbuffer; + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: udp_wrbuffer_initialize + * + * Description: + * Initialize the list of free write buffers + * + * Assumptions: + * Called once early initialization. + * + ****************************************************************************/ + +void udp_wrbuffer_initialize(void) +{ + int i; + + sq_init(&g_wrbuffer.freebuffers); + + for (i = 0; i < CONFIG_NET_UDP_NWRBCHAINS; i++) + { + sq_addfirst(&g_wrbuffer.buffers[i].wb_node, &g_wrbuffer.freebuffers); + } + + nxsem_init(&g_wrbuffer.sem, 0, CONFIG_NET_UDP_NWRBCHAINS); +} + +/**************************************************************************** + * Name: udp_wrbuffer_alloc + * + * Description: + * Allocate a UDP write buffer by taking a pre-allocated buffer from + * the free list. This function is called from UDP logic when a buffer + * of UDP data is about to sent + * + * Input parameters: + * None + * + * Assumptions: + * Called from user logic with the network locked. + * + ****************************************************************************/ + +FAR struct udp_wrbuffer_s *udp_wrbuffer_alloc(void) +{ + FAR struct udp_wrbuffer_s *wrb; + + /* We need to allocate two things: (1) A write buffer structure and (2) + * at least one I/O buffer to start the chain. + * + * Allocate the write buffer structure first then the IOBG. In order to + * avoid deadlocks, we will need to free the IOB first, then the write + * buffer + */ + + DEBUGVERIFY(net_lockedwait(&g_wrbuffer.sem)); /* TODO: Handle EINTR. */ + + /* Now, we are guaranteed to have a write buffer structure reserved + * for us in the free list. + */ + + wrb = (FAR struct udp_wrbuffer_s *)sq_remfirst(&g_wrbuffer.freebuffers); + DEBUGASSERT(wrb); + memset(wrb, 0, sizeof(struct udp_wrbuffer_s)); + + /* Now get the first I/O buffer for the write buffer structure */ + + wrb->wb_iob = iob_alloc(false); + if (!wrb->wb_iob) + { + nerr("ERROR: Failed to allocate I/O buffer\n"); + udp_wrbuffer_release(wrb); + return NULL; + } + + return wrb; +} + +/**************************************************************************** + * Name: udp_wrbuffer_release + * + * Description: + * Release a UDP write buffer by returning the buffer to the free list. + * This function is called from user logic after it is consumed the + * buffered data. + * + * Assumptions: + * This function must be called with the network locked. + * + ****************************************************************************/ + +void udp_wrbuffer_release(FAR struct udp_wrbuffer_s *wrb) +{ + DEBUGASSERT(wrb && wrb->wb_iob); + + /* To avoid deadlocks, we must following this ordering: Release the I/O + * buffer chain first, then the write buffer structure. + */ + + iob_free_chain(wrb->wb_iob); + + /* Then free the write buffer structure */ + + sq_addlast(&wrb->wb_node, &g_wrbuffer.freebuffers); + nxsem_post(&g_wrbuffer.sem); +} + +/**************************************************************************** + * Name: udp_wrbuffer_test + * + * Description: + * Check if there is room in the write buffer. Does not reserve any space. + * + * Assumptions: + * None. + * + ****************************************************************************/ + +int udp_wrbuffer_test(void) +{ + int val = 0; + nxsem_getvalue(&g_wrbuffer.sem, &val); + return val > 0 ? OK : ERROR; +} + +#endif /* CONFIG_NET && CONFIG_NET_UDP && CONFIG_NET_UDP_WRITE_BUFFERS */ diff --git a/net/udp/udp_wrbuffer_dump.c b/net/udp/udp_wrbuffer_dump.c new file mode 100644 index 0000000000..e3e8df1f59 --- /dev/null +++ b/net/udp/udp_wrbuffer_dump.c @@ -0,0 +1,70 @@ +/**************************************************************************** + * net/udp/udp_wrbuffer_dump.c + * + * Copyright (C) 2018 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +#include + +#include "udp/udp.h" + +#ifdef CONFIG_DEBUG_FEATURES + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: udp_wrbuffer_dump + * + * Description: + * Dump the contents of a write buffer + * + ****************************************************************************/ + +void udp_wrbuffer_dump(FAR const char *msg, FAR struct udp_wrbuffer_s *wrb, + unsigned int len, unsigned int offset) +{ + syslog(LOG_DEBUG, "%s: wrb=%p pktlen=%d\n", msg, wrb, wrb->wb_iob->io_pktlen); + iob_dump("I/O Buffer Chain", wrb->wb_iob, len, offset); +} + +#endif /* CONFIG_DEBUG_FEATURES */ -- GitLab From fa3ad468976c2c393355e0957a049ef686ed14fe Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 22 Jan 2018 18:46:58 -0600 Subject: [PATCH 061/228] net/udp: In sendto(), return EHOSTUNREACH if if the network is down. --- net/udp/udp_psock_sendto_buffered.c | 8 ++++++++ net/udp/udp_psock_sendto_unbuffered.c | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/net/udp/udp_psock_sendto_buffered.c b/net/udp/udp_psock_sendto_buffered.c index 3f5e5305b4..b9a8a89189 100644 --- a/net/udp/udp_psock_sendto_buffered.c +++ b/net/udp/udp_psock_sendto_buffered.c @@ -384,6 +384,14 @@ static int sendto_next_transfer(FAR struct socket *psock, return -ENETUNREACH; } + /* Make sure that the device is in the UP state */ + + if ((dev->d_flags & IFF_UP) == 0) + { + nwarn("WARNING: device is DOWN\n"); + return -EHOSTUNREACH; + } + /* If this is not the same device that we used in the last call to * udp_callback_alloc(), then we need to release and reallocate the old * callback instance. diff --git a/net/udp/udp_psock_sendto_unbuffered.c b/net/udp/udp_psock_sendto_unbuffered.c index 809ee2ce9e..7024d12baf 100644 --- a/net/udp/udp_psock_sendto_unbuffered.c +++ b/net/udp/udp_psock_sendto_unbuffered.c @@ -424,6 +424,15 @@ ssize_t psock_udp_sendto(FAR struct socket *psock, FAR const void *buf, goto errout_with_lock; } + /* Make sure that the device is in the UP state */ + + if ((dev->d_flags & IFF_UP) == 0) + { + nwarn("WARNING: device is DOWN\n"); + ret = -EHOSTUNREACH; + goto errout_with_lock; + } + /* Set up the callback in the connection */ state.st_cb = udp_callback_alloc(dev, conn); -- GitLab From 2d4fa19a54e9a84744d71345b01ccb0e8c1af640 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 22 Jan 2018 19:27:05 -0600 Subject: [PATCH 062/228] net/udp: Resolves final design issues with UDP write buffering. 100% code complete but also 100% untested. --- net/udp/udp_psock_sendto_buffered.c | 144 +++++++++++----------------- 1 file changed, 55 insertions(+), 89 deletions(-) diff --git a/net/udp/udp_psock_sendto_buffered.c b/net/udp/udp_psock_sendto_buffered.c index b9a8a89189..b084837b6e 100644 --- a/net/udp/udp_psock_sendto_buffered.c +++ b/net/udp/udp_psock_sendto_buffered.c @@ -105,9 +105,6 @@ * Private Function Prototypes ****************************************************************************/ -static inline void sendto_netdev_down(FAR struct socket *psock, - FAR struct udp_conn_s *conn); - #ifdef NEED_IPDOMAIN_SUPPORT static inline void sendto_ipselect(FAR struct net_driver_s *dev, FAR struct udp_conn_s *conn); @@ -135,47 +132,64 @@ static inline void sendto_txnotify(FAR struct socket *psock, ****************************************************************************/ /**************************************************************************** - * Name: sendto_netdev_down + * Name: sendto_writebuffer_release * * Description: - * The network device is down. Free all write buffers. - * REVISIT: Should only free write buffers associated with the device - * that went down. + * Release the write buffer at the head of the write buffer queue. * * Parameters: - * psock The socket structure - * conn The connection structure associated with the socket + * dev - The structure of the network driver that caused the event + * psock - Socket state structure * * Returned Value: * None * + * Assumptions: + * The network is locked + * ****************************************************************************/ -static inline void sendto_netdev_down(FAR struct socket *psock, - FAR struct udp_conn_s *conn) +static void sendto_writebuffer_release(FAR struct socket *psock, + FAR struct udp_conn_s *conn) { - FAR sq_entry_t *entry; - FAR sq_entry_t *next; - - /* Do not allow any further callbacks */ + FAR struct udp_wrbuffer_s *wrb; + int ret = OK; - if (psock->s_sndcb != NULL) + do { - psock->s_sndcb->flags = 0; - psock->s_sndcb->event = NULL; - } + /* Check if the write queue became empty */ - /* Free all queued write buffers */ + if (sq_empty(&conn->write_q)) + { + /* Yes.. stifle any further callbacks until more write data is + * enqueued. + */ - for (entry = sq_peek(&conn->write_q); entry; entry = next) - { - next = sq_next(entry); - udp_wrbuffer_release((FAR struct udp_wrbuffer_s *)entry); - } + psock->s_sndcb->flags = 0; + psock->s_sndcb->priv = NULL; + psock->s_sndcb->event = NULL; + wrb = NULL; + } + else + { + /* Remove the write buffer from the head of the write buffer queue + * and release it. + */ + + wrb = (FAR struct udp_wrbuffer_s *)sq_remfirst(&conn->write_q); + DEBUGASSERT(wrb != NULL); - /* Reset write buffering variables */ + udp_wrbuffer_release(wrb); + + /* Set up for the next packet transfer by setting the connection + * address to the address of the next packet now at the header of + * the write buffer queue. + */ - sq_init(&conn->write_q); + ret = sendto_next_transfer(psock, conn); + } + } + while (wrb != NULL && ret < 0); } /**************************************************************************** @@ -254,7 +268,7 @@ static inline void sendto_ipselect(FAR struct net_driver_s *dev, #ifdef CONFIG_NET_ETHERNET static inline bool sendto_addrcheck(FAR struct udp_conn_s *conn, - FAR struct net_driver_s *dev) + FAR struct net_driver_s *dev) { /* REVISIT: Could the MAC address not also be in a routing table? */ @@ -458,7 +472,6 @@ static uint16_t sendto_eventhandler(FAR struct net_driver_s *dev, { FAR struct udp_conn_s *conn = (FAR struct udp_conn_s *)pvconn; FAR struct socket *psock = (FAR struct socket *)pvpriv; - int ret; ninfo("flags: %04x\n", flags); @@ -468,9 +481,11 @@ static uint16_t sendto_eventhandler(FAR struct net_driver_s *dev, { ninfo("Device down: %04x\n", flags); - /* Free write buffers and terminate polling */ + /* Free the write buffer at the head of the queue and attempt to setup + * the next transfer. + */ - sendto_netdev_down(psock, conn); + sendto_writebuffer_release(psock, conn); return flags; } @@ -495,7 +510,6 @@ static uint16_t sendto_eventhandler(FAR struct net_driver_s *dev, if (sendto_addrcheck(conn, dev)) { FAR struct udp_wrbuffer_s *wrb; - FAR struct udp_wrbuffer_s *tmp; size_t sndlen; /* Peek at the head of the write queue (but don't remove anything @@ -530,41 +544,11 @@ static uint16_t sendto_eventhandler(FAR struct net_driver_s *dev, devif_iob_send(dev, wrb->wb_iob, sndlen, 0); - /* Remove and free the write buffer from the head of the write - * buffer queue. + /* Free the write buffer at the head of the queue and attempt to + * setup the next transfer. */ - do - { - tmp = (FAR struct udp_wrbuffer_s *)sq_remfirst(&conn->write_q); - DEBUGASSERT(tmp == wrb); - - udp_wrbuffer_release(tmp); - - /* Check if the write queue became empty */ - - if (sq_empty(&conn->write_q)) - { - /* Yes.. stifle any further callbacks until more write - * data is enqueued. - */ - - psock->s_sndcb->flags = 0; - psock->s_sndcb->priv = NULL; - psock->s_sndcb->event = NULL; - ret = OK; - } - else - { - /* Set up for the next packet transfer by setting the - * connection address to the address of the next packet - * now at the header of of the write buffer queue. - */ - - ret = sendto_next_transfer(psock, conn); - } - } - while (ret < 0); + sendto_writebuffer_release(psock, conn); /* Only one data can be sent by low level driver at once, * tell the caller stop polling the other connections. @@ -579,28 +563,11 @@ static uint16_t sendto_eventhandler(FAR struct net_driver_s *dev, else if (sendto_timeout(psock, conn)) { - FAR struct udp_wrbuffer_s *wrb; - - do - { - /* Remove and free the write buffer from the head of the write - * buffer queue. Here we know that the write queue is not empty - * because the entry at the head of the queue just timed out! - */ - - wrb = (FAR struct udp_wrbuffer_s *)sq_remfirst(&conn->write_q); - DEBUGASSERT(wrb != NULL); - - udp_wrbuffer_release(wrb); - - /* Set up for the next packet transfer by setting the connection - * address to the address of the next packet now at the header of the - * write buffer queue. - */ + /* Free the write buffer at the head of the queue and attempt to setup + * the next transfer. + */ - ret = sendto_next_transfer(psock, conn); - } - while (ret < 0); + sendto_writebuffer_release(psock, conn); } #endif /* CONFIG_NET_SOCKOPTS */ @@ -799,9 +766,8 @@ ssize_t psock_udp_sendto(FAR struct socket *psock, FAR const void *buf, ret = sendto_next_transfer(psock, conn); if (ret < 0) { - /* REVISIT: An error here is not recoverable */ - - goto errout_with_lock; + (void)sq_remlast(&conn->write_q); + goto errout_with_wrb; } /* Notify the device driver of the availability of TX data */ -- GitLab From 289e4dde06e1dee1e6e2250a2cd34c06c7aaf814 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 22 Jan 2018 19:33:14 -0600 Subject: [PATCH 063/228] net/udp and tcp: Yet another (cosmetic) change to UDP and TCP write buffer macro naming. --- net/tcp/tcp.h | 22 +++--- net/tcp/tcp_send_buffered.c | 104 ++++++++++++++-------------- net/tcp/tcp_wrbuffer_dump.c | 4 +- net/udp/udp.h | 4 +- net/udp/udp_psock_sendto_buffered.c | 6 +- 5 files changed, 70 insertions(+), 70 deletions(-) diff --git a/net/tcp/tcp.h b/net/tcp/tcp.h index bf8948da73..bfd402c00a 100644 --- a/net/tcp/tcp.h +++ b/net/tcp/tcp.h @@ -77,25 +77,25 @@ #ifdef CONFIG_NET_TCP_WRITE_BUFFERS /* TCP write buffer access macros */ -# define TCPWB_SEQNO(wrb) ((wrb)->wb_seqno) -# define TCPWB_PKTLEN(wrb) ((wrb)->wb_iob->io_pktlen) -# define TCPWB_SENT(wrb) ((wrb)->wb_sent) -# define TCPWB_NRTX(wrb) ((wrb)->wb_nrtx) -# define TCPWB_IOB(wrb) ((wrb)->wb_iob) -# define TCPWB_COPYOUT(wrb,dest,n) (iob_copyout(dest,(wrb)->wb_iob,(n),0)) -# define TCPWB_COPYIN(wrb,src,n) \ +# define TCP_WBSEQNO(wrb) ((wrb)->wb_seqno) +# define TCP_WBPKTLEN(wrb) ((wrb)->wb_iob->io_pktlen) +# define TCP_WBSENT(wrb) ((wrb)->wb_sent) +# define TCP_WBNRTX(wrb) ((wrb)->wb_nrtx) +# define TCP_WBIOB(wrb) ((wrb)->wb_iob) +# define TCP_WBCOPYOUT(wrb,dest,n) (iob_copyout(dest,(wrb)->wb_iob,(n),0)) +# define TCP_WBCOPYIN(wrb,src,n) \ (iob_copyin((wrb)->wb_iob,src,(n),0,false)) -# define TCPWB_TRYCOPYIN(wrb,src,n) \ +# define TCP_WBTRYCOPYIN(wrb,src,n) \ (iob_trycopyin((wrb)->wb_iob,src,(n),0,false)) -# define TCPWB_TRIM(wrb,n) \ +# define TCP_WBTRIM(wrb,n) \ do { (wrb)->wb_iob = iob_trimhead((wrb)->wb_iob,(n)); } while (0) #ifdef CONFIG_DEBUG_FEATURES -# define TCPWB_DUMP(msg,wrb,len,offset) \ +# define TCP_WBDUMP(msg,wrb,len,offset) \ tcp_wrbuffer_dump(msg,wrb,len,offset) # else -# define TCPWB_DUMP(msg,wrb,len,offset) +# define TCP_WBDUMP(msg,wrb,len,offset) # endif #endif diff --git a/net/tcp/tcp_send_buffered.c b/net/tcp/tcp_send_buffered.c index 5abb417e70..b8463b0643 100644 --- a/net/tcp/tcp_send_buffered.c +++ b/net/tcp/tcp_send_buffered.c @@ -98,8 +98,8 @@ # define BUF_DUMP(msg,buf,len) lib_dumpbuffer(msg,buf,len) #else # define BUF_DUMP(msg,buf,len) -# undef TCPWB_DUMP -# define TCPWB_DUMP(msg,wrb,len,offset) +# undef TCP_WBDUMP +# define TCP_WBDUMP(msg,wrb,len,offset) #endif /**************************************************************************** @@ -135,7 +135,7 @@ static void psock_insert_segment(FAR struct tcp_wrbuffer_s *wrb, for (itr = sq_peek(q); itr; itr = sq_next(itr)) { FAR struct tcp_wrbuffer_s *wrb0 = (FAR struct tcp_wrbuffer_s *)itr; - if (TCPWB_SEQNO(wrb0) < TCPWB_SEQNO(wrb)) + if (TCP_WBSEQNO(wrb0) < TCP_WBSEQNO(wrb)) { insert = itr; } @@ -417,13 +417,13 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, * the write buffer has been ACKed. */ - if (ackno > TCPWB_SEQNO(wrb)) + if (ackno > TCP_WBSEQNO(wrb)) { /* Get the sequence number at the end of the data */ - lastseq = TCPWB_SEQNO(wrb) + TCPWB_PKTLEN(wrb); + lastseq = TCP_WBSEQNO(wrb) + TCP_WBPKTLEN(wrb); ninfo("ACK: wrb=%p seqno=%u lastseq=%u pktlen=%u ackno=%u\n", - wrb, TCPWB_SEQNO(wrb), lastseq, TCPWB_PKTLEN(wrb), + wrb, TCP_WBSEQNO(wrb), lastseq, TCP_WBPKTLEN(wrb), ackno); /* Has the entire buffer been ACKed? */ @@ -450,24 +450,24 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, * buffers in the chain. */ - trimlen = ackno - TCPWB_SEQNO(wrb); - if (trimlen > TCPWB_SENT(wrb)) + trimlen = ackno - TCP_WBSEQNO(wrb); + if (trimlen > TCP_WBSENT(wrb)) { /* More data has been ACKed then we have sent? */ - trimlen = TCPWB_SENT(wrb); + trimlen = TCP_WBSENT(wrb); } ninfo("ACK: wrb=%p trim %u bytes\n", wrb, trimlen); - TCPWB_TRIM(wrb, trimlen); - TCPWB_SEQNO(wrb) = ackno; - TCPWB_SENT(wrb) -= trimlen; + TCP_WBTRIM(wrb, trimlen); + TCP_WBSEQNO(wrb) = ackno; + TCP_WBSENT(wrb) -= trimlen; /* Set the new sequence number for what remains */ ninfo("ACK: wrb=%p seqno=%u pktlen=%u\n", - wrb, TCPWB_SEQNO(wrb), TCPWB_PKTLEN(wrb)); + wrb, TCP_WBSEQNO(wrb), TCP_WBPKTLEN(wrb)); } } } @@ -478,31 +478,31 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, */ wrb = (FAR struct tcp_wrbuffer_s *)sq_peek(&conn->write_q); - if (wrb && TCPWB_SENT(wrb) > 0 && ackno > TCPWB_SEQNO(wrb)) + if (wrb && TCP_WBSENT(wrb) > 0 && ackno > TCP_WBSEQNO(wrb)) { uint32_t nacked; /* Number of bytes that were ACKed */ - nacked = ackno - TCPWB_SEQNO(wrb); - if (nacked > TCPWB_SENT(wrb)) + nacked = ackno - TCP_WBSEQNO(wrb); + if (nacked > TCP_WBSENT(wrb)) { /* More data has been ACKed then we have sent? ASSERT? */ - nacked = TCPWB_SENT(wrb); + nacked = TCP_WBSENT(wrb); } ninfo("ACK: wrb=%p seqno=%u nacked=%u sent=%u ackno=%u\n", - wrb, TCPWB_SEQNO(wrb), nacked, TCPWB_SENT(wrb), ackno); + wrb, TCP_WBSEQNO(wrb), nacked, TCP_WBSENT(wrb), ackno); /* Trim the ACKed bytes from the beginning of the write buffer. */ - TCPWB_TRIM(wrb, nacked); - TCPWB_SEQNO(wrb) = ackno; - TCPWB_SENT(wrb) -= nacked; + TCP_WBTRIM(wrb, nacked); + TCP_WBSEQNO(wrb) = ackno; + TCP_WBSENT(wrb) -= nacked; ninfo("ACK: wrb=%p seqno=%u pktlen=%u sent=%u\n", - wrb, TCPWB_SEQNO(wrb), TCPWB_PKTLEN(wrb), TCPWB_SENT(wrb)); + wrb, TCP_WBSEQNO(wrb), TCP_WBPKTLEN(wrb), TCP_WBSENT(wrb)); } } @@ -544,16 +544,16 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, */ wrb = (FAR struct tcp_wrbuffer_s *)sq_peek(&conn->write_q); - ninfo("REXMIT: wrb=%p sent=%u\n", wrb, wrb ? TCPWB_SENT(wrb) : 0); + ninfo("REXMIT: wrb=%p sent=%u\n", wrb, wrb ? TCP_WBSENT(wrb) : 0); - if (wrb != NULL && TCPWB_SENT(wrb) > 0) + if (wrb != NULL && TCP_WBSENT(wrb) > 0) { FAR struct tcp_wrbuffer_s *tmp; uint16_t sent; /* Yes.. Reset the number of bytes sent sent from the write buffer */ - sent = TCPWB_SENT(wrb); + sent = TCP_WBSENT(wrb); if (conn->unacked > sent) { conn->unacked -= sent; @@ -572,16 +572,16 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, conn->sent = 0; } - TCPWB_SENT(wrb) = 0; + TCP_WBSENT(wrb) = 0; ninfo("REXMIT: wrb=%p sent=%u, conn unacked=%d sent=%d\n", - wrb, TCPWB_SENT(wrb), conn->unacked, conn->sent); + wrb, TCP_WBSENT(wrb), conn->unacked, conn->sent); /* Increment the retransmit count on this write buffer. */ - if (++TCPWB_NRTX(wrb) >= TCP_MAXRTX) + if (++TCP_WBNRTX(wrb) >= TCP_MAXRTX) { nwarn("WARNING: Expiring wrb=%p nrtx=%u\n", - wrb, TCPWB_NRTX(wrb)); + wrb, TCP_WBNRTX(wrb)); /* The maximum retry count as been exhausted. Remove the write * buffer at the head of the queue. @@ -619,7 +619,7 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, /* Reset the number of bytes sent sent from the write buffer */ - sent = TCPWB_SENT(wrb); + sent = TCP_WBSENT(wrb); if (conn->unacked > sent) { conn->unacked -= sent; @@ -638,16 +638,16 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, conn->sent = 0; } - TCPWB_SENT(wrb) = 0; + TCP_WBSENT(wrb) = 0; ninfo("REXMIT: wrb=%p sent=%u, conn unacked=%d sent=%d\n", - wrb, TCPWB_SENT(wrb), conn->unacked, conn->sent); + wrb, TCP_WBSENT(wrb), conn->unacked, conn->sent); /* Free any write buffers that have exceed the retry count */ - if (++TCPWB_NRTX(wrb) >= TCP_MAXRTX) + if (++TCP_WBNRTX(wrb) >= TCP_MAXRTX) { nwarn("WARNING: Expiring wrb=%p nrtx=%u\n", - wrb, TCPWB_NRTX(wrb)); + wrb, TCP_WBNRTX(wrb)); /* Return the write buffer to the free list */ @@ -672,7 +672,7 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, * is pulled from the write_q again. */ - ninfo("REXMIT: Moving wrb=%p nrtx=%u\n", wrb, TCPWB_NRTX(wrb)); + ninfo("REXMIT: Moving wrb=%p nrtx=%u\n", wrb, TCP_WBNRTX(wrb)); psock_insert_segment(wrb, &conn->write_q); } @@ -727,7 +727,7 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, * window size. */ - sndlen = TCPWB_PKTLEN(wrb) - TCPWB_SENT(wrb); + sndlen = TCP_WBPKTLEN(wrb) - TCP_WBSENT(wrb); if (sndlen > conn->mss) { sndlen = conn->mss; @@ -739,16 +739,16 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, } ninfo("SEND: wrb=%p pktlen=%u sent=%u sndlen=%u\n", - wrb, TCPWB_PKTLEN(wrb), TCPWB_SENT(wrb), sndlen); + wrb, TCP_WBPKTLEN(wrb), TCP_WBSENT(wrb), sndlen); /* Set the sequence number for this segment. If we are * retransmitting, then the sequence number will already * be set for this write buffer. */ - if (TCPWB_SEQNO(wrb) == (unsigned)-1) + if (TCP_WBSEQNO(wrb) == (unsigned)-1) { - TCPWB_SEQNO(wrb) = conn->isn + conn->sent; + TCP_WBSEQNO(wrb) = conn->isn + conn->sent; } /* The TCP stack updates sndseq on receipt of ACK *before* @@ -758,7 +758,7 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, * before the packet is sent. */ - tcp_setsequence(conn->sndseq, TCPWB_SEQNO(wrb) + TCPWB_SENT(wrb)); + tcp_setsequence(conn->sndseq, TCP_WBSEQNO(wrb) + TCP_WBSENT(wrb)); #ifdef NEED_IPDOMAIN_SUPPORT /* If both IPv4 and IPv6 support are enabled, then we will need to @@ -774,7 +774,7 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, * won't actually happen until the polling cycle completes). */ - devif_iob_send(dev, TCPWB_IOB(wrb), sndlen, TCPWB_SENT(wrb)); + devif_iob_send(dev, TCP_WBIOB(wrb), sndlen, TCP_WBSENT(wrb)); /* Remember how much data we send out now so that we know * when everything has been acknowledged. Just increment @@ -796,21 +796,21 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, } ninfo("SEND: wrb=%p nrtx=%u unacked=%u sent=%u\n", - wrb, TCPWB_NRTX(wrb), conn->unacked, conn->sent); + wrb, TCP_WBNRTX(wrb), conn->unacked, conn->sent); /* Increment the count of bytes sent from this write buffer */ - TCPWB_SENT(wrb) += sndlen; + TCP_WBSENT(wrb) += sndlen; ninfo("SEND: wrb=%p sent=%u pktlen=%u\n", - wrb, TCPWB_SENT(wrb), TCPWB_PKTLEN(wrb)); + wrb, TCP_WBSENT(wrb), TCP_WBPKTLEN(wrb)); /* Remove the write buffer from the write queue if the * last of the data has been sent from the buffer. */ - DEBUGASSERT(TCPWB_SENT(wrb) <= TCPWB_PKTLEN(wrb)); - if (TCPWB_SENT(wrb) >= TCPWB_PKTLEN(wrb)) + DEBUGASSERT(TCP_WBSENT(wrb) <= TCP_WBPKTLEN(wrb)); + if (TCP_WBSENT(wrb) >= TCP_WBPKTLEN(wrb)) { FAR struct tcp_wrbuffer_s *tmp; @@ -1061,8 +1061,8 @@ ssize_t psock_tcp_send(FAR struct socket *psock, FAR const void *buf, /* Initialize the write buffer */ - TCPWB_SEQNO(wrb) = (unsigned)-1; - TCPWB_NRTX(wrb) = 0; + TCP_WBSEQNO(wrb) = (unsigned)-1; + TCP_WBNRTX(wrb) = 0; /* Copy the user data into the write buffer. We cannot wait for * buffer space if the socket was opened non-blocking. @@ -1070,16 +1070,16 @@ ssize_t psock_tcp_send(FAR struct socket *psock, FAR const void *buf, if (_SS_ISNONBLOCK(psock->s_flags)) { - result = TCPWB_TRYCOPYIN(wrb, (FAR uint8_t *)buf, len); + result = TCP_WBTRYCOPYIN(wrb, (FAR uint8_t *)buf, len); } else { - result = TCPWB_COPYIN(wrb, (FAR uint8_t *)buf, len); + result = TCP_WBCOPYIN(wrb, (FAR uint8_t *)buf, len); } /* Dump I/O buffer chain */ - TCPWB_DUMP("I/O buffer chain", wrb, TCPWB_PKTLEN(wrb), 0); + TCP_WBDUMP("I/O buffer chain", wrb, TCP_WBPKTLEN(wrb), 0); /* psock_send_eventhandler() will send data in FIFO order from the * conn->write_q @@ -1087,7 +1087,7 @@ ssize_t psock_tcp_send(FAR struct socket *psock, FAR const void *buf, sq_addlast(&wrb->wb_node, &conn->write_q); ninfo("Queued WRB=%p pktlen=%u write_q(%p,%p)\n", - wrb, TCPWB_PKTLEN(wrb), + wrb, TCP_WBPKTLEN(wrb), conn->write_q.head, conn->write_q.tail); /* Notify the device driver of the availability of TX data */ diff --git a/net/tcp/tcp_wrbuffer_dump.c b/net/tcp/tcp_wrbuffer_dump.c index a27bb60253..1af7657395 100644 --- a/net/tcp/tcp_wrbuffer_dump.c +++ b/net/tcp/tcp_wrbuffer_dump.c @@ -64,8 +64,8 @@ void tcp_wrbuffer_dump(FAR const char *msg, FAR struct tcp_wrbuffer_s *wrb, unsigned int len, unsigned int offset) { syslog(LOG_DEBUG, "%s: wrb=%p segno=%d sent=%d nrtx=%d\n", - msg, wrb, TCPWB_SEQNO(wrb), TCPWB_SENT(wrb), TCPWB_NRTX(wrb)); - iob_dump("I/O Buffer Chain", TCPWB_IOB(wrb), len, offset); + msg, wrb, TCP_WBSEQNO(wrb), TCP_WBSENT(wrb), TCP_WBNRTX(wrb)); + iob_dump("I/O Buffer Chain", TCP_WBIOB(wrb), len, offset); } #endif /* CONFIG_DEBUG_FEATURES */ diff --git a/net/udp/udp.h b/net/udp/udp.h index ee591ed078..f670f7bbfb 100644 --- a/net/udp/udp.h +++ b/net/udp/udp.h @@ -71,10 +71,10 @@ /* UDP write buffer dump macros */ # ifdef CONFIG_DEBUG_FEATURES -# define UDPWB_DUMP(msg,wrb,len,offset) \ +# define UDP_WBDUMP(msg,wrb,len,offset) \ udp_wrbuffer_dump(msg,wrb,len,offset) # else -# define UDPWB_DUMP(msg,wrb,len,offset) +# define UDP_WBDUMP(msg,wrb,len,offset) # endif #endif diff --git a/net/udp/udp_psock_sendto_buffered.c b/net/udp/udp_psock_sendto_buffered.c index b084837b6e..29308e1274 100644 --- a/net/udp/udp_psock_sendto_buffered.c +++ b/net/udp/udp_psock_sendto_buffered.c @@ -97,8 +97,8 @@ # define BUF_DUMP(msg,buf,len) lib_dumpbuffer(msg,buf,len) #else # define BUF_DUMP(msg,buf,len) -# undef UDPWB_DUMP -# define UDPWB_DUMP(msg,wrb,len,offset) +# undef UDP_WBDUMP +# define UDP_WBDUMP(msg,wrb,len,offset) #endif /**************************************************************************** @@ -747,7 +747,7 @@ ssize_t psock_udp_sendto(FAR struct socket *psock, FAR const void *buf, /* Dump I/O buffer chain */ - UDPWB_DUMP("I/O buffer chain", wrb, wrb->wb_iob->io_pktlen, 0); + UDP_WBDUMP("I/O buffer chain", wrb, wrb->wb_iob->io_pktlen, 0); /* sendto_eventhandler() will send data in FIFO order from the * conn->write_q -- GitLab From f2017bded845c25ed880014873ab018cb1848a0e Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 23 Jan 2018 07:32:17 -0600 Subject: [PATCH 064/228] net/udp: UDP write buffering is basically functional but needs a lot more verification. --- net/udp/Kconfig | 1 - net/udp/udp.h | 9 ++-- net/udp/udp_psock_sendto_buffered.c | 75 ++++++++--------------------- 3 files changed, 24 insertions(+), 61 deletions(-) diff --git a/net/udp/Kconfig b/net/udp/Kconfig index 16d40a72ef..7deccfc4ca 100644 --- a/net/udp/Kconfig +++ b/net/udp/Kconfig @@ -52,7 +52,6 @@ config NET_UDP_WRITE_BUFFERS default n select NET_WRITE_BUFFERS select MM_IOB - depends on EXPERIMENTAL ---help--- Write buffers allows buffering of ongoing UDP/IP packets, providing for higher performance, streamed output. diff --git a/net/udp/udp.h b/net/udp/udp.h index f670f7bbfb..24be51dc21 100644 --- a/net/udp/udp.h +++ b/net/udp/udp.h @@ -43,6 +43,7 @@ #include #include +#include #include #include @@ -137,12 +138,12 @@ struct udp_conn_s #ifdef CONFIG_NET_UDP_WRITE_BUFFERS struct udp_wrbuffer_s { - sq_entry_t wb_node; /* Supports a singly linked list */ - union ip_addr_u wb_dest; /* Destination address */ + sq_entry_t wb_node; /* Supports a singly linked list */ + struct sockaddr_storage wb_dest; /* Destination address */ #ifdef CONFIG_NET_SOCKOPTS - systime_t wb_start; /* Start time for timeout calculation */ + systime_t wb_start; /* Start time for timeout calculation */ #endif - struct iob_s *wb_iob; /* Head of the I/O buffer chain */ + struct iob_s *wb_iob; /* Head of the I/O buffer chain */ }; #endif diff --git a/net/udp/udp_psock_sendto_buffered.c b/net/udp/udp_psock_sendto_buffered.c index 29308e1274..9f8716d355 100644 --- a/net/udp/udp_psock_sendto_buffered.c +++ b/net/udp/udp_psock_sendto_buffered.c @@ -124,8 +124,6 @@ static int sendto_next_transfer(FAR struct socket *psock, static uint16_t sendto_eventhandler(FAR struct net_driver_s *dev, FAR void *pvconn, FAR void *pvpriv, uint16_t flags); -static inline void sendto_txnotify(FAR struct socket *psock, - FAR struct udp_conn_s *conn); /**************************************************************************** * Private Functions @@ -378,9 +376,13 @@ static int sendto_next_transfer(FAR struct socket *psock, */ wrb = (FAR struct udp_wrbuffer_s *)sq_peek(&conn->write_q); - DEBUGASSERT(wrb != NULL); + if (wrb == NULL) + { + ninfo("Write buffer queue is empty\n"); + return -ENOENT; + } - ret = udp_connect(conn, (FAR const struct sockaddr *)wrb->wb_iob->io_data); + ret = udp_connect(conn, (FAR const struct sockaddr *)&wrb->wb_dest); if (ret < 0) { nerr("ERROR: udp_connect failed: %d\n", ret); @@ -443,6 +445,10 @@ static int sendto_next_transfer(FAR struct socket *psock, psock->s_sndcb->flags = (UDP_POLL | NETDEV_DOWN); psock->s_sndcb->priv = (FAR void *)psock; psock->s_sndcb->event = sendto_eventhandler; + + /* Notify the device driver of the availability of TX data */ + + netdev_txnotify_dev(dev); return OK; } @@ -499,7 +505,7 @@ static uint16_t sendto_eventhandler(FAR struct net_driver_s *dev, * buffers to send. */ - if (dev->d_sndlen <= 0 && (flags & UDP_NEWDATA) != 0 && + if (dev->d_sndlen <= 0 && (flags & UDP_NEWDATA) == 0 && (flags & UDP_POLL) != 0 && !sq_empty(&conn->write_q)) { /* Check if the destination IP address is in the ARP or Neighbor @@ -576,53 +582,6 @@ static uint16_t sendto_eventhandler(FAR struct net_driver_s *dev, return flags; } -/**************************************************************************** - * Name: sendto_txnotify - * - * Description: - * Notify the appropriate device driver that we are have data ready to - * be send (UDP) - * - * Parameters: - * psock - Socket state structure - * conn - The UDP connection structure - * - * Returned Value: - * None - * - ****************************************************************************/ - -static inline void sendto_txnotify(FAR struct socket *psock, - FAR struct udp_conn_s *conn) -{ -#ifdef CONFIG_NET_IPv4 -#ifdef CONFIG_NET_IPv6 - /* If both IPv4 and IPv6 support are enabled, then we will need to select - * the device driver using the appropriate IP domain. - */ - - if (psock->s_domain == PF_INET) -#endif - { - /* Notify the device driver that send data is available */ - - netdev_ipv4_txnotify(conn->u.ipv4.laddr, conn->u.ipv4.raddr); - } -#endif /* CONFIG_NET_IPv4 */ - -#ifdef CONFIG_NET_IPv6 -#ifdef CONFIG_NET_IPv4 - else /* if (psock->s_domain == PF_INET6) */ -#endif /* CONFIG_NET_IPv4 */ - { - /* Notify the device driver that send data is available */ - - DEBUGASSERT(psock->s_domain == PF_INET6); - netdev_ipv6_txnotify(conn->u.ipv6.laddr, conn->u.ipv6.raddr); - } -#endif /* CONFIG_NET_IPv6 */ -} - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -750,7 +709,14 @@ ssize_t psock_udp_sendto(FAR struct socket *psock, FAR const void *buf, UDP_WBDUMP("I/O buffer chain", wrb, wrb->wb_iob->io_pktlen, 0); /* sendto_eventhandler() will send data in FIFO order from the - * conn->write_q + * conn->write_q. + * + * REVISIT: Why FIFO order? Because it is easy. In a real world + * environment where there are multiple network devices this might + * be inefficient because we could be sending data to different + * device out-of-queued-order to optimize performance. Sending + * data to different networks from a single UDP socket is probably + * not a very common use case, however. */ sq_addlast(&wrb->wb_node, &conn->write_q); @@ -770,9 +736,6 @@ ssize_t psock_udp_sendto(FAR struct socket *psock, FAR const void *buf, goto errout_with_wrb; } - /* Notify the device driver of the availability of TX data */ - - sendto_txnotify(psock, conn); net_unlock(); } -- GitLab From 82cb799bb6d0a06f2181f4dc63ab95a4859eab8b Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 23 Jan 2018 11:54:03 -0600 Subject: [PATCH 065/228] net/udp: Fix memory leak with UDP + write buffer is closed. Also update TODO and comments and refresh a configuration. --- TODO | 30 +++++++++------------ configs/viewtool-stm32f107/README.txt | 6 ----- configs/viewtool-stm32f107/netnsh/defconfig | 14 +++++++--- net/inet/inet_close.c | 18 +++++++++++-- net/tcp/tcp_netpoll.c | 6 ++++- net/udp/udp_netpoll.c | 6 ++++- 6 files changed, 49 insertions(+), 31 deletions(-) diff --git a/TODO b/TODO index dd4dca76ac..b5ab5f89da 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,4 @@ -NuttX TODO List (Last updated January 21, 2018) +NuttX TODO List (Last updated January 23, 2018) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This file summarizes known NuttX bugs, limitations, inconsistencies with @@ -19,7 +19,7 @@ nuttx/: (8) Kernel/Protected Build (3) C++ Support (6) Binary loaders (binfmt/) - (17) Network (net/, drivers/net) + (16) Network (net/, drivers/net) (4) USB (drivers/usbdev, drivers/usbhost) (0) Other drivers (drivers/) (12) Libraries (libc/, libm/) @@ -1075,23 +1075,19 @@ o Network (net/, drivers/net) Title: POLL/SELECT ON TCP/UDP SOCKETS NEEDS READ-AHEAD Description: poll()/select() only works for availability of buffered TCP/UDP read data (when read-ahead is enabled). The way writing is - handled in the network layer, all sockets must wait when send and - cannot be notified when they can send without waiting. + handled in the network layer, either (1) If CONFIG_UDP/TCP_WRITE_BUFFERS=y + then we never have to wait to send; otherwise, we always have + to wait to send. So it is impossible to notify the caller + when it can send without waiting. + + An exception "never having to wait" is the case where we are + out of memory for use in write buffering. In that case, the + blocking send()/sendto() would have to wait for the memory + to become available. Status: Open, probably will not be fixed. Priority: Medium... this does effect porting of applications that expect different behavior from poll()/select() - Title: SOCKETS DO NOT ALWAYS SUPPORT O_NONBLOCK - Description: sockets do not support all modes for O_NONBLOCK. Sockets - support nonblocking operations only (1) for TCP/IP non- - blocking read operations when read-ahead buffering is - enabled, (2) TCP/IP accept() operations when TCP/IP - connection backlog is enabled, (2) UDP/IP read() operations - when UDP read-ahead is enabled, and (3) non-blocking - operations on Unix domain sockets. - Status: Open - Priority: Low. - Title: INTERFACES TO LEAVE/JOIN IGMP MULTICAST GROUP Description: The interfaces used to leave/join IGMP multicast groups is non-standard. RFC3678 (IGMPv3) suggests ioctl() commands to do this (SIOCSIPMSFILTER) but @@ -1124,8 +1120,8 @@ o Network (net/, drivers/net) however. Others support the address filtering interfaces but have never been verifed: - C5471, LM3S, ez80, DM0x90 NIC, PIC: Do not support address - filtering. + C5471, LM3S, ez80, DM0x90 NIC, PIC, LPC54: Do not support + address filtering. Kinetis, LPC17xx, LPC43xx: Untested address filter support Status: Open diff --git a/configs/viewtool-stm32f107/README.txt b/configs/viewtool-stm32f107/README.txt index 3bb13a3166..42faf94f79 100644 --- a/configs/viewtool-stm32f107/README.txt +++ b/configs/viewtool-stm32f107/README.txt @@ -630,12 +630,6 @@ Configurations 6. USB support is disabled by default. See the section above entitled, "USB Interface" - STATUS. The first time I build the configuration, I get some undefined - external references. No idea why. Simply cleaning the apps/ directory - and rebuilding fixes the problem: - - make apps_clean all - nsh: This configuration directory provide the basic NuttShell (NSH). diff --git a/configs/viewtool-stm32f107/netnsh/defconfig b/configs/viewtool-stm32f107/netnsh/defconfig index 131d3b620b..72a2921d02 100644 --- a/configs/viewtool-stm32f107/netnsh/defconfig +++ b/configs/viewtool-stm32f107/netnsh/defconfig @@ -1,5 +1,4 @@ # CONFIG_NSH_ARGCAT is not set -# CONFIG_NSH_CMDOPT_DF_H is not set # CONFIG_NSH_CMDOPT_HEXDUMP is not set # CONFIG_NSH_CMDPARMS is not set CONFIG_ARCH_BOARD_VIEWTOOL_STM32F107=y @@ -23,9 +22,15 @@ CONFIG_NET_ARP_SEND=y CONFIG_NET_BROADCAST=y CONFIG_NET_ETH_MTU=650 CONFIG_NET_ETH_TCP_RECVWNDO=624 +CONFIG_NET_HOSTNAME="Viewtool-STM32F107" CONFIG_NET_ICMP_SOCKET=y CONFIG_NET_ICMP=y +CONFIG_NET_ICMPv6_NEIGHBOR=y +CONFIG_NET_ICMPv6_SOCKET=y +CONFIG_NET_ICMPv6=y +CONFIG_NET_IPv6=y CONFIG_NET_MAX_LISTENPORTS=40 +CONFIG_NET_ROUTE=y CONFIG_NET_SOCKOPTS=y CONFIG_NET_TCP_CONNS=40 CONFIG_NET_TCP_WRITE_BUFFERS=y @@ -56,9 +61,9 @@ CONFIG_SCHED_HPWORK=y CONFIG_SCHED_HPWORKPRIORITY=192 CONFIG_SCHED_HPWORKSTACKSIZE=1024 CONFIG_SDCLONE_DISABLE=y -CONFIG_START_DAY=21 -CONFIG_START_MONTH=9 -CONFIG_START_YEAR=2009 +CONFIG_START_DAY=23 +CONFIG_START_MONTH=1 +CONFIG_START_YEAR=2018 CONFIG_STM32_ETHMAC=y CONFIG_STM32_JTAG_FULL_ENABLE=y CONFIG_STM32_PHYSR_100MBPS=0x0000 @@ -70,6 +75,7 @@ CONFIG_STM32_PWR=y CONFIG_STM32_RMII_EXTCLK=y CONFIG_STM32_USART1=y CONFIG_SYSTEM_PING=y +CONFIG_SYSTEM_PING6=y CONFIG_TASK_NAME_SIZE=0 CONFIG_USART1_SERIAL_CONSOLE=y CONFIG_USER_ENTRYPOINT="nsh_main" diff --git a/net/inet/inet_close.c b/net/inet/inet_close.c index a36089e541..14c463c628 100644 --- a/net/inet/inet_close.c +++ b/net/inet/inet_close.c @@ -345,7 +345,7 @@ static inline int tcp_close_disconnect(FAR struct socket *psock) #ifdef CONFIG_NET_TCP_WRITE_BUFFERS /* If we have a semi-permanent write buffer callback in place, then - * is needs to be be nullifed. + * is needs to be be nullified. * * Commit f1ef2c6cdeb032eaa1833cc534a63b50c5058270: * "When a socket is closed, it should make sure that any pending write @@ -357,6 +357,9 @@ static inline int tcp_close_disconnect(FAR struct socket *psock) * data. However, to be able to actually send any new data, the send * callback must be left. The callback should be freed later when the * socket is actually destroyed." + * + * REVISIT: Where and how exactly is s_sndcb ever freed? Is there a + * memory leak here? */ psock->s_sndcb = NULL; @@ -548,7 +551,18 @@ int inet_close(FAR struct socket *psock) if (conn->crefs <= 1) { - /* Yes... free the connection structure */ + /* Yes... */ + +#ifdef CONFIG_NET_UDP_WRITE_BUFFERS + /* Free any semi-permanent write buffer callback in place. */ + + if (psock->s_sndcb != NULL) + { + udp_callback_free(conn->dev, conn, psock->s_sndcb); + psock->s_sndcb = NULL; + } +#endif + /* And free the connection structure */ conn->crefs = 0; udp_free(psock->s_conn); diff --git a/net/tcp/tcp_netpoll.c b/net/tcp/tcp_netpoll.c index 615fb84b56..3979cf7c8d 100644 --- a/net/tcp/tcp_netpoll.c +++ b/net/tcp/tcp_netpoll.c @@ -112,7 +112,11 @@ static uint16_t tcp_poll_eventhandler(FAR struct net_driver_s *dev, eventset |= POLLIN & info->fds->events; } - /* A poll is a sign that we are free to send data. */ + /* A poll is a sign that we are free to send data. + * REVISIT: This is bogus: If CONFIG_TCP_WRITE_BUFFERS=y then + * we never have to wait to send; otherwise, we always have to + * wait to send. Receiving a poll is irrelevant. + */ if ((flags & TCP_POLL) != 0) { diff --git a/net/udp/udp_netpoll.c b/net/udp/udp_netpoll.c index 0145c3303e..1479a00b96 100644 --- a/net/udp/udp_netpoll.c +++ b/net/udp/udp_netpoll.c @@ -111,7 +111,11 @@ static uint16_t udp_poll_eventhandler(FAR struct net_driver_s *dev, eventset |= (POLLIN & info->fds->events); } - /* poll is a sign that we are free to send data. */ + /* A poll is a sign that we are free to send data. + * REVISIT: This is bogus: If CONFIG_UDP_WRITE_BUFFERS=y then + * we never have to wait to send; otherwise, we always have to + * wait to send. Receiving a poll is irrelevant. + */ if ((flags & UDP_POLL) != 0) { -- GitLab From 5e49e9e93793e5b0d6ecca15be2d1aaf0c94a3cc Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 24 Jan 2018 06:50:20 -0600 Subject: [PATCH 066/228] Update some comments. --- net/inet/inet_sockif.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/net/inet/inet_sockif.c b/net/inet/inet_sockif.c index 9ab4be7336..d9c56ad76d 100644 --- a/net/inet/inet_sockif.c +++ b/net/inet/inet_sockif.c @@ -286,6 +286,10 @@ static sockcaps_t inet_sockcaps(FAR struct socket *psock) { #ifdef NET_TCP_HAVE_STACK case SOCK_STREAM: + /* REVISIT: Non-blocking recv() depends on CONFIG_NET_TCP_READAHEAD, + * but non-blocking send() depends on CONFIG_NET_TCP_WRITE_BUFFERS. + */ + #ifdef CONFIG_NET_TCP_READAHEAD return SOCKCAP_NONBLOCKING; #else @@ -295,6 +299,10 @@ static sockcaps_t inet_sockcaps(FAR struct socket *psock) #ifdef NET_UDP_HAVE_STACK case SOCK_DGRAM: + /* REVISIT: Non-blocking recvfrom() depends on CONFIG_NET_UDP_READAHEAD, + * but non-blocking sendto() depends on CONFIG_NET_UDP_WRITE_BUFFERS. + */ + #ifdef CONFIG_NET_UDP_READAHEAD return SOCKCAP_NONBLOCKING; #else -- GitLab From a7834bcb7b82aa3bafd1585b2adf00b2e8f6c292 Mon Sep 17 00:00:00 2001 From: Alexander Oryshchenko Date: Wed, 24 Jan 2018 06:51:34 -0600 Subject: [PATCH 067/228] drivers/mtd/at24xx.c: Correct page size for AT24C02 part. --- drivers/mtd/at24xx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/at24xx.c b/drivers/mtd/at24xx.c index f08cec9d61..a09b948db2 100644 --- a/drivers/mtd/at24xx.c +++ b/drivers/mtd/at24xx.c @@ -86,9 +86,9 @@ /* Get the part configuration based on the size configuration */ -#if CONFIG_AT24XX_SIZE == 2 /* AT24C02: 2Kbits = 256; 16 * 16 = 256 */ -# define AT24XX_NPAGES 16 -# define AT24XX_PAGESIZE 16 +#if CONFIG_AT24XX_SIZE == 2 /* AT24C02: 2Kbits = 256; 32 * 8 = 256 */ +# define AT24XX_NPAGES 32 +# define AT24XX_PAGESIZE 8 # define AT24XX_ADDRSIZE 1 #elif CONFIG_AT24XX_SIZE == 4 /* AT24C04: 4Kbits = 512B; 32 * 16 = 512 */ # define AT24XX_NPAGES 32 -- GitLab From dd4fc9f5c3578ba829a8465dca2f8557365662f4 Mon Sep 17 00:00:00 2001 From: Alexander Oryshchenko Date: Wed, 24 Jan 2018 06:55:14 -0600 Subject: [PATCH 068/228] arch/arm/src/stm32: Make STM32 usable with an external RTC. drivers/timers/ds3231.c: Correct some debug statments. --- arch/arm/src/stm32/stm32_irq.c | 2 +- arch/arm/src/stm32/stm32f40xxx_rtcc.c | 5 +++-- drivers/timers/ds3231.c | 12 ++++++------ 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/arch/arm/src/stm32/stm32_irq.c b/arch/arm/src/stm32/stm32_irq.c index 98adf74f36..402351aafa 100644 --- a/arch/arm/src/stm32/stm32_irq.c +++ b/arch/arm/src/stm32/stm32_irq.c @@ -387,7 +387,7 @@ void up_irqinitialize(void) up_enable_irq(STM32_IRQ_MEMFAULT); #endif -#ifdef CONFIG_RTC +#if defined(CONFIG_RTC) && !defined(CONFIG_RTC_EXTERNAL) /* RTC was initialized earlier but IRQs weren't ready at that time */ stm32_rtc_irqinitialize(); diff --git a/arch/arm/src/stm32/stm32f40xxx_rtcc.c b/arch/arm/src/stm32/stm32f40xxx_rtcc.c index 8657d6e166..460a3872d8 100644 --- a/arch/arm/src/stm32/stm32f40xxx_rtcc.c +++ b/arch/arm/src/stm32/stm32f40xxx_rtcc.c @@ -58,7 +58,7 @@ #include -#ifdef CONFIG_RTC +#if defined(CONFIG_RTC) && !defined(CONFIG_RTC_EXTERNAL) /**************************************************************************** * Pre-processor Definitions @@ -1659,4 +1659,5 @@ int stm32_rtc_rdalarm(FAR struct alm_rdalarm_s *alminfo) } #endif -#endif /* CONFIG_RTC */ +#endif /* CONFIG_RTC && !CONFIG_RTC_EXTERNAL */ + diff --git a/drivers/timers/ds3231.c b/drivers/timers/ds3231.c index 4f1e2a1c9f..113fb97743 100644 --- a/drivers/timers/ds3231.c +++ b/drivers/timers/ds3231.c @@ -321,7 +321,7 @@ int up_rtc_getdatetime(FAR struct tm *tp) ret = I2C_TRANSFER(g_ds3231.i2c, msg, 4); if (ret < 0) { - rtcerr("ERROR: I2C_TRANSFER failed: %d\n", ret) + rtcerr("ERROR: I2C_TRANSFER failed: %d\n", ret); return ret; } } @@ -415,7 +415,7 @@ int up_rtc_settime(FAR const struct timespec *tp) return -EAGAIN; } - rtc_dumptime(tp, "Setting time"); + rtcinfo("Setting time tp=(%d,%d)\n", (int)tp->tv_sec, (int)tp->tv_nsec); /* Get the broken out time */ @@ -430,18 +430,18 @@ int up_rtc_settime(FAR const struct timespec *tp) #ifdef CONFIG_LIBC_LOCALTIME if (localtime_r(&newtime, &newtm) == NULL) { - rtcerr("ERROR: localtime_r failed\n") + rtcerr("ERROR: localtime_r failed\n"); return -EINVAL; } #else if (gmtime_r(&newtime, &newtm) == NULL) { - rtcerr("ERROR: gmtime_r failed\n") + rtcerr("ERROR: gmtime_r failed\n"); return -EINVAL; } #endif - rtc_dumptime(&tm, "New time"); + rtc_dumptime(&newtm, "New time"); /* Construct the message */ /* Write starting with the seconds regiser */ @@ -536,7 +536,7 @@ int up_rtc_settime(FAR const struct timespec *tp) ret = I2C_TRANSFER(g_ds3231.i2c, msg, 3); if (ret < 0) { - rtcerr("ERROR: I2C_TRANSFER failed: %d\n", ret) + rtcerr("ERROR: I2C_TRANSFER failed: %d\n", ret); return ret; } } -- GitLab From a7e56359a4af0ddd00511fd9b98720c7fc027b3e Mon Sep 17 00:00:00 2001 From: Alexander Oryshchenko Date: Wed, 24 Jan 2018 06:57:17 -0600 Subject: [PATCH 069/228] arch/arm/src/stm32/stm32_spi.c: Removed unnecessary (and incorrect) speed limitation --- arch/arm/src/stm32/stm32_spi.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/arch/arm/src/stm32/stm32_spi.c b/arch/arm/src/stm32/stm32_spi.c index 71f6dbfb3a..1be51d49c2 100644 --- a/arch/arm/src/stm32/stm32_spi.c +++ b/arch/arm/src/stm32/stm32_spi.c @@ -1122,13 +1122,6 @@ static uint32_t spi_setfrequency(FAR struct spi_dev_s *dev, uint32_t frequency) uint16_t setbits; uint32_t actual; - /* Limit to max possible (if STM32_SPI_CLK_MAX is defined in board.h) */ - - if (frequency > STM32_SPI_CLK_MAX) - { - frequency = STM32_SPI_CLK_MAX; - } - /* Has the frequency changed? */ if (frequency != priv->frequency) -- GitLab From d1cfcabb1f9e6cc1aa8fb7718dfcb9962d1780e7 Mon Sep 17 00:00:00 2001 From: Alexander Oryshchenko Date: Wed, 24 Jan 2018 06:58:47 -0600 Subject: [PATCH 070/228] arch/arm/src/stm32/stm32f40xxx_i2c.c: Correct some recent changes to STM32F4 I2C that broke poll mode of operation. --- arch/arm/src/stm32/stm32f40xxx_i2c.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/src/stm32/stm32f40xxx_i2c.c b/arch/arm/src/stm32/stm32f40xxx_i2c.c index 86de66e7f5..9317b3608c 100644 --- a/arch/arm/src/stm32/stm32f40xxx_i2c.c +++ b/arch/arm/src/stm32/stm32f40xxx_i2c.c @@ -1273,7 +1273,7 @@ static int stm32_i2c_isr_process(struct stm32_i2c_priv_s *priv) if (priv->dcnt == -1 && priv->msgc != 0 && (status & I2C_SR1_SB) == 0) { -#ifdef CONFIG_STM32_I2C_DMA +#if defined(CONFIG_STM32_I2C_DMA) || defined(CONFIG_I2C_POLLED) return OK; #else priv->status |= I2C_SR1_TIMEOUT; @@ -2049,7 +2049,7 @@ static int stm32_i2c_isr_process(struct stm32_i2c_priv_s *priv) /* Clear interrupt flags */ -#ifndef CONFIG_STM32_I2C_DMA +#if !defined(CONFIG_STM32_I2C_DMA) && !defined(CONFIG_I2C_POLLED) state_error: #endif stm32_i2c_putreg(priv, STM32_I2C_SR1_OFFSET, 0); -- GitLab From cafb5272629b093a56860d6e6f03cfc2a97e87a7 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 24 Jan 2018 08:52:40 -0600 Subject: [PATCH 071/228] configs/flipnclick-sam3x: Using JTAG (vs. Bossac) I was finally able to load code and verify the basic NSH configuration. Updated READMEs. Also switched to USART0 (vs UART0) for the serial console because I was not getting bi-directional communication on the VCOM. --- configs/arduino-due/README.txt | 6 +++ configs/flipnclick-sam3x/README.txt | 70 +++++++++++++++++--------- configs/flipnclick-sam3x/nsh/defconfig | 4 +- configs/freedom-k64f/README.txt | 2 +- configs/freedom-k66f/README.txt | 5 +- 5 files changed, 59 insertions(+), 28 deletions(-) diff --git a/configs/arduino-due/README.txt b/configs/arduino-due/README.txt index bb6d7f08aa..0de6bcb4d2 100644 --- a/configs/arduino-due/README.txt +++ b/configs/arduino-due/README.txt @@ -330,6 +330,12 @@ Serial Consoles Loading Code ============ + [NOTE: I believe that there have been significant changes to the more + recent tool environment such that Bossac may no longer be usable. I + don't know that for certain and perhaps someone with more knowledge of + the tools than I could make this work. See the Flip'n'Clip SAM3X README + file for additional information.] + Installing the Arduino USB Driver under Windows: ------------------------------------------------ diff --git a/configs/flipnclick-sam3x/README.txt b/configs/flipnclick-sam3x/README.txt index 6cbf47b569..8ab7a159a8 100644 --- a/configs/flipnclick-sam3x/README.txt +++ b/configs/flipnclick-sam3x/README.txt @@ -22,23 +22,11 @@ STATUS ====== 2018-01-07: Created the configuration. At present it does not work; I - believe because of tool-related issues. I do the following: - - a) Open TeraTerm, select COM7 at 1200 baud, type a few ENTERs, and - close teraterm. - - b) Execute the following command which claims to have successfully - written to FLASH. - - bossac.exe --info --debug --port COM7 --usb-port=0 --erase --write --verify -b nuttx.bin -R - - But the code does not boot. There is no indication of life. - - c) Repeat a) then - - bossac.exe --info --debug --port COM7 --usb-port=0 --verify -b nuttx.bin - - And it says that the content of the FLASH is not good. + believe because of tool-related issues. See discussion under "Loading + Code" below. + 2018-01-24: I ordered a JTAG connector and soldered that to the Flip'n'Click + and I am now successfully able to load code. The NSH configuration appears + to be fully functional. Buttons and LEDs ================ @@ -99,10 +87,11 @@ Serial Consoles serial chip connected to the first of the MCU (RX0 and TX0 on PA8 and PA9, respectively). The output from that port is visible using the Arduino tool. - Any of UART and USART0-3 may be used as a serial console. By default, - UART0 is used as the serial console in all configurations. But that is - easily changed by modifying the configuration as described under - "Configurations" below. + [NOTE: My experience so far: I get serial output on the virtual COM port + via the UART, but I receive no serial input for keyboard data entered in + the PC serial terminal. I have not investigated this problem. It may + be something as simple as the Rx pin configuration. Instead, I just + switched to USART0.] Other convenient U[S]ARTs that may be used as the Serial console include: @@ -125,9 +114,22 @@ Serial Consoles transceiver to get the signals to RS232 levels (or connect to the USB virtual COM port in the case of UART0). + Any of UART and USART0-3 may be used as a serial console. UART0 would + be the preferred default console setting. However, due to the communication + problems mentioned above, USART0 is used as the default serial console + in all configurations. But that is easily changed by modifying the + configuration as described under "Configurations" below. + Loading Code ============ + [NOTE: This text was mostly copied from the Arduino Due README.txt. I + believe, however, that there have been significant changes to the + tool environment such that Bossac may no longer be usable. I don't + know that for certain and perhaps someone with more knowledge of + the tools than I could make this work. See STATUS below for the + current issues that I see.] + Installing the Arduino USB Driver under Windows ----------------------------------------------- @@ -302,6 +304,25 @@ Loading Code $ bossac.exe --port=COM7 --usb-port=false --boot=1 Set boot flash true + STATUS: + At present this procedure does not work. I do the following: + + a) Open TeraTerm, select COM7 at 1200 baud, type a few ENTERs, and + close teraterm. + + b) Execute the following command which claims to have successfully + written to FLASH. + + bossac.exe --info --debug --port COM7 --usb-port=0 --erase --write --verify -b nuttx.bin -R + + But the code does not boot. There is no indication of life. + + c) Repeat a) then + + bossac.exe --info --debug --port COM7 --usb-port=0 --verify -b nuttx.bin + + And it says that the content of the FLASH is not good. + Uploading NuttX to the Flip&Click Using JTAG -------------------------------------------- @@ -465,15 +486,16 @@ Configurations reconfiguration process. 2. Unless stated otherwise, all configurations generate console - output on UART0 which is available both on the USB virtual COM port - and on the PWML connector (see the section "Serial Consoles" above). + output on USART0 which is available either on the Arduion Shield + connector or on mikroBUS A as described above in the section entitled + "Serial Consoles". 3. Unless otherwise stated, the configurations are setup for Cygwin under Windows: Build Setup: CONFIG_HOST_WINDOWS=y : Microsoft Windows - CONFIG_WINDIWS_CYGWIN=y : Cygwin under Windoes + CONFIG_WINDIWS_CYGWIN=y : Cygwin under Windows 3. All of these configurations are set up to build under Windows using the "GNU Tools for ARM Embedded Processors" that is maintained by ARM diff --git a/configs/flipnclick-sam3x/nsh/defconfig b/configs/flipnclick-sam3x/nsh/defconfig index 79057461ad..f0ba4aedf3 100644 --- a/configs/flipnclick-sam3x/nsh/defconfig +++ b/configs/flipnclick-sam3x/nsh/defconfig @@ -1,4 +1,5 @@ # CONFIG_ARCH_RAMFUNCS is not set +# CONFIG_SAM34_UART0 is not set CONFIG_ARCH_BOARD_FLIPNCLICK_SAM3X=y CONFIG_ARCH_BOARD="flipnclick-sam3x" CONFIG_ARCH_CHIP_ATSAM3X8E=y @@ -33,12 +34,13 @@ CONFIG_RAM_SIZE=65536 CONFIG_RAM_START=0x20000000 CONFIG_RAW_BINARY=y CONFIG_RR_INTERVAL=200 +CONFIG_SAM34_USART0=y CONFIG_SCHED_WAITPID=y CONFIG_SDCLONE_DISABLE=y CONFIG_START_DAY=28 CONFIG_START_MONTH=6 CONFIG_START_YEAR=2013 CONFIG_TASK_NAME_SIZE=0 -CONFIG_UART0_SERIAL_CONSOLE=y +CONFIG_USART0_SERIAL_CONSOLE=y CONFIG_USER_ENTRYPOINT="nsh_main" CONFIG_WDOG_INTRESERVE=0 diff --git a/configs/freedom-k64f/README.txt b/configs/freedom-k64f/README.txt index 5559b2fe5f..a2ce126b7d 100644 --- a/configs/freedom-k64f/README.txt +++ b/configs/freedom-k64f/README.txt @@ -618,7 +618,7 @@ GNU Toolchain Options ===================== The NuttX make system supports several GNU-based toolchains under Linux, - Cygwin under Windows, and Windoes native. To select a toolchain: + Cygwin under Windows, and Windows native. To select a toolchain: 1. Use 'make menuconfig' and select the toolchain that you are using under the System Type menu. diff --git a/configs/freedom-k66f/README.txt b/configs/freedom-k66f/README.txt index 7f5da7cffa..c78a3c4c80 100644 --- a/configs/freedom-k66f/README.txt +++ b/configs/freedom-k66f/README.txt @@ -621,7 +621,7 @@ GNU Toolchain Options ===================== The NuttX make system supports several GNU-based toolchains under Linux, - Cygwin under Windows, and Windoes native. To select a toolchain: + Cygwin under Windows, and Windows native. To select a toolchain: 1. Use 'make menuconfig' and select the toolchain that you are using under the System Type menu. @@ -972,4 +972,5 @@ Status 2017-02-14: nsh: SDHC DMA is not working yet. Buttons and SDIO with automounter is working. netnsh:Is building but Ehternet is not working yet. TX is called but - not IRQ is issued. \ No newline at end of file + not IRQ is issued. + -- GitLab From c70df0960d1f275a0186279ca6cd033471a4e76b Mon Sep 17 00:00:00 2001 From: Masayuki Ishikawa Date: Thu, 18 Jan 2018 12:30:43 +0900 Subject: [PATCH 072/228] arch/arm/src/lc823450: Assign I2S IRQ handling to CPU0 Previous commit assumed that the caller is running on CPU0. However, the caller sometimes runs at CPU1. This patch will assign the caller to CPU0 explicitly. Signed-off-by: Masayuki Ishikawa --- arch/arm/src/lc823450/lc823450_i2s.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/arch/arm/src/lc823450/lc823450_i2s.c b/arch/arm/src/lc823450/lc823450_i2s.c index 3eced5cb4f..fb9efa28df 100644 --- a/arch/arm/src/lc823450/lc823450_i2s.c +++ b/arch/arm/src/lc823450/lc823450_i2s.c @@ -51,6 +51,10 @@ #include #include +#ifdef CONFIG_SMP +# include +#endif + #include "up_arch.h" #include "lc823450_dma.h" #include "lc823450_i2s.h" @@ -460,8 +464,32 @@ FAR struct i2s_dev_s *lc823450_i2sdev_initialize(void) nxsem_init(&_sem_txdma, 0, 0); nxsem_init(&_sem_buf_under, 0, 0); +#ifdef CONFIG_SMP + cpu_set_t cpuset0; + cpu_set_t cpuset1; + + CPU_ZERO(&cpuset1); + CPU_SET(0, &cpuset1); + + /* Backup the current affinity */ + + sched_getaffinity(getpid(), sizeof(cpuset0), &cpuset0); + + /* Set the new affinity which assigns to CPU0 */ + + sched_setaffinity(getpid(), sizeof(cpuset1), &cpuset1); + nxsig_usleep(10 * 1000); +#endif + irq_attach(LC823450_IRQ_AUDIOBUF0, _i2s_isr, NULL); +#ifdef CONFIG_SMP + /* Restore the original affinity */ + + sched_setaffinity(getpid(), sizeof(cpuset0), &cpuset0); + nxsig_usleep(10 * 1000); +#endif + /* Enable IRQ for Audio Buffer */ up_enable_irq(LC823450_IRQ_AUDIOBUF0); -- GitLab From c93bbdcbc853bc4fff0738d9b92f4435459a2d63 Mon Sep 17 00:00:00 2001 From: Masayuki Ishikawa Date: Thu, 18 Jan 2018 12:48:07 +0900 Subject: [PATCH 073/228] arch/arm/src/lc823450: Change irqwarn() to ASSERT() in up_ack_irq() Signed-off-by: Masayuki Ishikawa --- arch/arm/src/lc823450/lc823450_irq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/arm/src/lc823450/lc823450_irq.c b/arch/arm/src/lc823450/lc823450_irq.c index 9339f7cd63..bd159ef545 100644 --- a/arch/arm/src/lc823450/lc823450_irq.c +++ b/arch/arm/src/lc823450/lc823450_irq.c @@ -711,7 +711,9 @@ void up_ack_irq(int irq) #ifdef CONFIG_SMP if (irq > LC823450_IRQ_LPDSP0 && 1 == up_cpu_index()) { - irqwarn("*** warning irq(%d) handled on CPU1."); + /* IRQ should be handled on CPU0 */ + + ASSERT(false); } #endif -- GitLab From c48a6a78fb34a858e08423b047ddfce15673dd88 Mon Sep 17 00:00:00 2001 From: Masayuki Ishikawa Date: Thu, 18 Jan 2018 12:49:46 +0900 Subject: [PATCH 074/228] configs/lc823450-xgevk: Update README.txt and defconfigs Update comments on SMP in README.txt Enable SYSTEM_TIME64 in defconfigs. Enable INSTRUMENTATION in rndis configuration. Signed-off-by: Masayuki Ishikawa --- configs/lc823450-xgevk/README.txt | 30 +++++++++++++++++++++----- configs/lc823450-xgevk/audio/defconfig | 1 + configs/lc823450-xgevk/nsh/defconfig | 1 + configs/lc823450-xgevk/rndis/defconfig | 4 ++++ configs/lc823450-xgevk/usb/defconfig | 1 + 5 files changed, 32 insertions(+), 5 deletions(-) diff --git a/configs/lc823450-xgevk/README.txt b/configs/lc823450-xgevk/README.txt index 63db6a0a30..a152c893e1 100644 --- a/configs/lc823450-xgevk/README.txt +++ b/configs/lc823450-xgevk/README.txt @@ -45,13 +45,33 @@ to set MSP (main stack pointer) as follows. SMP related Status ^^^^^^^^^^^^^^^^^^ -Currently all applications except for ostest work in SMP mode but might stop -due to deadlocks or ASSERT(). - CPU activities are shown at D9 (CPU0) and D10 (CPU1) respectively. -1. "nsh> smp" works but the result will be corrupted. -2. "nsh> ostest" works but might cause a deadlock or assertion. +Currently all applications except for ostest work in SMP mode but might stop +due to deadlocks or ASSERT(). For a workaround, please try + +$ cd apps; git diff +diff --git a/examples/ostest/waitpid.c b/examples/ostest/waitpid.c +index 687f50ca..8418eff8 100644 +--- a/examples/ostest/waitpid.c ++++ b/examples/ostest/waitpid.c +@@ -54,7 +54,7 @@ + ****************************************************************************/ + + #define RETURN_STATUS 14 +-#define NCHILDREN 3 ++#define NCHILDREN 2 + #define PRIORITY 100 + + /**************************************************************************** + +If other deadlocks or ASSERT() still happen, please try the following. + +$ cd nuttx; git revert e238c8b0904988b966c3b33e7df2ba3faba52e2b + +This will revert the changes for clock_systimer() for 64bit so that it can +use spinlock to protect the internal data. We think that there still exist +race conditions somewhere in SMP logic but the revert might relax the conditions. Other Status ^^^^^^^^^^^^ diff --git a/configs/lc823450-xgevk/audio/defconfig b/configs/lc823450-xgevk/audio/defconfig index ae8ef0ad37..e06f30abc5 100644 --- a/configs/lc823450-xgevk/audio/defconfig +++ b/configs/lc823450-xgevk/audio/defconfig @@ -127,6 +127,7 @@ CONFIG_START_MONTH=10 CONFIG_START_YEAR=2013 CONFIG_SYSTEM_I2CTOOL=y CONFIG_SYSTEM_NXPLAYER=y +CONFIG_SYSTEM_TIME64=y CONFIG_SYSTEM_USBMSC_CMD_STACKSIZE=2048 CONFIG_SYSTEM_USBMSC_DEVPATH1="/dev/mtdblock0p10" CONFIG_SYSTEM_USBMSC_DEVPATH2="/dev/mtdblock1" diff --git a/configs/lc823450-xgevk/nsh/defconfig b/configs/lc823450-xgevk/nsh/defconfig index 74040a6739..91b32fbe49 100644 --- a/configs/lc823450-xgevk/nsh/defconfig +++ b/configs/lc823450-xgevk/nsh/defconfig @@ -124,6 +124,7 @@ CONFIG_START_DAY=3 CONFIG_START_MONTH=10 CONFIG_START_YEAR=2013 CONFIG_SYSTEM_I2CTOOL=y +CONFIG_SYSTEM_TIME64=y CONFIG_TASK_NAME_SIZE=24 CONFIG_UART0_RXBUFSIZE=512 CONFIG_UART0_SERIAL_CONSOLE=y diff --git a/configs/lc823450-xgevk/rndis/defconfig b/configs/lc823450-xgevk/rndis/defconfig index c07e826ca6..32a899edd9 100644 --- a/configs/lc823450-xgevk/rndis/defconfig +++ b/configs/lc823450-xgevk/rndis/defconfig @@ -150,6 +150,9 @@ CONFIG_SCHED_HAVE_PARENT=y CONFIG_SCHED_HPWORKPERIOD=50000 CONFIG_SCHED_HPWORKPRIORITY=192 CONFIG_SCHED_HPWORK=y +CONFIG_SCHED_INSTRUMENTATION_BUFFER=y +CONFIG_SCHED_INSTRUMENTATION_PREEMPTION=y +CONFIG_SCHED_INSTRUMENTATION=y CONFIG_SCHED_LPWORK=y CONFIG_SCHED_ONEXIT_MAX=32 CONFIG_SCHED_ONEXIT=y @@ -169,6 +172,7 @@ CONFIG_START_YEAR=2013 CONFIG_SYSTEM_I2CTOOL=y CONFIG_SYSTEM_NXPLAYER=y CONFIG_SYSTEM_PING=y +CONFIG_SYSTEM_TIME64=y CONFIG_TASK_NAME_SIZE=24 CONFIG_TELNET_CHARACTER_MODE=y CONFIG_UART0_RXBUFSIZE=512 diff --git a/configs/lc823450-xgevk/usb/defconfig b/configs/lc823450-xgevk/usb/defconfig index 4b680dbd51..3ca1889d1b 100644 --- a/configs/lc823450-xgevk/usb/defconfig +++ b/configs/lc823450-xgevk/usb/defconfig @@ -126,6 +126,7 @@ CONFIG_START_DAY=3 CONFIG_START_MONTH=10 CONFIG_START_YEAR=2013 CONFIG_SYSTEM_I2CTOOL=y +CONFIG_SYSTEM_TIME64=y CONFIG_SYSTEM_USBMSC_CMD_STACKSIZE=2048 CONFIG_SYSTEM_USBMSC_DEVPATH1="/dev/mtdblock0p10" CONFIG_SYSTEM_USBMSC_DEVPATH2="/dev/mtdblock1" -- GitLab From 9776a32e264021d15c5563cb402e309a3a007ef1 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 18 Jan 2018 06:57:13 -0600 Subject: [PATCH 075/228] configst/stm3240g-eval: Remove only bogus logic to start the NX server. That was there only to support the knxwm configuration and was implemented priorit to boardctl(BOARCIOC_NX_START). --- configs/lpcxpresso-lpc54628/README.txt | 1 - configs/stm3240g-eval/src/stm32_boot.c | 111 +--------------------- configs/stm3240g-eval/src/stm32_bringup.c | 22 ++--- configs/stm32f429i-disco/src/stm32_boot.c | 37 -------- 4 files changed, 10 insertions(+), 161 deletions(-) diff --git a/configs/lpcxpresso-lpc54628/README.txt b/configs/lpcxpresso-lpc54628/README.txt index 2cb8625a85..e7b195ef41 100644 --- a/configs/lpcxpresso-lpc54628/README.txt +++ b/configs/lpcxpresso-lpc54628/README.txt @@ -475,4 +475,3 @@ Configurations $ cd ~//nuttx $ make - diff --git a/configs/stm3240g-eval/src/stm32_boot.c b/configs/stm3240g-eval/src/stm32_boot.c index 2309fc50bb..2861a30b1d 100644 --- a/configs/stm3240g-eval/src/stm32_boot.c +++ b/configs/stm3240g-eval/src/stm32_boot.c @@ -45,108 +45,10 @@ #include "stm3240g-eval.h" -/************************************************************************************ - * Pre-processor Definitions - ************************************************************************************/ -/* Configuration ********************************************************************/ -/* Should we initialize the NX server using nx_start? This is done for NxWidgets - * (CONFIG_NXWIDGETS=y) and if the NxWidget::CNxServer class expects the RTOS do the - * the NX initialization (CONFIG_NXWIDGET_SERVERINIT=n). This combination of - * settings is normally only used in the kernel build mode* (CONFIG_BUILD_PROTECTED) - * when NxWidgets is unable to initialize NX from user-space. - */ - -#undef HAVE_NXSTART - -#if defined(CONFIG_NXWIDGETS) && !defined(CONFIG_NXWIDGET_SERVERINIT) -# define HAVE_NXSTART -# include -#endif - -/* Should we initialize the touchscreen for the NxWM (CONFIG_NXWM=y)? This - * is done if we have a touchscreen (CONFIG_INPUT_STMPE811=y) and NxWM uses the - * touchscreen (CONFIG_NXWM_TOUCHSCREEN=y). - */ - -#undef HAVE_TCINIT - -#if defined(CONFIG_NXWM_TOUCHSCREEN) -# if !defined(CONFIG_NXWM_TOUCHSCREEN_DEVNO) -# error CONFIG_NXWM_TOUCHSCREEN_DEVNO is not defined -# elif defined(CONFIG_INPUT_STMPE811) -# define HAVE_TCINIT 1 -# include -# else -# error CONFIG_INPUT_STMPE811=y is needed -# endif -#endif - -/* Check if we will need to support the initialization kernel thread */ - -#undef HAVE_INITTHREAD - -#ifdef CONFIG_BOARD_INITIALIZE -# if defined(CONFIG_NSH_LIBRARY) && !defined(CONFIG_LIB_BOARDCTL) -# define HAVE_INITTHREAD 1 -# elif defined(HAVE_NXSTART) -# define HAVE_INITTHREAD 1 -# elif defined(HAVE_TCINIT) -# define HAVE_INITTHREAD 1 -# endif -#endif - -#ifdef HAVE_INITTHREAD -# include -# include -# include -# ifndef CONFIG_STM3240G_BOARDINIT_PRIO -# define CONFIG_STM3240G_BOARDINIT_PRIO 196 -# endif -# ifndef CONFIG_STM3240G_BOARDINIT_STACK -# define CONFIG_STM3240G_BOARDINIT_STACK 2048 -# endif -#endif - /************************************************************************************ * Private Functions ************************************************************************************/ -/************************************************************************************ - * Name: board_initthread - * - * Description: - * Board initialization kernel thread. This thread exists to support - * initialization when CONFIG_BOARD_INITIALIZE is defined. It is started by - * board_initialize() which runs on the IDLE thread. - * - * This function thread exists because some initialization steps may require - * waiting for events. Such waiting is not possible on the IDLE thread. - * - * Input Parameters: - * Standard task start-up parameters (none of which are used) - * - * Returned Value: - * Always returns EXIT_SUCCESS. - * - ************************************************************************************/ - -#ifdef HAVE_INITTHREAD -static int board_initthread(int argc, char *argv[]) -{ - int ret; - - /* Perform the board initialization on an initialization thread */ - - ret = stm32_bringup(); - if (ret < 0) - { - gerr("ERROR: stm32_bringup failed: %d\n", ret); - } - - return EXIT_SUCCESS; -} -#endif - /************************************************************************************ * Public Functions ************************************************************************************/ @@ -184,7 +86,7 @@ void stm32_boardinitialize(void) /* Initialize USB if the 1) OTG FS controller is in the configuration and 2) * disabled, and 3) the weak function stm32_usbinitialize() has been brought * the weak function stm32_usbinitialize() has been brought into the build. - * Presumeably either CONFIG_USBDEV or CONFIG_USBHOST is also selected. + * Presumably either CONFIG_USBDEV or CONFIG_USBHOST is also selected. */ if (stm32_usbinitialize) @@ -216,22 +118,11 @@ void stm32_boardinitialize(void) #ifdef CONFIG_BOARD_INITIALIZE void board_initialize(void) { -#ifdef HAVE_INITTHREAD - pid_t server; - - /* Start the board initialization kernel thread */ - - server = kthread_create("Board Init", CONFIG_STM3240G_BOARDINIT_PRIO, - CONFIG_STM3240G_BOARDINIT_STACK, board_initthread, - NULL); - ASSERT(server > 0); -#else /* Perform the board initialization on the start-up thread. Some * initializations may fail in this case due to the limited capability of * the start-up thread. */ (void)stm32_bringup(); -#endif } #endif diff --git a/configs/stm3240g-eval/src/stm32_bringup.c b/configs/stm3240g-eval/src/stm32_bringup.c index 61d3f4a69c..7f78ccb8f3 100644 --- a/configs/stm3240g-eval/src/stm32_bringup.c +++ b/configs/stm3240g-eval/src/stm32_bringup.c @@ -71,6 +71,10 @@ # include #endif +#ifdef CONFIG_INPUT_STMPE811 +# include +#endif + #include "stm32.h" #include "stm32_i2c.h" #include "stm3240g-eval.h" @@ -354,20 +358,12 @@ int stm32_bringup(void) } #endif -#ifdef HAVE_NXSTART - /* Initialize the NX server */ - - ret = nx_start(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: nx_start failed: %d\n", ret); - } -#endif - -#ifdef HAVE_TCINIT - /* Initialize the touchscreen */ +#ifdef CONFIG_INPUT_STMPE811 + /* Initialize the touchscreen. + * WARNING: stm32_tsc_setup() cannot be called from the IDLE thread. + */ - ret = stm32_tsc_setup(CONFIG_NXWM_TOUCHSCREEN_DEVNO); + ret = stm32_tsc_setup(0); if (ret < 0) { syslog(LOG_ERR, "ERROR: stm32_tsc_setup failed: %d\n", ret); diff --git a/configs/stm32f429i-disco/src/stm32_boot.c b/configs/stm32f429i-disco/src/stm32_boot.c index 9dda08d1de..d76f3122fa 100644 --- a/configs/stm32f429i-disco/src/stm32_boot.c +++ b/configs/stm32f429i-disco/src/stm32_boot.c @@ -48,43 +48,6 @@ #include "stm32f429i-disco.h" #include "stm32_ccm.h" -/************************************************************************************ - * Pre-processor Definitions - ************************************************************************************/ - -/* Configuration ********************************************************************/ -/* Should we initialize the NX server using nx_start? This is done for NxWidgets - * (CONFIG_NXWIDGETS=y) and if the NxWidget::CNxServer class expects the RTOS do the - * the NX initialization (CONFIG_NXWIDGET_SERVERINIT=n). This combination of - * settings is normally only used in the kernel build mode* (CONFIG_BUILD_PROTECTED) - * when NxWidgets is unable to initialize NX from user-space. - */ - -#undef HAVE_NXSTART - -#if defined(CONFIG_NXWIDGETS) && !defined(CONFIG_NXWIDGET_SERVERINIT) -# define HAVE_NXSTART -# include -#endif - -/* Should we initialize the touchscreen for the NxWM (CONFIG_NXWM=y)? This - * is done if we have a touchscreen (CONFIG_INPUT_STMPE811=y) and NxWM uses the - * touchscreen (CONFIG_NXWM_TOUCHSCREEN=y). - */ - -#undef HAVE_TCINIT - -#if defined(CONFIG_NXWM_TOUCHSCREEN) -# if !defined(CONFIG_NXWM_TOUCHSCREEN_DEVNO) -# error CONFIG_NXWM_TOUCHSCREEN_DEVNO is not defined -# elif defined(CONFIG_INPUT_STMPE811) -# define HAVE_TCINIT -# include -# else -# error CONFIG_INPUT_STMPE811=y is needed -# endif -#endif - /************************************************************************************ * Public Functions ************************************************************************************/ -- GitLab From a65ebeeb2c98fd1e829bead8bc9a1a98a98d3cce Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 18 Jan 2018 09:59:31 -0600 Subject: [PATCH 076/228] drivers/input/ft5x06.c: Remove cool logic to disable polling when there there is no client waiting for read data. That was a great idea to save CPU cycles when there is nothing reading from the touchscrren but, unfortunately, does not work with readers that open the driver in non-blocking mode. So I think we just have to eat the CPUs even when there is nothing waiting for touchscreen input. --- drivers/input/ft5x06.c | 40 ++++++---------------------------------- 1 file changed, 6 insertions(+), 34 deletions(-) diff --git a/drivers/input/ft5x06.c b/drivers/input/ft5x06.c index 25bd5f1551..de23742fba 100644 --- a/drivers/input/ft5x06.c +++ b/drivers/input/ft5x06.c @@ -364,15 +364,9 @@ static void ft5x06_data_worker(FAR void *arg) } #ifdef CONFIG_FT5X06_POLLMODE - /* Exit, re-starting the poll (unless there is no longer any task waiting - * for touch data). - */ + /* Exit, re-starting the poll. */ - if (priv->nwaiters > 0) - { - (void)wd_start(priv->polltimer, priv->delay, ft5x06_poll_timeout, 1, - priv); - } + (void)wd_start(priv->polltimer, priv->delay, ft5x06_poll_timeout, 1, priv); #else /* Exit, re-enabling FT5x06 interrupts */ @@ -398,14 +392,11 @@ static void ft5x06_poll_timeout(int argc, wdparm_t arg1, ...) * required to protected the work queue. */ - if (priv->nwaiters > 0) + DEBUGASSERT(priv->work.worker == NULL); + ret = work_queue(HPWORK, &priv->work, ft5x06_data_worker, priv, 0); + if (ret != 0) { - DEBUGASSERT(priv->work.worker == NULL); - ret = work_queue(HPWORK, &priv->work, ft5x06_data_worker, priv, 0); - if (ret != 0) - { - ierr("ERROR: Failed to queue work: %d\n", ret); - } + ierr("ERROR: Failed to queue work: %d\n", ret); } } #endif @@ -682,25 +673,6 @@ static ssize_t ft5x06_waitsample(FAR struct ft5x06_dev_s *priv, priv->nwaiters++; -#ifdef CONFIG_FT5X06_POLLMODE - /* The poll timer is stopped when there are no waiters. So we may - * need to restart with at the maximum rate. - */ - - if (priv->nwaiters == 1) - { - priv->delay = POLL_MINDELAY; - - ret = wd_start(priv->polltimer, priv->delay, ft5x06_poll_timeout, - 1, priv); - if (ret < 0) - { - ierr("ERROR: nxsem_wait failed: %d\n", ret); - goto errout; - } - } -#endif - /* Wait for a change in the FT5x06 state */ ret = nxsem_wait(&priv->waitsem); -- GitLab From af2ac8063f5e18a1f1b4c258807f2f9bc1fbb3d5 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 18 Jan 2018 10:00:27 -0600 Subject: [PATCH 077/228] configs/lpcxpresso-lpc54628/lvgl: Add LittlevGL graphics demo configuration. --- configs/lpcxpresso-lpc54628/README.txt | 21 +++++++ configs/lpcxpresso-lpc54628/lvgl/defconfig | 71 ++++++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 configs/lpcxpresso-lpc54628/lvgl/defconfig diff --git a/configs/lpcxpresso-lpc54628/README.txt b/configs/lpcxpresso-lpc54628/README.txt index e7b195ef41..ff1597cc4a 100644 --- a/configs/lpcxpresso-lpc54628/README.txt +++ b/configs/lpcxpresso-lpc54628/README.txt @@ -229,6 +229,27 @@ Configurations interrupts are not supported on P4. So polled mode only for this puppy. + lvgl + ---- + This is a demonstration of the LittlevGL graphics library running on + the NuttX frame buffer driver (as in the fb configuration). You can + find LittlevGL here: + + https://littlevgl.com/ + https://github.com/littlevgl + + This configuration uses the LittlevGL demonstration at apps/examples/lvgldemo. + + NOTES: + + 1. The LittlevGL demonstration is quit large, due mostly to some large + graphic images. So memory is tight in the LPC54628's 512Kb FLASH. In + fact, if you disable optimization, the demo will not fit into FLASH + memory (at least not with debug output also enabled). + + A longer term solution might load the large images into the abundant + SDRAM at runtime instead of linking it statically in FLASH. + netnsh: ------ This is a special version of the NuttShell (nsh) configuration that is diff --git a/configs/lpcxpresso-lpc54628/lvgl/defconfig b/configs/lpcxpresso-lpc54628/lvgl/defconfig new file mode 100644 index 0000000000..69faf20696 --- /dev/null +++ b/configs/lpcxpresso-lpc54628/lvgl/defconfig @@ -0,0 +1,71 @@ +# CONFIG_ARCH_FPU is not set +# CONFIG_LV_FONT_ANTIALIAS is not set +CONFIG_ARCH_BOARD_LPCXPRESSO_LPC54628=y +CONFIG_ARCH_BOARD="lpcxpresso-lpc54628" +CONFIG_ARCH_CHIP_LPC54628=y +CONFIG_ARCH_CHIP_LPC54XX=y +CONFIG_ARCH_INTERRUPTSTACK=2048 +CONFIG_ARCH_STACKDUMP=y +CONFIG_ARCH_STDARG_H=y +CONFIG_ARCH="arm" +CONFIG_BOARD_LOOPSPERMSEC=21082 +CONFIG_BUILTIN=y +CONFIG_DRIVERS_VIDEO=y +CONFIG_EXAMPLES_LVGLDEMO=y +CONFIG_FS_PROCFS=y +CONFIG_FT5X06_POLLMODE=y +CONFIG_FT5X06_SINGLEPOINT=y +CONFIG_FT5X06_SWAPXY=y +CONFIG_GRAPHICS_LVGL=y +CONFIG_HAVE_CXX=y +CONFIG_HAVE_CXXINITIALIZE=y +CONFIG_HOST_WINDOWS=y +CONFIG_INPUT_FT5X06=y +CONFIG_INPUT=y +CONFIG_INTELHEX_BINARY=y +CONFIG_LIB_BOARDCTL=y +CONFIG_LPC54_EMC_DYNAMIC_CS0_OFFSET=0x00080000 +CONFIG_LPC54_EMC_DYNAMIC_CS0_SIZE=0x00f80000 +CONFIG_LPC54_EMC_DYNAMIC_CS0=y +CONFIG_LPC54_EMC=y +CONFIG_LPC54_GPIOIRQ=y +CONFIG_LPC54_I2C2_MASTER=y +CONFIG_LPC54_LCD_BGR=y +CONFIG_LPC54_LCD_BPP16_565=y +CONFIG_LPC54_LCD_HBACKPORCH=43 +CONFIG_LPC54_LCD_HFRONTPORCH=8 +CONFIG_LPC54_LCD_VBACKPORCH=12 +CONFIG_LPC54_LCD_VFRONTPORCH=4 +CONFIG_LPC54_LCD_VPULSE=10 +CONFIG_LPC54_LCD_VRAMBASE=0xa0000000 +CONFIG_LPC54_LCD=y +CONFIG_LPC54_USART0=y +CONFIG_LV_HOR_RES=480 +CONFIG_LV_VER_RES=272 +CONFIG_MAX_TASKS=16 +CONFIG_MAX_WDOGPARMS=2 +CONFIG_MM_REGIONS=2 +CONFIG_NFILE_DESCRIPTORS=8 +CONFIG_NFILE_STREAMS=8 +CONFIG_PREALLOC_MQ_MSGS=4 +CONFIG_PREALLOC_TIMERS=4 +CONFIG_PREALLOC_WDOGS=4 +CONFIG_RAM_SIZE=163840 +CONFIG_RAM_START=0x20000000 +CONFIG_RAW_BINARY=y +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_HPWORK=y +CONFIG_SCHED_WAITPID=y +CONFIG_SDCLONE_DISABLE=y +CONFIG_TASK_NAME_SIZE=32 +CONFIG_USART0_SERIAL_CONSOLE=y +CONFIG_USE_LV_FONT_DEJAVU_40_CYRILLIC=y +CONFIG_USE_LV_FONT_DEJAVU_40_LATIN_EXT_A=y +CONFIG_USE_LV_FONT_DEJAVU_40_LATIN_EXT_B=y +CONFIG_USE_LV_FONT_DEJAVU_40_SUP=y +CONFIG_USE_LV_FONT_SYMBOL_40_BASIC=y +CONFIG_USE_LV_FONT_SYMBOL_40_FEEDBACK=y +CONFIG_USE_LV_FONT_SYMBOL_40_FILE=y +CONFIG_USER_ENTRYPOINT="lvgldemo_main" +CONFIG_VIDEO_FB=y +CONFIG_WDOG_INTRESERVE=0 -- GitLab From 5350d7efa20915217c4789a6b19efc903ea8fc17 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 18 Jan 2018 11:14:54 -0600 Subject: [PATCH 078/228] configs/lpcxpresso-lpc54628: Update README --- configs/lpcxpresso-lpc54628/README.txt | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/configs/lpcxpresso-lpc54628/README.txt b/configs/lpcxpresso-lpc54628/README.txt index ff1597cc4a..c9b3cbb524 100644 --- a/configs/lpcxpresso-lpc54628/README.txt +++ b/configs/lpcxpresso-lpc54628/README.txt @@ -95,10 +95,12 @@ STATUS more testing is certainly needed. 2018-01-14: The basic SPI driver is code complete but still untested. It is "basic" in the sense that it supports only polled mode (no DMA). + 2018-01-18: Added the lvgl configuration. See notes under "Configuration + Sub-directories" for additional status. - There is still no support for the Accelerometer, SPIFI, or USB. There are - complete but not-yet-functional SD card and SPI drivers. There are no - on-board devices to support SPI testing. + There is still no support for the Accelerometer, SPIFI, or USB. There is + a complete but not-yet-functional SD card driver and and tested SPI + driver. There are no on-board devices to support SPI testing. Configurations ============== @@ -156,7 +158,7 @@ Configurations System Type -> Toolchain: CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIW=y : GNU ARM EABI toolchain - Configuration sub-directories + Configuration Sub-directories ----------------------------- fb: @@ -250,6 +252,18 @@ Configurations A longer term solution might load the large images into the abundant SDRAM at runtime instead of linking it statically in FLASH. + STATUS: + + 2018-01-18: The demo is basically function but has some issues: + + a) The font is too big on the "Write" screen. They don't fit in on + the keyboard. + b) The "List" display is filled with a big box that says "Click a + button to copy its text to Text area." There are no buttons and + nothing to click on (maybe they are behind the big box?). This + may also be a font size issue. + c) The "Chart" display looks okay. + netnsh: ------ This is a special version of the NuttShell (nsh) configuration that is -- GitLab From 75b1844b7bbf9784112b3cc7c2a30d894a7bd44c Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 18 Jan 2018 12:51:07 -0600 Subject: [PATCH 079/228] include/termios.h: Update comments; fix long lines. --- include/termios.h | 70 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 52 insertions(+), 18 deletions(-) diff --git a/include/termios.h b/include/termios.h index 8427cbf599..10e88d7e00 100644 --- a/include/termios.h +++ b/include/termios.h @@ -58,7 +58,8 @@ #define INLCR (1 << 5) /* Bit 5: Map NL to CR on input */ #define INPCK (1 << 6) /* Bit 6: Enable input parity check */ #define ISTRIP (1 << 7) /* Bit 7: Strip character */ -#define IUCLC (1 << 8) /* Bit 8: Map upper-case to lower-case on input (LEGACY) */ +#define IUCLC (1 << 8) /* Bit 8: Map upper-case to lower-case on input + * (LEGACY) */ #define IXANY (1 << 9) /* Bit 9: Enable any character to restart output */ #define IXOFF (1 << 10) /* Bit 10: Enable start/stop input control */ #define IXON (1 << 11) /* Bit 11: Enable start/stop output control */ @@ -67,7 +68,8 @@ /* Terminal output modes (c_oflag in the termios structure) */ #define OPOST (1 << 0) /* Bit 0: Post-process output */ -#define OLCUC (1 << 1) /* Bit 1: Map lower-case to upper-case on output (LEGACY) */ +#define OLCUC (1 << 1) /* Bit 1: Map lower-case to upper-case on +* * output (LEGACY) */ #define ONLCR (1 << 2) /* Bit 2: Map NL to CR-NL on output */ #define OCRNL (1 << 3) /* Bit 3: Map CR to NL on output */ #define ONOCR (1 << 4) /* Bit 4: No CR output at column 0 */ @@ -116,22 +118,47 @@ /* Local Modes (c_lflag in the termios structure) */ #define ECHO (1 << 0) /* Bit 0: Enable echo */ -#define ECHOE (1 << 1) /* Bit 1: Echo erase character as error-correcting backspace */ +#define ECHOE (1 << 1) /* Bit 1: Echo erase character as error- + * correcting backspace */ #define ECHOK (1 << 2) /* Bit 2: Echo KILL */ #define ECHONL (1 << 3) /* Bit 3: Echo NL */ -#define ICANON (1 << 4) /* Bit 4: Canonical input (erase and kill processing) */ -#define IEXTEN (1 << 5) /* Bit 5: Enable extended input character processing */ +#define ICANON (1 << 4) /* Bit 4: Canonical input (erase and kill + * processing) */ +#define IEXTEN (1 << 5) /* Bit 5: Enable extended input character + * processing */ #define ISIG (1 << 6) /* Bit 6: Enable signals */ #define NOFLSH (1 << 7) /* Bit 7: Disable flush after interrupt or quit */ #define TOSTOP (1 << 8) /* Bit 8: Send SIGTTOU for background output */ -#define XCASE (1 << 9) /* Bit 9: Canonical upper/lower presentation (LEGACY) */ +#define XCASE (1 << 9) /* Bit 9: Canonical upper/lower presentation + * (LEGACY) */ -/* The following are subscript names for the termios c_cc array */ +/* The following are subscript names for the termios c_cc array. + * + * Common characters: VINTR, VQUIT, VSTART, VSTOP, VSUSP + * + * VINTR: Interrupt character (Default ETX, Control-C) + * VQUIT: Quit character (Default FS, Control-\) + * VSTART: Start character (Default DC1, Control-Q) + * VSTOP: Stop character (Default DC3, Control-S) + * VSUSP: Suspend character (Default SUB, Control-Z) + * + * Canonical mode: Adds VEOF, VEOL, VERASE, VKILL + * + * VEOL: End-of-file character (Default SUB, Control-Z) + * VEOF: End-of-line character (Default NUL) + * VERASE: Erase character (Default DEL or BS, Control-H) + * VKILL: Kill character (Default NAK or BS, Control-U) + * + * Non-canonical mode: Adds VMIN, VTIME + * + * VMIN: Minimum number of characters for non-canonical read + * VTIME: Timeout in deciseconds for non-canonical read + */ #define VEOF 0 /* Bit 0: EOF character (canonical mode) */ -#define VMIN VEOF /* Bit 0: MIN value (Non-canonical mode) */ +#define VMIN VEOF /* Bit 0: MIN value (non-canonical mode) */ #define VEOL 1 /* Bit 1: EOL character (canonical mode) */ -#define VTIME VEOL /* Bit 1: TIME value (Non-canonical mode) */ +#define VTIME VEOL /* Bit 1: TIME value (non-canonical mode) */ #define VERASE 2 /* Bit 2: ERASE character (canonical mode) */ #define VINTR 3 /* Bit 3: INTR character */ #define VKILL 4 /* Bit 4: KILL character (canonical mode) */ @@ -139,11 +166,13 @@ #define VSTART 6 /* Bit 6: START character */ #define VSTOP 7 /* Bit 7: STOP character */ #define VSUSP 8 /* Bit 8: SUSP character */ -#define NCCS 9 /* Bit 9: Size of the array c_cc for control characters */ +#define NCCS 9 /* Bit 9: Size of the array c_cc for control + * characters */ -/* Baud Rate Selection. These are instances of type speed_t. Values of 38400 - * and below are specified by POSIX; values above 38400 are sometimes referred - * to as extended values and most values appear in most termios.h implementations. +/* Baud Rate Selection. These are instances of type speed_t. Values of + * 38400 and below are specified by POSIX; values above 38400 are sometimes + * referred to as extended values and most values appear in most termios.h + * implementations. * * NOTE that is NuttX that the encoding of the speed_t values is simply the * value of the baud itself. So this opens a window for non-portable abuse @@ -188,18 +217,23 @@ #define TCSANOW 0 /* Change attributes immediately */ #define TCSADRAIN 1 /* Change attributes when output has drained */ -#define TCSAFLUSH 2 /* Change attributes when output has drained; also flush pending input */ +#define TCSAFLUSH 2 /* Change attributes when output has drained; + * also flush pending input */ /* Line Control (used with tcflush()) */ -#define TCIFLUSH 0 /* Flush pending input. Flush untransmitted output */ -#define TCIOFLUSH 1 /* Flush both pending input and untransmitted output */ +#define TCIFLUSH 0 /* Flush pending input. Flush untransmitted + * output */ +#define TCIOFLUSH 1 /* Flush both pending input and untransmitte + * output */ #define TCOFLUSH 2 /* Flush untransmitted output */ /* Constants for use with tcflow() */ -#define TCIOFF 0 /* Transmit a STOP character, intended to suspend input data */ -#define TCION 1 /* Transmit a START character, intended to restart input data */ +#define TCIOFF 0 /* Transmit a STOP character, intended to + * suspend input data */ +#define TCION 1 /* Transmit a START character, intended to + * restart input data */ #define TCOOFF 2 /* Suspend output */ #define TCOON 3 /* Restart output */ -- GitLab From cd1641305a5d7b9d5c5b44874b2b5a484324abb8 Mon Sep 17 00:00:00 2001 From: Masayuki Ishikawa Date: Fri, 19 Jan 2018 22:11:09 +0900 Subject: [PATCH 080/228] sched/semaphore: Add ASSERT(false) in nxsem_post() if no waiting task is found. Signed-off-by: Masayuki Ishikawa --- sched/semaphore/sem_post.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sched/semaphore/sem_post.c b/sched/semaphore/sem_post.c index 08a399b916..a550c0aab4 100644 --- a/sched/semaphore/sem_post.c +++ b/sched/semaphore/sem_post.c @@ -165,6 +165,12 @@ int nxsem_post(FAR sem_t *sem) up_unblock_task(stcb); } + else + { + /* This should not happen. */ + + ASSERT(false); + } } /* Check if we need to drop the priority of any threads holding -- GitLab From 1f54842c1e67c2ed9151efe4343e871a4859233c Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 19 Jan 2018 08:49:55 -0600 Subject: [PATCH 081/228] sched/sched/sched_sporadic.c: fix compiler error when priority inheritance is enabled. Noted by eunb.song@samsung.com --- sched/sched/sched_sporadic.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sched/sched/sched_sporadic.c b/sched/sched/sched_sporadic.c index 666416cf7d..dda7a355b8 100644 --- a/sched/sched/sched_sporadic.c +++ b/sched/sched/sched_sporadic.c @@ -138,7 +138,7 @@ static int sporadic_set_lowpriority(FAR struct tcb_s *tcb) * state. */ - tcb->base_priority = sporadic->low_priority; + tcb->base_priority = tcb->low_priority; } #endif @@ -194,7 +194,7 @@ static int sporadic_set_hipriority(FAR struct tcb_s *tcb) { /* Boosted... Do we still need to reprioritize? */ - if (sporadic->hi_priority < sporadic->base_priority) + if (sporadic->hi_priority < tcb->base_priority) { /* No.. the current execution priority is lower than the * boosted priority. Just reset the base priority. @@ -322,7 +322,7 @@ static int sporadic_interval_start(FAR struct replenishment_s *mrepl) /* Start the timer that will terminate the low priority cycle. This timer * expiration is independent of what else may occur (except that it must - * be cancelled if the thread exits. + * be canceled if the thread exits. */ DEBUGVERIFY(wd_start(&mrepl->timer, remainder, sporadic_interval_expire, -- GitLab From 5a102fb227c7deab27c28ced95d56206946dca15 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 19 Jan 2018 09:07:19 -0600 Subject: [PATCH 082/228] Change ASSERT(false) to DEBUGPANIC(). --- sched/semaphore/sem_post.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sched/semaphore/sem_post.c b/sched/semaphore/sem_post.c index a550c0aab4..f20cb68c77 100644 --- a/sched/semaphore/sem_post.c +++ b/sched/semaphore/sem_post.c @@ -169,7 +169,7 @@ int nxsem_post(FAR sem_t *sem) { /* This should not happen. */ - ASSERT(false); + DEBUGPANIC(); } } -- GitLab From c7f293d38823e74286b9442e941f6be43e1e9f02 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 20 Jan 2018 07:11:33 -0600 Subject: [PATCH 083/228] Documentation: Fix copy/paste error in NX graphics document. Noted by Henjiu Kang. --- Documentation/NXGraphicsSubsystem.html | 4 ++-- configs/flipnclick-pic32mz/README.txt | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Documentation/NXGraphicsSubsystem.html b/Documentation/NXGraphicsSubsystem.html index 3a58de35fc..efb8cbf1fe 100644 --- a/Documentation/NXGraphicsSubsystem.html +++ b/Documentation/NXGraphicsSubsystem.html @@ -12,7 +12,7 @@

    NX Graphics Subsystem

    -

    Last Updated: October 17, 2017

    +

    Last Updated: January 21, 2018

    @@ -542,7 +542,7 @@ void nxgl_yuv2rgb(uint8_t y, uint8_t u, uint8_t v, uint8_t *r, uint8_t *g, uint8

    Description: - Convert 8-bit RGB triplet to 8-bit YUV triplet. + Convert 8-bit YUV triplet to 8-bit RGB triplet.

    2.2.3 nxgl_rectcopy()

    diff --git a/configs/flipnclick-pic32mz/README.txt b/configs/flipnclick-pic32mz/README.txt index 000cda2fcc..3a1c3575d6 100644 --- a/configs/flipnclick-pic32mz/README.txt +++ b/configs/flipnclick-pic32mz/README.txt @@ -46,7 +46,8 @@ On Board Debug Support There is a simple application available at Mikroe that will allow you to write .hex files via the USB HID bootloader. However, in order to use the bootloader, you will have to control the memory map so that the - downloaded code does not clobber the bootloader. + downloaded code does not clobber the bootloader code FLASH, data + memory, exception vectors, etc. At this point, I have found no documentation describing how to build the code outside of the Mikroe toolchain for use with the Mikroe -- GitLab From 414c449cf9c2b5a03e5ce8d6eb343bbb4bced95d Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 20 Jan 2018 07:44:35 -0600 Subject: [PATCH 084/228] sched/sched: Fix some priority inheritance related issues noted during review of logic. Also add some REVISIT comments for some issues noted in the design. --- sched/sched/sched_sporadic.c | 55 ++++++++++++++++++++++++++---------- 1 file changed, 40 insertions(+), 15 deletions(-) diff --git a/sched/sched/sched_sporadic.c b/sched/sched/sched_sporadic.c index dda7a355b8..35984b7242 100644 --- a/sched/sched/sched_sporadic.c +++ b/sched/sched/sched_sporadic.c @@ -129,7 +129,19 @@ static int sporadic_set_lowpriority(FAR struct tcb_s *tcb) #ifdef CONFIG_PRIORITY_INHERITANCE /* If the priority was boosted above the higher priority, than just - * reset the base priority. + * reset the base priority and continue to run at the boosted priority. + * + * REVISIT: There is a logic flaw here... If the priority was NOT + * boosted above the hi_priority, then it still may still need to + * boosted with respect to the lo_priority. If the highest priority + * thread waiting on a semaphore held by the sporadic thread is greater + * than the low priority (but less than the hi_priority), the new + * sched_priority should be set to that priority, not to the lo_priority + * + * In order to do this we would need a list of all semaphores held by + * the thread. We would need to select the highest priority from among + * all tasks waiting for the semaphores. Unfortunately, at present we + * know nothing about the semaphores held by the sporadic thread. */ if (tcb->sched_priority > tcb->base_priority) @@ -140,18 +152,20 @@ static int sporadic_set_lowpriority(FAR struct tcb_s *tcb) tcb->base_priority = tcb->low_priority; } + else #endif - - /* Otherwise drop the priority of thread, possible causing a context - * switch. - */ - - ret = sched_reprioritize(tcb, sporadic->low_priority); - if (ret < 0) { - int errcode = get_errno(); - serr("ERROR: sched_reprioritize failed: %d\n", errcode); - return -errcode; + /* Otherwise drop the priority of thread, possible causing a context + * switch. + */ + + ret = sched_reprioritize(tcb, sporadic->low_priority); + if (ret < 0) + { + int errcode = get_errno(); + serr("ERROR: sched_reprioritize failed: %d\n", errcode); + return -errcode; + } } return OK; @@ -188,16 +202,27 @@ static int sporadic_set_hipriority(FAR struct tcb_s *tcb) #ifdef CONFIG_PRIORITY_INHERITANCE /* If the priority was boosted above the higher priority, than just * reset the base priority. + * + * First, was the priority boosted above the lo_priority which should be + * the same as the base_priority here? (This is an unnecessary test. + * sched_priority > hi_priority would be sufficient). */ if (tcb->sched_priority > tcb->base_priority) { - /* Boosted... Do we still need to reprioritize? */ + /* Boosted... Do we still need to reprioritize? If we were boosted to + * a priority above the hi_priority then we do not need to do anything + * except to adjust the base_priority + * + * REVISIT: This logic is probably okay. But may lead to problems + * when the hi_priority is resumed. See REVISIT comments in + * sporadic_set_lowpriority(). + */ - if (sporadic->hi_priority < tcb->base_priority) + if (tcb->sched_priority > sporadic->hi_priority) { - /* No.. the current execution priority is lower than the - * boosted priority. Just reset the base priority. + /* No.. the new execution priority is lower than the boosted + * priority. Just reset the base priority. */ tcb->base_priority = sporadic->hi_priority; -- GitLab From 2f0bc1907b9252f141cf3d2ac36ed71872bacc6a Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 20 Jan 2018 12:59:56 -0600 Subject: [PATCH 085/228] Update README and some comments --- README.txt | 19 +++++++++++++++++++ sched/sched/sched_sporadic.c | 8 ++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/README.txt b/README.txt index 4dfd513a7f..719fe60d17 100644 --- a/README.txt +++ b/README.txt @@ -1422,6 +1422,22 @@ Installing GNUWin32 CYGWIN BUILD PROBLEMS ^^^^^^^^^^^^^^^^^^^^^ +Performance +----------- + + Build performance under Cygwin is really not so bad, certainly not as good + as a Linux build. However, often you will find that the performance is + not just bad but terrible. If you are seeing awful performance.. like two + or three compilations per second.. the culprit is usually your Windows + Anti-Virus protection interfering with the build tool program execution. + + I use Cygwin quite often and I use Windows Defender. In order to get good + build performance, I routinely keep the Windows Defender "Virus & Threat + Protections Settings" screen up: I disable "Real-Time Protection" just + before entering 'make' then turn "Real-Time Protection" back on when the + build completes. With this additional nuisance step, I find that build + performance under Cygwin is completely acceptable. + Strange Path Problems --------------------- @@ -1475,6 +1491,7 @@ Window Native Toolchain Issues if you are using a native Windows toolchain. That bring us to #3: General Pre-built Toolchain Issues +---------------------------------- To continue with the list of "Window Native Toolchain Issues" we can add the following. These, however, are really just issues that you will have @@ -1528,6 +1545,7 @@ General Pre-built Toolchain Issues binutils and possibly different ABIs. Building Original Linux Boards in Cygwin +---------------------------------------- Some default board configurations are set to build under Linux and others to build under Windows with Cygwin. Various default toolchains may also @@ -1546,6 +1564,7 @@ Building Original Linux Boards in Cygwin ("Run As" option, right button) you find errors like "Permission denied". Recovering from Bad Configurations +---------------------------------- Many people make the mistake of configuring NuttX with the "canned" configuration and then just typing 'make' with disastrous consequences; diff --git a/sched/sched/sched_sporadic.c b/sched/sched/sched_sporadic.c index 35984b7242..90206c486e 100644 --- a/sched/sched/sched_sporadic.c +++ b/sched/sched/sched_sporadic.c @@ -138,10 +138,10 @@ static int sporadic_set_lowpriority(FAR struct tcb_s *tcb) * than the low priority (but less than the hi_priority), the new * sched_priority should be set to that priority, not to the lo_priority * - * In order to do this we would need a list of all semaphores held by - * the thread. We would need to select the highest priority from among - * all tasks waiting for the semaphores. Unfortunately, at present we - * know nothing about the semaphores held by the sporadic thread. + * In order to do this we would need to know the highest priority from + * among all tasks waiting for the all semaphores held by the sporadic + * task. Perhaps that information could be retained by the priority + * inheritance logic for use here? */ if (tcb->sched_priority > tcb->base_priority) -- GitLab From c4e8dbbe6e6038602484e0d4d53a635f9069fb82 Mon Sep 17 00:00:00 2001 From: Fanda Vacek Date: Sat, 20 Jan 2018 23:00:47 +0100 Subject: [PATCH 086/228] Issue #85: /dev/userleds is not working for nucleo-l432kc fixed --- configs/nucleo-l432kc/README.txt | 2 +- configs/nucleo-l432kc/include/board.h | 4 ++-- configs/nucleo-l432kc/src/nucleo-l432kc.h | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/configs/nucleo-l432kc/README.txt b/configs/nucleo-l432kc/README.txt index 33ebc530cd..b68e68ebbd 100644 --- a/configs/nucleo-l432kc/README.txt +++ b/configs/nucleo-l432kc/README.txt @@ -324,7 +324,7 @@ Hardware ---- The Nucleo F401RE and Nucleo F411RE provide a single user LED, LD2. LD2 is the green LED connected to Arduino signal D13 corresponding to MCU I/O - PA5 (pin 21) or PB13 (pin 34) depending on the STM32target. + PB3 (pin 26). - When the I/O is HIGH value, the LED is on. - When the I/O is LOW, the LED is off. diff --git a/configs/nucleo-l432kc/include/board.h b/configs/nucleo-l432kc/include/board.h index dbe6dbe48f..529accb653 100644 --- a/configs/nucleo-l432kc/include/board.h +++ b/configs/nucleo-l432kc/include/board.h @@ -147,8 +147,8 @@ /* LEDs * * The Nucleo l476RG board provides a single user LED, LD2. LD2 - * is the green LED connected to Arduino signal D13 corresponding to MCU I/O - * PA5 (pin 21) or PB13 (pin 34) depending on the STM32 target. + * is the green LED connected to Arduino signal D13 corresponding to + * MCU I/O PB3 (pin 26). * * - When the I/O is HIGH value, the LED is on. * - When the I/O is LOW, the LED is off. diff --git a/configs/nucleo-l432kc/src/nucleo-l432kc.h b/configs/nucleo-l432kc/src/nucleo-l432kc.h index 9ce05bc83d..e5c34816bb 100644 --- a/configs/nucleo-l432kc/src/nucleo-l432kc.h +++ b/configs/nucleo-l432kc/src/nucleo-l432kc.h @@ -77,7 +77,7 @@ #endif /* LED. User LD2: the green LED is a user LED connected to Arduino signal D13 - * corresponding to MCU I/O PA5 (pin 21) or PB13 (pin 34) depending on the STM32 + * corresponding to MCU I/O PB3 (pin 26) * target. * * - When the I/O is HIGH value, the LED is on. @@ -85,7 +85,7 @@ */ #define GPIO_LD2 \ - (GPIO_PORTA | GPIO_PIN5 | GPIO_OUTPUT_CLEAR | GPIO_OUTPUT | GPIO_PULLUP | \ + (GPIO_PORTB | GPIO_PIN3 | GPIO_OUTPUT_CLEAR | GPIO_OUTPUT | GPIO_PULLUP | \ GPIO_SPEED_50MHz) #define LED_DRIVER_PATH "/dev/userleds" -- GitLab From 1c502d4f726fd7df5ae73f62d7773e00f46240ad Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 20 Jan 2018 16:16:35 -0600 Subject: [PATCH 087/228] configs/nucleo-l432kc: Fix numerous cloning errors/typos. --- TODO | 4 ++-- configs/nucleo-l432kc/README.txt | 19 ++++++++----------- configs/nucleo-l432kc/include/board.h | 4 ++-- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/TODO b/TODO index 3d92fd7ee2..19b328e54d 100644 --- a/TODO +++ b/TODO @@ -745,7 +745,7 @@ o Kernel/Protected Build Title: USER MODE TASKS CAN MODIFY PRIVILEGED TASKS Description: Certain interfaces, such as sched_setparam(), sched_setscheduler(), etc. can be used by user mode tasks to - modify the behavior of priviledged kernel threads. + modify the behavior of privileged kernel threads. For a truly secure system. Privileges need to be checked in every interface that permits one thread to modify the properties of another thread. @@ -1282,7 +1282,7 @@ o Network (net/, drivers/net) however, because its priority is low and so it is blocked from execution. - In the mean time, the remote host sends a - packet which is presumeably caught in the read-ahead buffer. + packet which is presumably caught in the read-ahead buffer. - Then the remote host closes the socket. Nothing happens on the target side because net_start_monitor() has not yet been called. diff --git a/configs/nucleo-l432kc/README.txt b/configs/nucleo-l432kc/README.txt index b68e68ebbd..43eacb4391 100644 --- a/configs/nucleo-l432kc/README.txt +++ b/configs/nucleo-l432kc/README.txt @@ -230,12 +230,10 @@ NuttX EABI "buildroot" Toolchain 1. You must have already configured Nuttx in /nuttx. - $ (cd tools; ./configure.sh nucleo-f4x1re/f401-nsh) + $ tools/configure.sh nucleo-f432kc/nsh $ make qconfig $ V=1 make context all 2>&1 | tee mout - Use the f411-nsh configuration if you have the Nucleo-F411RE board. - 2. Download the latest buildroot package into 3. unpack the buildroot tarball. The resulting directory may @@ -298,14 +296,13 @@ NXFLAT Toolchain mbed ==== - The Nucleo-F401RE includes boot loader from mbed: + The Nucleo-F432KC includes boot loader from mbed: - https://mbed.org/platforms/ST-Nucleo-F401RE/ https://mbed.org/handbook/Homepage Using the mbed loader: - 1. Connect the Nucleo-F4x1RE to the host PC using the USB connector. + 1. Connect the Nucleo-F432kc to the host PC using the USB connector. 2. A new file system will appear called NUCLEO; open it with Windows Explorer (assuming that you are using Windows). 3. Drag and drop nuttx.bin into the MBED window. This will load the @@ -322,7 +319,7 @@ Hardware LEDs ---- - The Nucleo F401RE and Nucleo F411RE provide a single user LED, LD2. LD2 + The Nucleo F401RE and Nucleo F432KC provide a single user LED, LD2. LD2 is the green LED connected to Arduino signal D13 corresponding to MCU I/O PB3 (pin 26). @@ -367,7 +364,7 @@ Serial Consoles TTL to RS-232 converter connection: - Nucleo CN10 STM32F4x1RE + Nucleo CN10 STM32F432KC ----------- ------------ Pin 21 PA9 USART1_RX *Warning you make need to reverse RX/TX on Pin 33 PA10 USART1_TX some RS-232 converters @@ -399,7 +396,7 @@ Serial Consoles TTL to RS-232 converter connection: - Nucleo CN9 STM32F4x1RE + Nucleo CN9 STM32F432KC ----------- ------------ Pin 1 PA3 USART2_RX *Warning you make need to reverse RX/TX on Pin 2 PA2 USART2_TX some RS-232 converters @@ -457,7 +454,7 @@ Configurations nsh: --------- Configures the NuttShell (nsh) located at apps/examples/nsh for the - Nucleo-F401RE board. The Configuration enables the serial interfaces + Nucleo-F432KC board. The Configuration enables the serial interfaces on UART2. Support for builtin applications is enabled, but in the base configuration no builtin applications are selected (see NOTES below). @@ -484,7 +481,7 @@ Configurations Consoles). I have been using a TTL-to-RS-232 converter connected as shown below: - Nucleo CN10 STM32F4x1RE + Nucleo CN10 STM32F432KC ----------- ------------ Pin 21 PA9 USART1_RX *Warning you make need to reverse RX/TX on Pin 33 PA10 USART1_TX some RS-232 converters diff --git a/configs/nucleo-l432kc/include/board.h b/configs/nucleo-l432kc/include/board.h index 529accb653..3e7e90c453 100644 --- a/configs/nucleo-l432kc/include/board.h +++ b/configs/nucleo-l432kc/include/board.h @@ -146,7 +146,7 @@ /* LEDs * - * The Nucleo l476RG board provides a single user LED, LD2. LD2 + * The Nucleo l432kc board provides a single user LED, LD2. LD2 * is the green LED connected to Arduino signal D13 corresponding to * MCU I/O PB3 (pin 26). * @@ -266,4 +266,4 @@ void stm32l4_board_initialize(void); #endif #endif /* __ASSEMBLY__ */ -#endif /* __CONFIGS_NUCLEO_F476RG_INCLUDE_BOARD_H */ +#endif /* __CONFIGS_NUCLEO_F432KC_INCLUDE_BOARD_H */ -- GitLab From ef54d16116e8313d9b60ef29ddbce3ea120355be Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sun, 21 Jan 2018 07:47:13 -0600 Subject: [PATCH 088/228] Update TODO list --- TODO | 81 +++++++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 67 insertions(+), 14 deletions(-) diff --git a/TODO b/TODO index 19b328e54d..4d46a3e5b0 100644 --- a/TODO +++ b/TODO @@ -1,15 +1,15 @@ -NuttX TODO List (Last updated January 3, 2018) +NuttX TODO List (Last updated January 21, 2018) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This file summarizes known NuttX bugs, limitations, inconsistencies with standards, things that could be improved, and ideas for enhancements. This -TODO list does not include issues associated with individual boar ports. See +TODO list does not include issues associated with individual board ports. See also the individual README.txt files in the configs/ sub-directories for issues related to each board port. nuttx/: - (12) Task/Scheduler (sched/) + (14) Task/Scheduler (sched/) (1) SMP (1) Memory Management (mm/) (0) Power Management (drivers/pm) @@ -47,7 +47,7 @@ o Task/Scheduler (sched/) Status: Closed. No, this behavior will not be implemented. Priority: Medium, required for good emulation of process/pthread model. The current behavior allows for the main thread of a task to - exit() and any child pthreads will perist. That does raise + exit() and any child pthreads will persist. That does raise some issues: The main thread is treated much like just-another- pthread but must follow the semantics of a task or a process. That results in some inconsistencies (for example, with robust @@ -124,7 +124,7 @@ o Task/Scheduler (sched/) The fix for all of these issues it to have the callbacks run on the caller's thread as is currently done with signal handlers. Signals are delivered differently in - PROTECTED and KERNEL modes: The deliver is involes a + PROTECTED and KERNEL modes: The delivery involves a signal handling trampoline function in the user address space and two signal handlers: One to call the signal handler trampoline in user mode (SYS_signal_handler) and @@ -198,7 +198,7 @@ o Task/Scheduler (sched/) Description: The internal NuttX logic uses the same interfaces as does the application. That sometime produces a problem because there is "overloaded" functionality in those user interfaces - that are not desireable. + that are not desirable. For example, having cancellation points hidden inside of the OS can cause non-cancellation point interfaces to behave @@ -327,6 +327,59 @@ o Task/Scheduler (sched/) Status: Open Priority: Low, only needed for more complete debug. + Title: PRIORITY INHERITANCE WITH SPORADIC SCHEDULER + Description: The sporadic scheduler manages CPU utilization by a task by + alternating between a high and a low priority. In either + state, it may have its priority boosted. However, under + some circumstances, it is impossible in the current design to + switch to the correct correct priority if a semaphore is + participating in priority inheritance: + + There is an when switching from the high to the low priority + state. If the priority was NOT boosted above the higher + priority, it still may still need to boosted with respect to + the lower priority. If the highest priority thread waiting + on a semaphore held by the sporadic thread is higher in + priority than the low priority but less than the higher + priority, then new thread priority should be set to that + middle priority, not to the lower priority + + In order to do this we would need to know the highest + priority from among all tasks waiting for the all semaphores + held by the sporadic task. That information could be + retained by the priority inheritance logic for use by the + sporadic scheduler. The boost priority could be retained in + a new field of the TCB (say, pend_priority). That + pend_priority could then be used when switching from the + higher to the lower priority. + Status: Open + Priority: Low. Does anyone actually use the sporadic scheduler? + + Title: SIMPLIFY SPORADIC SCHEDULER DESIGN + Description: I have been planning to re-implement sporadic scheduling for + some time. I believe that the current implementation is + unnecessarily complex. There is no clear statement for the + requirements of sporadic scheduling that I could find, so I + based the design on some behaviors of another OS that I saw + published (QNX as I recall). + + But I think that the bottom line requirement for sporadic + scheduling is that is it should make a best attempt to + control a fixed percentage of CPU bandwidth for a task in + during an interval only by modifying it is priority between + a low and a high priority. The current design involves + several timers: A "budget" timer plus a variable number of + "replenishment" timers and a lot of nonsense to duplicate QNX + behavior that I think I not necessary. + + It think that the sporadic scheduler could be re-implemented + with only the single "budget" timer. Instead of starting a + new "replenishment" timer when the task is resumed, that + single timer could just be extended. + Status: Open + Priority: Low. This is an enhancement. And does anyone actually use + the sporadic scheduler? + o SMP ^^^ @@ -572,7 +625,7 @@ o pthreads (sched/pthreads) group structure. I am, however, hesitant to make this change: In the FLAT build model, there is nothing that prevents people from accessing the inter-thread controls from threads in - differnt task groups. Making this change, while correct, + different task groups. Making this change, while correct, might introduce subtle bugs in code by people who are not using NuttX correctly. Status: Open @@ -1838,7 +1891,7 @@ o File system / Generic drivers (fs/, drivers/) (using pctl() instead sysctl()). My objective was to be able to control the number of available file descriptors on a task- by-task basis. The complexity due to the partitioning of - desciptor space in a range for file descriptors and a range + descriptor space in a range for file descriptors and a range for socket descriptors made this feature nearly impossible to implement. Status: Open @@ -1920,8 +1973,8 @@ o File system / Generic drivers (fs/, drivers/) 4) When comparing the checksum in the long file name entry with the checksum of the short file name, the checksum fails and the entire directory sequence is - ignored by readder() logic. This the file does not - appear in the 'ls'. + ignored by readdir() logic. This is why the file does + not appear in the 'ls'. o Graphics Subsystem (graphics/) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -2014,7 +2067,7 @@ o Graphics Subsystem (graphics/) Title: LOW-RES FRAMEBUFFER RENDERERING Description: There are obvious issues in the low-res, < 8 BPP, implemenation of - the framebuffer rendereing logic of graphics/nxglib/fb. I see two + the framebuffer rendering logic of graphics/nxglib/fb. I see two obvious problems in reviewing nxglib_copyrectangle(): 1. The masking logic might work 1 BPP, but is insufficient for other @@ -2026,7 +2079,7 @@ o Graphics Subsystem (graphics/) derives from nxglib_copyrectangle() and all of those issues have been resolved in that file. - Other frambuffer rendering functions probably have similary issues. + Other frambuffer rendering functions probably have similar issues. Status: Open Priority: Low. It is not surprising that there would be bugs in this logic: I have never encountered a hardware framebuffer with sub-byte pixel @@ -2279,11 +2332,11 @@ o Modbus (apps/modbus) Title: MODBUS NOT USABLE WITH USB SERIAL Description: Modbus can be used with USB serial, however, if the USB - serial connectiont is lost, Modbus will hang in an infinite + serial connection is lost, Modbus will hang in an infinite loop. This is a problem in the handling of select() and read() - and could probabaly resolved by studying the Modbus error + and could probably resolved by studying the Modbus error handling. A more USB-friendly solution would be to: (1) Re-connect and -- GitLab From e02a46f1d5e1ecea0de8709ad0647963c71a69ce Mon Sep 17 00:00:00 2001 From: Fanda Vacek Date: Sun, 21 Jan 2018 19:06:22 +0100 Subject: [PATCH 089/228] NUCLEO F432KC typo fixed, correct name is L432KC Just README.txt and comments affected, no changes in the code --- configs/nucleo-l432kc/README.txt | 16 ++++++++-------- configs/nucleo-l432kc/include/board.h | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/configs/nucleo-l432kc/README.txt b/configs/nucleo-l432kc/README.txt index 43eacb4391..a922e17638 100644 --- a/configs/nucleo-l432kc/README.txt +++ b/configs/nucleo-l432kc/README.txt @@ -230,7 +230,7 @@ NuttX EABI "buildroot" Toolchain 1. You must have already configured Nuttx in /nuttx. - $ tools/configure.sh nucleo-f432kc/nsh + $ tools/configure.sh nucleo-l432kc/nsh $ make qconfig $ V=1 make context all 2>&1 | tee mout @@ -296,13 +296,13 @@ NXFLAT Toolchain mbed ==== - The Nucleo-F432KC includes boot loader from mbed: + The Nucleo-L432KC includes boot loader from mbed: https://mbed.org/handbook/Homepage Using the mbed loader: - 1. Connect the Nucleo-F432kc to the host PC using the USB connector. + 1. Connect the Nucleo-L432kc to the host PC using the USB connector. 2. A new file system will appear called NUCLEO; open it with Windows Explorer (assuming that you are using Windows). 3. Drag and drop nuttx.bin into the MBED window. This will load the @@ -319,7 +319,7 @@ Hardware LEDs ---- - The Nucleo F401RE and Nucleo F432KC provide a single user LED, LD2. LD2 + The Nucleo L432KC provides a single user LED, LD2. LD2 is the green LED connected to Arduino signal D13 corresponding to MCU I/O PB3 (pin 26). @@ -364,7 +364,7 @@ Serial Consoles TTL to RS-232 converter connection: - Nucleo CN10 STM32F432KC + Nucleo CN10 STM32L432KC ----------- ------------ Pin 21 PA9 USART1_RX *Warning you make need to reverse RX/TX on Pin 33 PA10 USART1_TX some RS-232 converters @@ -396,7 +396,7 @@ Serial Consoles TTL to RS-232 converter connection: - Nucleo CN9 STM32F432KC + Nucleo CN9 STM32L432KC ----------- ------------ Pin 1 PA3 USART2_RX *Warning you make need to reverse RX/TX on Pin 2 PA2 USART2_TX some RS-232 converters @@ -454,7 +454,7 @@ Configurations nsh: --------- Configures the NuttShell (nsh) located at apps/examples/nsh for the - Nucleo-F432KC board. The Configuration enables the serial interfaces + Nucleo-L432KC board. The Configuration enables the serial interfaces on UART2. Support for builtin applications is enabled, but in the base configuration no builtin applications are selected (see NOTES below). @@ -481,7 +481,7 @@ Configurations Consoles). I have been using a TTL-to-RS-232 converter connected as shown below: - Nucleo CN10 STM32F432KC + Nucleo CN10 STM32L432KC ----------- ------------ Pin 21 PA9 USART1_RX *Warning you make need to reverse RX/TX on Pin 33 PA10 USART1_TX some RS-232 converters diff --git a/configs/nucleo-l432kc/include/board.h b/configs/nucleo-l432kc/include/board.h index 3e7e90c453..041a755787 100644 --- a/configs/nucleo-l432kc/include/board.h +++ b/configs/nucleo-l432kc/include/board.h @@ -266,4 +266,4 @@ void stm32l4_board_initialize(void); #endif #endif /* __ASSEMBLY__ */ -#endif /* __CONFIGS_NUCLEO_F432KC_INCLUDE_BOARD_H */ +#endif /* __CONFIGS_NUCLEO_L432KC_INCLUDE_BOARD_H */ -- GitLab From 6fd85ff0761a1f229d6657177dc7042573e21c51 Mon Sep 17 00:00:00 2001 From: Mateusz Szafoni Date: Sun, 21 Jan 2018 18:28:09 +0000 Subject: [PATCH 090/228] Merged in raiden00/nuttx (pull request #579) Master * stm32_hritm: add interface to get timer clock frequency stm32_hrtim: fix timer freq calculation stm32_hrtim: add compar/capture registers significant bits checking stm32_hrtim: minor changes * stm32f334-disco: add buck converter and boost converter logic Approved-by: Gregory Nutt --- arch/arm/src/stm32/stm32_hrtim.c | 415 +++++++++++++------ arch/arm/src/stm32/stm32_hrtim.h | 38 +- configs/stm32f334-disco/include/board.h | 34 +- configs/stm32f334-disco/src/stm32_smps.c | 493 ++++++++++++++++++++--- 4 files changed, 790 insertions(+), 190 deletions(-) diff --git a/arch/arm/src/stm32/stm32_hrtim.c b/arch/arm/src/stm32/stm32_hrtim.c index 44f78bff6f..121b0e2e4f 100644 --- a/arch/arm/src/stm32/stm32_hrtim.c +++ b/arch/arm/src/stm32/stm32_hrtim.c @@ -375,12 +375,13 @@ struct stm32_hrtim_capture_s struct stm32_hrtim_timcmn_s { uint32_t base; /* The base adress of the timer */ - uint32_t pclk; /* The frequency of the peripheral clock + uint64_t fclk; /* The frequency of the peripheral clock * that drives the timer module. */ + uint8_t prescaler:3; /* Prescaler */ uint8_t mode; /* Timer mode */ uint8_t dac:2; /* DAC triggering */ - uint8_t reserved:6; + uint8_t reserved:3; #ifdef CONFIG_STM32_HRTIM_INTERRUPTS uint16_t irq; /* interrupts configuration */ #endif @@ -623,6 +624,8 @@ static uint32_t hrtim_tim_getreg(FAR struct stm32_hrtim_s *priv, uint8_t timer, uint32_t offset); static FAR struct stm32_hrtim_tim_s *hrtim_tim_get(FAR struct stm32_hrtim_s *priv, uint8_t timer); +static FAR struct stm32_hrtim_slave_priv_s *hrtim_slave_get(FAR struct stm32_hrtim_s *priv, + uint8_t timer); static uint32_t hrtim_base_get(FAR struct stm32_hrtim_s *priv, uint8_t timer); /* Configuration */ @@ -665,7 +668,8 @@ static int hrtim_tim_dma_cfg(FAR struct stm32_hrtim_s *priv, uint8_t timer, #ifdef CONFIG_STM32_HRTIM_DEADTIME static int hrtim_deadtime_update(FAR struct hrtim_dev_s *dev, uint8_t timer, uint8_t dt, uint16_t value); -static uint16_t hrtim_deadtime_get(FAR struct hrtim_dev_s *dev, uint8_t dt); +static uint16_t hrtim_deadtime_get(FAR struct hrtim_dev_s *dev, uint8_t timer, + uint8_t dt); static int hrtim_tim_deadtime_cfg(FAR struct stm32_hrtim_s *priv, uint8_t timer); static int hrtim_deadtime_config(FAR struct stm32_hrtim_s *priv); #endif @@ -705,6 +709,7 @@ static int hrtim_per_update(FAR struct hrtim_dev_s *dev, uint8_t timer, static uint16_t hrtim_per_get(FAR struct hrtim_dev_s *dev, uint8_t timer); static uint16_t hrtim_cmp_get(FAR struct hrtim_dev_s *dev, uint8_t timer, uint8_t index); +static uint64_t hrtim_fclk_get(FAR struct hrtim_dev_s *dev, uint8_t timer); static int hrtim_tim_reset_set(FAR struct stm32_hrtim_s *priv, uint8_t timer, uint32_t reset); static int hrtim_reset_config(FAR struct stm32_hrtim_s *priv); @@ -753,20 +758,21 @@ static struct stm32_hrtim_tim_s g_master = /* If MASTER is disabled, we need only MASTER base */ #ifdef CONFIG_STM32_HRTIM_MASTER - .pclk = HRTIM_CLOCK/(HRTIM_MASTER_PRESCALER+1), - .mode = HRTIM_MASTER_MODE, + .fclk = HRTIM_CLOCK/(1<priv; + +errout: + return slave; +} + /**************************************************************************** * Name: hrtim_base_get * @@ -2049,7 +2108,7 @@ static void hrtim_dumpregs(FAR struct stm32_hrtim_s *priv, uint8_t timer, * priv - A reference to the HRTIM structure * * Returned Value: - * 0 on success, a negated errno value on failure + * 0 on success, a negated errno value on failure * ****************************************************************************/ @@ -2093,7 +2152,7 @@ static int hrtim_dll_cal(FAR struct stm32_hrtim_s *priv) * timer - An HRTIM Timer index * * Returned Value: - * 0 on success, a negated errno value on failure + * 0 on success, a negated errno value on failure * ****************************************************************************/ @@ -2182,7 +2241,7 @@ errout: * priv - A reference to the HRTIM structure * * Returned Value: - * 0 on success, a negated errno value on failure + * 0 on success, a negated errno value on failure * ****************************************************************************/ @@ -2264,7 +2323,7 @@ errout: * priv - A reference to the HRTIM structure * * Returned Value: - * 0 on success, a negated errno value on failure + * 0 on success, a negated errno value on failure * ****************************************************************************/ @@ -2467,7 +2526,7 @@ static int hrtim_gpios_config(FAR struct stm32_hrtim_s *priv) * capture - capture trigers configuration * * Returned Value: - * None + * 0 on success, a negated errno value on failure * ****************************************************************************/ @@ -2478,7 +2537,9 @@ static int hrtim_tim_capture_cfg(FAR struct stm32_hrtim_s *priv, int ret = OK; uint32_t offset = 0; - if (timer == HRTIM_TIMER_MASTER) + /* Sanity checking */ + + if (timer == HRTIM_TIMER_MASTER || timer == HRTIM_TIMER_COMMON) { ret = -EINVAL; goto errout; @@ -2521,7 +2582,7 @@ errout: * priv - A reference to the HRTIM block * * Returned Value: - * None + * 0 on success, a negated errno value on failure * ****************************************************************************/ @@ -2574,7 +2635,7 @@ static int hrtim_capture_config(FAR struct stm32_hrtim_s *priv) * index - Capture register index * * Returned Value: - * None + * Timer Capture value on success, 0 on failure * ****************************************************************************/ @@ -2623,7 +2684,7 @@ errout: * priv - A reference to the HRTIM structure * * Returned Value: - * 0 on success, a negated errno value on failure + * 0 on success, a negated errno value on failure * ****************************************************************************/ @@ -2645,37 +2706,26 @@ static int hrtim_synch_config(FAR struct stm32_hrtim_s *priv) * priv - A reference to the HRTIM structure * * Returned Value: - * 0 on success, a negated errno value on failure + * 0 on success, a negated errno value on failure * ****************************************************************************/ #if defined(CONFIG_STM32_HRTIM_PWM) static int hrtim_tim_outputs_config(FAR struct stm32_hrtim_s *priv, uint8_t timer) { - FAR struct stm32_hrtim_tim_s* tim; FAR struct stm32_hrtim_slave_priv_s* slave; uint32_t regval = 0; int ret = OK; - /* Master Timer has no outputs */ - - if (timer == HRTIM_TIMER_MASTER) - { - ret = -EINVAL; - goto errout; - } - - /* Get Timer data strucutre */ + /* Get Slave Timer data structure */ - tim = hrtim_tim_get(priv, timer); - if (tim == NULL) + slave = hrtim_slave_get(priv, timer); + if (slave == NULL) { ret = -EINVAL; goto errout; } - slave = (struct stm32_hrtim_slave_priv_s*)tim->priv; - /* Configure CH1 SET events */ regval = slave->pwm.ch1.set; @@ -2773,7 +2823,7 @@ errout: * priv - A reference to the HRTIM structure * * Returned Value: - * 0 on success, a negated errno value on failure + * 0 on success, a negated errno value on failure * ****************************************************************************/ @@ -2848,7 +2898,7 @@ errout: * state - Enable/disable operation * * Returned Value: - * 0 on success, a negated errno value on failure + * 0 on success, a negated errno value on failure * ****************************************************************************/ @@ -3009,7 +3059,6 @@ static int hrtim_output_set_set(FAR struct hrtim_dev_s *dev, uint16_t output, uint32_t set) { FAR struct stm32_hrtim_s *priv = (FAR struct stm32_hrtim_s *)dev->hd_priv; - FAR struct stm32_hrtim_tim_s* tim; FAR struct stm32_hrtim_slave_priv_s* slave; uint8_t timer = 0; int ret = OK; @@ -3018,17 +3067,15 @@ static int hrtim_output_set_set(FAR struct hrtim_dev_s *dev, uint16_t output, timer = output_tim_index_get(output); - /* Get Timer data strucutre */ + /* Get Slave Timer data strucutre */ - tim = hrtim_tim_get(priv, timer); - if (tim == NULL) + slave = hrtim_slave_get(priv, timer); + if (slave == NULL) { ret = -EINVAL; goto errout; } - slave = (struct stm32_hrtim_slave_priv_s*)tim->priv; - /* Set new SET value */ switch (output_tim_ch_get(output)) @@ -3065,7 +3112,6 @@ static int hrtim_output_rst_set(FAR struct hrtim_dev_s *dev, uint16_t output, uint32_t rst) { FAR struct stm32_hrtim_s *priv = (FAR struct stm32_hrtim_s *)dev->hd_priv; - FAR struct stm32_hrtim_tim_s* tim; FAR struct stm32_hrtim_slave_priv_s* slave; uint8_t timer = 0; int ret = OK; @@ -3074,17 +3120,15 @@ static int hrtim_output_rst_set(FAR struct hrtim_dev_s *dev, uint16_t output, timer = output_tim_index_get(output); - /* Get Timer data strucutre */ + /* Get Salve Timer data strucutre */ - tim = hrtim_tim_get(priv, timer); - if (tim == NULL) + slave = hrtim_slave_get(priv, timer); + if (slave == NULL) { ret = -EINVAL; goto errout; } - slave = (struct stm32_hrtim_slave_priv_s*)tim->priv; - /* Set new RST value */ switch (output_tim_ch_get(output)) @@ -3124,7 +3168,7 @@ errout: * priv - A reference to the HRTIM structure * * Returned Value: - * 0 on success, a negated errno value on failure + * 0 on success, a negated errno value on failure * ****************************************************************************/ @@ -3172,7 +3216,7 @@ static int hrtim_adc_config(FAR struct stm32_hrtim_s *priv) * dac - DAC synchronisation event configuration * * Returned Value: - * 0 on success, a negated errno value on failure + * 0 on success, a negated errno value on failure * ****************************************************************************/ @@ -3203,7 +3247,7 @@ static int hrtim_tim_dac_cfg(FAR struct stm32_hrtim_s *priv, uint8_t timer, * priv - A reference to the HRTIM structure * * Returned Value: - * 0 on success, a negated errno value on failure + * 0 on success, a negated errno value on failure * ****************************************************************************/ @@ -3268,6 +3312,14 @@ static int hrtim_tim_dma_cfg(FAR struct stm32_hrtim_s *priv, uint8_t timer, int ret = OK; uint32_t regval = 0; + /* Sanity checking */ + + if (timer == HRTIM_TIMER_COMMON) + { + ret = -EINVAL; + goto errout; + } + if (timer == HRTIM_TIMER_MASTER) { /* Master support first 7 DMA requests */ @@ -3397,7 +3449,8 @@ errout: * Name: hrtim_deadtime_get ****************************************************************************/ -static uint16_t hrtim_deadtime_get(FAR struct hrtim_dev_s *dev, uint8_t dt) +static uint16_t hrtim_deadtime_get(FAR struct hrtim_dev_s *dev, uint8_t timer, + uint8_t dt) { #warning missing logic } @@ -3408,30 +3461,27 @@ static uint16_t hrtim_deadtime_get(FAR struct hrtim_dev_s *dev, uint8_t dt) static int hrtim_tim_deadtime_cfg(FAR struct stm32_hrtim_s *priv, uint8_t timer) { - FAR struct stm32_hrtim_tim_s* tim; FAR struct stm32_hrtim_slave_priv_s* slave; uint32_t regval = 0; int ret = OK; - /* Master Timer has no outputs */ + /* Sanity checking */ - if (timer == HRTIM_TIMER_MASTER) + if (timer == HRTIM_TIMER_MASTER || timer == HRTIM_TIMER_COMMON) { ret = -EINVAL; goto errout; } - /* Get Timer data strucutre */ + /* Get Slave Timer data strucutre */ - tim = hrtim_tim_get(priv, timer); - if (tim == NULL) + slave = hrtim_slave_get(priv, timer); + if (slave == NULL) { ret = -EINVAL; goto errout; } - slave = (struct stm32_hrtim_slave_priv_s*)tim->priv; - /* Configure deadtime prescaler */ regval |= slave->pwm.dt.prescaler << HRTIM_TIMDT_DTPRSC_SHIFT; @@ -3550,7 +3600,7 @@ static int hrtim_deadtime_config(FAR struct stm32_hrtim_s *priv) * state - Enable/disable operation * * Returned Value: - * 0 on success, a negated errno value on failure + * 0 on success, a negated errno value on failure * ****************************************************************************/ @@ -3610,31 +3660,28 @@ errout: static int hrtim_tim_chopper_cfg(FAR struct stm32_hrtim_s *priv, uint8_t timer) { - FAR struct stm32_hrtim_tim_s* tim; FAR struct stm32_hrtim_slave_priv_s* slave; int ret = OK; uint32_t regval = 0; - /* Master Timer has no outputs */ + /* Sanity checking */ - if (timer == HRTIM_TIMER_MASTER) + if (timer == HRTIM_TIMER_MASTER || timer == HRTIM_TIMER_COMMON) { ret = -EINVAL; goto errout; } - /* Get Timer data strucutre */ + /* Get Slave Timer data strucutre */ - tim = hrtim_tim_get(priv, timer); - if (tim == NULL) + slave = hrtim_slave_get(priv, timer); + if (slave == NULL) { ret = -EINVAL; goto errout; } - slave = (struct stm32_hrtim_slave_priv_s*)tim->priv; - /* Configure start pulsewidth */ regval |= slave->pwm.chp.start_pulse << HRTIM_TIMCHP_STRTPW_SHIFT; @@ -3891,19 +3938,22 @@ static int hrtim_burst_config(FAR struct stm32_hrtim_s *priv) * timer - timer index * * Returned Value: - * 0 on success, a negated errno value on failure + * 0 on success, a negated errno value on failure * ****************************************************************************/ static int hrtim_tim_faults_cfg(FAR struct stm32_hrtim_s *priv, uint8_t timer) { - FAR struct stm32_hrtim_tim_s *tim; FAR struct stm32_hrtim_slave_priv_s *slave; uint32_t regval = 0; + int ret = OK; - tim = hrtim_tim_get(priv, timer); - - slave = tim->priv; + slave = hrtim_slave_get(priv, timer); + if (slave == NULL) + { + ret = -EINVAL; + goto errout; + } /* Get lock configuration */ @@ -3917,7 +3967,8 @@ static int hrtim_tim_faults_cfg(FAR struct stm32_hrtim_s *priv, uint8_t timer) hrtim_tim_putreg(priv, timer, STM32_HRTIM_TIM_FLTR_OFFSET, regval); - return OK; +errout: + return ret; } /**************************************************************************** @@ -3931,7 +3982,7 @@ static int hrtim_tim_faults_cfg(FAR struct stm32_hrtim_s *priv, uint8_t timer) * index - Fault index * * Returned Value: - * 0 on success, a negated errno value on failure + * 0 on success, a negated errno value on failure * ****************************************************************************/ @@ -4073,7 +4124,7 @@ errout: * priv - A reference to the HRTIM structure * * Returned Value: - * 0 on success, a negated errno value on failure + * 0 on success, a negated errno value on failure * ****************************************************************************/ @@ -4147,7 +4198,7 @@ static int hrtim_faults_config(FAR struct stm32_hrtim_s *priv) * index - External Event index * * Returned Value: - * 0 on success, a negated errno value on failure + * 0 on success, a negated errno value on failure * ****************************************************************************/ @@ -4322,7 +4373,7 @@ errout: * priv - A reference to the HRTIM structure * * Returned Value: - * 0 on success, a negated errno value on failure + * 0 on success, a negated errno value on failure * ****************************************************************************/ @@ -4392,7 +4443,7 @@ static int hrtim_events_config(FAR struct stm32_hrtim_s *priv) * priv - A reference to the HRTIM structure * * Returned Value: - * 0 on success, a negated errno value on failure + * 0 on success, a negated errno value on failure * ****************************************************************************/ @@ -4483,7 +4534,7 @@ static void hrtim_tim_mode_set(FAR struct stm32_hrtim_s *priv, uint8_t timer, * priv - A reference to the HRTIM structure * * Returned Value: - * None + * None * ****************************************************************************/ @@ -4514,6 +4565,77 @@ static void hrtim_mode_config(FAR struct stm32_hrtim_s *priv) #endif } +/**************************************************************************** + * Name: hrtim_cmpcap_mask_get + * + * Description: + * This function returns not significant bits in counter/capture + * regsiters for given HRTIM Timer index. + * + * Input Parameters: + * priv - A reference to the HRTIM structure + * timer - HRTIM Timer index + * + * Returned Value: + * Not significant bits for counter/capture registers + * + ****************************************************************************/ + +static uint8_t hrtim_cmpcap_mask_get(FAR struct stm32_hrtim_s *priv, + uint8_t timer) +{ + FAR struct stm32_hrtim_tim_s* tim; + uint8_t mask = 0; + + /* Get Timer data strucutre */ + + tim = hrtim_tim_get(priv, timer); + if (tim == NULL) + { + mask = 0; + goto errout; + } + + /* Not significant bits depens on timer prescaler */ + + switch(tim->tim.prescaler) + { + case HRTIM_PRESCALER_1: + { + mask = 0b11111; + break; + } + case HRTIM_PRESCALER_2: + { + mask = 0b1111; + break; + } + case HRTIM_PRESCALER_4: + { + mask = 0b111; + break; + } + case HRTIM_PRESCALER_8: + { + mask = 0b11; + break; + } + case HRTIM_PRESCALER_16: + { + mask = 0b1; + break; + } + default: + { + mask = 0; + break; + } + } + +errout: + return mask; +} + /**************************************************************************** * Name: hrtim_cmp_update * @@ -4527,7 +4649,7 @@ static void hrtim_mode_config(FAR struct stm32_hrtim_s *priv) * cmp - New compare register value * * Returned Value: - * Zero on success; a negated errno value on failure + * 0 on success, a negated errno value on failure * ****************************************************************************/ @@ -4537,6 +4659,7 @@ static int hrtim_cmp_update(FAR struct hrtim_dev_s *dev, uint8_t timer, FAR struct stm32_hrtim_s *priv = (FAR struct stm32_hrtim_s *)dev->hd_priv; int ret = OK; uint32_t offset = 0; + uint8_t mask = 0; switch (index) { @@ -4571,6 +4694,16 @@ static int hrtim_cmp_update(FAR struct hrtim_dev_s *dev, uint8_t timer, } } + /* REVISIT: what should we do if cmp value is not significant ? + * At this moment we set compare register to the nearest significant value. + */ + + mask = hrtim_cmpcap_mask_get(priv, timer); + if (cmp <= mask) + { + cmp = mask + 1; + } + hrtim_tim_putreg(priv, timer, offset, cmp); errout: @@ -4589,7 +4722,7 @@ errout: * per - New period register value * * Returned Value: - * Zero on success; a negated errno value on failure + * 0 on success; a negated errno value on failure * ****************************************************************************/ @@ -4613,7 +4746,7 @@ static int hrtim_per_update(FAR struct hrtim_dev_s *dev, uint8_t timer, * timer - HRTIM Timer index * * Returned Value: - * Zero on success; a negated errno value on failure + * Timer period value * ****************************************************************************/ @@ -4636,7 +4769,7 @@ static uint16_t hrtim_per_get(FAR struct hrtim_dev_s *dev, uint8_t timer) * index - Compare register timer * * Returned Value: - * Zero on success; a negated errno value on failure + * Timer compare value * ****************************************************************************/ @@ -4686,6 +4819,42 @@ errout: return cmpx; } +/**************************************************************************** + * Name: hrtim_fclk_get + * + * Description: + * Get HRTIM Timer clock value + * + * Input parameters: + * dev - HRTIM device structure + * timer - HRTIM Timer index + * + * Returned Value: + * Timer clock value + * + ****************************************************************************/ + +static uint64_t hrtim_fclk_get(FAR struct hrtim_dev_s *dev, uint8_t timer) +{ + FAR struct stm32_hrtim_s *priv = (FAR struct stm32_hrtim_s *)dev->hd_priv; + FAR struct stm32_hrtim_tim_s *tim; + uint64_t fclk = 0; + + /* Get Slave Timer data structure */ + + tim = hrtim_tim_get(priv, timer); + if (tim == NULL) + { + fclk = 0; + goto errout; + } + + fclk = tim->tim.fclk; + +errout: + return fclk; +} + /**************************************************************************** * Name: hrtim_tim_reset_set * @@ -4707,7 +4876,9 @@ static int hrtim_tim_reset_set(FAR struct stm32_hrtim_s *priv, uint8_t timer, { int ret = OK; - if (timer == HRTIM_TIMER_MASTER) + /* Sanity checking */ + + if (timer == HRTIM_TIMER_MASTER || timer == HRTIM_TIMER_COMMON) { ret = -EINVAL; goto errout; @@ -4811,7 +4982,7 @@ static int hrtim_update_config(FAR struct stm32_hrtim_s *priv) * priv - A reference to the HRTIM structure * * Returned Value: - * 0 on success, a negated errno value on failure + * 0 on success, a negated errno value on failure * ****************************************************************************/ diff --git a/arch/arm/src/stm32/stm32_hrtim.h b/arch/arm/src/stm32/stm32_hrtim.h index 40ffe37b8d..da02364460 100644 --- a/arch/arm/src/stm32/stm32_hrtim.h +++ b/arch/arm/src/stm32/stm32_hrtim.h @@ -187,7 +187,7 @@ # error "APB2 prescaler factor can not be greater than 2" # else # define HRTIM_HAVE_CLK_FROM_PLL 1 -# define HRTIM_CLOCK 2*STM32_PLL_FREQUENCY +# define HRTIM_MAIN_CLOCK 2*STM32_PLL_FREQUENCY # endif # else # error "Clock system must be set to PLL" @@ -195,19 +195,27 @@ #else # error "Not supported yet: system freezes when no PLL selected." # define HRTIM_HAVE_CLK_FROM_APB2 1 -# if STM32_RCC_CFGR_PPRE2 == RCC_CFGR_PPRE2_HCLK -# define HRTIM_CLOCK STM32_PCLK2_FREQUENCY +# if STM32_RCC_CFGR_PPRE2 == RCC_CFGR_PPRE2_HCLK +# define HRTIM_MAIN_CLOCK STM32_PCLK2_FREQUENCY # else -# define HRTIM_CLOCK 2*STM32_PCLK2_FREQUENCY +# define HRTIM_MAIN_CLOCK 2*STM32_PCLK2_FREQUENCY # endif #endif +/* High-resolution equivalent clock */ + +#define HRTIM_CLOCK (HRTIM_MAIN_CLOCK*32ull) + /* Helpers **************************************************************************/ #define HRTIM_CMP_SET(hrtim, tim, index, cmp) \ (hrtim)->hd_ops->cmp_update(hrtim, tim, index, cmp) #define HRTIM_PER_SET(hrtim, tim, per) \ (hrtim)->hd_ops->per_update(hrtim, tim, per) +#define HRTIM_PER_GET(hrtim, tim) \ + (hrtim)->hd_ops->per_get(hrtim, tim) +#define HRTIM_FCLK_GET(hrtim, tim) \ + (hrtim)->hd_ops->fclk_get(hrtim, tim) #define HRTIM_OUTPUTS_ENABLE(hrtim, outputs, state) \ (hrtim)->hd_ops->outputs_enable(hrtim, outputs, state) #define HRTIM_OUTPUT_SET_SET(hrtim, output, set) \ @@ -225,6 +233,11 @@ #define HRTIM_DEADTIME_UPDATE(hrtim, tim, dt, val) \ (hrtim)->hd_ops->deadtime_update(hrtim, tim, dt, val) +#define HRTIM_PER_MAX 0xFFFF +#define HRTIM_CMP_MAX 0xFFFF +#define HRTIM_CPT_MAX 0xFFFF +#define HRTIM_REP_MAX 0xFF + /************************************************************************************ * Public Types ************************************************************************************/ @@ -384,14 +397,14 @@ enum stm32_hrtim_tim_rst_e enum stm32_hrtim_tim_prescaler_e { - HRTIM_PRESCALER_1, - HRTIM_PRESCALER_2, - HRTIM_PRESCALER_4, - HRTIM_PRESCALER_8, - HRTIM_PRESCALER_16, - HRTIM_PRESCALER_32, - HRTIM_PRESCALER_64, - HRTIM_PRESCALER_128 + HRTIM_PRESCALER_1, /* CKPSC = 0 */ + HRTIM_PRESCALER_2, /* CKPSC = 1 */ + HRTIM_PRESCALER_4, /* CKPSC = 2 */ + HRTIM_PRESCALER_8, /* CKPSC = 3 */ + HRTIM_PRESCALER_16, /* CKPSC = 4 */ + HRTIM_PRESCALER_32, /* CKPSC = 5 */ + HRTIM_PRESCALER_64, /* CKPSC = 6 */ + HRTIM_PRESCALER_128 /* CKPSC = 7 */ }; /* HRTIM Timer Master/Slave mode */ @@ -971,6 +984,7 @@ struct stm32_hrtim_ops_s uint16_t (*per_get)(FAR struct hrtim_dev_s *dev, uint8_t timer); uint16_t (*cmp_get)(FAR struct hrtim_dev_s *dev, uint8_t timer, uint8_t index); + uint64_t (*fclk_get)(FAR struct hrtim_dev_s *dev, uint8_t timer); #ifdef CONFIG_STM32_HRTIM_INTERRUPTS void (*irq_ack)(FAR struct hrtim_dev_s *dev, uint8_t timer, int source); #endif diff --git a/configs/stm32f334-disco/include/board.h b/configs/stm32f334-disco/include/board.h index 115b02abd4..c138e01cab 100644 --- a/configs/stm32f334-disco/include/board.h +++ b/configs/stm32f334-disco/include/board.h @@ -277,12 +277,42 @@ /* HRTIM configuration ******************************************************/ -#define HRTIM_TIMA_PRESCALER HRTIM_PRESCALER_32 +/* Timer A configuration - Buck operations */ + +#define HRTIM_TIMA_PRESCALER HRTIM_PRESCALER_1 #define HRTIM_TIMA_MODE HRTIM_MODE_CONT -#define HRTIM_TIMB_PRESCALER HRTIM_PRESCALER_32 +#define HRTIM_TIMA_CH1_SET HRTIM_OUT_SET_NONE +#define HRTIM_TIMA_CH1_RST HRTIM_OUT_RST_NONE +#define HRTIM_TIMA_CH2_SET HRTIM_OUT_SET_NONE +#define HRTIM_TIMA_CH2_RST HRTIM_OUT_RST_NONE + +#define HRTIM_TIMA_DT_FSLOCK HRTIM_DT_LOCK +#define HRTIM_TIMA_DT_RSLOCK HRTIM_DT_LOCK +#define HRTIM_TIMA_DT_FVLOCK HRTIM_DT_RW +#define HRTIM_TIMA_DT_RVLOCK HRTIM_DT_RW +#define HRTIM_TIMA_DT_FSIGN HRTIM_DT_SIGN_POSITIVE +#define HRTIM_TIMA_DT_RSIGN HRTIM_DT_SIGN_POSITIVE +#define HRTIM_TIMA_DT_PRESCALER HRTIM_DEADTIME_PRESCALER_1 + +/* Timer B configuration - Boost operations */ + +#define HRTIM_TIMB_PRESCALER HRTIM_PRESCALER_1 #define HRTIM_TIMB_MODE HRTIM_MODE_CONT +#define HRTIM_TIMB_CH1_SET HRTIM_OUT_SET_NONE +#define HRTIM_TIMB_CH1_RST HRTIM_OUT_RST_NONE +#define HRTIM_TIMB_CH2_SET HRTIM_OUT_SET_NONE +#define HRTIM_TIMB_CH2_RST HRTIM_OUT_RST_NONE + +#define HRTIM_TIMB_DT_FSLOCK HRTIM_DT_LOCK +#define HRTIM_TIMB_DT_RSLOCK HRTIM_DT_LOCK +#define HRTIM_TIMB_DT_FVLOCK HRTIM_DT_RW +#define HRTIM_TIMB_DT_RVLOCK HRTIM_DT_RW +#define HRTIM_TIMB_DT_FSIGN HRTIM_DT_SIGN_POSITIVE +#define HRTIM_TIMB_DT_RSIGN HRTIM_DT_SIGN_POSITIVE +#define HRTIM_TIMB_DT_PRESCALER HRTIM_DEADTIME_PRESCALER_1 + #define HRTIM_ADC_TRG2 HRTIM_ADCTRG24_AC4 /* DMA channels *************************************************************/ diff --git a/configs/stm32f334-disco/src/stm32_smps.c b/configs/stm32f334-disco/src/stm32_smps.c index 952af64c1b..b1ae43e216 100644 --- a/configs/stm32f334-disco/src/stm32_smps.c +++ b/configs/stm32f334-disco/src/stm32_smps.c @@ -105,8 +105,8 @@ /* ADC1 injected channels numeration */ -#define VIN_ADC_INJ_CHANNEL 0 -#define VOUT_ADC_INJ_CHANNEL 1 +#define V_IN_ADC_INJ_CHANNEL 0 +#define V_OUT_ADC_INJ_CHANNEL 1 /* Voltage reference for ADC */ @@ -118,11 +118,11 @@ /* Input voltage convertion ratio - 6.8k/(6.8k + 27k) */ -#define VIN_RATIO (float)((float)(6800+27000)/(float)6800) +#define V_IN_RATIO (float)((float)(6800+27000)/(float)6800) /* Output voltage convertion ratio - 3.3k/(3.3k + 13.3k) */ -#define VOUT_RATIO (float)((float)(3300+13300)/(float)3300) +#define V_OUT_RATIO (float)((float)(3300+13300)/(float)3300) /* Some absolute limits */ @@ -130,6 +130,61 @@ #define SMPS_ABSOLUTE_OUT_VOLTAGE_LIMIT_mV 15000 #define SMPS_ABSOLUTE_IN_VOLTAGE_LIMIT_mV 15000 +#if CONFIG_EXAMPLES_SMPS_OUT_CURRENT_LIMIT > SMPS_ABSOLUTE_OUT_CURRENT_LIMIT_mA +# error "Output current limit great than absolute limit!" +#endif +#if CONFIG_EXAMPLES_SMPS_OUT_VOLTAGE_LIMIT > SMPS_ABSOLUTE_OUT_VOLTAGE_LIMIT_mV +# error "Output voltage limit greater than absolute limit!" +#endif +#if CONFIG_EXAMPLES_SMPS_IN_VOLTAGE_LIMIT > SMPS_ABSOLUTE_IN_VOLTAGE_LIMIT_mV +# error "Input voltage limit greater than absolute limit!" +#endif + +/* Maximum output voltage for boost conveter in float */ + +#define BOOST_VOLT_MAX ((float)CONFIG_EXAMPLES_SMPS_OUT_VOLTAGE_LIMIT/1000.0) + +/* Current limit table dimmension */ + +#define SMPS_CURRENT_LIMIT_TAB_DIM 15 + +/* At this time only PID controller implemented */ + +#define SMPS_CONTROLLER_PID 1 + +/* Converter's finite accuracy */ + +#define SMPS_VOLTAGE_ACCURACY ((float)0.01) + +/* Buck-boost mode threshold */ + +#define SMPS_BUCKBOOST_RANGE ((float)0.5) + +/* PID controller configuration */ + +#define PID_KP ((float)1.0) +#define PID_KI ((float)0.1) +#define PID_KD ((float)0.0) + +/* Converter frequncies: + * - TIMA_PWM_FREQ - buck converter 250kHz + * - TIMB_PWM_FREQ - boost converter 250kHz + */ + +#define TIMA_PWM_FREQ 250000 +#define TIMB_PWM_FREQ 250000 + +/* Deadtime configuration */ + +#define DT_RISING 0x0A0 +#define DT_FALLING 0x0A0 + +/* Helper macros */ + +#define HRTIM_ALL_OUTPUTS_ENABLE(hrtim, state) \ + HRTIM_OUTPUTS_ENABLE(hrtim, HRTIM_OUT_TIMA_CH1|HRTIM_OUT_TIMA_CH2| \ + HRTIM_OUT_TIMB_CH1|HRTIM_OUT_TIMB_CH2, state); + /**************************************************************************** * Private Types ****************************************************************************/ @@ -138,6 +193,7 @@ enum converter_mode_e { + CONVERTER_MODE_INIT, /* Initial mode */ CONVERTER_MODE_BUCK, /* Buck mode operations (V_in > V_out) */ CONVERTER_MODE_BOOST, /* Boost mode operations (V_in < V_out) */ CONVERTER_MODE_BUCKBOOST, /* Buck-boost operations (V_in near V_out)*/ @@ -159,11 +215,13 @@ struct smps_lower_dev_s struct smps_priv_s { uint8_t conv_mode; /* Converter mode */ - uint16_t vin_raw; /* Voltage input RAW value */ - uint16_t vout_raw; /* Voltage output RAW value */ - float vin; /* Voltage input real value in V */ - float vout; /* Voltage output real value in V */ + uint16_t v_in_raw; /* Voltage input RAW value */ + uint16_t v_out_raw; /* Voltage output RAW value */ + float v_in; /* Voltage input real value in V */ + float v_out; /* Voltage output real value in V */ bool running; /* Running flag */ + float state[3]; /* Controller state vartiables */ + float *c_limit_tab; /* Current limit tab */ }; /**************************************************************************** @@ -215,8 +273,9 @@ struct smps_ops_s g_smps_ops = struct smps_dev_s g_smps_dev = { - .ops = &g_smps_ops, - .priv = &g_smps + .ops = &g_smps_ops, + .priv = &g_smps, + .lower = NULL }; /* ADC configuration: @@ -232,16 +291,16 @@ struct smps_dev_s g_smps_dev = * Transistors configuration in boost mode: * - T4 - ON * - T11 - OFF - * - T5 and T15 - boost operation + * - T5 and T12 - boost operation * Transistors configuration in buck-boost mode: * - T4, T11 - buck operation - * - T5 and T15 - boost operation + * - T5 and T12 - boost operation * * HRTIM outputs configuration: * - T4 -> PA8 -> HRTIM_CHA1 * - T5 -> PA11 -> HRTIM_CHB2 * - T11 -> PA9 -> HRTIM_CHA2 - * - T15 -> PA10 -> HRTIM_CHB1 + * - T12 -> PA10 -> HRTIM_CHB1 * */ @@ -257,8 +316,8 @@ static const uint8_t g_adc1chan[ADC1_NCHANNELS] = static const uint32_t g_adc1pins[ADC1_NCHANNELS] = { - GPIO_ADC1_IN2, /* PA1 - VIN */ - GPIO_ADC1_IN4, /* PA3 - VOUT */ + GPIO_ADC1_IN2, /* PA1 - V_IN */ + GPIO_ADC1_IN4, /* PA3 - V_OUT */ }; /**************************************************************************** @@ -290,7 +349,7 @@ static int smps_shutdown(FAR struct smps_dev_s *dev) * Description: * * Returned Value: - * 0 on success, a negated errno value on failure + * 0 on success, a negated errno value on failure * ****************************************************************************/ @@ -300,6 +359,7 @@ static int smps_setup(FAR struct smps_dev_s *dev) FAR struct smps_s *smps = (FAR struct smps_s *)dev->priv; FAR struct hrtim_dev_s *hrtim = NULL; FAR struct adc_dev_s *adc = NULL; + FAR struct smps_priv_s *priv; /* Initialize smps structure */ @@ -321,6 +381,8 @@ static int smps_setup(FAR struct smps_dev_s *dev) printf("ERROR: failed to get ADC lower level interface"); } + /* TODO: create current limit table */ + errout: return OK; } @@ -331,28 +393,89 @@ static int smps_start(FAR struct smps_dev_s *dev) FAR struct stm32_adc_dev_s *stm32_adc = (FAR struct stm32_adc_dev_s *) lower->adc->ad_priv; FAR struct smps_s *smps = (FAR struct smps_s *)dev->priv; + FAR struct smps_priv_s *priv = (struct smps_priv_s *)smps->priv; FAR struct hrtim_dev_s *hrtim = lower->hrtim; + volatile uint64_t per = 0; + uint64_t fclk = 0; + int ret = OK; - /* Stop HRTIM PWM */ + /* Disable HRTIM outputs */ + + HRTIM_ALL_OUTPUTS_ENABLE(hrtim, false); + + /* Reset SMPS private structure */ + + memset(priv, 0, sizeof(struct smps_priv_s)); + + /* Get TIMA period value for given frequency */ + + fclk = HRTIM_FCLK_GET(hrtim, HRTIM_TIMER_TIMA); + per = fclk/TIMA_PWM_FREQ; + if (per > HRTIM_PER_MAX) + { + printf("ERROR: can not achieve tima pwm freq=%u if fclk=%llu\n", + (uint32_t)TIMA_PWM_FREQ, (uint64_t)fclk); + ret = -EINVAL; + goto errout; + } - HRTIM_OUTPUTS_ENABLE(hrtim, HRTIM_OUT_TIMA_CH1, false); - HRTIM_OUTPUTS_ENABLE(hrtim, HRTIM_OUT_TIMA_CH2, false); + /* Set TIMA period value */ - HRTIM_OUTPUTS_ENABLE(hrtim, HRTIM_OUT_TIMB_CH1, false); - HRTIM_OUTPUTS_ENABLE(hrtim, HRTIM_OUT_TIMB_CH2, false); + HRTIM_PER_SET(hrtim, HRTIM_TIMER_TIMA, (uint16_t)per); + + /* Get TIMB period value for given frequency */ + + fclk = HRTIM_FCLK_GET(hrtim, HRTIM_TIMER_TIMB); + per = fclk/TIMB_PWM_FREQ; + if (per > HRTIM_PER_MAX) + { + printf("ERROR: can not achieve timb pwm freq=%u if fclk=%llu\n", + (uint32_t)TIMB_PWM_FREQ, (uint64_t)fclk); + ret = -EINVAL; + goto errout; + } - /* 1 period is 4us - 100% time */ + /* Set TIMB period value */ - HRTIM_PER_SET(hrtim, HRTIM_TIMER_TIMA, 18432); - HRTIM_PER_SET(hrtim, HRTIM_TIMER_TIMB, 18432); + HRTIM_PER_SET(hrtim, HRTIM_TIMER_TIMB, (uint16_t)per); /* ADC trigger on TIMA CMP4 */ HRTIM_CMP_SET(hrtim, HRTIM_TIMER_TIMA, HRTIM_CMP4, 10000); + /* Configure TIMER A and TIMER B deadtime mode + * + * NOTE: In deadtime mode we have to configure output 1 only (SETx1, RSTx1), + * output 2 configuration is not significant. + */ + + HRTIM_DEADTIME_UPDATE(hrtim, HRTIM_TIMER_TIMA, HRTIM_DT_EDGE_RISING, DT_RISING); + HRTIM_DEADTIME_UPDATE(hrtim, HRTIM_TIMER_TIMA, HRTIM_DT_EDGE_FALLING, DT_FALLING); + HRTIM_DEADTIME_UPDATE(hrtim, HRTIM_TIMER_TIMB, HRTIM_DT_EDGE_RISING, DT_RISING); + HRTIM_DEADTIME_UPDATE(hrtim, HRTIM_TIMER_TIMB, HRTIM_DT_EDGE_FALLING, DT_FALLING); + + /* Set T4 and T12 to a low state. + * Deadtime mode force T11 and T5 to a high state. + */ + + HRTIM_OUTPUT_SET_SET(hrtim, HRTIM_OUT_TIMA_CH1, HRTIM_OUT_SET_NONE); + HRTIM_OUTPUT_RST_SET(hrtim, HRTIM_OUT_TIMA_CH1, HRTIM_OUT_RST_PER); + + HRTIM_OUTPUT_SET_SET(hrtim, HRTIM_OUT_TIMB_CH1, HRTIM_OUT_SET_NONE); + HRTIM_OUTPUT_RST_SET(hrtim, HRTIM_OUT_TIMB_CH1, HRTIM_OUT_RST_PER); + + /* Set running flag */ + + priv->running = true; + + HRTIM_ALL_OUTPUTS_ENABLE(hrtim, true); + /* Enable ADC interrupts */ stm32_adc->ops->int_en(stm32_adc, ADC_INT_JEOS); + +errout: + return ret; } static int smps_stop(FAR struct smps_dev_s *dev) @@ -366,11 +489,7 @@ static int smps_stop(FAR struct smps_dev_s *dev) /* Disable HRTIM outputs */ - HRTIM_OUTPUTS_ENABLE(hrtim, HRTIM_OUT_TIMA_CH1, false); - HRTIM_OUTPUTS_ENABLE(hrtim, HRTIM_OUT_TIMA_CH2, false); - - HRTIM_OUTPUTS_ENABLE(hrtim, HRTIM_OUT_TIMB_CH1, false); - HRTIM_OUTPUTS_ENABLE(hrtim, HRTIM_OUT_TIMB_CH2, false); + HRTIM_ALL_OUTPUTS_ENABLE(hrtim, false); /* Disable ADC interrupts */ @@ -459,27 +578,27 @@ static int smps_limits_set(FAR struct smps_dev_s *dev, goto errout; } - if (limits->v_out * 1000 > SMPS_ABSOLUTE_OUT_VOLTAGE_LIMIT_mV) + if (limits->v_out * 1000 > CONFIG_EXAMPLES_SMPS_OUT_VOLTAGE_LIMIT) { - limits->v_out = (float)SMPS_ABSOLUTE_OUT_VOLTAGE_LIMIT_mV/1000.0; + limits->v_out = (float)CONFIG_EXAMPLES_SMPS_OUT_VOLTAGE_LIMIT/1000.0; printf("SMPS output voltage limiit > SMPS absoulute output voltage limit." - " Set output voltage limit to %d.\n", + " Set output voltage limit to %.2f.\n", limits->v_out); } - if (limits->v_in * 1000 > SMPS_ABSOLUTE_IN_VOLTAGE_LIMIT_mV) + if (limits->v_in * 1000 > CONFIG_EXAMPLES_SMPS_IN_VOLTAGE_LIMIT) { - limits->v_in = (float)SMPS_ABSOLUTE_IN_VOLTAGE_LIMIT_mV/1000.0; + limits->v_in = (float)CONFIG_EXAMPLES_SMPS_IN_VOLTAGE_LIMIT/1000.0; printf("SMPS input voltage limiit > SMPS absoulute input voltage limit." - " Set input voltage limit to %d.\n", + " Set input voltage limit to %.2f.\n", limits->v_in); } - if (limits->i_out * 1000 > SMPS_ABSOLUTE_OUT_CURRENT_LIMIT_mA) + if (limits->i_out * 1000 > CONFIG_EXAMPLES_SMPS_OUT_CURRENT_LIMIT) { - limits->i_out = (float)SMPS_ABSOLUTE_OUT_CURRENT_LIMIT_mA/1000.0; + limits->i_out = (float)CONFIG_EXAMPLES_SMPS_OUT_CURRENT_LIMIT/1000.0; printf("SMPS output current limiit > SMPS absoulute output current limit." - " Set output current limit to %d.\n", + " Set output current limit to %.2f.\n", limits->i_out); } @@ -510,8 +629,8 @@ static int smps_state_get(FAR struct smps_dev_s *dev, /* Copy localy stored feedbacks data to status structure */ - smps->state.fb.v_in = g_smps_priv.vin; - smps->state.fb.v_out = g_smps_priv.vout; + smps->state.fb.v_in = g_smps_priv.v_in; + smps->state.fb.v_out = g_smps_priv.v_out; /* Return state structure to caller */ @@ -544,36 +663,302 @@ static int smps_ioctl(FAR struct smps_dev_s *dev, int cmd, unsigned long arg) return OK; } +/**************************************************************************** + * Name: pid_controller + ****************************************************************************/ + +static float pid_controller(struct smps_priv_s *priv, float err) +{ + float out; + float A0 = PID_KP + PID_KD + PID_KI; + float A1 = -PID_KP - 2.0*PID_KD; + float A2 = PID_KD; + + /* Get PID controller output */ + + out = (A0 * err) + (A1 * priv->state[0]) + (A2 * priv->state[1]) + priv->state[2]; + + /* Store PID contrroller variables */ + + priv->state[1] = priv->state[0]; + priv->state[0] = err; + priv->state[2] = out; + + return out; +} + +/**************************************************************************** + * Name: smps_controller + ****************************************************************************/ + +static float smps_controller(struct smps_priv_s *priv, float err) +{ +#ifdef SMPS_CONTROLLER_PID + return pid_controller(priv, err); +#else +# error "At this time only PID controller implemented" +#endif +} + +/**************************************************************************** + * Name: smps_duty_set + ****************************************************************************/ + +static void smps_duty_set(struct smps_priv_s *priv, struct smps_lower_dev_s *lower, + float out) +{ + FAR struct hrtim_dev_s *hrtim = lower->hrtim; + uint8_t mode = priv->conv_mode; + uint16_t cmp = 0; + float duty = 0.0; + uint16_t per = 0; + + switch (mode) + { + case CONVERTER_MODE_INIT: + { + /* Do nothing */ + + break; + } + + case CONVERTER_MODE_BUCK: + { + if (out >= priv->v_in) out = priv->v_in; + if (out < 0.0) out = 0.0; + + duty = out/priv->v_in; + +#warning TODO: current limit in buck mode + + per = HRTIM_PER_GET(hrtim, HRTIM_TIMER_TIMA); + + cmp = (uint16_t)(per * duty); + + if (cmp > per-30) cmp = per - 30; + + /* Set T4 duty cycle. T11 is complementary to T4 */ + + HRTIM_CMP_SET(hrtim, HRTIM_TIMER_TIMA, HRTIM_CMP1, cmp); + + break; + } + + case CONVERTER_MODE_BOOST: + { + per = HRTIM_PER_GET(hrtim, HRTIM_TIMER_TIMA); + + + if (out < priv->v_in) out = priv->v_in; + if (out >= BOOST_VOLT_MAX) out = BOOST_VOLT_MAX; + + duty = 1.0 - priv->v_in/out; + +#warning TODO: current limit in boost mode + + cmp = (uint16_t)(per * duty); + + /* Set T12 duty cycle. T5 is complementary to T12 */ + + HRTIM_CMP_SET(hrtim, HRTIM_TIMER_TIMB, HRTIM_CMP1, cmp); + + break; + } + + case CONVERTER_MODE_BUCKBOOST: + { + /* do something */ + +#warning TODO: buck boost mode + + break; + } + + default: + { + printf("ERROR: unknown converter mode %d!\n", mode); + break; + } + } +} + +/**************************************************************************** + * Name: smps_conv_mode_set + * + * Description: + * Change converter mode (buck/boost/buck-boost). + * + * Returned Value: + * None + * + ****************************************************************************/ + +static void smps_conv_mode_set(struct smps_priv_s *priv, struct smps_lower_dev_s *lower, + uint8_t mode) +{ + FAR struct hrtim_dev_s *hrtim = lower->hrtim; + + /* Disable all outputs */ + + HRTIM_ALL_OUTPUTS_ENABLE(hrtim, false); + + switch (mode) + { + case CONVERTER_MODE_INIT: + { + + break; + } + + case CONVERTER_MODE_BUCK: + { + /* Set T12 low (T5 high) on the next PER */ + + HRTIM_OUTPUT_SET_SET(hrtim, HRTIM_OUT_TIMB_CH1, HRTIM_OUT_SET_NONE); + HRTIM_OUTPUT_RST_SET(hrtim, HRTIM_OUT_TIMB_CH1, HRTIM_OUT_RST_PER); + + + /* Set T4 to a high state on PER and reset on CMP1. + T11 is complementary to T4. */ + + HRTIM_OUTPUT_SET_SET(hrtim, HRTIM_OUT_TIMA_CH1, HRTIM_OUT_SET_PER); + HRTIM_OUTPUT_RST_SET(hrtim, HRTIM_OUT_TIMA_CH1, HRTIM_OUT_RST_CMP1); + + break; + } + + case CONVERTER_MODE_BOOST: + { + /* Set T4 high (T11 low) on the next PER */ + + HRTIM_OUTPUT_SET_SET(hrtim, HRTIM_OUT_TIMA_CH1, HRTIM_OUT_SET_PER); + HRTIM_OUTPUT_RST_SET(hrtim, HRTIM_OUT_TIMA_CH1, HRTIM_OUT_RST_NONE); + + /* Set T12 to a high state on PER and reset on CMP1. + T5 is complementary to T12. */ + + HRTIM_OUTPUT_SET_SET(hrtim, HRTIM_OUT_TIMB_CH1, HRTIM_OUT_SET_PER); + HRTIM_OUTPUT_RST_SET(hrtim, HRTIM_OUT_TIMB_CH1, HRTIM_OUT_RST_CMP1); + + break; + } + + case CONVERTER_MODE_BUCKBOOST: + { + /* Set T4 to a high state on PER and reset on CMP1. + T11 is complementary to T4. */ + + HRTIM_OUTPUT_SET_SET(hrtim, HRTIM_OUT_TIMA_CH1, HRTIM_OUT_SET_PER); + HRTIM_OUTPUT_RST_SET(hrtim, HRTIM_OUT_TIMA_CH1, HRTIM_OUT_RST_CMP1); + + /* Set T12 to a high state on PER and reset on CMP1. + T5 is complementary to T12. */ + + HRTIM_OUTPUT_SET_SET(hrtim, HRTIM_OUT_TIMB_CH1, HRTIM_OUT_SET_PER); + HRTIM_OUTPUT_RST_SET(hrtim, HRTIM_OUT_TIMB_CH1, HRTIM_OUT_RST_CMP1); + + break; + } + + default: + { + printf("ERROR: unknown converter mode %d!\n", mode); + break; + } + } + + /* Set mode in private data */ + + priv->conv_mode = mode; + + /* Enable outputs */ + + HRTIM_ALL_OUTPUTS_ENABLE(hrtim, true); + +} + +/**************************************************************************** + * Name: adc12_handler + ****************************************************************************/ + static void adc12_handler(void) { - FAR struct smps_lower_dev_s *lower = g_smps_dev.lower; - FAR struct stm32_adc_dev_s *stm32_adc = + FAR struct smps_dev_s *dev = &g_smps_dev; + FAR struct smps_s *smps = (FAR struct smps_s *)dev->priv; + FAR struct smps_priv_s *priv = (struct smps_priv_s *)smps->priv; + FAR struct smps_lower_dev_s *lower = dev->lower; + FAR struct stm32_adc_dev_s *adc = (FAR struct stm32_adc_dev_s*)lower->adc->ad_priv; + uint32_t pending; float ref = ADC_REF_VOLTAGE; float bit = ADC_VAL_MAX; - uint32_t pending; + float err; + float out; + uint8_t mode; - pending = stm32_adc->ops->int_get(stm32_adc); + pending = adc->ops->int_get(adc); - if (pending & ADC_INT_JEOC) + if (pending & ADC_INT_JEOC && priv->running == true) { /* Get raw ADC values */ - g_smps_priv.vout_raw = stm32_adc->ops->inj_get(stm32_adc, VOUT_ADC_INJ_CHANNEL); - g_smps_priv.vin_raw = stm32_adc->ops->inj_get(stm32_adc, VIN_ADC_INJ_CHANNEL); + priv->v_out_raw = adc->ops->inj_get(adc, V_OUT_ADC_INJ_CHANNEL); + priv->v_in_raw = adc->ops->inj_get(adc, V_IN_ADC_INJ_CHANNEL); /* Convert raw values to real values */ - g_smps_priv.vout = (g_smps_priv.vout_raw * ref / bit) * VOUT_RATIO; - g_smps_priv.vin = (g_smps_priv.vin_raw * ref / bit) * VIN_RATIO; + priv->v_out = (priv->v_out_raw * ref / bit) * V_OUT_RATIO; + priv->v_in = (priv->v_in_raw * ref / bit) * V_IN_RATIO; + + /* According to measured voltages we set converter in appropriate mode */ + + if (smps->param.v_out > (priv->v_in+SMPS_BUCKBOOST_RANGE)) + { + /* Desired output voltage greather than input voltage - set boost converter */ + + mode = CONVERTER_MODE_BOOST; + } + + else if (smps->param.v_out < (priv->v_in-SMPS_BUCKBOOST_RANGE)) + { + /* Desired output voltage lower than input voltage - set buck converter */ + + mode = CONVERTER_MODE_BUCK; + } + + else + { + /* Desired output voltage close to input voltage - set buck-boost converter */ + + mode = CONVERTER_MODE_BUCKBOOST; + } + + /* Configure converter to the new mode if needed */ + + if (priv->conv_mode != mode) + { + smps_conv_mode_set(priv, lower, mode); + } + + /* Get regualtor error */ + + err = smps->param.v_out - priv->v_out; + + if (err >= SMPS_VOLTAGE_ACCURACY || err <= (-SMPS_VOLTAGE_ACCURACY)) + { + /* PID controller */ + + out = smps_controller(priv, err); -#warning "missing regulator logic!" + /* Update duty cycle */ + smps_duty_set(priv, lower, out); + } } /* Clear pending */ - stm32_adc->ops->int_ack(stm32_adc, pending); + adc->ops->int_ack(adc, pending); } /**************************************************************************** @@ -584,12 +969,12 @@ static void adc12_handler(void) * Name: stm32_smps_setup * * Description: - * Initialize SMPS driver. + * Initialize SMPS driver. * - * This function should be call by board_app_initialize(). + * This function should be call by board_app_initialize(). * * Returned Value: - * 0 on success, a negated errno value on failure + * 0 on success, a negated errno value on failure * ****************************************************************************/ -- GitLab From 2ef098dfdaf9a4e70cf9cadfa046f2707151cee4 Mon Sep 17 00:00:00 2001 From: Juha Niskanen Date: Mon, 22 Jan 2018 07:14:32 -0600 Subject: [PATCH 091/228] fs/userfs: use correct req type in userfs_truncate, remove use of undeclared buf --- fs/userfs/fs_userfs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/userfs/fs_userfs.c b/fs/userfs/fs_userfs.c index bf91d58c1e..3cb7a10b21 100644 --- a/fs/userfs/fs_userfs.c +++ b/fs/userfs/fs_userfs.c @@ -944,7 +944,7 @@ static int userfs_truncate(FAR struct file *filep, off_t length) /* Construct and send the request to the server */ req = (FAR struct userfs_truncate_request_s *)priv->iobuffer; - req->req = USERFS_REQ_FSTAT; + req->req = USERFS_REQ_TRUNCATE; req->openinfo = filep->f_priv; req->length = length; @@ -986,7 +986,6 @@ static int userfs_truncate(FAR struct file *filep, off_t length) /* Return the result of truncate operation */ - DEBUGASSERT(buf != NULL); return resp->ret; } -- GitLab From 65afc69dc81daa77257d2b1045f886b056288755 Mon Sep 17 00:00:00 2001 From: David Alessio Date: Mon, 22 Jan 2018 13:20:35 +0000 Subject: [PATCH 092/228] Merged in david_alessio/nuttx/refactor-pll-setup (pull request #581) Refactor pll setup * fix typo in #def * refactor PLL setup code... * refactored PLL/CLK config, easier, checks for correctness * call go_os_start if STACK_COLORIZED * smarter config of EXTCLK output freq * cosmetic Approved-by: Gregory Nutt --- arch/arm/src/xmc4/chip/xmc4_scu.h | 2 +- arch/arm/src/xmc4/xmc4_clockconfig.c | 37 ++++- arch/arm/src/xmc4/xmc4_start.c | 8 + configs/xmc4500-relax/include/board.h | 219 +++++++++++++------------- 4 files changed, 148 insertions(+), 118 deletions(-) diff --git a/arch/arm/src/xmc4/chip/xmc4_scu.h b/arch/arm/src/xmc4/chip/xmc4_scu.h index 2d22084252..afa4d0f8a7 100644 --- a/arch/arm/src/xmc4/chip/xmc4_scu.h +++ b/arch/arm/src/xmc4/chip/xmc4_scu.h @@ -938,7 +938,7 @@ #define SCU_SLEEPCR_SYSSEL (1 << 0) /* Bit 0: System Clock Selection Value */ # define SCU_SLEEPCR_SYSSEL_OFI (0) /* 0=fOFI */ -# define SCU_SLEEPCR_SYSSEL_ PLL (1 << 0) /* 1=fPLL */ +# define SCU_SLEEPCR_SYSSEL_FPLL (1 << 0) /* 1=fPLL */ #define SCU_SLEEPCR_USBCR (1 << 16) /* Bit 6: USB Clock Control in Sleep Mode */ #define SCU_SLEEPCR_MMCCR (1 << 17) /* Bit 17: MMC Clock Control in Sleep Mode */ #define SCU_SLEEPCR_ETH0CR (1 << 18) /* Bit 18: Ethernet Clock Control in Sleep Mode */ diff --git a/arch/arm/src/xmc4/xmc4_clockconfig.c b/arch/arm/src/xmc4/xmc4_clockconfig.c index eeb71dbe0b..9d6cc0621e 100644 --- a/arch/arm/src/xmc4/xmc4_clockconfig.c +++ b/arch/arm/src/xmc4/xmc4_clockconfig.c @@ -58,6 +58,7 @@ #include "up_arch.h" #include "chip/xmc4_scu.h" #include "xmc4_clockconfig.h" +#include "chip/xmc4_ports.h" #include @@ -105,7 +106,7 @@ #define CLKSET_VALUE (0x00000000) #define USBCLKCR_VALUE (0x00010000) -#if BOARD_PBDIV == 1 +#if BOARD_PLL_PBDIV == 1 # define PBCLKCR_VALUE SCU_PBCLKCR_PBDIV_FCPU #else /* BOARD_PBDIV == 2 */ # define PBCLKCR_VALUE SCU_PBCLKCR_PBDIV_DIV2 @@ -387,8 +388,8 @@ void xmc4_clock_configure(void) /* Setup fSYS clock */ - regval = (BOARD_ENABLE_PLL << SCU_SYSCLKCR_SYSSEL); - regval |= SCU_SYSCLKCR_SYSDIV(BOARD_SYSDIV); + regval = (BOARD_ENABLE_PLL ? SCU_SYSCLKCR_SYSSEL : 0); + regval |= SCU_SYSCLKCR_SYSDIV(BOARD_PLL_SYSDIV); putreg32(regval, XMC4_SCU_SYSCLKCR); /* Setup peripheral clock divider */ @@ -411,7 +412,7 @@ void xmc4_clock_configure(void) /* Setup EBU clock */ - regval = SCU_EBUCLKCR_EBUDIV(BOARD_EBUDIV); + regval = SCU_EBUCLKCR_EBUDIV(BOARD_PLL_EBUDIV); putreg32(regval, XMC4_SCU_EBUCLKCR); #ifdef BOARD_ENABLE_USBPLL @@ -423,7 +424,7 @@ void xmc4_clock_configure(void) /* Setup EXT */ regval = (BOARD_EXT_SOURCE << SCU_EXTCLKCR_ECKSEL_SHIFT); - regval |= SCU_EXTCLKCR_ECKDIV(BOARD_EXTDIV); + regval |= SCU_EXTCLKCR_ECKDIV(BOARD_PLL_ECKDIV); putreg32(regval, XMC4_SCU_EXTCLKCR); #if BOARD_ENABLE_PLL @@ -561,4 +562,30 @@ void xmc4_clock_configure(void) /* Enable selected clocks */ putreg32(CLKSET_VALUE, XMC4_SCU_CLKSET); + +#if BOARD_PLL_CLOCKSRC_XTAL == 1 + regval = SCU_SLEEPCR_SYSSEL_FPLL; + putreg32(regval, XMC4_SCU_SLEEPCR); +#endif /* BOARD_PLL_CLOCKSRC_XTAL == 1 */ + +#if BOARD_EXTCKL_ENABLE +#if BOARD_EXTCLK_PIN == EXTCLK_PIN_P0_8 + /* enable EXTCLK output on P0.8 */ + regval = getreg32(XMC4_PORT0_HWSEL); + regval &= ~PORT_HWSEL_HW8_MASK; + putreg32(regval, XMC4_PORT0_HWSEL); + + regval = getreg32(XMC4_PORT0_PDR1); + regval &= ~PORT_PDR1_PD8_MASK; + putreg32(regval, XMC4_PORT0_PDR1); + + regval = getreg32(XMC4_PORT0_IOCR8); + regval &= ~PORT_IOCR8_PC8_MASK; + regval |= PORT_IOCR8_PC8(0x11); /* push-pull output, alt func 1 */ + putreg32(regval, XMC4_PORT0_IOCR8); +#else + /* enable EXTCLK output on P1.15 */ +# warn "Not yet implemented" +#endif +#endif } diff --git a/arch/arm/src/xmc4/xmc4_start.c b/arch/arm/src/xmc4/xmc4_start.c index d1a1b4a1c3..5e65aecaac 100644 --- a/arch/arm/src/xmc4/xmc4_start.c +++ b/arch/arm/src/xmc4/xmc4_start.c @@ -396,9 +396,17 @@ void __start(void) /* Then start NuttX */ +#ifdef CONFIG_STACK_COLORATION + /* Set the IDLE stack to the coloration value and jump into os_start() */ + + go_os_start((FAR void *)&_ebss, CONFIG_IDLETHREAD_STACKSIZE); +#else + /* Call os_start() */ + os_start(); /* Shouldn't get here */ for (; ; ); +#endif } diff --git a/configs/xmc4500-relax/include/board.h b/configs/xmc4500-relax/include/board.h index 7190d1c939..0dfd182eb6 100644 --- a/configs/xmc4500-relax/include/board.h +++ b/configs/xmc4500-relax/include/board.h @@ -82,158 +82,153 @@ #define BOARD_XTAL_FREQUENCY 12000000 /* 12MHz XTAL */ #undef BOARD_RTC_XTAL_FRQUENCY /* 32.768KHz RTC XTAL not available on the Relax Lite */ - -#if defined(BOARD_FCPU_144MHZ) -/* Default clock initialization - * - * fXTAL = 12Mhz - * -> fPLL = (fXTAL / (2 * 1) * 48) = 288MHz - * -> fSYS = (fPLL / 1) = 288MHz - * -> fCPU = (fSYS / 2) = 144MHz - * -> fPERIPH = (fCPU / 1) = 144MHz - * -> fCCU = (fSYS / 2) = 144MHz - * -> fETH = 72MHz (REVISIT) - * -> fUSB = 48MHz (REVISIT) - * -> fEBU = 72MHz (REVISIT) - * - * fUSBPLL Disabled, only enabled if SCU_CLK_USBCLKCR_USBSEL_USBPLL is selected - * - * fOFI = 24MHz - * -> fWDT = 24MHz (REVISIT) +/* + * TODO: enable the RTC osc, use RTC for time/date */ /* Select the external crystal as the PLL clock source */ -# define BOARD_PLL_CLOCKSRC_XTAL 1 /* PLL Clock source == external crystal */ +# define BOARD_PLL_CLOCKSRC_XTAL 1 /* PLL Clock source == extnernal crystal */ # undef BOARD_PLL_CLOCKSRC_OFI /* PLL Clock source != internal fast oscillator */ /* PLL Configuration: * - * fPLL = (fPLLSRC / (pdiv * k2div) * ndiv + * fXTAL = 12Mhz + * 260 MHz <= fVCO <= 520 MHz * - * fPLL = (12000000 / (2 * 1)) * 48 - * = 288MHz + * fVCO = fXTAL * ndiv / pdiv + * fPLL = fVCO / k2div + * fSYS = fPLL / sysdiv + * fETH = fSYS / 2 (fixed div by 2) + * fCCU = fSYS / ccudiv (div by 1 or 2) + * fCPU = fSYS / cpudiv (div by 1 or 2) + * fPERIPH = fCPU / pbdiv (div by 1 or 2) */ -# define BOARD_ENABLE_PLL 1 -# define BOARD_PLL_PDIV 2 -# define BOARD_PLL_NDIV 48 -# define BOARD_PLL_K2DIV 1 -# define BOARD_PLL_FREQUENCY 288000000 +# define BOARD_ENABLE_PLL 1 /* enable the PLL */ +# define CPU_FREQ 120 /* MHz */ + +/* TODO: Automate PLL calculations */ -/* System frequency, fSYS, is divided down from PLL output */ +#if CPU_FREQ == 120 +/* + * 120 MHz + * + * fVCO = 12MHz * 40 / 2 = 480MHz + * fPLL = 480MHz / 2 = 240MHz + * fSYS = fPLL / 2 = 120MHz + * fCCU = fSYS / 2 = 60MHz + * fCPU = fSYS / 1 = 120MHz + * fPB = fCPU / 2 = 60MHz + * fETH = fSYS / 2 = 60MHz + */ -# define BOARD_SYSDIV 1 /* PLL Output divider to get fSYS */ -# define BOARD_SYS_FREQUENCY 288000000 +# define BOARD_PLL_NDIV 40 +# define BOARD_PLL_PDIV 1 +# define BOARD_PLL_K2DIV 4 +# define BOARD_PLL_SYSDIV 1 +# define BOARD_PLL_CPUDIV 1 +# define BOARD_PLL_PBDIV 2 +# define BOARD_PLL_CCUDIV 2 +# define BOARD_PLL_EBUDIV 4 + +#elif CPU_FREQ == 144 +/* + * 144 MHz + * + * fVCO = 12MHz * 36 / 1 = 432MHz + * fPLL = 432MHz / 3 = 144MHz + * fSYS = fPLL / 1 = 144MHz + * fCCU = fSYS / 2 = 72MHz + * fCPU = fSYS / 1 = 144MHz + * fPB = fCPU / 2 = 72MHz + * fETH = fSYS / 2 = 72MHz + */ -/* CPU frequency, fCPU, may be divided down from system frequency */ +# define BOARD_PLL_NDIV 36 +# define BOARD_PLL_PDIV 1 +# define BOARD_PLL_K2DIV 3 +# define BOARD_PLL_SYSDIV 1 +# define BOARD_PLL_CPUDIV 1 +# define BOARD_PLL_PBDIV 2 +# define BOARD_PLL_CCUDIV 2 +# define BOARD_PLL_EBUDIV 2 -# define BOARD_CPUDIV_ENABLE 1 /* Enable PLL divide by 2 for fCPU */ -# define BOARD_CPU_FREQUENCY 144000000 +#else +# error "Illegal or Unsupported CPU Frequency" +#endif -/* CCU frequency may be divided down from system frequency */ -# define BOARD_CCUDIV_ENABLE 1 /* Enable PLL div by 2 */ -# define BOARD_CCU_FREQUENCY 144000000 +# define BOARD_CCUDIV_ENABLE (BOARD_PLL_CCUDIV - 1) +# define BOARD_CPUDIV_ENABLE (BOARD_PLL_CPUDIV - 1) -/* Watchdog clock settings */ +# define BOARD_VCO_FREQUENCY (BOARD_XTAL_FREQUENCY * BOARD_PLL_NDIV / BOARD_PLL_PDIV) +# define BOARD_PLL_FREQUENCY (BOARD_VCO_FREQUENCY / BOARD_PLL_K2DIV) +# define BOARD_SYS_FREQUENCY (BOARD_PLL_FREQUENCY / BOARD_PLL_SYSDIV) +# define BOARD_CCU_FREQUENCY (BOARD_SYS_FREQUENCY / BOARD_PLL_CCUDIV) +# define BOARD_CPU_FREQUENCY (BOARD_SYS_FREQUENCY / BOARD_PLL_CPUDIV) +# define BOARD_PERIPH_FREQUENCY (BOARD_CPU_FREQUENCY / BOARD_PLL_PBDIV) +# define BOARD_ETH_FREQUENCY (BOARD_SYS_FREQUENCY / 2) # define BOARD_WDT_SOURCE WDT_CLKSRC_FOFI # define BOARD_WDTDIV 1 # define BOARD_WDT_FREQUENCY 24000000 -/* EBU frequency may be divided down from system frequency */ - -# define BOARD_EBUDIV 2 /* fSYS / 2 */ -# define BOARD_EBU_FREQUENCY 72000000 - -/* EXT clock settings */ - # define BOARD_EXT_SOURCE EXT_CLKSRC_FPLL -# define BOARD_EXTDIV 289 /* REVISIT */ -# define BOARD_EXT_FREQUENCY 498270 /* REVISIT */ +# define BOARD_PLL_ECKDIV 480 /* [1,512] */ -/* The peripheral clock, fPERIPH, derives from fCPU with no division */ +# define kHz_1 1000 +# define MHz_1 (kHz_1 * kHz_1) +# define MHz_50 ( 50 * MHz_1) +# define MHz_260 (260 * MHz_1) +# define MHz_520 (520 * MHz_1) -# define BOARD_PBDIV 1 /* No division */ -# define BOARD_PERIPH_FREQUENCY 144000000 + /* range check VCO frequency */ +# if (BOARD_VCO_FREQUENCY < MHz_260) +# error "VCO freq must be >= 260 MHz" +# endif -#elif defined(BOARD_FCPU_120MHZ) -/* Default clock initialization - * - * fXTAL = 12Mhz - * -> fPLL = (fXTAL / (2 * 4) * 80) = 120 - * -> fSYS = (fPLL / 1) = 120MHz - * -> fCPU = (fSYS / 1) = 120MHz - * -> fPERIPH = (fCPU / 1) = 120MHz - * -> fCCU = (fSYS / 1) = 120MHz - * -> fETH = 60MHz (REVISIT) - * -> fUSB = 48MHz (REVISIT) - * -> fEBU = 60MHz (REVISIT) - * - * fUSBPLL Disabled, only enabled if SCU_CLK_USBCLKCR_USBSEL_USBPLL is selected - * - * fOFI = 24MHz - * -> fWDT = 24MHz (REVISIT) - */ +# if (BOARD_VCO_FREQUENCY > MHz_520) +# error "VCO freq must be <= 520 MHz" +# endif -/* Select the external crystal as the PLL clock source */ - -# define BOARD_PLL_CLOCKSRC_XTAL 1 /* PLL Clock source == extnernal crystal */ -# undef BOARD_PLL_CLOCKSRC_OFI /* PLL Clock source != internal fast oscillator */ - -/* PLL Configuration: - * - * fPLL = (fPLLSRC / (pdiv * k2div) * ndiv - * - * fPLL = (12000000 / (2 * 4)) * 80 - * = 120MHz - */ - -# define BOARD_ENABLE_PLL 1 -# define BOARD_PLL_PDIV 2 -# define BOARD_PLL_NDIV 80 -# define BOARD_PLL_K2DIV 4 -# define BOARD_PLL_FREQUENCY 120000000 - -/* System frequency, fSYS, is divided down from PLL output */ + /* range check Ethernet MAC frequency */ +# if (BOARD_ETH_FREQUENCY <= MHz_50) +# error "ETH freq must be > 50 MHz" +# endif -# define BOARD_SYSDIV 1 /* No division */ -# define BOARD_SYS_FREQUENCY 120000000 -/* CPU frequency, fCPU, may be divided down from system frequency */ -# define BOARD_CPUDIV_ENABLE 0 /* No divison */ -# define BOARD_CPU_FREQUENCY 120000000 - -/* CCU frequency may be divided down from system frequency */ - -# define BOARD_CCUDIV_ENABLE 0 /* No divison */ -# define BOARD_CCU_FREQUENCY 120000000 - -/* Watchdog clock setting */ - -# define BOARD_WDT_SOURCE WDT_CLKSRC_FOFI -# define BOARD_WDTDIV 1 -# define BOARD_WDT_FREQUENCY 24000000 +/* check ccudiv cpudiv pbdiv against Table 11-5 + * of XMC4500 User Manual + */ +#define CLKDIV_INDEX (4 * (BOARD_PLL_CCUDIV-1) + \ + 2 * (BOARD_PLL_CPUDIV-1) + \ + (BOARD_PLL_PBDIV-1) ) -/* EBU frequency may be divided down from system frequency */ +#if (CLKDIV_INDEX == 3) || (CLKDIV_INDEX == 4) || (CLKDIV_INDEX > 6) +# error "Illegal combination of dividers! Ref: Table 11-5 of UM" +#endif -# define BOARD_EBUDIV 2 /* fSYS/2 */ -# define BOARD_EBU_FREQUENCY 60000000 /* EXT clock settings */ +#define BOARD_EXTCKL_ENABLE 1 /* 0 disables output */ +#if BOARD_EXTCKL_ENABLE +# define EXTCLK_PIN_P0_8 8 +# define EXTCLK_PIN_P1_15 15 +# define BOARD_EXTCLK_PIN EXTCLK_PIN_P0_8 # define BOARD_EXT_SOURCE EXT_CLKSRC_FPLL -# define BOARD_EXTDIV 289 /* REVISIT */ -# define BOARD_EXT_FREQUENCY 415225 /* REVISIT */ +# define BOARD_EXT_FREQUENCY (250 * kHz_1) /* Desired output freq */ +# define BOARD_EXTDIV (BOARD_PLL_FREQUENCY / BOARD_EXT_FREQUENCY) -/* The peripheral clock, fPERIPH, derives from fCPU with no division */ - -# define BOARD_PBDIV 1 /* No division */ -# define BOARD_PERIPH_FREQUENCY 120000000 +/* range check EXTDIV */ +# if BOARD_EXTDIV > 512 +# error "EXTCLK Divisor out of range!" +# endif #endif + /* Standby clock source selection * * BOARD_STDBY_CLOCKSRC_OSI - Internal 32.768KHz slow oscillator -- GitLab From fccd44387abcdb5f8368903cb51aae5f2c536d40 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 22 Jan 2018 08:17:31 -0600 Subject: [PATCH 093/228] The existence of the network driver ioctl() method should depend on CONFIG_NETDEV_IOCTL rather than CONFIG_NETDEV_PHY_IOCTL. The former enables the method, the later enables a subset of possible driver IOCTLs. This change should be basically a no-operation. The affected ioctl methods only support those subset of driver IOCTLs selected by CONFIG_NETDEV_PHY_IOCTL and the network logic will tolerate a nul ioctl method. --- arch/arm/src/c5471/c5471_ethernet.c | 2 +- arch/arm/src/kinetis/kinetis_enet.c | 70 +++++------ arch/arm/src/lpc17xx/lpc17_ethernet.c | 2 +- arch/arm/src/lpc43xx/lpc43_ethernet.c | 16 +-- arch/arm/src/lpc54xx/lpc54_ethernet.c | 4 + arch/arm/src/sam34/sam_emac.c | 110 +++++++++--------- arch/arm/src/sama5/sam_emaca.c | 110 +++++++++--------- arch/arm/src/sama5/sam_emacb.c | 106 +++++++++-------- arch/arm/src/sama5/sam_gmac.c | 104 +++++++++-------- arch/arm/src/samv7/sam_emac.c | 108 ++++++++--------- arch/arm/src/stm32/stm32_eth.c | 82 ++++++------- arch/arm/src/stm32f7/stm32_ethernet.c | 14 ++- arch/arm/src/tiva/tm4c_ethernet.c | 80 ++++++------- arch/hc/src/m9s12/m9s12_ethernet.c | 2 +- arch/mips/src/pic32mx/pic32mx-ethernet.c | 2 +- arch/mips/src/pic32mz/pic32mz-ethernet.c | 2 +- arch/misoc/src/common/misoc_net.c | 2 +- arch/z80/src/ez80/ez80_emac.c | 2 +- drivers/net/dm90x0.c | 2 +- drivers/net/enc28j60.c | 2 +- drivers/net/encx24j600.c | 2 +- drivers/net/ftmac100.c | 2 +- drivers/net/tun.c | 2 +- .../wireless/ieee802154/xbee/xbee_netdev.c | 2 +- .../wireless/spirit/drivers/spirit_netdev.c | 2 +- wireless/ieee802154/mac802154_netdev.c | 2 +- 26 files changed, 435 insertions(+), 399 deletions(-) diff --git a/arch/arm/src/c5471/c5471_ethernet.c b/arch/arm/src/c5471/c5471_ethernet.c index b98fd6ecac..f38497a37e 100644 --- a/arch/arm/src/c5471/c5471_ethernet.c +++ b/arch/arm/src/c5471/c5471_ethernet.c @@ -2447,7 +2447,7 @@ void up_netinitialize(void) #endif g_c5471[0].c_dev.d_private = (void *)g_c5471; /* Used to recover private state from dev */ - /* Create a watchdog for timing polling for and timing of transmisstions */ + /* Create a watchdog for timing polling for and timing of transmissions */ g_c5471[0].c_txpoll = wd_create(); /* Create periodic poll timer */ g_c5471[0].c_txtimeout = wd_create(); /* Create TX timeout timer */ diff --git a/arch/arm/src/kinetis/kinetis_enet.c b/arch/arm/src/kinetis/kinetis_enet.c index 8f51cc6a7b..4a7e1ba7ca 100644 --- a/arch/arm/src/kinetis/kinetis_enet.c +++ b/arch/arm/src/kinetis/kinetis_enet.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/kinetis/kinetis_enet.c * - * Copyright (C) 2011-2012, 2014-2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2011-2012, 2014-2018 Gregory Nutt. All rights reserved. * Authors: Gregory Nutt * David Sidrane * @@ -310,7 +310,7 @@ static int kinetis_addmac(struct net_driver_s *dev, static int kinetis_rmmac(struct net_driver_s *dev, FAR const uint8_t *mac); #endif -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL static int kinetis_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg); #endif @@ -1449,48 +1449,52 @@ static int kinetis_rmmac(struct net_driver_s *dev, FAR const uint8_t *mac) * ****************************************************************************/ -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL static int kinetis_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg) { - int ret; +#ifdef CONFIG_NETDEV_PHY_IOCTL FAR struct kinetis_driver_s *priv = (FAR struct kinetis_driver_s *)dev->d_private; +#endif + int ret; switch (cmd) - { - case SIOCGMIIPHY: /* Get MII PHY address */ { - struct mii_ioctl_data_s *req = - (struct mii_ioctl_data_s *)((uintptr_t)arg); - req->phy_id = priv->phyaddr; - ret = OK; - } - break; +#ifdef CONFIG_NETDEV_PHY_IOCTL + case SIOCGMIIPHY: /* Get MII PHY address */ + { + struct mii_ioctl_data_s *req = + (struct mii_ioctl_data_s *)((uintptr_t)arg); + req->phy_id = priv->phyaddr; + ret = OK; + } + break; - case SIOCGMIIREG: /* Get register from MII PHY */ - { - struct mii_ioctl_data_s *req = - (struct mii_ioctl_data_s *)((uintptr_t)arg); - ret = kinetis_readmii(priv, req->phy_id, req->reg_num, &req->val_out); - } - break; + case SIOCGMIIREG: /* Get register from MII PHY */ + { + struct mii_ioctl_data_s *req = + (struct mii_ioctl_data_s *)((uintptr_t)arg); + ret = kinetis_readmii(priv, req->phy_id, req->reg_num, &req->val_out); + } + break; - case SIOCSMIIREG: /* Set register in MII PHY */ - { - struct mii_ioctl_data_s *req = - (struct mii_ioctl_data_s *)((uintptr_t)arg); - ret = kinetis_writemii(priv, req->phy_id, req->reg_num, req->val_in); - } - break; + case SIOCSMIIREG: /* Set register in MII PHY */ + { + struct mii_ioctl_data_s *req = + (struct mii_ioctl_data_s *)((uintptr_t)arg); + ret = kinetis_writemii(priv, req->phy_id, req->reg_num, req->val_in); + } + break; +#endif /* ifdef CONFIG_NETDEV_PHY_IOCTL */ - default: - ret = -ENOTTY; - break; - } + default: + ret = -ENOTTY; + break; + } return ret; } -#endif /* CONFIG_NETDEV_PHY_IOCTL */ +#endif /* CONFIG_NETDEV_IOCTL */ /**************************************************************************** * Function: kinetis_initmii @@ -2127,12 +2131,12 @@ int kinetis_netinitialize(int intf) priv->dev.d_addmac = kinetis_addmac; /* Add multicast MAC address */ priv->dev.d_rmmac = kinetis_rmmac; /* Remove multicast MAC address */ #endif -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL priv->dev.d_ioctl = kinetis_ioctl; /* Support PHY ioctl() calls */ #endif priv->dev.d_private = (void *)g_enet; /* Used to recover private state from dev */ - /* Create a watchdog for timing polling for and timing of transmisstions */ + /* Create a watchdog for timing polling for and timing of transmissions */ priv->txpoll = wd_create(); /* Create periodic poll timer */ priv->txtimeout = wd_create(); /* Create TX timeout timer */ diff --git a/arch/arm/src/lpc17xx/lpc17_ethernet.c b/arch/arm/src/lpc17xx/lpc17_ethernet.c index dd1c05d0d1..196b15bab8 100644 --- a/arch/arm/src/lpc17xx/lpc17_ethernet.c +++ b/arch/arm/src/lpc17xx/lpc17_ethernet.c @@ -3056,7 +3056,7 @@ static inline int lpc17_ethinitialize(int intf) priv->lp_irq = ??; /* Ethernet controller IRQ number */ #endif - /* Create a watchdog for timing polling for and timing of transmisstions */ + /* Create a watchdog for timing polling for and timing of transmissions */ priv->lp_txpoll = wd_create(); /* Create periodic poll timer */ priv->lp_txtimeout = wd_create(); /* Create TX timeout timer */ diff --git a/arch/arm/src/lpc43xx/lpc43_ethernet.c b/arch/arm/src/lpc43xx/lpc43_ethernet.c index f5a9cb1e58..e598178811 100644 --- a/arch/arm/src/lpc43xx/lpc43_ethernet.c +++ b/arch/arm/src/lpc43xx/lpc43_ethernet.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/lpc43/lpc43_eth.c * - * Copyright (C) 2011-2015, 2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2011-2015, 2017-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -621,7 +621,7 @@ static int lpc43_addmac(struct net_driver_s *dev, FAR const uint8_t *mac); #ifdef CONFIG_NET_IGMP static int lpc43_rmmac(struct net_driver_s *dev, FAR const uint8_t *mac); #endif -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL static int lpc43_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg); #endif @@ -2744,16 +2744,17 @@ static void lpc43_rxdescinit(FAR struct lpc43_ethmac_s *priv) * ****************************************************************************/ -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL static int lpc43_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg) { -#ifdef CONFIG_ARCH_PHY_INTERRUPT +#if defined(CONFIG_NETDEV_PHY_IOCTL) && defined(CONFIG_ARCH_PHY_INTERRUPT) FAR struct lpc43_ethmac_s *priv = (FAR struct lpc43_ethmac_s *)dev->d_private; #endif int ret; switch (cmd) { +#ifdef CONFIG_NETDEV_PHY_IOCTL #ifdef CONFIG_ARCH_PHY_INTERRUPT case SIOCMIINOTIFY: /* Set up for PHY event notifications */ { @@ -2791,6 +2792,7 @@ static int lpc43_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg) ret = lpc43_phywrite(req->phy_id, req->reg_num, req->val_in); } break; +#endif /* ifdef CONFIG_NETDEV_PHY_IOCTL */ default: ret = -ENOTTY; @@ -2799,7 +2801,7 @@ static int lpc43_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg) return ret; } -#endif /* CONFIG_NETDEV_PHY_IOCTL */ +#endif /* CONFIG_NETDEV_IOCTL */ /**************************************************************************** * Function: lpc43_phyintenable @@ -3823,12 +3825,12 @@ static inline int lpc43_ethinitialize(void) priv->dev.d_addmac = lpc43_addmac; /* Add multicast MAC address */ priv->dev.d_rmmac = lpc43_rmmac; /* Remove multicast MAC address */ #endif -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL priv->dev.d_ioctl = lpc43_ioctl; /* Support PHY ioctl() calls */ #endif priv->dev.d_private = (void *)&g_lpc43ethmac; /* Used to recover private state from dev */ - /* Create a watchdog for timing polling for and timing of transmisstions */ + /* Create a watchdog for timing polling for and timing of transmission */ priv->txpoll = wd_create(); /* Create periodic poll timer */ priv->txtimeout = wd_create(); /* Create TX timeout timer */ diff --git a/arch/arm/src/lpc54xx/lpc54_ethernet.c b/arch/arm/src/lpc54xx/lpc54_ethernet.c index d89317247d..dde91da5c1 100644 --- a/arch/arm/src/lpc54xx/lpc54_ethernet.c +++ b/arch/arm/src/lpc54xx/lpc54_ethernet.c @@ -2392,13 +2392,16 @@ static int lpc54_eth_rmmac(struct net_driver_s *dev, const uint8_t *mac) static int lpc54_eth_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg) { +#ifdef CONFIG_NETDEV_PHY_IOCTL struct lpc54_ethdriver_s *priv = (struct lpc54_ethdriver_s *)dev->d_private; +#endif int ret; /* Decode and dispatch the driver-specific IOCTL command */ switch (cmd) { +#ifdef CONFIG_NETDEV_PHY_IOCTL case SIOCGMIIPHY: /* Get MII PHY address */ { struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); @@ -2422,6 +2425,7 @@ static int lpc54_eth_ioctl(struct net_driver_s *dev, int cmd, ret = OK } break; +#endif /* ifdef CONFIG_NETDEV_PHY_IOCTL */ default: nerr("ERROR: Unrecognized IOCTL command: %d\n", command); diff --git a/arch/arm/src/sam34/sam_emac.c b/arch/arm/src/sam34/sam_emac.c index c45ea9f383..88d43258d5 100644 --- a/arch/arm/src/sam34/sam_emac.c +++ b/arch/arm/src/sam34/sam_emac.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/sam34/sam_emac.c * - * Copyright (C) 2014-2015, 2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2014-2015, 2017-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * This logic derives from the SAM34D3 Ethernet driver. @@ -408,7 +408,7 @@ static int sam_addmac(struct net_driver_s *dev, const uint8_t *mac); static int sam_rmmac(struct net_driver_s *dev, const uint8_t *mac); #endif -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL static int sam_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg); #endif @@ -2309,86 +2309,90 @@ static int sam_rmmac(struct net_driver_s *dev, const uint8_t *mac) * ****************************************************************************/ -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL static int sam_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg) { +#ifdef CONFIG_NETDEV_PHY_IOCTL struct sam_emac_s *priv = (struct sam_emac_s *)dev->d_private; +#endif int ret; switch (cmd) - { -#ifdef CONFIG_ARCH_PHY_INTERRUPT - case SIOCMIINOTIFY: /* Set up for PHY event notifications */ { - struct mii_iotcl_notify_s *req = (struct mii_iotcl_notify_s *)((uintptr_t)arg); - - ret = phy_notify_subscribe(dev->d_ifname, req->pid, req->signo, req->arg); - if (ret == OK) +#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_ARCH_PHY_INTERRUPT + case SIOCMIINOTIFY: /* Set up for PHY event notifications */ { - /* Enable PHY link up/down interrupts */ + struct mii_iotcl_notify_s *req = (struct mii_iotcl_notify_s *)((uintptr_t)arg); - ret = sam_phyintenable(priv); + ret = phy_notify_subscribe(dev->d_ifname, req->pid, req->signo, req->arg); + if (ret == OK) + { + /* Enable PHY link up/down interrupts */ + + ret = sam_phyintenable(priv); + } } - } - break; + break; #endif - case SIOCGMIIPHY: /* Get MII PHY address */ - { - struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); - req->phy_id = priv->phyaddr; - ret = OK; - } - break; + case SIOCGMIIPHY: /* Get MII PHY address */ + { + struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); + req->phy_id = priv->phyaddr; + ret = OK; + } + break; - case SIOCGMIIREG: /* Get register from MII PHY */ - { - struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); - uint32_t regval; + case SIOCGMIIREG: /* Get register from MII PHY */ + { + struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); + uint32_t regval; - /* Enable management port */ + /* Enable management port */ - regval = sam_getreg(priv, SAM_EMAC_NCR); - sam_putreg(priv, SAM_EMAC_NCR, regval | EMAC_NCR_MPE); + regval = sam_getreg(priv, SAM_EMAC_NCR); + sam_putreg(priv, SAM_EMAC_NCR, regval | EMAC_NCR_MPE); - /* Read from the requested register */ + /* Read from the requested register */ - ret = sam_phyread(priv, req->phy_id, req->reg_num, &req->val_out); + ret = sam_phyread(priv, req->phy_id, req->reg_num, &req->val_out); - /* Disable management port (probably) */ + /* Disable management port (probably) */ - sam_putreg(priv, SAM_EMAC_NCR, regval); - } - break; + sam_putreg(priv, SAM_EMAC_NCR, regval); + } + break; - case SIOCSMIIREG: /* Set register in MII PHY */ - { - struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); - uint32_t regval; + case SIOCSMIIREG: /* Set register in MII PHY */ + { + struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); + uint32_t regval; - /* Enable management port */ + /* Enable management port */ - regval = sam_getreg(priv, SAM_EMAC_NCR); - sam_putreg(priv, SAM_EMAC_NCR, regval | EMAC_NCR_MPE); + regval = sam_getreg(priv, SAM_EMAC_NCR); + sam_putreg(priv, SAM_EMAC_NCR, regval | EMAC_NCR_MPE); - /* Write to the requested register */ + /* Write to the requested register */ - ret = sam_phywrite(priv, req->phy_id, req->reg_num, req->val_in); + ret = sam_phywrite(priv, req->phy_id, req->reg_num, req->val_in); - /* Disable management port (probably) */ + /* Disable management port (probably) */ - sam_putreg(priv, SAM_EMAC_NCR, regval); - } - break; + sam_putreg(priv, SAM_EMAC_NCR, regval); + } + break; +#endif /* ifdef CONFIG_NETDEV_PHY_IOCTL */ - default: - ret = -ENOTTY; - break; - } + default: + ret = -ENOTTY; + break; + } return ret; } -#endif /* CONFIG_NETDEV_PHY_IOCTL */ +#endif /* CONFIG_NETDEV_IOCTL */ /**************************************************************************** * Function: sam_phydump @@ -3630,7 +3634,7 @@ void up_netinitialize(void) priv->dev.d_addmac = sam_addmac; /* Add multicast MAC address */ priv->dev.d_rmmac = sam_rmmac; /* Remove multicast MAC address */ #endif -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL priv->dev.d_ioctl = sam_ioctl; /* Support PHY ioctl() calls */ #endif priv->dev.d_private = (void *)&g_emac; /* Used to recover private state from dev */ diff --git a/arch/arm/src/sama5/sam_emaca.c b/arch/arm/src/sama5/sam_emaca.c index 1648cab525..3a011a5b7c 100644 --- a/arch/arm/src/sama5/sam_emaca.c +++ b/arch/arm/src/sama5/sam_emaca.c @@ -4,7 +4,7 @@ * 10/100 Base-T Ethernet driver for the SAMA5D3. Denoted as 'A' to * distinguish it from the SAMA5D4 EMAC driver. * - * Copyright (C) 2013-2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2013-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * References: @@ -413,7 +413,7 @@ static int sam_addmac(struct net_driver_s *dev, const uint8_t *mac); static int sam_rmmac(struct net_driver_s *dev, const uint8_t *mac); #endif -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL static int sam_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg); #endif @@ -2345,86 +2345,90 @@ static int sam_rmmac(struct net_driver_s *dev, const uint8_t *mac) * ****************************************************************************/ -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL static int sam_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg) { +#ifdef CONFIG_NETDEV_PHY_IOCTL struct sam_emac_s *priv = (struct sam_emac_s *)dev->d_private; +#endif int ret; switch (cmd) - { -#ifdef CONFIG_ARCH_PHY_INTERRUPT - case SIOCMIINOTIFY: /* Set up for PHY event notifications */ { - struct mii_iotcl_notify_s *req = (struct mii_iotcl_notify_s *)((uintptr_t)arg); - - ret = phy_notify_subscribe(dev->d_ifname, req->pid, req->signo, req->arg); - if (ret == OK) +#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_ARCH_PHY_INTERRUPT + case SIOCMIINOTIFY: /* Set up for PHY event notifications */ { - /* Enable PHY link up/down interrupts */ + struct mii_iotcl_notify_s *req = (struct mii_iotcl_notify_s *)((uintptr_t)arg); - ret = sam_phyintenable(priv); + ret = phy_notify_subscribe(dev->d_ifname, req->pid, req->signo, req->arg); + if (ret == OK) + { + /* Enable PHY link up/down interrupts */ + + ret = sam_phyintenable(priv); + } } - } - break; + break; #endif - case SIOCGMIIPHY: /* Get MII PHY address */ - { - struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); - req->phy_id = priv->phyaddr; - ret = OK; - } - break; + case SIOCGMIIPHY: /* Get MII PHY address */ + { + struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); + req->phy_id = priv->phyaddr; + ret = OK; + } + break; - case SIOCGMIIREG: /* Get register from MII PHY */ - { - struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); - uint32_t regval; + case SIOCGMIIREG: /* Get register from MII PHY */ + { + struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); + uint32_t regval; - /* Enable management port */ + /* Enable management port */ - regval = sam_getreg(priv, SAM_EMAC_NCR); - sam_putreg(priv, SAM_EMAC_NCR, regval | EMAC_NCR_MPE); + regval = sam_getreg(priv, SAM_EMAC_NCR); + sam_putreg(priv, SAM_EMAC_NCR, regval | EMAC_NCR_MPE); - /* Read from the requested register */ + /* Read from the requested register */ - ret = sam_phyread(priv, req->phy_id, req->reg_num, &req->val_out); + ret = sam_phyread(priv, req->phy_id, req->reg_num, &req->val_out); - /* Disable management port (probably) */ + /* Disable management port (probably) */ - sam_putreg(priv, SAM_EMAC_NCR, regval); - } - break; + sam_putreg(priv, SAM_EMAC_NCR, regval); + } + break; - case SIOCSMIIREG: /* Set register in MII PHY */ - { - struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); - uint32_t regval; + case SIOCSMIIREG: /* Set register in MII PHY */ + { + struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); + uint32_t regval; - /* Enable management port */ + /* Enable management port */ - regval = sam_getreg(priv, SAM_EMAC_NCR); - sam_putreg(priv, SAM_EMAC_NCR, regval | EMAC_NCR_MPE); + regval = sam_getreg(priv, SAM_EMAC_NCR); + sam_putreg(priv, SAM_EMAC_NCR, regval | EMAC_NCR_MPE); - /* Write to the requested register */ + /* Write to the requested register */ - ret = sam_phywrite(priv, req->phy_id, req->reg_num, req->val_in); + ret = sam_phywrite(priv, req->phy_id, req->reg_num, req->val_in); - /* Disable management port (probably) */ + /* Disable management port (probably) */ - sam_putreg(priv, SAM_EMAC_NCR, regval); - } - break; + sam_putreg(priv, SAM_EMAC_NCR, regval); + } + break; +#endif /* CONFIG_NETDEV_PHY_IOCTL */ - default: - ret = -ENOTTY; - break; - } + default: + ret = -ENOTTY; + break; + } return ret; } -#endif /* CONFIG_NETDEV_PHY_IOCTL */ +#endif /* CONFIG_NETDEV_IOCTL */ /**************************************************************************** * Function: sam_phydump @@ -3672,7 +3676,7 @@ int sam_emac_initialize(void) priv->dev.d_addmac = sam_addmac; /* Add multicast MAC address */ priv->dev.d_rmmac = sam_rmmac; /* Remove multicast MAC address */ #endif -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL priv->dev.d_ioctl = sam_ioctl; /* Support PHY ioctl() calls */ #endif priv->dev.d_private = (void *)&g_emac; /* Used to recover private state from dev */ diff --git a/arch/arm/src/sama5/sam_emacb.c b/arch/arm/src/sama5/sam_emacb.c index c9fb251aca..9f6f366e24 100644 --- a/arch/arm/src/sama5/sam_emacb.c +++ b/arch/arm/src/sama5/sam_emacb.c @@ -507,7 +507,7 @@ static int sam_addmac(struct net_driver_s *dev, const uint8_t *mac); static int sam_rmmac(struct net_driver_s *dev, const uint8_t *mac); #endif -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL static int sam_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg); #endif @@ -2715,79 +2715,83 @@ static int sam_rmmac(struct net_driver_s *dev, const uint8_t *mac) #ifdef CONFIG_NETDEV_PHY_IOCTL static int sam_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg) { +#ifdef CONFIG_NETDEV_PHY_IOCTL struct sam_emac_s *priv = (struct sam_emac_s *)dev->d_private; +#endif int ret; switch (cmd) - { -#ifdef CONFIG_ARCH_PHY_INTERRUPT - case SIOCMIINOTIFY: /* Set up for PHY event notifications */ { - struct mii_iotcl_notify_s *req = (struct mii_iotcl_notify_s *)((uintptr_t)arg); +#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_ARCH_PHY_INTERRUPT + case SIOCMIINOTIFY: /* Set up for PHY event notifications */ + { + struct mii_iotcl_notify_s *req = (struct mii_iotcl_notify_s *)((uintptr_t)arg); - ret = phy_notify_subscribe(dev->d_ifname, req->pid, req->signo, req->arg); - if (ret == OK) - { - /* Enable PHY link up/down interrupts */ + ret = phy_notify_subscribe(dev->d_ifname, req->pid, req->signo, req->arg); + if (ret == OK) + { + /* Enable PHY link up/down interrupts */ - ret = sam_phyintenable(priv); + ret = sam_phyintenable(priv); + } } - } - break; + break; #endif - case SIOCGMIIPHY: /* Get MII PHY address */ - { - struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); - req->phy_id = priv->phyaddr; - ret = OK; - } - break; + case SIOCGMIIPHY: /* Get MII PHY address */ + { + struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); + req->phy_id = priv->phyaddr; + ret = OK; + } + break; - case SIOCGMIIREG: /* Get register from MII PHY */ - { - struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); - uint32_t regval; + case SIOCGMIIREG: /* Get register from MII PHY */ + { + struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); + uint32_t regval; - /* Enable management port */ + /* Enable management port */ - regval = sam_getreg(priv, SAM_EMAC_NCR_OFFSET); - sam_putreg(priv, SAM_EMAC_NCR_OFFSET, regval | EMAC_NCR_MPE); + regval = sam_getreg(priv, SAM_EMAC_NCR_OFFSET); + sam_putreg(priv, SAM_EMAC_NCR_OFFSET, regval | EMAC_NCR_MPE); - /* Read from the requested register */ + /* Read from the requested register */ - ret = sam_phyread(priv, req->phy_id, req->reg_num, &req->val_out); + ret = sam_phyread(priv, req->phy_id, req->reg_num, &req->val_out); - /* Disable management port (probably) */ + /* Disable management port (probably) */ - sam_putreg(priv, SAM_EMAC_NCR_OFFSET, regval); - } - break; + sam_putreg(priv, SAM_EMAC_NCR_OFFSET, regval); + } + break; - case SIOCSMIIREG: /* Set register in MII PHY */ - { - struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); - uint32_t regval; + case SIOCSMIIREG: /* Set register in MII PHY */ + { + struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); + uint32_t regval; - /* Enable management port */ + /* Enable management port */ - regval = sam_getreg(priv, SAM_EMAC_NCR_OFFSET); - sam_putreg(priv, SAM_EMAC_NCR_OFFSET, regval | EMAC_NCR_MPE); + regval = sam_getreg(priv, SAM_EMAC_NCR_OFFSET); + sam_putreg(priv, SAM_EMAC_NCR_OFFSET, regval | EMAC_NCR_MPE); - /* Write to the requested register */ + /* Write to the requested register */ - ret = sam_phywrite(priv, req->phy_id, req->reg_num, req->val_in); + ret = sam_phywrite(priv, req->phy_id, req->reg_num, req->val_in); - /* Disable management port (probably) */ + /* Disable management port (probably) */ - sam_putreg(priv, SAM_EMAC_NCR_OFFSET, regval); - } - break; + sam_putreg(priv, SAM_EMAC_NCR_OFFSET, regval); + } + break; +#endif /* CONFIG_NETDEV_PHY_IOCTL */ - default: - ret = -ENOTTY; - break; - } + default: + ret = -ENOTTY; + break; + } return ret; } @@ -4357,9 +4361,9 @@ int sam_emac_initialize(int intf) priv->dev.d_addmac = sam_addmac; /* Add multicast MAC address */ priv->dev.d_rmmac = sam_rmmac; /* Remove multicast MAC address */ #endif -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL priv->dev.d_ioctl = sam_ioctl; /* Support PHY ioctl() calls */ -#ifdef CONFIG_ARCH_PHY_INTERRUPT +#if defined(CONFIG_NETDEV_PHY_IOCTL) && defined(CONFIG_ARCH_PHY_INTERRUPT) priv->phytype = phytype; /* Type of PHY on port */ #endif #endif diff --git a/arch/arm/src/sama5/sam_gmac.c b/arch/arm/src/sama5/sam_gmac.c index d909962190..d70a40c5a3 100644 --- a/arch/arm/src/sama5/sam_gmac.c +++ b/arch/arm/src/sama5/sam_gmac.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/sama5/sam_gmac.c * - * Copyright (C) 2013-2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2013-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * References: @@ -338,7 +338,7 @@ static int sam_addmac(struct net_driver_s *dev, const uint8_t *mac); static int sam_rmmac(struct net_driver_s *dev, const uint8_t *mac); #endif -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL static int sam_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg); #endif @@ -2300,82 +2300,86 @@ static int sam_rmmac(struct net_driver_s *dev, const uint8_t *mac) * ****************************************************************************/ -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL static int sam_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg) { +#ifdef CONFIG_NETDEV_PHY_IOCTL struct sam_gmac_s *priv = (struct sam_gmac_s *)dev->d_private; +#endif int ret; switch (cmd) - { -#ifdef CONFIG_ARCH_PHY_INTERRUPT - case SIOCMIINOTIFY: /* Set up for PHY event notifications */ { - struct mii_iotcl_notify_s *req = (struct mii_iotcl_notify_s *)((uintptr_t)arg); - - ret = phy_notify_subscribe(dev->d_ifname, req->pid, req->signo, req->arg); - if (ret == OK) +#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_ARCH_PHY_INTERRUPT + case SIOCMIINOTIFY: /* Set up for PHY event notifications */ { - /* Enable PHY link up/down interrupts */ + struct mii_iotcl_notify_s *req = (struct mii_iotcl_notify_s *)((uintptr_t)arg); - ret = sam_phyintenable(priv); + ret = phy_notify_subscribe(dev->d_ifname, req->pid, req->signo, req->arg); + if (ret == OK) + { + /* Enable PHY link up/down interrupts */ + + ret = sam_phyintenable(priv); + } } - } - break; + break; #endif - case SIOCGMIIPHY: /* Get MII PHY address */ - { - struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); - req->phy_id = priv->phyaddr; - ret = OK; - } - break; + case SIOCGMIIPHY: /* Get MII PHY address */ + { + struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); + req->phy_id = priv->phyaddr; + ret = OK; + } + break; - case SIOCGMIIREG: /* Get register from MII PHY */ - { - struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); + case SIOCGMIIREG: /* Get register from MII PHY */ + { + struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); - /* Enable the management port */ + /* Enable the management port */ - sam_enablemdio(priv); + sam_enablemdio(priv); - /* Read from the requested register */ + /* Read from the requested register */ - ret = sam_phyread(priv, req->phy_id, req->reg_num, &req->val_out); + ret = sam_phyread(priv, req->phy_id, req->reg_num, &req->val_out); - /* Disable the management port */ + /* Disable the management port */ - sam_disablemdio(priv); - } - break; + sam_disablemdio(priv); + } + break; - case SIOCSMIIREG: /* Set register in MII PHY */ - { - struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); + case SIOCSMIIREG: /* Set register in MII PHY */ + { + struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); - /* Enable the management port */ + /* Enable the management port */ - sam_enablemdio(priv); + sam_enablemdio(priv); - /* Write to the requested register */ + /* Write to the requested register */ - ret = sam_phywrite(priv, req->phy_id, req->reg_num, req->val_in); + ret = sam_phywrite(priv, req->phy_id, req->reg_num, req->val_in); - /* Disable the management port */ + /* Disable the management port */ - sam_disablemdio(priv); - } - break; + sam_disablemdio(priv); + } + break; +#endif /* CONFIG_NETDEV_PHY_IOCTL */ - default: - ret = -ENOTTY; - break; - } + default: + ret = -ENOTTY; + break; + } return ret; } -#endif /* CONFIG_NETDEV_PHY_IOCTL */ +#endif /* CONFIG_NETDEV_IOCTL */ /**************************************************************************** * Function: sam_phydump @@ -3744,12 +3748,12 @@ int sam_gmac_initialize(void) priv->dev.d_addmac = sam_addmac; /* Add multicast MAC address */ priv->dev.d_rmmac = sam_rmmac; /* Remove multicast MAC address */ #endif -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL priv->dev.d_ioctl = sam_ioctl; /* Support PHY ioctl() calls */ #endif priv->dev.d_private = (void *)&g_gmac; /* Used to recover private state from dev */ - /* Create a watchdog for timing polling for and timing of transmisstions */ + /* Create a watchdog for timing polling for and timing of transmissions */ priv->txpoll = wd_create(); if (!priv->txpoll) diff --git a/arch/arm/src/samv7/sam_emac.c b/arch/arm/src/samv7/sam_emac.c index 3496331898..94c5956b2b 100644 --- a/arch/arm/src/samv7/sam_emac.c +++ b/arch/arm/src/samv7/sam_emac.c @@ -2,7 +2,7 @@ * arch/arm/src/samv7/sam_emac.c * 10/100 Base-T Ethernet driver for the SAMV71. * - * Copyright (C) 2015, 2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2015, 2017-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * This logic derives from the SAMA5 Ethernet driver which, in turn, derived @@ -622,7 +622,7 @@ static int sam_addmac(struct net_driver_s *dev, const uint8_t *mac); static int sam_rmmac(struct net_driver_s *dev, const uint8_t *mac); #endif -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL static int sam_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg); #endif @@ -3196,86 +3196,90 @@ static int sam_rmmac(struct net_driver_s *dev, const uint8_t *mac) * ****************************************************************************/ -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL static int sam_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg) { +#ifdef CONFIG_NETDEV_PHY_IOCTL struct sam_emac_s *priv = (struct sam_emac_s *)dev->d_private; +#endif int ret; switch (cmd) - { + { +#ifdef CONFIG_NETDEV_PHY_IOCTL #ifdef CONFIG_ARCH_PHY_INTERRUPT case SIOCMIINOTIFY: /* Set up for PHY event notifications */ { - struct mii_iotcl_notify_s *req = (struct mii_iotcl_notify_s *)((uintptr_t)arg); + struct mii_iotcl_notify_s *req = (struct mii_iotcl_notify_s *)((uintptr_t)arg); - ret = phy_notify_subscribe(dev->d_ifname, req->pid, req->signo, req->arg); - if (ret == OK) - { - /* Enable PHY link up/down interrupts */ + ret = phy_notify_subscribe(dev->d_ifname, req->pid, req->signo, req->arg); + if (ret == OK) + { + /* Enable PHY link up/down interrupts */ - ret = sam_phyintenable(priv); + ret = sam_phyintenable(priv); + } } - } - break; + break; #endif - case SIOCGMIIPHY: /* Get MII PHY address */ - { - struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); - req->phy_id = priv->phyaddr; - ret = OK; - } - break; + case SIOCGMIIPHY: /* Get MII PHY address */ + { + struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); + req->phy_id = priv->phyaddr; + ret = OK; + } + break; - case SIOCGMIIREG: /* Get register from MII PHY */ - { - struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); - uint32_t regval; + case SIOCGMIIREG: /* Get register from MII PHY */ + { + struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); + uint32_t regval; - /* Enable management port */ + /* Enable management port */ - regval = sam_getreg(priv, SAM_EMAC_NCR_OFFSET); - sam_putreg(priv, SAM_EMAC_NCR_OFFSET, regval | EMAC_NCR_MPE); + regval = sam_getreg(priv, SAM_EMAC_NCR_OFFSET); + sam_putreg(priv, SAM_EMAC_NCR_OFFSET, regval | EMAC_NCR_MPE); - /* Read from the requested register */ + /* Read from the requested register */ - ret = sam_phyread(priv, req->phy_id, req->reg_num, &req->val_out); + ret = sam_phyread(priv, req->phy_id, req->reg_num, &req->val_out); - /* Disable management port (probably) */ + /* Disable management port (probably) */ - sam_putreg(priv, SAM_EMAC_NCR_OFFSET, regval); - } - break; + sam_putreg(priv, SAM_EMAC_NCR_OFFSET, regval); + } + break; - case SIOCSMIIREG: /* Set register in MII PHY */ - { - struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); - uint32_t regval; + case SIOCSMIIREG: /* Set register in MII PHY */ + { + struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); + uint32_t regval; - /* Enable management port */ + /* Enable management port */ - regval = sam_getreg(priv, SAM_EMAC_NCR_OFFSET); - sam_putreg(priv, SAM_EMAC_NCR_OFFSET, regval | EMAC_NCR_MPE); + regval = sam_getreg(priv, SAM_EMAC_NCR_OFFSET); + sam_putreg(priv, SAM_EMAC_NCR_OFFSET, regval | EMAC_NCR_MPE); - /* Write to the requested register */ + /* Write to the requested register */ - ret = sam_phywrite(priv, req->phy_id, req->reg_num, req->val_in); + ret = sam_phywrite(priv, req->phy_id, req->reg_num, req->val_in); - /* Disable management port (probably) */ + /* Disable management port (probably) */ - sam_putreg(priv, SAM_EMAC_NCR_OFFSET, regval); - } - break; + sam_putreg(priv, SAM_EMAC_NCR_OFFSET, regval); + } + break; +#endif /* CONFIG_NETDEV_PHY_IOCTL */ - default: - ret = -ENOTTY; - break; - } + default: + ret = -ENOTTY; + break; + } return ret; } -#endif /* CONFIG_NETDEV_PHY_IOCTL */ +#endif /* CONFIG_NETDEV_IOCTL */ /**************************************************************************** * Function: sam_phydump @@ -5017,9 +5021,9 @@ int sam_emac_initialize(int intf) priv->dev.d_addmac = sam_addmac; /* Add multicast MAC address */ priv->dev.d_rmmac = sam_rmmac; /* Remove multicast MAC address */ #endif -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL priv->dev.d_ioctl = sam_ioctl; /* Support PHY ioctl() calls */ -#ifdef CONFIG_ARCH_PHY_INTERRUPT +#if defined(CONFIG_NETDEV_PHY_IOCTL) && defined(CONFIG_ARCH_PHY_INTERRUPT) priv->phytype = phytype; /* Type of PHY on port */ #endif #endif diff --git a/arch/arm/src/stm32/stm32_eth.c b/arch/arm/src/stm32/stm32_eth.c index 62e44a0ff2..0c2aac1311 100644 --- a/arch/arm/src/stm32/stm32_eth.c +++ b/arch/arm/src/stm32/stm32_eth.c @@ -721,7 +721,7 @@ static int stm32_addmac(struct net_driver_s *dev, FAR const uint8_t *mac); #ifdef CONFIG_NET_IGMP static int stm32_rmmac(struct net_driver_s *dev, FAR const uint8_t *mac); #endif -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL static int stm32_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg); #endif @@ -2847,62 +2847,64 @@ static void stm32_rxdescinit(FAR struct stm32_ethmac_s *priv) * ****************************************************************************/ -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL static int stm32_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg) { -#ifdef CONFIG_ARCH_PHY_INTERRUPT +#if defined(CONFIG_NETDEV_PHY_IOCTL) && defined(CONFIG_ARCH_PHY_INTERRUPT) FAR struct stm32_ethmac_s *priv = (FAR struct stm32_ethmac_s *)dev->d_private; #endif int ret; switch (cmd) - { -#ifdef CONFIG_ARCH_PHY_INTERRUPT - case SIOCMIINOTIFY: /* Set up for PHY event notifications */ { - struct mii_iotcl_notify_s *req = (struct mii_iotcl_notify_s *)((uintptr_t)arg); - - ret = phy_notify_subscribe(dev->d_ifname, req->pid, req->signo, req->arg); - if (ret == OK) +#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_ARCH_PHY_INTERRUPT + case SIOCMIINOTIFY: /* Set up for PHY event notifications */ { - /* Enable PHY link up/down interrupts */ + struct mii_iotcl_notify_s *req = (struct mii_iotcl_notify_s *)((uintptr_t)arg); - ret = stm32_phyintenable(priv); + ret = phy_notify_subscribe(dev->d_ifname, req->pid, req->signo, req->arg); + if (ret == OK) + { + /* Enable PHY link up/down interrupts */ + + ret = stm32_phyintenable(priv); + } } - } - break; + break; #endif - case SIOCGMIIPHY: /* Get MII PHY address */ - { - struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); - req->phy_id = CONFIG_STM32_PHYADDR; - ret = OK; - } - break; + case SIOCGMIIPHY: /* Get MII PHY address */ + { + struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); + req->phy_id = CONFIG_STM32_PHYADDR; + ret = OK; + } + break; - case SIOCGMIIREG: /* Get register from MII PHY */ - { - struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); - ret = stm32_phyread(req->phy_id, req->reg_num, &req->val_out); - } - break; + case SIOCGMIIREG: /* Get register from MII PHY */ + { + struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); + ret = stm32_phyread(req->phy_id, req->reg_num, &req->val_out); + } + break; - case SIOCSMIIREG: /* Set register in MII PHY */ - { - struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); - ret = stm32_phywrite(req->phy_id, req->reg_num, req->val_in); - } - break; + case SIOCSMIIREG: /* Set register in MII PHY */ + { + struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); + ret = stm32_phywrite(req->phy_id, req->reg_num, req->val_in); + } + break; +#endif /* CONFIG_NETDEV_PHY_IOCTL */ - default: - ret = -ENOTTY; - break; - } + default: + ret = -ENOTTY; + break; + } return ret; } -#endif /* CONFIG_NETDEV_PHY_IOCTL */ +#endif /* CONFIG_NETDEV_IOCTL */ /**************************************************************************** * Function: stm32_phyintenable @@ -4014,12 +4016,12 @@ int stm32_ethinitialize(int intf) priv->dev.d_addmac = stm32_addmac; /* Add multicast MAC address */ priv->dev.d_rmmac = stm32_rmmac; /* Remove multicast MAC address */ #endif -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL priv->dev.d_ioctl = stm32_ioctl; /* Support PHY ioctl() calls */ #endif priv->dev.d_private = (void *)g_stm32ethmac; /* Used to recover private state from dev */ - /* Create a watchdog for timing polling for and timing of transmisstions */ + /* Create a watchdog for timing polling for and timing of transmissions */ priv->txpoll = wd_create(); /* Create periodic poll timer */ priv->txtimeout = wd_create(); /* Create TX timeout timer */ diff --git a/arch/arm/src/stm32f7/stm32_ethernet.c b/arch/arm/src/stm32f7/stm32_ethernet.c index 8c0eddd847..d5337d8f48 100644 --- a/arch/arm/src/stm32f7/stm32_ethernet.c +++ b/arch/arm/src/stm32f7/stm32_ethernet.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/stm32f7/stm32_ethernet.c * - * Copyright (C) 2015-2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2015-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -732,7 +732,7 @@ static int stm32_addmac(struct net_driver_s *dev, const uint8_t *mac); #ifdef CONFIG_NET_IGMP static int stm32_rmmac(struct net_driver_s *dev, const uint8_t *mac); #endif -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL static int stm32_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg); #endif @@ -2958,16 +2958,17 @@ static void stm32_rxdescinit(struct stm32_ethmac_s *priv, * ****************************************************************************/ -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL static int stm32_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg) { -#ifdef CONFIG_ARCH_PHY_INTERRUPT +#if defined(CONFIG_NETDEV_PHY_IOCTL) && defined(CONFIG_ARCH_PHY_INTERRUPT) struct stm32_ethmac_s *priv = (struct stm32_ethmac_s *)dev->d_private; #endif int ret; switch (cmd) { +#ifdef CONFIG_NETDEV_PHY_IOCTL #ifdef CONFIG_ARCH_PHY_INTERRUPT case SIOCMIINOTIFY: /* Set up for PHY event notifications */ { @@ -3005,6 +3006,7 @@ static int stm32_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg) ret = stm32_phywrite(req->phy_id, req->reg_num, req->val_in); } break; +#endif /* CONFIG_NETDEV_PHY_IOCTL */ default: ret = -ENOTTY; @@ -3013,7 +3015,7 @@ static int stm32_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg) return ret; } -#endif /* CONFIG_NETDEV_PHY_IOCTL */ +#endif /* CONFIG_NETDEV_IOCTL */ /**************************************************************************** * Function: stm32_phyintenable @@ -4095,7 +4097,7 @@ int stm32_ethinitialize(int intf) priv->dev.d_addmac = stm32_addmac; /* Add multicast MAC address */ priv->dev.d_rmmac = stm32_rmmac; /* Remove multicast MAC address */ #endif -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL priv->dev.d_ioctl = stm32_ioctl; /* Support PHY ioctl() calls */ #endif priv->dev.d_private = (void *)g_stm32ethmac; /* Used to recover private state from dev */ diff --git a/arch/arm/src/tiva/tm4c_ethernet.c b/arch/arm/src/tiva/tm4c_ethernet.c index 3458db363c..be2dd12350 100644 --- a/arch/arm/src/tiva/tm4c_ethernet.c +++ b/arch/arm/src/tiva/tm4c_ethernet.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/tiva/tm4c_ethernet.c * - * Copyright (C) 2014-2015, 2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2014-2015, 2017-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -733,7 +733,7 @@ static int tiva_addmac(struct net_driver_s *dev, FAR const uint8_t *mac); #ifdef CONFIG_NET_IGMP static int tiva_rmmac(struct net_driver_s *dev, FAR const uint8_t *mac); #endif -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL static int tiva_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg); #endif @@ -2860,59 +2860,61 @@ static void tiva_rxdescinit(FAR struct tiva_ethmac_s *priv) * ****************************************************************************/ -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL static int tiva_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg) { int ret; switch (cmd) - { -#ifdef CONFIG_TIVA_PHY_INTERRUPTS - case SIOCMIINOTIFY: /* Set up for PHY event notifications */ { - struct mii_iotcl_notify_s *req = (struct mii_iotcl_notify_s *)((uintptr_t)arg); - - ret = phy_notify_subscribe(dev->d_ifname, req->pid, req->signo, req->arg); - if (ret == OK) +#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_TIVA_PHY_INTERRUPTS + case SIOCMIINOTIFY: /* Set up for PHY event notifications */ { - /* Enable PHY link up/down interrupts */ + struct mii_iotcl_notify_s *req = (struct mii_iotcl_notify_s *)((uintptr_t)arg); - tiva_phy_intenable(true); + ret = phy_notify_subscribe(dev->d_ifname, req->pid, req->signo, req->arg); + if (ret == OK) + { + /* Enable PHY link up/down interrupts */ + + tiva_phy_intenable(true); + } } - } - break; + break; #endif - case SIOCGMIIPHY: /* Get MII PHY address */ - { - struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); - req->phy_id = CONFIG_TIVA_PHYADDR; - ret = OK; - } - break; + case SIOCGMIIPHY: /* Get MII PHY address */ + { + struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); + req->phy_id = CONFIG_TIVA_PHYADDR; + ret = OK; + } + break; - case SIOCGMIIREG: /* Get register from MII PHY */ - { - struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); - ret = tiva_phyread(req->phy_id, req->reg_num, &req->val_out); - } - break; + case SIOCGMIIREG: /* Get register from MII PHY */ + { + struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); + ret = tiva_phyread(req->phy_id, req->reg_num, &req->val_out); + } + break; - case SIOCSMIIREG: /* Set register in MII PHY */ - { - struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); - ret = tiva_phywrite(req->phy_id, req->reg_num, req->val_in); - } - break; + case SIOCSMIIREG: /* Set register in MII PHY */ + { + struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg); + ret = tiva_phywrite(req->phy_id, req->reg_num, req->val_in); + } + break; +#endif /* CONFIG_NETDEV_PHY_IOCTL */ - default: - ret = -ENOTTY; - break; - } + default: + ret = -ENOTTY; + break; + } return ret; } -#endif /* CONFIG_NETDEV_PHY_IOCTL */ +#endif /* CONFIG_NETDEV_IOCTL */ /**************************************************************************** * Function: tiva_phy_intenable @@ -4040,7 +4042,7 @@ int tiva_ethinitialize(int intf) priv->dev.d_addmac = tiva_addmac; /* Add multicast MAC address */ priv->dev.d_rmmac = tiva_rmmac; /* Remove multicast MAC address */ #endif -#ifdef CONFIG_NETDEV_PHY_IOCTL +#ifdef CONFIG_NETDEV_IOCTL priv->dev.d_ioctl = tiva_ioctl; /* Support PHY ioctl() calls */ #endif priv->dev.d_private = (void *)g_tiva_ethmac; /* Used to recover private state from dev */ diff --git a/arch/hc/src/m9s12/m9s12_ethernet.c b/arch/hc/src/m9s12/m9s12_ethernet.c index 3b3fcf0d74..a56a267c91 100644 --- a/arch/hc/src/m9s12/m9s12_ethernet.c +++ b/arch/hc/src/m9s12/m9s12_ethernet.c @@ -772,7 +772,7 @@ int emac_initialize(int intf) #endif priv->d_dev.d_private = (void*)g_emac; /* Used to recover private state from dev */ - /* Create a watchdog for timing polling for and timing of transmisstions */ + /* Create a watchdog for timing polling for and timing of transmissions */ priv->d_txpoll = wd_create(); /* Create periodic poll timer */ priv->d_txtimeout = wd_create(); /* Create TX timeout timer */ diff --git a/arch/mips/src/pic32mx/pic32mx-ethernet.c b/arch/mips/src/pic32mx/pic32mx-ethernet.c index f436b298b6..d772a8ba14 100644 --- a/arch/mips/src/pic32mx/pic32mx-ethernet.c +++ b/arch/mips/src/pic32mx/pic32mx-ethernet.c @@ -3348,7 +3348,7 @@ static inline int pic32mx_ethinitialize(int intf) priv->pd_irqsrc = ??; /* Ethernet controller IRQ source number */ #endif - /* Create a watchdog for timing polling for and timing of transmisstions */ + /* Create a watchdog for timing polling for and timing of transmissions */ priv->pd_txpoll = wd_create(); /* Create periodic poll timer */ priv->pd_txtimeout = wd_create(); /* Create TX timeout timer */ diff --git a/arch/mips/src/pic32mz/pic32mz-ethernet.c b/arch/mips/src/pic32mz/pic32mz-ethernet.c index 5e1b2f5e04..046b2861e9 100644 --- a/arch/mips/src/pic32mz/pic32mz-ethernet.c +++ b/arch/mips/src/pic32mz/pic32mz-ethernet.c @@ -3384,7 +3384,7 @@ static inline int pic32mz_ethinitialize(int intf) priv->pd_irqsrc = ??; /* Ethernet controller IRQ source number */ #endif - /* Create a watchdog for timing polling for and timing of transmisstions */ + /* Create a watchdog for timing polling for and timing of transmissions */ priv->pd_txpoll = wd_create(); /* Create periodic poll timer */ priv->pd_txtimeout = wd_create(); /* Create TX timeout timer */ diff --git a/arch/misoc/src/common/misoc_net.c b/arch/misoc/src/common/misoc_net.c index a7df365435..595cbbbcff 100644 --- a/arch/misoc/src/common/misoc_net.c +++ b/arch/misoc/src/common/misoc_net.c @@ -1172,7 +1172,7 @@ int misoc_net_initialize(int intf) #endif priv->misoc_net_dev.d_private = (FAR void *)g_misoc_net; /* Used to recover private state from dev */ - /* Create a watchdog for timing polling for and timing of transmisstions */ + /* Create a watchdog for timing polling for and timing of transmissions */ priv->misoc_net_txpoll = wd_create(); /* Create periodic poll timer */ priv->misoc_net_txtimeout = wd_create(); /* Create TX timeout timer */ diff --git a/arch/z80/src/ez80/ez80_emac.c b/arch/z80/src/ez80/ez80_emac.c index 55896c08ff..7ef110f811 100644 --- a/arch/z80/src/ez80/ez80_emac.c +++ b/arch/z80/src/ez80/ez80_emac.c @@ -2537,7 +2537,7 @@ int up_netinitialize(void) #endif priv->dev.d_private = (FAR void*)&g_emac; /* Used to recover private state from dev */ - /* Create a watchdog for timing polling for and timing of transmisstions */ + /* Create a watchdog for timing polling for and timing of transmissions */ priv->txpoll = wd_create(); /* Create periodic poll timer */ priv->txtimeout = wd_create(); /* Create TX timeout timer */ diff --git a/drivers/net/dm90x0.c b/drivers/net/dm90x0.c index b6cfa6dfb7..c55c222a99 100644 --- a/drivers/net/dm90x0.c +++ b/drivers/net/dm90x0.c @@ -1948,7 +1948,7 @@ int dm9x_initialize(void) #endif g_dm9x[0].dm_dev.d_private = (FAR void *)g_dm9x; /* Used to recover private state from dev */ - /* Create a watchdog for timing polling for and timing of transmisstions */ + /* Create a watchdog for timing polling for and timing of transmissions */ g_dm9x[0].dm_txpoll = wd_create(); /* Create periodic poll timer */ g_dm9x[0].dm_txtimeout = wd_create(); /* Create TX timeout timer */ diff --git a/drivers/net/enc28j60.c b/drivers/net/enc28j60.c index 23c4c77067..9c45d4b115 100644 --- a/drivers/net/enc28j60.c +++ b/drivers/net/enc28j60.c @@ -2632,7 +2632,7 @@ int enc_initialize(FAR struct spi_dev_s *spi, #endif priv->dev.d_private = priv; /* Used to recover private state from dev */ - /* Create a watchdog for timing polling for and timing of transmisstions */ + /* Create a watchdog for timing polling for and timing of transmissions */ priv->txpoll = wd_create(); /* Create periodic poll timer */ priv->txtimeout = wd_create(); /* Create TX timeout timer */ diff --git a/drivers/net/encx24j600.c b/drivers/net/encx24j600.c index 5c2b590e2e..31732a0b68 100644 --- a/drivers/net/encx24j600.c +++ b/drivers/net/encx24j600.c @@ -2815,7 +2815,7 @@ int enc_initialize(FAR struct spi_dev_s *spi, #endif priv->dev.d_private = priv; /* Used to recover private state from dev */ - /* Create a watchdog for timing polling for and timing of transmisstions */ + /* Create a watchdog for timing polling for and timing of transmissions */ priv->txpoll = wd_create(); /* Create periodic poll timer */ priv->txtimeout = wd_create(); /* Create TX timeout timer */ diff --git a/drivers/net/ftmac100.c b/drivers/net/ftmac100.c index 9acc93d643..cb7749706f 100644 --- a/drivers/net/ftmac100.c +++ b/drivers/net/ftmac100.c @@ -1554,7 +1554,7 @@ int ftmac100_initialize(int intf) #endif priv->ft_dev.d_private = (FAR void *)g_ftmac100; /* Used to recover private state from dev */ - /* Create a watchdog for timing polling for and timing of transmisstions */ + /* Create a watchdog for timing polling for and timing of transmissions */ priv->ft_txpoll = wd_create(); /* Create periodic poll timer */ priv->ft_txtimeout = wd_create(); /* Create TX timeout timer */ diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 6c5beeba5e..f397f847df 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -891,7 +891,7 @@ static int tun_dev_init(FAR struct tun_device_s *priv, FAR struct file *filep, nxsem_setprotocol(&priv->read_wait_sem, SEM_PRIO_NONE); - /* Create a watchdog for timing polling for and timing of transmisstions */ + /* Create a watchdog for timing polling for and timing of transmissions */ priv->txpoll = wd_create(); /* Create periodic poll timer */ diff --git a/drivers/wireless/ieee802154/xbee/xbee_netdev.c b/drivers/wireless/ieee802154/xbee/xbee_netdev.c index d408d21ec3..1c0c682057 100644 --- a/drivers/wireless/ieee802154/xbee/xbee_netdev.c +++ b/drivers/wireless/ieee802154/xbee/xbee_netdev.c @@ -1392,7 +1392,7 @@ int xbee_netdev_register(XBEEHANDLE xbee) #endif dev->d_private = (FAR void *)priv; /* Used to recover private state from dev */ - /* Create a watchdog for timing polling for and timing of transmisstions */ + /* Create a watchdog for timing polling for and timing of transmissions */ priv->xd_mac = xbee; /* Save the MAC interface instance */ priv->xd_txpoll = wd_create(); /* Create periodic poll timer */ diff --git a/drivers/wireless/spirit/drivers/spirit_netdev.c b/drivers/wireless/spirit/drivers/spirit_netdev.c index 9e9b0655c0..e951f3fe0a 100644 --- a/drivers/wireless/spirit/drivers/spirit_netdev.c +++ b/drivers/wireless/spirit/drivers/spirit_netdev.c @@ -2812,7 +2812,7 @@ int spirit_netdev_initialize(FAR struct spi_dev_s *spi, priv->lower = lower; - /* Create a watchdog for timing polling for and timing of transmisstions */ + /* Create a watchdog for timing polling for and timing of transmissions */ priv->txpoll = wd_create(); /* Create periodic poll timer */ priv->txtimeout = wd_create(); /* Create TX timeout timer */ diff --git a/wireless/ieee802154/mac802154_netdev.c b/wireless/ieee802154/mac802154_netdev.c index 953c37f26d..aa4abe8ab2 100644 --- a/wireless/ieee802154/mac802154_netdev.c +++ b/wireless/ieee802154/mac802154_netdev.c @@ -1400,7 +1400,7 @@ int mac802154netdev_register(MACHANDLE mac) #endif dev->d_private = (FAR void *)priv; /* Used to recover private state from dev */ - /* Create a watchdog for timing polling for and timing of transmisstions */ + /* Create a watchdog for timing polling for and timing of transmissions */ priv->md_mac = mac; /* Save the MAC interface instance */ priv->md_txpoll = wd_create(); /* Create periodic poll timer */ -- GitLab From 5ab4eb4f30177522c4dd2e79da6a26a32c83a8aa Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 22 Jan 2018 11:11:23 -0600 Subject: [PATCH 094/228] net/tcp: Write buffering logic should not wait for a free buffer if the socket was opened non-blocking. Also, rename the TCP write buffering macros from WRB_* to TCPWB_* to make room in the namespace for write buffering with other protocols. --- TODO | 22 +++---- net/tcp/tcp.h | 37 ++++++------ net/tcp/tcp_send_buffered.c | 117 ++++++++++++++++++++---------------- net/tcp/tcp_wrbuffer_dump.c | 6 +- 4 files changed, 99 insertions(+), 83 deletions(-) diff --git a/TODO b/TODO index 4d46a3e5b0..dd4dca76ac 100644 --- a/TODO +++ b/TODO @@ -332,17 +332,17 @@ o Task/Scheduler (sched/) alternating between a high and a low priority. In either state, it may have its priority boosted. However, under some circumstances, it is impossible in the current design to - switch to the correct correct priority if a semaphore is - participating in priority inheritance: - - There is an when switching from the high to the low priority - state. If the priority was NOT boosted above the higher - priority, it still may still need to boosted with respect to - the lower priority. If the highest priority thread waiting - on a semaphore held by the sporadic thread is higher in - priority than the low priority but less than the higher - priority, then new thread priority should be set to that - middle priority, not to the lower priority + switch to the correct priority if a semaphore held by the + sporadic thread is participating in priority inheritance: + + There is an issue when switching from the high to the low + priority state. If the priority was NOT boosted above the + higher priority, it still may still need to boosted with + respect to the lower priority. If the highest priority + thread waiting on a semaphore held by the sporadic thread is + higher in priority than the low priority but less than the + higher priority, then new thread priority should be set to + that middle priority, not to the lower priority. In order to do this we would need to know the highest priority from among all tasks waiting for the all semaphores diff --git a/net/tcp/tcp.h b/net/tcp/tcp.h index 91e13ffe7b..bf8948da73 100644 --- a/net/tcp/tcp.h +++ b/net/tcp/tcp.h @@ -1,7 +1,7 @@ /**************************************************************************** * net/tcp/tcp.h * - * Copyright (C) 2014-2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2014-2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -77,23 +77,26 @@ #ifdef CONFIG_NET_TCP_WRITE_BUFFERS /* TCP write buffer access macros */ -# define WRB_SEQNO(wrb) ((wrb)->wb_seqno) -# define WRB_PKTLEN(wrb) ((wrb)->wb_iob->io_pktlen) -# define WRB_SENT(wrb) ((wrb)->wb_sent) -# define WRB_NRTX(wrb) ((wrb)->wb_nrtx) -# define WRB_IOB(wrb) ((wrb)->wb_iob) -# define WRB_COPYOUT(wrb,dest,n) (iob_copyout(dest,(wrb)->wb_iob,(n),0)) -# define WRB_COPYIN(wrb,src,n) (iob_copyin((wrb)->wb_iob,src,(n),0,false)) +# define TCPWB_SEQNO(wrb) ((wrb)->wb_seqno) +# define TCPWB_PKTLEN(wrb) ((wrb)->wb_iob->io_pktlen) +# define TCPWB_SENT(wrb) ((wrb)->wb_sent) +# define TCPWB_NRTX(wrb) ((wrb)->wb_nrtx) +# define TCPWB_IOB(wrb) ((wrb)->wb_iob) +# define TCPWB_COPYOUT(wrb,dest,n) (iob_copyout(dest,(wrb)->wb_iob,(n),0)) +# define TCPWB_COPYIN(wrb,src,n) \ + (iob_copyin((wrb)->wb_iob,src,(n),0,false)) +# define TCPWB_TRYCOPYIN(wrb,src,n) \ + (iob_trycopyin((wrb)->wb_iob,src,(n),0,false)) -# define WRB_TRIM(wrb,n) \ - do { (wrb)->wb_iob = iob_trimhead((wrb)->wb_iob,(n)); } while (0) +# define TCPWB_TRIM(wrb,n) \ + do { (wrb)->wb_iob = iob_trimhead((wrb)->wb_iob,(n)); } while (0) #ifdef CONFIG_DEBUG_FEATURES -# define WRB_DUMP(msg,wrb,len,offset) \ +# define TCPWB_DUMP(msg,wrb,len,offset) \ tcp_wrbuffer_dump(msg,wrb,len,offset) -#else -# define WRB_DUMP(msg,wrb,len,offset) -#endif +# else +# define TCPWB_DUMP(msg,wrb,len,offset) +# endif #endif /**************************************************************************** @@ -438,7 +441,7 @@ int tcp_local_ipv6_device(FAR struct tcp_conn_s *conn); * * Description: * Select the network driver to use with the IPv6 TCP transaction based - * on the remotely conected IPv6 address + * on the remotely connected IPv6 address * * Input Parameters: * conn - TCP connection structure. The remotely connected address, raddr, @@ -558,7 +561,7 @@ int tcp_start_monitor(FAR struct socket *psock); * * Description: * Stop monitoring TCP connection changes for a sockets associated with - * a given TCP connection stucture. + * a given TCP connection structure. * * Input Parameters: * conn - The TCP connection of interest @@ -1282,7 +1285,7 @@ ssize_t psock_tcp_send(FAR struct socket *psock, FAR const void *buf, * * Returned Value: * OK - * At least one byte of data could be succesfully written. + * At least one byte of data could be successfully written. * -EWOULDBLOCK * There is no room in the output buffer. * -EBADF diff --git a/net/tcp/tcp_send_buffered.c b/net/tcp/tcp_send_buffered.c index df54f338c3..5abb417e70 100644 --- a/net/tcp/tcp_send_buffered.c +++ b/net/tcp/tcp_send_buffered.c @@ -1,7 +1,7 @@ /**************************************************************************** * net/tcp/tcp_send_buffered.c * - * Copyright (C) 2007-2014, 2016-2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2014, 2016-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * Jason Jiang * @@ -98,8 +98,8 @@ # define BUF_DUMP(msg,buf,len) lib_dumpbuffer(msg,buf,len) #else # define BUF_DUMP(msg,buf,len) -# undef WRB_DUMP -# define WRB_DUMP(msg,wrb,len,offset) +# undef TCPWB_DUMP +# define TCPWB_DUMP(msg,wrb,len,offset) #endif /**************************************************************************** @@ -135,7 +135,7 @@ static void psock_insert_segment(FAR struct tcp_wrbuffer_s *wrb, for (itr = sq_peek(q); itr; itr = sq_next(itr)) { FAR struct tcp_wrbuffer_s *wrb0 = (FAR struct tcp_wrbuffer_s *)itr; - if (WRB_SEQNO(wrb0) < WRB_SEQNO(wrb)) + if (TCPWB_SEQNO(wrb0) < TCPWB_SEQNO(wrb)) { insert = itr; } @@ -417,13 +417,14 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, * the write buffer has been ACKed. */ - if (ackno > WRB_SEQNO(wrb)) + if (ackno > TCPWB_SEQNO(wrb)) { /* Get the sequence number at the end of the data */ - lastseq = WRB_SEQNO(wrb) + WRB_PKTLEN(wrb); + lastseq = TCPWB_SEQNO(wrb) + TCPWB_PKTLEN(wrb); ninfo("ACK: wrb=%p seqno=%u lastseq=%u pktlen=%u ackno=%u\n", - wrb, WRB_SEQNO(wrb), lastseq, WRB_PKTLEN(wrb), ackno); + wrb, TCPWB_SEQNO(wrb), lastseq, TCPWB_PKTLEN(wrb), + ackno); /* Has the entire buffer been ACKed? */ @@ -449,24 +450,24 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, * buffers in the chain. */ - trimlen = ackno - WRB_SEQNO(wrb); - if (trimlen > WRB_SENT(wrb)) + trimlen = ackno - TCPWB_SEQNO(wrb); + if (trimlen > TCPWB_SENT(wrb)) { /* More data has been ACKed then we have sent? */ - trimlen = WRB_SENT(wrb); + trimlen = TCPWB_SENT(wrb); } ninfo("ACK: wrb=%p trim %u bytes\n", wrb, trimlen); - WRB_TRIM(wrb, trimlen); - WRB_SEQNO(wrb) = ackno; - WRB_SENT(wrb) -= trimlen; + TCPWB_TRIM(wrb, trimlen); + TCPWB_SEQNO(wrb) = ackno; + TCPWB_SENT(wrb) -= trimlen; /* Set the new sequence number for what remains */ ninfo("ACK: wrb=%p seqno=%u pktlen=%u\n", - wrb, WRB_SEQNO(wrb), WRB_PKTLEN(wrb)); + wrb, TCPWB_SEQNO(wrb), TCPWB_PKTLEN(wrb)); } } } @@ -477,31 +478,31 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, */ wrb = (FAR struct tcp_wrbuffer_s *)sq_peek(&conn->write_q); - if (wrb && WRB_SENT(wrb) > 0 && ackno > WRB_SEQNO(wrb)) + if (wrb && TCPWB_SENT(wrb) > 0 && ackno > TCPWB_SEQNO(wrb)) { uint32_t nacked; /* Number of bytes that were ACKed */ - nacked = ackno - WRB_SEQNO(wrb); - if (nacked > WRB_SENT(wrb)) + nacked = ackno - TCPWB_SEQNO(wrb); + if (nacked > TCPWB_SENT(wrb)) { /* More data has been ACKed then we have sent? ASSERT? */ - nacked = WRB_SENT(wrb); + nacked = TCPWB_SENT(wrb); } ninfo("ACK: wrb=%p seqno=%u nacked=%u sent=%u ackno=%u\n", - wrb, WRB_SEQNO(wrb), nacked, WRB_SENT(wrb), ackno); + wrb, TCPWB_SEQNO(wrb), nacked, TCPWB_SENT(wrb), ackno); /* Trim the ACKed bytes from the beginning of the write buffer. */ - WRB_TRIM(wrb, nacked); - WRB_SEQNO(wrb) = ackno; - WRB_SENT(wrb) -= nacked; + TCPWB_TRIM(wrb, nacked); + TCPWB_SEQNO(wrb) = ackno; + TCPWB_SENT(wrb) -= nacked; ninfo("ACK: wrb=%p seqno=%u pktlen=%u sent=%u\n", - wrb, WRB_SEQNO(wrb), WRB_PKTLEN(wrb), WRB_SENT(wrb)); + wrb, TCPWB_SEQNO(wrb), TCPWB_PKTLEN(wrb), TCPWB_SENT(wrb)); } } @@ -543,16 +544,16 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, */ wrb = (FAR struct tcp_wrbuffer_s *)sq_peek(&conn->write_q); - ninfo("REXMIT: wrb=%p sent=%u\n", wrb, wrb ? WRB_SENT(wrb) : 0); + ninfo("REXMIT: wrb=%p sent=%u\n", wrb, wrb ? TCPWB_SENT(wrb) : 0); - if (wrb != NULL && WRB_SENT(wrb) > 0) + if (wrb != NULL && TCPWB_SENT(wrb) > 0) { FAR struct tcp_wrbuffer_s *tmp; uint16_t sent; /* Yes.. Reset the number of bytes sent sent from the write buffer */ - sent = WRB_SENT(wrb); + sent = TCPWB_SENT(wrb); if (conn->unacked > sent) { conn->unacked -= sent; @@ -571,16 +572,16 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, conn->sent = 0; } - WRB_SENT(wrb) = 0; + TCPWB_SENT(wrb) = 0; ninfo("REXMIT: wrb=%p sent=%u, conn unacked=%d sent=%d\n", - wrb, WRB_SENT(wrb), conn->unacked, conn->sent); + wrb, TCPWB_SENT(wrb), conn->unacked, conn->sent); /* Increment the retransmit count on this write buffer. */ - if (++WRB_NRTX(wrb) >= TCP_MAXRTX) + if (++TCPWB_NRTX(wrb) >= TCP_MAXRTX) { nwarn("WARNING: Expiring wrb=%p nrtx=%u\n", - wrb, WRB_NRTX(wrb)); + wrb, TCPWB_NRTX(wrb)); /* The maximum retry count as been exhausted. Remove the write * buffer at the head of the queue. @@ -618,7 +619,7 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, /* Reset the number of bytes sent sent from the write buffer */ - sent = WRB_SENT(wrb); + sent = TCPWB_SENT(wrb); if (conn->unacked > sent) { conn->unacked -= sent; @@ -637,16 +638,16 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, conn->sent = 0; } - WRB_SENT(wrb) = 0; + TCPWB_SENT(wrb) = 0; ninfo("REXMIT: wrb=%p sent=%u, conn unacked=%d sent=%d\n", - wrb, WRB_SENT(wrb), conn->unacked, conn->sent); + wrb, TCPWB_SENT(wrb), conn->unacked, conn->sent); /* Free any write buffers that have exceed the retry count */ - if (++WRB_NRTX(wrb) >= TCP_MAXRTX) + if (++TCPWB_NRTX(wrb) >= TCP_MAXRTX) { nwarn("WARNING: Expiring wrb=%p nrtx=%u\n", - wrb, WRB_NRTX(wrb)); + wrb, TCPWB_NRTX(wrb)); /* Return the write buffer to the free list */ @@ -671,7 +672,7 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, * is pulled from the write_q again. */ - ninfo("REXMIT: Moving wrb=%p nrtx=%u\n", wrb, WRB_NRTX(wrb)); + ninfo("REXMIT: Moving wrb=%p nrtx=%u\n", wrb, TCPWB_NRTX(wrb)); psock_insert_segment(wrb, &conn->write_q); } @@ -726,7 +727,7 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, * window size. */ - sndlen = WRB_PKTLEN(wrb) - WRB_SENT(wrb); + sndlen = TCPWB_PKTLEN(wrb) - TCPWB_SENT(wrb); if (sndlen > conn->mss) { sndlen = conn->mss; @@ -738,16 +739,16 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, } ninfo("SEND: wrb=%p pktlen=%u sent=%u sndlen=%u\n", - wrb, WRB_PKTLEN(wrb), WRB_SENT(wrb), sndlen); + wrb, TCPWB_PKTLEN(wrb), TCPWB_SENT(wrb), sndlen); /* Set the sequence number for this segment. If we are * retransmitting, then the sequence number will already * be set for this write buffer. */ - if (WRB_SEQNO(wrb) == (unsigned)-1) + if (TCPWB_SEQNO(wrb) == (unsigned)-1) { - WRB_SEQNO(wrb) = conn->isn + conn->sent; + TCPWB_SEQNO(wrb) = conn->isn + conn->sent; } /* The TCP stack updates sndseq on receipt of ACK *before* @@ -757,7 +758,7 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, * before the packet is sent. */ - tcp_setsequence(conn->sndseq, WRB_SEQNO(wrb) + WRB_SENT(wrb)); + tcp_setsequence(conn->sndseq, TCPWB_SEQNO(wrb) + TCPWB_SENT(wrb)); #ifdef NEED_IPDOMAIN_SUPPORT /* If both IPv4 and IPv6 support are enabled, then we will need to @@ -773,7 +774,7 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, * won't actually happen until the polling cycle completes). */ - devif_iob_send(dev, WRB_IOB(wrb), sndlen, WRB_SENT(wrb)); + devif_iob_send(dev, TCPWB_IOB(wrb), sndlen, TCPWB_SENT(wrb)); /* Remember how much data we send out now so that we know * when everything has been acknowledged. Just increment @@ -795,21 +796,21 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, } ninfo("SEND: wrb=%p nrtx=%u unacked=%u sent=%u\n", - wrb, WRB_NRTX(wrb), conn->unacked, conn->sent); + wrb, TCPWB_NRTX(wrb), conn->unacked, conn->sent); /* Increment the count of bytes sent from this write buffer */ - WRB_SENT(wrb) += sndlen; + TCPWB_SENT(wrb) += sndlen; ninfo("SEND: wrb=%p sent=%u pktlen=%u\n", - wrb, WRB_SENT(wrb), WRB_PKTLEN(wrb)); + wrb, TCPWB_SENT(wrb), TCPWB_PKTLEN(wrb)); /* Remove the write buffer from the write queue if the * last of the data has been sent from the buffer. */ - DEBUGASSERT(WRB_SENT(wrb) <= WRB_PKTLEN(wrb)); - if (WRB_SENT(wrb) >= WRB_PKTLEN(wrb)) + DEBUGASSERT(TCPWB_SENT(wrb) <= TCPWB_PKTLEN(wrb)); + if (TCPWB_SENT(wrb) >= TCPWB_PKTLEN(wrb)) { FAR struct tcp_wrbuffer_s *tmp; @@ -1060,13 +1061,25 @@ ssize_t psock_tcp_send(FAR struct socket *psock, FAR const void *buf, /* Initialize the write buffer */ - WRB_SEQNO(wrb) = (unsigned)-1; - WRB_NRTX(wrb) = 0; - result = WRB_COPYIN(wrb, (FAR uint8_t *)buf, len); + TCPWB_SEQNO(wrb) = (unsigned)-1; + TCPWB_NRTX(wrb) = 0; + + /* Copy the user data into the write buffer. We cannot wait for + * buffer space if the socket was opened non-blocking. + */ + + if (_SS_ISNONBLOCK(psock->s_flags)) + { + result = TCPWB_TRYCOPYIN(wrb, (FAR uint8_t *)buf, len); + } + else + { + result = TCPWB_COPYIN(wrb, (FAR uint8_t *)buf, len); + } /* Dump I/O buffer chain */ - WRB_DUMP("I/O buffer chain", wrb, WRB_PKTLEN(wrb), 0); + TCPWB_DUMP("I/O buffer chain", wrb, TCPWB_PKTLEN(wrb), 0); /* psock_send_eventhandler() will send data in FIFO order from the * conn->write_q @@ -1074,7 +1087,7 @@ ssize_t psock_tcp_send(FAR struct socket *psock, FAR const void *buf, sq_addlast(&wrb->wb_node, &conn->write_q); ninfo("Queued WRB=%p pktlen=%u write_q(%p,%p)\n", - wrb, WRB_PKTLEN(wrb), + wrb, TCPWB_PKTLEN(wrb), conn->write_q.head, conn->write_q.tail); /* Notify the device driver of the availability of TX data */ diff --git a/net/tcp/tcp_wrbuffer_dump.c b/net/tcp/tcp_wrbuffer_dump.c index ad92bfb904..a27bb60253 100644 --- a/net/tcp/tcp_wrbuffer_dump.c +++ b/net/tcp/tcp_wrbuffer_dump.c @@ -1,7 +1,7 @@ /**************************************************************************** * net/tcp/tcp_wrbuffer_dump.c * - * Copyright (C) 2014 Gregory Nutt. All rights reserved. + * Copyright (C) 2014, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -64,8 +64,8 @@ void tcp_wrbuffer_dump(FAR const char *msg, FAR struct tcp_wrbuffer_s *wrb, unsigned int len, unsigned int offset) { syslog(LOG_DEBUG, "%s: wrb=%p segno=%d sent=%d nrtx=%d\n", - msg, wrb, WRB_SEQNO(wrb), WRB_SENT(wrb), WRB_NRTX(wrb)); - iob_dump("I/O Buffer Chain", WRB_IOB(wrb), len, offset); + msg, wrb, TCPWB_SEQNO(wrb), TCPWB_SENT(wrb), TCPWB_NRTX(wrb)); + iob_dump("I/O Buffer Chain", TCPWB_IOB(wrb), len, offset); } #endif /* CONFIG_DEBUG_FEATURES */ -- GitLab From 055a3ef844a51361d3f96e91e75b4f57ec8d5d6a Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 22 Jan 2018 14:14:32 -0600 Subject: [PATCH 095/228] net/udp: Remove some conditional logic that was true if there is only a single network device, but not true in the multi-device context. --- net/udp/udp_psock_sendto.c | 36 ++++++++---------------------------- 1 file changed, 8 insertions(+), 28 deletions(-) diff --git a/net/udp/udp_psock_sendto.c b/net/udp/udp_psock_sendto.c index 4710fb36d6..ff362a310e 100644 --- a/net/udp/udp_psock_sendto.c +++ b/net/udp/udp_psock_sendto.c @@ -70,36 +70,16 @@ # define NEED_IPDOMAIN_SUPPORT 1 #endif -/* Timeouts on sendto() do not make sense. Each polling cycle from the - * driver is an opportunity to send a packet. If the driver is not polling, - * then the network is not up (and there are no polling cycles to drive - * the timeout). - * - * There is a remote possibility that if there is a lot of other network - * traffic that a UDP sendto could get delayed, but I would not expect this - * generate a timeout. - */ - -#undef CONFIG_NET_SENDTO_TIMEOUT - -/* If supported, the sendto timeout function would depend on socket options - * and a system clock. - */ - -#ifndef CONFIG_NET_SOCKOPTS -# undef CONFIG_NET_SENDTO_TIMEOUT -#endif - /**************************************************************************** * Private Types ****************************************************************************/ struct sendto_s { -#if defined(CONFIG_NET_SENDTO_TIMEOUT) || defined(NEED_IPDOMAIN_SUPPORT) +#if defined(CONFIG_NET_SOCKOPTS) || defined(NEED_IPDOMAIN_SUPPORT) FAR struct socket *st_sock; /* Points to the parent socket structure */ #endif -#ifdef CONFIG_NET_SENDTO_TIMEOUT +#ifdef CONFIG_NET_SOCKOPTS systime_t st_time; /* Last send time for determining timeout */ #endif FAR struct devif_callback_s *st_cb; /* Reference to callback instance */ @@ -130,7 +110,7 @@ struct sendto_s * ****************************************************************************/ -#ifdef CONFIG_NET_SENDTO_TIMEOUT +#ifdef CONFIG_NET_SOCKOPTS static inline int send_timeout(FAR struct sendto_s *pstate) { FAR struct socket *psock; @@ -151,7 +131,7 @@ static inline int send_timeout(FAR struct sendto_s *pstate) return FALSE; } -#endif /* CONFIG_NET_SENDTO_TIMEOUT */ +#endif /* CONFIG_NET_SOCKOPTS */ /**************************************************************************** * Name: sendto_ipselect @@ -254,7 +234,7 @@ static uint16_t sendto_eventhandler(FAR struct net_driver_s *dev, * polling cycle and check again. */ -#ifdef CONFIG_NET_SENDTO_TIMEOUT +#ifdef CONFIG_NET_SOCKOPTS if (send_timeout(pstate)) { /* Yes.. report the timeout */ @@ -263,7 +243,7 @@ static uint16_t sendto_eventhandler(FAR struct net_driver_s *dev, pstate->st_sndlen = -ETIMEDOUT; } else -#endif /* CONFIG_NET_SENDTO_TIMEOUT */ +#endif /* CONFIG_NET_SOCKOPTS */ { /* No timeout. Just wait for the next polling cycle */ @@ -403,7 +383,7 @@ ssize_t psock_udp_sendto(FAR struct socket *psock, FAR const void *buf, state.st_buflen = len; state.st_buffer = buf; -#if defined(CONFIG_NET_SENDTO_TIMEOUT) || defined(NEED_IPDOMAIN_SUPPORT) +#if defined(CONFIG_NET_SOCKOPTS) || defined(NEED_IPDOMAIN_SUPPORT) /* Save the reference to the socket structure if it will be needed for * asynchronous processing. */ @@ -411,7 +391,7 @@ ssize_t psock_udp_sendto(FAR struct socket *psock, FAR const void *buf, state.st_sock = psock; #endif -#ifdef CONFIG_NET_SENDTO_TIMEOUT +#ifdef CONFIG_NET_SOCKOPTS /* Set the initial time for calculating timeouts */ state.st_time = clock_systimer(); -- GitLab From 880176e1cb6893e836df219df17cf4f022b6254f Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 22 Jan 2018 18:32:02 -0600 Subject: [PATCH 096/228] This commit adds an as-of-yet untested implemented of UDP write buffering. Squashed commit of the following: net/udp: Address most of the issues with UDP write buffering. There is a remaining issue with handling one network going down in a multi-network environment. None of this has been test but it is certainly ready for test. Hence, the feature is marked EXPERIMENTAL. net/udp: Some baby steps toward a corrected write buffering design. net/udp: Remove pesky write buffer macros. Eliminate trailing space at the end of lines. net/udp: A little more UDP write buffering logic. Still at least on big gaping hole in the design. net/udp: Undefined CONFIG_NET_SENDTO_TIMEOUT. net/udp: Crude, naive port of the TCP write buffering logic into UDP. This commit is certainly non-functional and is simply a starting point for the implementatin of UDP write buffering. net/udp: Rename udp/udp_psock_sendto.c udp/udp_psock_sendto_unbuffered.c. --- include/nuttx/net/net.h | 4 +- mm/iob/Kconfig | 14 +- net/Kconfig | 8 + net/inet/inet_sockif.c | 2 +- net/net_initialize.c | 4 + net/socket/socket.c | 2 +- net/tcp/Kconfig | 4 +- net/udp/Kconfig | 50 ++ net/udp/Make.defs | 19 +- net/udp/udp.h | 129 ++- net/udp/udp_conn.c | 21 +- net/udp/udp_psock_sendto_buffered.c | 821 ++++++++++++++++++ ...sendto.c => udp_psock_sendto_unbuffered.c} | 11 +- net/udp/udp_wrbuffer.c | 217 +++++ net/udp/udp_wrbuffer_dump.c | 70 ++ 15 files changed, 1354 insertions(+), 22 deletions(-) create mode 100644 net/udp/udp_psock_sendto_buffered.c rename net/udp/{udp_psock_sendto.c => udp_psock_sendto_unbuffered.c} (98%) create mode 100644 net/udp/udp_wrbuffer.c create mode 100644 net/udp/udp_wrbuffer_dump.c diff --git a/include/nuttx/net/net.h b/include/nuttx/net/net.h index fb4de5c473..9e1eec09db 100644 --- a/include/nuttx/net/net.h +++ b/include/nuttx/net/net.h @@ -208,8 +208,8 @@ struct socket FAR const struct sock_intf_s *s_sockif; -#ifdef CONFIG_NET_TCP_WRITE_BUFFERS - /* Callback instance for TCP send */ +#if defined(CONFIG_NET_TCP_WRITE_BUFFERS) || defined(CONFIG_NET_UDP_WRITE_BUFFERS) + /* Callback instance for TCP send() or UDP sendto() */ FAR struct devif_callback_s *s_sndcb; #endif diff --git a/mm/iob/Kconfig b/mm/iob/Kconfig index b64f90e3ce..62893db094 100644 --- a/mm/iob/Kconfig +++ b/mm/iob/Kconfig @@ -16,9 +16,9 @@ if MM_IOB config IOB_NBUFFERS int "Number of pre-allocated I/O buffers" - default 24 if (NET_TCP_WRITE_BUFFERS && !NET_TCP_READAHEAD) || (!NET_TCP_WRITE_BUFFERS && NET_TCP_READAHEAD) - default 36 if NET_TCP_WRITE_BUFFERS && NET_TCP_READAHEAD - default 8 if !NET_TCP_WRITE_BUFFERS && !NET_TCP_READAHEAD + default 24 if (NET_WRITE_BUFFERS && !NET_READAHEAD) || (!NET_WRITE_BUFFERS && NET_READAHEAD) + default 36 if NET_WRITE_BUFFERS && NET_READAHEAD + default 8 if !NET_WRITE_BUFFERS && !NET_READAHEAD ---help--- Each packet is represented by a series of small I/O buffers in a chain. This setting determines the number of preallocated I/O @@ -34,8 +34,8 @@ config IOB_BUFSIZE config IOB_NCHAINS int "Number of pre-allocated I/O buffer chain heads" - default 0 if !NET_TCP_READAHEAD && !NET_UDP_READAHEAD - default 8 if NET_TCP_READAHEAD || NET_UDP_READAHEAD + default 0 if !NET_READAHEAD && !NET_UDP_READAHEAD + default 8 if NET_READAHEAD || NET_UDP_READAHEAD ---help--- These tiny nodes are used as "containers" to support queueing of I/O buffer chains. This will limit the number of I/O transactions @@ -49,8 +49,8 @@ config IOB_NCHAINS config IOB_THROTTLE int "I/O buffer throttle value" - default 0 if !NET_TCP_WRITE_BUFFERS || !NET_TCP_READAHEAD - default 8 if NET_TCP_WRITE_BUFFERS && NET_TCP_READAHEAD + default 0 if !NET_WRITE_BUFFERS || !NET_READAHEAD + default 8 if NET_WRITE_BUFFERS && NET_READAHEAD ---help--- TCP write buffering and read-ahead buffer use the same pool of free I/O buffers. In order to prevent uncontrolled incoming TCP packets diff --git a/net/Kconfig b/net/Kconfig index 48163d26bf..3c4f969486 100644 --- a/net/Kconfig +++ b/net/Kconfig @@ -11,6 +11,14 @@ config ARCH_HAVE_PHY bool default n +config NET_WRITE_BUFFERS + bool + default n + +config NET_READAHEAD + bool + default n + config NET bool "Networking support" default n diff --git a/net/inet/inet_sockif.c b/net/inet/inet_sockif.c index 761a65bb1b..9ab4be7336 100644 --- a/net/inet/inet_sockif.c +++ b/net/inet/inet_sockif.c @@ -1146,7 +1146,7 @@ static ssize_t inet_sendto(FAR struct socket *psock, FAR const void *buf, #if defined(CONFIG_NET_6LOWPAN) /* Try 6LoWPAN UDP packet sendto() */ - nsent = psock_6lowpan_udp_sendto(psock, buf, len, flags, to, tolen); + nsent = psock_6lowpan_udp_sendto(psock, buf, len, flags, to, minlen); #ifdef NET_UDP_HAVE_STACK if (nsent < 0) diff --git a/net/net_initialize.c b/net/net_initialize.c index 4d0105acf7..0447f88dfc 100644 --- a/net/net_initialize.c +++ b/net/net_initialize.c @@ -172,6 +172,10 @@ void net_setup(void) /* Initialize the UDP connection structures */ udp_initialize(); + +#ifdef CONFIG_NET_UDP_WRITE_BUFFERS + udp_wrbuffer_initialize(); +#endif #endif #ifdef CONFIG_NET_IGMP diff --git a/net/socket/socket.c b/net/socket/socket.c index 539ef0b216..caaed28320 100644 --- a/net/socket/socket.c +++ b/net/socket/socket.c @@ -105,7 +105,7 @@ int psock_socket(int domain, int type, int protocol, FAR struct socket *psock) psock->s_domain = domain; psock->s_type = type; psock->s_conn = NULL; -#ifdef CONFIG_NET_TCP_WRITE_BUFFERS +#if defined(CONFIG_NET_TCP_WRITE_BUFFERS) || defined(CONFIG_NET_UDP_WRITE_BUFFERS) psock->s_sndcb = NULL; #endif diff --git a/net/tcp/Kconfig b/net/tcp/Kconfig index 77cebe81fb..c3647ae289 100644 --- a/net/tcp/Kconfig +++ b/net/tcp/Kconfig @@ -70,6 +70,7 @@ config NET_MAX_LISTENPORTS config NET_TCP_READAHEAD bool "Enable TCP/IP read-ahead buffering" default y + select NET_READAHEAD select MM_IOB ---help--- Read-ahead buffers allows buffering of TCP/IP packets when there is no @@ -91,6 +92,7 @@ endif # NET_TCP_READAHEAD config NET_TCP_WRITE_BUFFERS bool "Enable TCP/IP write buffering" default n + select NET_WRITE_BUFFERS select MM_IOB ---help--- Write buffers allows buffering of ongoing TCP/IP packets, providing @@ -105,7 +107,7 @@ config NET_TCP_NWRBCHAINS int "Number of pre-allocated I/O buffer chain heads" default 8 ---help--- - These tiny nodes are used as "containers" to support queueing of + These tiny nodes are used as "containers" to support queuing of TCP write buffers. This setting will limit the number of TCP write operations that can be "in-flight" at any give time. So a good choice for this value would be the same as the maximum number of diff --git a/net/udp/Kconfig b/net/udp/Kconfig index ba710b8629..16d40a72ef 100644 --- a/net/udp/Kconfig +++ b/net/udp/Kconfig @@ -44,7 +44,57 @@ config NET_BROADCAST config NET_UDP_READAHEAD bool "Enable UDP/IP read-ahead buffering" default y + select NET_READAHEAD select MM_IOB +config NET_UDP_WRITE_BUFFERS + bool "Enable UDP/IP write buffering" + default n + select NET_WRITE_BUFFERS + select MM_IOB + depends on EXPERIMENTAL + ---help--- + Write buffers allows buffering of ongoing UDP/IP packets, providing + for higher performance, streamed output. + + You might want to disable UDP/IP write buffering on a highly memory + memory constrained system where there are no performance issues. + +if NET_UDP_WRITE_BUFFERS + +config NET_UDP_NWRBCHAINS + int "Number of pre-allocated I/O buffer chain heads" + default 8 + ---help--- + These tiny nodes are used as "containers" to support queuing of + UDP write buffers. This setting will limit the number of UDP write + operations that can be "in-flight" at any give time. So a good + choice for this value would be the same as the maximum number of + UDP connections. + +config NET_UDP_WRBUFFER_DEBUG + bool "Force write buffer debug" + default n + depends on DEBUG_FEATURES + select IOB_DEBUG + ---help--- + This option will force debug output from UDP write buffer logic, + even without network debug output. This is not normally something + that would want to do but is convenient if you are debugging the + write buffer logic and do not want to get overloaded with other + network-related debug output. + +config NET_UDP_WRBUFFER_DUMP + bool "Force write buffer dump" + default n + depends on DEBUG_NET || NET_UDP_WRBUFFER_DEBUG + select IOB_DEBUG + ---help--- + Dump the contents of the write buffers. You do not want to do this + unless you really want to analyze the write buffer transfers in + detail. + +endif # NET_UDP_WRITE_BUFFERS + endif # NET_UDP && !NET_UDP_NO_STACK endmenu # UDP Networking diff --git a/net/udp/Make.defs b/net/udp/Make.defs index 4b3992911d..5c8918ea9a 100644 --- a/net/udp/Make.defs +++ b/net/udp/Make.defs @@ -1,7 +1,7 @@ ############################################################################ # net/udp/Make.defs # -# Copyright (C) 2014-2015 Gregory Nutt. All rights reserved. +# Copyright (C) 2014-2015, 2018 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -40,7 +40,13 @@ ifneq ($(CONFIG_NET_UDP_NO_STACK),y) # Socket layer -NET_CSRCS += udp_psock_send.c udp_psock_sendto.c +NET_CSRCS += udp_psock_send.c + +ifeq ($(CONFIG_NET_UDP_WRITE_BUFFERS),y) +SOCK_CSRCS += udp_psock_sendto_buffered.c +else +SOCK_CSRCS += udp_psock_sendto_unbuffered.c +endif ifneq ($(CONFIG_DISABLE_POLL),y) ifeq ($(CONFIG_NET_UDP_READAHEAD),y) @@ -53,6 +59,15 @@ endif NET_CSRCS += udp_conn.c udp_devpoll.c udp_send.c udp_input.c udp_finddev.c NET_CSRCS += udp_callback.c udp_ipselect.c +# UDP write buffering + +ifeq ($(CONFIG_NET_UDP_WRITE_BUFFERS),y) +NET_CSRCS += udp_wrbuffer.c +ifeq ($(CONFIG_DEBUG_FEATURES),y) +NET_CSRCS += udp_wrbuffer_dump.c +endif +endif + # Include UDP build support DEPPATH += --dep-path udp diff --git a/net/udp/udp.h b/net/udp/udp.h index cb6ca378f5..ee591ed078 100644 --- a/net/udp/udp.h +++ b/net/udp/udp.h @@ -1,7 +1,7 @@ /**************************************************************************** * net/udp/udp.h * - * Copyright (C) 2014-2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2014-2015, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -45,6 +45,7 @@ #include #include +#include #include #ifdef CONFIG_NET_UDP_READAHEAD @@ -66,6 +67,17 @@ # define HAVE_UDP_POLL #endif +#ifdef CONFIG_NET_UDP_WRITE_BUFFERS +/* UDP write buffer dump macros */ + +# ifdef CONFIG_DEBUG_FEATURES +# define UDPWB_DUMP(msg,wrb,len,offset) \ + udp_wrbuffer_dump(msg,wrb,len,offset) +# else +# define UDPWB_DUMP(msg,wrb,len,offset) +# endif +#endif + /* Allocate a new UDP data callback */ #define udp_callback_alloc(dev,conn) \ @@ -102,11 +114,38 @@ struct udp_conn_s struct iob_queue_s readahead; /* Read-ahead buffering */ #endif +#ifdef CONFIG_NET_TCP_WRITE_BUFFERS + /* Write buffering + * + * write_q - The queue of unsent I/O buffers. The head of this + * list may be partially sent. FIFO ordering. + */ + + sq_queue_t write_q; /* Write buffering for UDP packets */ + FAR struct net_driver_s *dev; /* Last device */ +#endif + /* Defines the list of UDP callbacks */ FAR struct devif_callback_s *list; }; +/* This structure supports UDP write buffering. It is simply a container + * for a IOB list and associated destination address. + */ + +#ifdef CONFIG_NET_UDP_WRITE_BUFFERS +struct udp_wrbuffer_s +{ + sq_entry_t wb_node; /* Supports a singly linked list */ + union ip_addr_u wb_dest; /* Destination address */ +#ifdef CONFIG_NET_SOCKOPTS + systime_t wb_start; /* Start time for timeout calculation */ +#endif + struct iob_s *wb_iob; /* Head of the I/O buffer chain */ +}; +#endif + /**************************************************************************** * Public Data ****************************************************************************/ @@ -291,6 +330,92 @@ void udp_poll(FAR struct net_driver_s *dev, FAR struct udp_conn_s *conn); void udp_send(FAR struct net_driver_s *dev, FAR struct udp_conn_s *conn); +/**************************************************************************** + * Name: udp_wrbuffer_initialize + * + * Description: + * Initialize the list of free write buffers + * + * Assumptions: + * Called once early initialization. + * + ****************************************************************************/ + +#ifdef CONFIG_NET_UDP_WRITE_BUFFERS +void udp_wrbuffer_initialize(void); +#endif /* CONFIG_NET_UDP_WRITE_BUFFERS */ + +/**************************************************************************** + * Name: udp_wrbuffer_alloc + * + * Description: + * Allocate a UDP write buffer by taking a pre-allocated buffer from + * the free list. This function is called from UDP logic when a buffer + * of UDP data is about to sent + * + * Input parameters: + * None + * + * Assumptions: + * Called from user logic with the network locked. + * + ****************************************************************************/ + +#ifdef CONFIG_NET_UDP_WRITE_BUFFERS +struct udp_wrbuffer_s; + +FAR struct udp_wrbuffer_s *udp_wrbuffer_alloc(void); +#endif /* CONFIG_NET_UDP_WRITE_BUFFERS */ + +/**************************************************************************** + * Name: udp_wrbuffer_release + * + * Description: + * Release a UDP write buffer by returning the buffer to the free list. + * This function is called from user logic after it is consumed the + * buffered data. + * + * Assumptions: + * Called from network stack logic with the network stack locked + * + ****************************************************************************/ + +#ifdef CONFIG_NET_UDP_WRITE_BUFFERS +void udp_wrbuffer_release(FAR struct udp_wrbuffer_s *wrb); +#endif /* CONFIG_NET_UDP_WRITE_BUFFERS */ + +/**************************************************************************** + * Name: udp_wrbuffer_test + * + * Description: + * Check if there is room in the write buffer. Does not reserve any space. + * + * Assumptions: + * None. + * + ****************************************************************************/ + +#ifdef CONFIG_NET_UDP_WRITE_BUFFERS +int udp_wrbuffer_test(void); +#endif /* CONFIG_NET_UDP_WRITE_BUFFERS */ + +/**************************************************************************** + * Name: udp_wrbuffer_dump + * + * Description: + * Dump the contents of a write buffer. + * + ****************************************************************************/ + +#ifdef CONFIG_NET_UDP_WRITE_BUFFERS +#ifdef CONFIG_DEBUG_FEATURES +void udp_wrbuffer_dump(FAR const char *msg, FAR struct udp_wrbuffer_s *wrb, + unsigned int len, unsigned int offset); +#else +# define udp_wrbuffer_dump(msg,wrb) +#endif +#endif /* CONFIG_NET_UDP_WRITE_BUFFERS */ + /**************************************************************************** * Name: udp_ipv4_input * @@ -495,7 +620,7 @@ int udp_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds); * Teardown monitoring of events on an UDP/IP socket * * Input Parameters: - * psock - The TCP/IP socket of interest + * psock - The UDP/IP socket of interest * fds - The structure describing the events to be monitored, OR NULL if * this is a request to stop monitoring events. * diff --git a/net/udp/udp_conn.c b/net/udp/udp_conn.c index 97037c444f..61e67028f6 100644 --- a/net/udp/udp_conn.c +++ b/net/udp/udp_conn.c @@ -1,7 +1,8 @@ /**************************************************************************** * net/udp/udp_conn.c * - * Copyright (C) 2007-2009, 2011-2012, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011-2012, 2016, 2018 Gregory Nutt. All rights + * reserved. * Author: Gregory Nutt * * Large parts of this file were leveraged from uIP logic: @@ -485,6 +486,11 @@ FAR struct udp_conn_s *udp_alloc(uint8_t domain) conn->lport = 0; conn->ttl = IP_TTL; +#ifdef CONFIG_NET_TCP_WRITE_BUFFERS + /* Initialize the write buffer lists */ + + sq_init(&conn->write_q); +#endif /* Enqueue the connection into the active list */ dq_addlast(&conn->node, &g_active_udp_connections); @@ -505,6 +511,10 @@ FAR struct udp_conn_s *udp_alloc(uint8_t domain) void udp_free(FAR struct udp_conn_s *conn) { +#ifdef CONFIG_NET_UDP_WRITE_BUFFERS + FAR struct udp_wrbuffer_s *wrbuffer; +#endif + /* The free list is protected by a semaphore (that behaves like a mutex). */ DEBUGASSERT(conn->crefs == 0); @@ -522,6 +532,15 @@ void udp_free(FAR struct udp_conn_s *conn) iob_free_queue(&conn->readahead); #endif +#ifdef CONFIG_NET_UDP_WRITE_BUFFERS + /* Release any write buffers attached to the connection */ + + while ((wrbuffer = (struct udp_wrbuffer_s *)sq_remfirst(&conn->write_q)) != NULL) + { + udp_wrbuffer_release(wrbuffer); + } +#endif + /* Free the connection */ dq_addlast(&conn->node, &g_free_udp_connections); diff --git a/net/udp/udp_psock_sendto_buffered.c b/net/udp/udp_psock_sendto_buffered.c new file mode 100644 index 0000000000..3f5e5305b4 --- /dev/null +++ b/net/udp/udp_psock_sendto_buffered.c @@ -0,0 +1,821 @@ +/**************************************************************************** + * net/udp/udp_send_buffered.c + * + * Copyright (C) 2018 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#if defined(CONFIG_NET) && defined(CONFIG_NET_UDP) && \ + defined(CONFIG_NET_UDP_WRITE_BUFFERS) + +#if defined(CONFIG_DEBUG_FEATURES) && defined(CONFIG_NET_UDP_WRBUFFER_DEBUG) +/* Force debug output (from this file only) */ + +# undef CONFIG_DEBUG_NET +# define CONFIG_DEBUG_NET 1 +#endif + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "netdev/netdev.h" +#include "socket/socket.h" +#include "inet/inet.h" +#include "arp/arp.h" +#include "icmpv6/icmpv6.h" +#include "neighbor/neighbor.h" +#include "udp/udp.h" +#include "devif/devif.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ +/* If both IPv4 and IPv6 support are both enabled, then we will need to build + * in some additional domain selection support. + */ + +#if defined(CONFIG_NET_IPv4) && defined(CONFIG_NET_IPv6) +# define NEED_IPDOMAIN_SUPPORT 1 +#endif + +#define UDPIPv4BUF ((struct udp_hdr_s *)&dev->d_buf[NET_LL_HDRLEN(dev) + IPv4_HDRLEN]) +#define UDPIPv6BUF ((struct udp_hdr_s *)&dev->d_buf[NET_LL_HDRLEN(dev) + IPv6_HDRLEN]) + +/* Debug */ + +#ifdef CONFIG_NET_UDP_WRBUFFER_DUMP +# define BUF_DUMP(msg,buf,len) lib_dumpbuffer(msg,buf,len) +#else +# define BUF_DUMP(msg,buf,len) +# undef UDPWB_DUMP +# define UDPWB_DUMP(msg,wrb,len,offset) +#endif + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +static inline void sendto_netdev_down(FAR struct socket *psock, + FAR struct udp_conn_s *conn); + +#ifdef NEED_IPDOMAIN_SUPPORT +static inline void sendto_ipselect(FAR struct net_driver_s *dev, + FAR struct udp_conn_s *conn); +#endif +#ifdef CONFIG_NET_ETHERNET +static inline bool sendto_addrcheck(FAR struct udp_conn_s *conn, + FAR struct net_driver_s *dev); +#else +# define sendto_addrcheck(c,d) (true) +#endif +#ifdef CONFIG_NET_SOCKOPTS +static inline int sendto_timeout(FAR struct socket *psock, + FAR struct udp_conn_s *conn); +#endif +static int sendto_next_transfer(FAR struct socket *psock, + FAR struct udp_conn_s *conn); +static uint16_t sendto_eventhandler(FAR struct net_driver_s *dev, + FAR void *pvconn, FAR void *pvpriv, + uint16_t flags); +static inline void sendto_txnotify(FAR struct socket *psock, + FAR struct udp_conn_s *conn); + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: sendto_netdev_down + * + * Description: + * The network device is down. Free all write buffers. + * REVISIT: Should only free write buffers associated with the device + * that went down. + * + * Parameters: + * psock The socket structure + * conn The connection structure associated with the socket + * + * Returned Value: + * None + * + ****************************************************************************/ + +static inline void sendto_netdev_down(FAR struct socket *psock, + FAR struct udp_conn_s *conn) +{ + FAR sq_entry_t *entry; + FAR sq_entry_t *next; + + /* Do not allow any further callbacks */ + + if (psock->s_sndcb != NULL) + { + psock->s_sndcb->flags = 0; + psock->s_sndcb->event = NULL; + } + + /* Free all queued write buffers */ + + for (entry = sq_peek(&conn->write_q); entry; entry = next) + { + next = sq_next(entry); + udp_wrbuffer_release((FAR struct udp_wrbuffer_s *)entry); + } + + /* Reset write buffering variables */ + + sq_init(&conn->write_q); +} + +/**************************************************************************** + * Name: sendto_ipselect + * + * Description: + * If both IPv4 and IPv6 support are enabled, then we will need to select + * which one to use when generating the outgoing packet. If only one + * domain is selected, then the setup is already in place and we need do + * nothing. + * + * Parameters: + * dev - The structure of the network driver that caused the event + * psock - Socket state structure + * + * Returned Value: + * None + * + * Assumptions: + * The network is locked + * + ****************************************************************************/ + +#ifdef NEED_IPDOMAIN_SUPPORT +static inline void sendto_ipselect(FAR struct net_driver_s *dev, + FAR struct udp_conn_s *conn) +{ + /* Which domain the socket support */ + + if (conn->domain == PF_INET) + { + /* Select the IPv4 domain */ + + udp_ipv4_select(dev); + } + else /* if (conn->domain == PF_INET6) */ + { + /* Select the IPv6 domain */ + + DEBUGASSERT(conn->domain == PF_INET6); + udp_ipv6_select(dev); + } +} +#endif + +/**************************************************************************** + * Name: sendto_addrcheck + * + * Description: + * Check if the destination IP address is in the IPv4 ARP or IPv6 Neighbor + * tables. If not, then the send won't actually make it out... it will be + * replaced with an ARP request (IPv4) or a Neighbor Solicitation (IPv6). + * + * NOTE 1: This could be an expensive check if there are a lot of + * entries in the ARP or Neighbor tables. + * + * NOTE 2: If we are actually harvesting IP addresses on incoming IP + * packets, then this check should not be necessary; the MAC mapping + * should already be in the ARP table in many cases (IPv4 only). + * + * NOTE 3: If CONFIG_NET_ARP_SEND then we can be assured that the IP + * address mapping is already in the ARP table. + * + * Parameters: + * conn - The UDP connection structure + * dev - Polling network device + * + * Returned Value: + * true - The Ethernet MAC address is in the ARP or Neighbor table (OR + * the network device is not Ethernet). + * + * Assumptions: + * The network is locked + * + ****************************************************************************/ + +#ifdef CONFIG_NET_ETHERNET +static inline bool sendto_addrcheck(FAR struct udp_conn_s *conn, + FAR struct net_driver_s *dev) +{ + /* REVISIT: Could the MAC address not also be in a routing table? */ + + if (dev->d_lltype != NET_LL_ETHERNET) + { + return true; + } + +#ifdef CONFIG_NET_IPv4 +#ifdef CONFIG_NET_IPv6 + if (conn->domain == PF_INET) +#endif + { +#if !defined(CONFIG_NET_ARP_IPIN) && !defined(CONFIG_NET_ARP_SEND) + return (arp_find(conn->u.ipv4.raddr) != NULL); +#else + return true; +#endif + } +#endif /* CONFIG_NET_IPv4 */ + +#ifdef CONFIG_NET_IPv6 +#ifdef CONFIG_NET_IPv4 + else +#endif + { +#if !defined(CONFIG_NET_ICMPv6_NEIGHBOR) + return (neighbor_findentry(conn->u.ipv6.raddr) != NULL); +#else + return true; +#endif + } +#endif /* CONFIG_NET_IPv6 */ +} +#endif /* CONFIG_NET_ETHERNET */ + +/**************************************************************************** + * Name: sendto_timeout + * + * Description: + * Check for send timeout. + * + * Parameters: + * pstate - sendto state structure + * + * Returned Value: + * TRUE:timeout FALSE:no timeout + * + * Assumptions: + * The network is locked + * + ****************************************************************************/ + +#ifdef CONFIG_NET_SOCKOPTS +static inline int sendto_timeout(FAR struct socket *psock, + FAR struct udp_conn_s *conn) +{ + FAR struct udp_wrbuffer_s *wrb; + + /* Peek at the head of the write queue (without altering the write queue). */ + + wrb = (FAR struct udp_wrbuffer_s *)sq_peek(&conn->write_q); + if (wrb != NULL) + { + /* Check for a timeout configured via setsockopts(SO_SNDTIMEO). + * If none... we well let the send wait forever. + */ + + if (psock->s_sndtimeo != 0) + { + /* Check if the configured timeout has elapsed */ + + return net_timeo(wrb->wb_start, psock->s_sndtimeo); + } + } + + /* No timeout */ + + return FALSE; +} +#endif /* CONFIG_NET_SOCKOPTS */ + +/**************************************************************************** + * Name: sendto_next_transfer + * + * Description: + * Setup for the next packet transfer + * + * Parameters: + * psock - Socket state structure + * conn - The UDP connection structure + * + * Returned Value: + * None + * + ****************************************************************************/ + +static int sendto_next_transfer(FAR struct socket *psock, + FAR struct udp_conn_s *conn) +{ + FAR struct udp_wrbuffer_s *wrb; + FAR struct net_driver_s *dev; + int ret; + + /* Set the UDP "connection" to the destination address of the write buffer + * at the head of the queue. + */ + + wrb = (FAR struct udp_wrbuffer_s *)sq_peek(&conn->write_q); + DEBUGASSERT(wrb != NULL); + + ret = udp_connect(conn, (FAR const struct sockaddr *)wrb->wb_iob->io_data); + if (ret < 0) + { + nerr("ERROR: udp_connect failed: %d\n", ret); + return ret; + } + + /* Get the device that will handle the remote packet transfers. This + * should never be NULL. + */ + + dev = udp_find_raddr_device(conn); + if (dev == NULL) + { + nerr("ERROR: udp_find_raddr_device failed\n"); + return -ENETUNREACH; + } + + /* If this is not the same device that we used in the last call to + * udp_callback_alloc(), then we need to release and reallocate the old + * callback instance. + */ + + if (psock->s_sndcb != NULL && conn->dev != dev) + { + udp_callback_free(conn->dev, conn, psock->s_sndcb); + psock->s_sndcb = NULL; + } + + /* Allocate resources to receive a callback from this device if the + * callback is not already in place. + */ + + if (psock->s_sndcb == NULL) + { + psock->s_sndcb = udp_callback_alloc(dev, conn); + } + + /* Test if the callback has been allocated */ + + if (psock->s_sndcb == NULL) + { + /* A buffer allocation error occurred */ + + nerr("ERROR: Failed to allocate callback\n"); + return -ENOMEM; + } + + conn->dev = dev; + + /* Set up the callback in the connection */ + + psock->s_sndcb->flags = (UDP_POLL | NETDEV_DOWN); + psock->s_sndcb->priv = (FAR void *)psock; + psock->s_sndcb->event = sendto_eventhandler; + return OK; +} + +/**************************************************************************** + * Name: sendto_eventhandler + * + * Description: + * This function is called to perform the actual send operation when + * polled by the lower, device interfacing layer. + * + * Parameters: + * dev The structure of the network driver that caused the event + * conn The connection structure associated with the socket + * flags Set of events describing why the callback was invoked + * + * Returned Value: + * None + * + * Assumptions: + * The network is locked + * + ****************************************************************************/ + +static uint16_t sendto_eventhandler(FAR struct net_driver_s *dev, + FAR void *pvconn, FAR void *pvpriv, + uint16_t flags) +{ + FAR struct udp_conn_s *conn = (FAR struct udp_conn_s *)pvconn; + FAR struct socket *psock = (FAR struct socket *)pvpriv; + int ret; + + ninfo("flags: %04x\n", flags); + + /* Check if the network device has gone down */ + + if ((flags & NETDEV_DOWN) != 0) + { + ninfo("Device down: %04x\n", flags); + + /* Free write buffers and terminate polling */ + + sendto_netdev_down(psock, conn); + return flags; + } + + /* Check for a normal polling cycle and if the outgoing packet is + * available. It would not be available if it has been claimed by a send + * event serving a different thread -OR- if the output buffer currently + * contains unprocessed incoming data. In these cases we will just have + * to wait for the next polling cycle. + * + * And, of course, we can do nothing if we have no data in the write + * buffers to send. + */ + + if (dev->d_sndlen <= 0 && (flags & UDP_NEWDATA) != 0 && + (flags & UDP_POLL) != 0 && !sq_empty(&conn->write_q)) + { + /* Check if the destination IP address is in the ARP or Neighbor + * table. If not, then the send won't actually make it out... it + * will be replaced with an ARP request or Neighbor Solicitation. + */ + + if (sendto_addrcheck(conn, dev)) + { + FAR struct udp_wrbuffer_s *wrb; + FAR struct udp_wrbuffer_s *tmp; + size_t sndlen; + + /* Peek at the head of the write queue (but don't remove anything + * from the write queue yet). We know from the above test that + * the write_q is not empty. + */ + + wrb = (FAR struct udp_wrbuffer_s *)sq_peek(&conn->write_q); + DEBUGASSERT(wrb != NULL); + + /* Get the amount of data that we can send in the next packet. + * We will send either the remaining data in the buffer I/O + * buffer chain, or as much as will fit given the MSS and current + * window size. + */ + + sndlen = wrb->wb_iob->io_pktlen; + ninfo("wrb=%p sndlen=%u\n", wrb, sndlen); + +#ifdef NEED_IPDOMAIN_SUPPORT + /* If both IPv4 and IPv6 support are enabled, then we will need to + * select which one to use when generating the outgoing packet. + * If only one domain is selected, then the setup is already in + * place and we need do nothing. + */ + + sendto_ipselect(dev, conn); +#endif + /* Then set-up to send that amount of data with the offset + * corresponding to the size of the IP-dependent address structure. + */ + + devif_iob_send(dev, wrb->wb_iob, sndlen, 0); + + /* Remove and free the write buffer from the head of the write + * buffer queue. + */ + + do + { + tmp = (FAR struct udp_wrbuffer_s *)sq_remfirst(&conn->write_q); + DEBUGASSERT(tmp == wrb); + + udp_wrbuffer_release(tmp); + + /* Check if the write queue became empty */ + + if (sq_empty(&conn->write_q)) + { + /* Yes.. stifle any further callbacks until more write + * data is enqueued. + */ + + psock->s_sndcb->flags = 0; + psock->s_sndcb->priv = NULL; + psock->s_sndcb->event = NULL; + ret = OK; + } + else + { + /* Set up for the next packet transfer by setting the + * connection address to the address of the next packet + * now at the header of of the write buffer queue. + */ + + ret = sendto_next_transfer(psock, conn); + } + } + while (ret < 0); + + /* Only one data can be sent by low level driver at once, + * tell the caller stop polling the other connections. + */ + + flags &= ~UDP_POLL; + } + } + +#ifdef CONFIG_NET_SOCKOPTS + /* We cannot send the data now. Check for a timeout. */ + + else if (sendto_timeout(psock, conn)) + { + FAR struct udp_wrbuffer_s *wrb; + + do + { + /* Remove and free the write buffer from the head of the write + * buffer queue. Here we know that the write queue is not empty + * because the entry at the head of the queue just timed out! + */ + + wrb = (FAR struct udp_wrbuffer_s *)sq_remfirst(&conn->write_q); + DEBUGASSERT(wrb != NULL); + + udp_wrbuffer_release(wrb); + + /* Set up for the next packet transfer by setting the connection + * address to the address of the next packet now at the header of the + * write buffer queue. + */ + + ret = sendto_next_transfer(psock, conn); + } + while (ret < 0); + } +#endif /* CONFIG_NET_SOCKOPTS */ + + /* Continue waiting */ + + return flags; +} + +/**************************************************************************** + * Name: sendto_txnotify + * + * Description: + * Notify the appropriate device driver that we are have data ready to + * be send (UDP) + * + * Parameters: + * psock - Socket state structure + * conn - The UDP connection structure + * + * Returned Value: + * None + * + ****************************************************************************/ + +static inline void sendto_txnotify(FAR struct socket *psock, + FAR struct udp_conn_s *conn) +{ +#ifdef CONFIG_NET_IPv4 +#ifdef CONFIG_NET_IPv6 + /* If both IPv4 and IPv6 support are enabled, then we will need to select + * the device driver using the appropriate IP domain. + */ + + if (psock->s_domain == PF_INET) +#endif + { + /* Notify the device driver that send data is available */ + + netdev_ipv4_txnotify(conn->u.ipv4.laddr, conn->u.ipv4.raddr); + } +#endif /* CONFIG_NET_IPv4 */ + +#ifdef CONFIG_NET_IPv6 +#ifdef CONFIG_NET_IPv4 + else /* if (psock->s_domain == PF_INET6) */ +#endif /* CONFIG_NET_IPv4 */ + { + /* Notify the device driver that send data is available */ + + DEBUGASSERT(psock->s_domain == PF_INET6); + netdev_ipv6_txnotify(conn->u.ipv6.laddr, conn->u.ipv6.raddr); + } +#endif /* CONFIG_NET_IPv6 */ +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: psock_udp_sendto + * + * Description: + * This function implements the UDP-specific logic of the standard + * sendto() socket operation. + * + * Input Parameters: + * psock A pointer to a NuttX-specific, internal socket structure + * buf Data to send + * len Length of data to send + * flags Send flags + * to Address of recipient + * tolen The length of the address structure + * + * NOTE: All input parameters were verified by sendto() before this + * function was called. + * + * Returned Value: + * On success, returns the number of characters sent. On error, + * a negated errno value is returned. See the description in + * net/socket/sendto.c for the list of appropriate return value. + * + ****************************************************************************/ + +ssize_t psock_udp_sendto(FAR struct socket *psock, FAR const void *buf, + size_t len, int flags, FAR const struct sockaddr *to, + socklen_t tolen) +{ + FAR struct udp_conn_s *conn; + FAR struct udp_wrbuffer_s *wrb; + int ret = OK; + + /* Make sure that we have the IP address mapping */ + + conn = (FAR struct udp_conn_s *)psock->s_conn; + DEBUGASSERT(conn); + +#if defined(CONFIG_NET_ARP_SEND) || defined(CONFIG_NET_ICMPv6_NEIGHBOR) +#ifdef CONFIG_NET_ARP_SEND +#ifdef CONFIG_NET_ICMPv6_NEIGHBOR + if (psock->s_domain == PF_INET) +#endif + { + /* Make sure that the IP address mapping is in the ARP table */ + + ret = arp_send(conn->u.ipv4.raddr); + } +#endif /* CONFIG_NET_ARP_SEND */ + +#ifdef CONFIG_NET_ICMPv6_NEIGHBOR +#ifdef CONFIG_NET_ARP_SEND + else +#endif + { + /* Make sure that the IP address mapping is in the Neighbor Table */ + + ret = icmpv6_neighbor(conn->u.ipv6.raddr); + } +#endif /* CONFIG_NET_ICMPv6_NEIGHBOR */ + + /* Did we successfully get the address mapping? */ + + if (ret < 0) + { + nerr("ERROR: Not reachable\n"); + return -ENETUNREACH; + } +#endif /* CONFIG_NET_ARP_SEND || CONFIG_NET_ICMPv6_NEIGHBOR */ + + /* Dump the incoming buffer */ + + BUF_DUMP("psock_udp_send", buf, len); + + /* Set the socket state to sending */ + + psock->s_flags = _SS_SETSTATE(psock->s_flags, _SF_SEND); + + if (len > 0) + { + /* Allocate a write buffer. Careful, the network will be momentarily + * unlocked here. + */ + + net_lock(); + wrb = udp_wrbuffer_alloc(); + if (wrb == NULL) + { + /* A buffer allocation error occurred */ + + nerr("ERROR: Failed to allocate write buffer\n"); + ret = -ENOMEM; + goto errout_with_lock; + } + + /* Initialize the write buffer */ + + memcpy(&wrb->wb_dest, to, tolen); + wrb->wb_start = clock_systimer(); + + /* Copy the user data into the write buffer. We cannot wait for + * buffer space if the socket was opened non-blocking. + */ + + if (_SS_ISNONBLOCK(psock->s_flags)) + { + ret = iob_trycopyin(wrb->wb_iob, (FAR uint8_t *)buf, len, 0, false); + } + else + { + ret = iob_copyin(wrb->wb_iob, (FAR uint8_t *)buf, len, 0, false); + } + + if (ret < 0) + { + goto errout_with_wrb; + } + + /* Dump I/O buffer chain */ + + UDPWB_DUMP("I/O buffer chain", wrb, wrb->wb_iob->io_pktlen, 0); + + /* sendto_eventhandler() will send data in FIFO order from the + * conn->write_q + */ + + sq_addlast(&wrb->wb_node, &conn->write_q); + ninfo("Queued WRB=%p pktlen=%u write_q(%p,%p)\n", + wrb, wrb->wb_iob->io_pktlen, + conn->write_q.head, conn->write_q.tail); + + /* Set up for the next packet transfer by setting the connection + * address to the address of the next packet now at the header of the + * write buffer queue. + */ + + ret = sendto_next_transfer(psock, conn); + if (ret < 0) + { + /* REVISIT: An error here is not recoverable */ + + goto errout_with_lock; + } + + /* Notify the device driver of the availability of TX data */ + + sendto_txnotify(psock, conn); + net_unlock(); + } + + /* Set the socket state to idle */ + + psock->s_flags = _SS_SETSTATE(psock->s_flags, _SF_IDLE); + + /* Return the number of bytes that will be sent */ + + return len; + +errout_with_wrb: + udp_wrbuffer_release(wrb); + +errout_with_lock: + net_unlock(); + return ret; +} + +#endif /* CONFIG_NET && CONFIG_NET_UDP && CONFIG_NET_UDP_WRITE_BUFFERS */ diff --git a/net/udp/udp_psock_sendto.c b/net/udp/udp_psock_sendto_unbuffered.c similarity index 98% rename from net/udp/udp_psock_sendto.c rename to net/udp/udp_psock_sendto_unbuffered.c index ff362a310e..809ee2ce9e 100644 --- a/net/udp/udp_psock_sendto.c +++ b/net/udp/udp_psock_sendto_unbuffered.c @@ -1,7 +1,8 @@ /**************************************************************************** - * net/udp/udp_psock_sendto.c + * net/udp/udp_psock_sendto_unbuffered.c * - * Copyright (C) 2007-2009, 2011-2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011-2016, 2018 Gregory Nutt. All rights + * reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -94,7 +95,7 @@ struct sendto_s ****************************************************************************/ /**************************************************************************** - * Name: send_timeout + * Name: sendto_timeout * * Description: * Check for send timeout. @@ -111,7 +112,7 @@ struct sendto_s ****************************************************************************/ #ifdef CONFIG_NET_SOCKOPTS -static inline int send_timeout(FAR struct sendto_s *pstate) +static inline int sendto_timeout(FAR struct sendto_s *pstate) { FAR struct socket *psock; @@ -235,7 +236,7 @@ static uint16_t sendto_eventhandler(FAR struct net_driver_s *dev, */ #ifdef CONFIG_NET_SOCKOPTS - if (send_timeout(pstate)) + if (sendto_timeout(pstate)) { /* Yes.. report the timeout */ diff --git a/net/udp/udp_wrbuffer.c b/net/udp/udp_wrbuffer.c new file mode 100644 index 0000000000..ae8fafd7ff --- /dev/null +++ b/net/udp/udp_wrbuffer.c @@ -0,0 +1,217 @@ +/**************************************************************************** + * net/udp/udp_wrbuffer.c + * + * Copyright (C) 2018 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#if defined(CONFIG_NET) && defined(CONFIG_NET_UDP) && defined(CONFIG_NET_UDP_WRITE_BUFFERS) + +#if defined(CONFIG_DEBUG_FEATURES) && defined(CONFIG_NET_UDP_WRBUFFER_DEBUG) +/* Force debug output (from this file only) */ + +# undef CONFIG_DEBUG_NET +# define CONFIG_DEBUG_NET 1 +#endif + +#include +#include +#include +#include + +#include +#include +#include + +#include "udp/udp.h" + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/* Package all globals used by this logic into a structure */ + +struct wrbuffer_s +{ + /* The semaphore to protect the buffers */ + + sem_t sem; + + /* This is the list of available write buffers */ + + sq_queue_t freebuffers; + + /* These are the pre-allocated write buffers */ + + struct udp_wrbuffer_s buffers[CONFIG_NET_UDP_NWRBCHAINS]; +}; + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/* This is the state of the global write buffer resource */ + +static struct wrbuffer_s g_wrbuffer; + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: udp_wrbuffer_initialize + * + * Description: + * Initialize the list of free write buffers + * + * Assumptions: + * Called once early initialization. + * + ****************************************************************************/ + +void udp_wrbuffer_initialize(void) +{ + int i; + + sq_init(&g_wrbuffer.freebuffers); + + for (i = 0; i < CONFIG_NET_UDP_NWRBCHAINS; i++) + { + sq_addfirst(&g_wrbuffer.buffers[i].wb_node, &g_wrbuffer.freebuffers); + } + + nxsem_init(&g_wrbuffer.sem, 0, CONFIG_NET_UDP_NWRBCHAINS); +} + +/**************************************************************************** + * Name: udp_wrbuffer_alloc + * + * Description: + * Allocate a UDP write buffer by taking a pre-allocated buffer from + * the free list. This function is called from UDP logic when a buffer + * of UDP data is about to sent + * + * Input parameters: + * None + * + * Assumptions: + * Called from user logic with the network locked. + * + ****************************************************************************/ + +FAR struct udp_wrbuffer_s *udp_wrbuffer_alloc(void) +{ + FAR struct udp_wrbuffer_s *wrb; + + /* We need to allocate two things: (1) A write buffer structure and (2) + * at least one I/O buffer to start the chain. + * + * Allocate the write buffer structure first then the IOBG. In order to + * avoid deadlocks, we will need to free the IOB first, then the write + * buffer + */ + + DEBUGVERIFY(net_lockedwait(&g_wrbuffer.sem)); /* TODO: Handle EINTR. */ + + /* Now, we are guaranteed to have a write buffer structure reserved + * for us in the free list. + */ + + wrb = (FAR struct udp_wrbuffer_s *)sq_remfirst(&g_wrbuffer.freebuffers); + DEBUGASSERT(wrb); + memset(wrb, 0, sizeof(struct udp_wrbuffer_s)); + + /* Now get the first I/O buffer for the write buffer structure */ + + wrb->wb_iob = iob_alloc(false); + if (!wrb->wb_iob) + { + nerr("ERROR: Failed to allocate I/O buffer\n"); + udp_wrbuffer_release(wrb); + return NULL; + } + + return wrb; +} + +/**************************************************************************** + * Name: udp_wrbuffer_release + * + * Description: + * Release a UDP write buffer by returning the buffer to the free list. + * This function is called from user logic after it is consumed the + * buffered data. + * + * Assumptions: + * This function must be called with the network locked. + * + ****************************************************************************/ + +void udp_wrbuffer_release(FAR struct udp_wrbuffer_s *wrb) +{ + DEBUGASSERT(wrb && wrb->wb_iob); + + /* To avoid deadlocks, we must following this ordering: Release the I/O + * buffer chain first, then the write buffer structure. + */ + + iob_free_chain(wrb->wb_iob); + + /* Then free the write buffer structure */ + + sq_addlast(&wrb->wb_node, &g_wrbuffer.freebuffers); + nxsem_post(&g_wrbuffer.sem); +} + +/**************************************************************************** + * Name: udp_wrbuffer_test + * + * Description: + * Check if there is room in the write buffer. Does not reserve any space. + * + * Assumptions: + * None. + * + ****************************************************************************/ + +int udp_wrbuffer_test(void) +{ + int val = 0; + nxsem_getvalue(&g_wrbuffer.sem, &val); + return val > 0 ? OK : ERROR; +} + +#endif /* CONFIG_NET && CONFIG_NET_UDP && CONFIG_NET_UDP_WRITE_BUFFERS */ diff --git a/net/udp/udp_wrbuffer_dump.c b/net/udp/udp_wrbuffer_dump.c new file mode 100644 index 0000000000..e3e8df1f59 --- /dev/null +++ b/net/udp/udp_wrbuffer_dump.c @@ -0,0 +1,70 @@ +/**************************************************************************** + * net/udp/udp_wrbuffer_dump.c + * + * Copyright (C) 2018 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +#include + +#include "udp/udp.h" + +#ifdef CONFIG_DEBUG_FEATURES + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: udp_wrbuffer_dump + * + * Description: + * Dump the contents of a write buffer + * + ****************************************************************************/ + +void udp_wrbuffer_dump(FAR const char *msg, FAR struct udp_wrbuffer_s *wrb, + unsigned int len, unsigned int offset) +{ + syslog(LOG_DEBUG, "%s: wrb=%p pktlen=%d\n", msg, wrb, wrb->wb_iob->io_pktlen); + iob_dump("I/O Buffer Chain", wrb->wb_iob, len, offset); +} + +#endif /* CONFIG_DEBUG_FEATURES */ -- GitLab From 2f548a880c329dfef0588f7a13c87ad0d46ea32f Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 22 Jan 2018 18:46:58 -0600 Subject: [PATCH 097/228] net/udp: In sendto(), return EHOSTUNREACH if if the network is down. --- net/udp/udp_psock_sendto_buffered.c | 8 ++++++++ net/udp/udp_psock_sendto_unbuffered.c | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/net/udp/udp_psock_sendto_buffered.c b/net/udp/udp_psock_sendto_buffered.c index 3f5e5305b4..b9a8a89189 100644 --- a/net/udp/udp_psock_sendto_buffered.c +++ b/net/udp/udp_psock_sendto_buffered.c @@ -384,6 +384,14 @@ static int sendto_next_transfer(FAR struct socket *psock, return -ENETUNREACH; } + /* Make sure that the device is in the UP state */ + + if ((dev->d_flags & IFF_UP) == 0) + { + nwarn("WARNING: device is DOWN\n"); + return -EHOSTUNREACH; + } + /* If this is not the same device that we used in the last call to * udp_callback_alloc(), then we need to release and reallocate the old * callback instance. diff --git a/net/udp/udp_psock_sendto_unbuffered.c b/net/udp/udp_psock_sendto_unbuffered.c index 809ee2ce9e..7024d12baf 100644 --- a/net/udp/udp_psock_sendto_unbuffered.c +++ b/net/udp/udp_psock_sendto_unbuffered.c @@ -424,6 +424,15 @@ ssize_t psock_udp_sendto(FAR struct socket *psock, FAR const void *buf, goto errout_with_lock; } + /* Make sure that the device is in the UP state */ + + if ((dev->d_flags & IFF_UP) == 0) + { + nwarn("WARNING: device is DOWN\n"); + ret = -EHOSTUNREACH; + goto errout_with_lock; + } + /* Set up the callback in the connection */ state.st_cb = udp_callback_alloc(dev, conn); -- GitLab From 7dc436a1349ab53a2160d6065eb8b7c2e6ec8fe2 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 22 Jan 2018 19:27:05 -0600 Subject: [PATCH 098/228] net/udp: Resolves final design issues with UDP write buffering. 100% code complete but also 100% untested. --- net/udp/udp_psock_sendto_buffered.c | 144 +++++++++++----------------- 1 file changed, 55 insertions(+), 89 deletions(-) diff --git a/net/udp/udp_psock_sendto_buffered.c b/net/udp/udp_psock_sendto_buffered.c index b9a8a89189..b084837b6e 100644 --- a/net/udp/udp_psock_sendto_buffered.c +++ b/net/udp/udp_psock_sendto_buffered.c @@ -105,9 +105,6 @@ * Private Function Prototypes ****************************************************************************/ -static inline void sendto_netdev_down(FAR struct socket *psock, - FAR struct udp_conn_s *conn); - #ifdef NEED_IPDOMAIN_SUPPORT static inline void sendto_ipselect(FAR struct net_driver_s *dev, FAR struct udp_conn_s *conn); @@ -135,47 +132,64 @@ static inline void sendto_txnotify(FAR struct socket *psock, ****************************************************************************/ /**************************************************************************** - * Name: sendto_netdev_down + * Name: sendto_writebuffer_release * * Description: - * The network device is down. Free all write buffers. - * REVISIT: Should only free write buffers associated with the device - * that went down. + * Release the write buffer at the head of the write buffer queue. * * Parameters: - * psock The socket structure - * conn The connection structure associated with the socket + * dev - The structure of the network driver that caused the event + * psock - Socket state structure * * Returned Value: * None * + * Assumptions: + * The network is locked + * ****************************************************************************/ -static inline void sendto_netdev_down(FAR struct socket *psock, - FAR struct udp_conn_s *conn) +static void sendto_writebuffer_release(FAR struct socket *psock, + FAR struct udp_conn_s *conn) { - FAR sq_entry_t *entry; - FAR sq_entry_t *next; - - /* Do not allow any further callbacks */ + FAR struct udp_wrbuffer_s *wrb; + int ret = OK; - if (psock->s_sndcb != NULL) + do { - psock->s_sndcb->flags = 0; - psock->s_sndcb->event = NULL; - } + /* Check if the write queue became empty */ - /* Free all queued write buffers */ + if (sq_empty(&conn->write_q)) + { + /* Yes.. stifle any further callbacks until more write data is + * enqueued. + */ - for (entry = sq_peek(&conn->write_q); entry; entry = next) - { - next = sq_next(entry); - udp_wrbuffer_release((FAR struct udp_wrbuffer_s *)entry); - } + psock->s_sndcb->flags = 0; + psock->s_sndcb->priv = NULL; + psock->s_sndcb->event = NULL; + wrb = NULL; + } + else + { + /* Remove the write buffer from the head of the write buffer queue + * and release it. + */ + + wrb = (FAR struct udp_wrbuffer_s *)sq_remfirst(&conn->write_q); + DEBUGASSERT(wrb != NULL); - /* Reset write buffering variables */ + udp_wrbuffer_release(wrb); + + /* Set up for the next packet transfer by setting the connection + * address to the address of the next packet now at the header of + * the write buffer queue. + */ - sq_init(&conn->write_q); + ret = sendto_next_transfer(psock, conn); + } + } + while (wrb != NULL && ret < 0); } /**************************************************************************** @@ -254,7 +268,7 @@ static inline void sendto_ipselect(FAR struct net_driver_s *dev, #ifdef CONFIG_NET_ETHERNET static inline bool sendto_addrcheck(FAR struct udp_conn_s *conn, - FAR struct net_driver_s *dev) + FAR struct net_driver_s *dev) { /* REVISIT: Could the MAC address not also be in a routing table? */ @@ -458,7 +472,6 @@ static uint16_t sendto_eventhandler(FAR struct net_driver_s *dev, { FAR struct udp_conn_s *conn = (FAR struct udp_conn_s *)pvconn; FAR struct socket *psock = (FAR struct socket *)pvpriv; - int ret; ninfo("flags: %04x\n", flags); @@ -468,9 +481,11 @@ static uint16_t sendto_eventhandler(FAR struct net_driver_s *dev, { ninfo("Device down: %04x\n", flags); - /* Free write buffers and terminate polling */ + /* Free the write buffer at the head of the queue and attempt to setup + * the next transfer. + */ - sendto_netdev_down(psock, conn); + sendto_writebuffer_release(psock, conn); return flags; } @@ -495,7 +510,6 @@ static uint16_t sendto_eventhandler(FAR struct net_driver_s *dev, if (sendto_addrcheck(conn, dev)) { FAR struct udp_wrbuffer_s *wrb; - FAR struct udp_wrbuffer_s *tmp; size_t sndlen; /* Peek at the head of the write queue (but don't remove anything @@ -530,41 +544,11 @@ static uint16_t sendto_eventhandler(FAR struct net_driver_s *dev, devif_iob_send(dev, wrb->wb_iob, sndlen, 0); - /* Remove and free the write buffer from the head of the write - * buffer queue. + /* Free the write buffer at the head of the queue and attempt to + * setup the next transfer. */ - do - { - tmp = (FAR struct udp_wrbuffer_s *)sq_remfirst(&conn->write_q); - DEBUGASSERT(tmp == wrb); - - udp_wrbuffer_release(tmp); - - /* Check if the write queue became empty */ - - if (sq_empty(&conn->write_q)) - { - /* Yes.. stifle any further callbacks until more write - * data is enqueued. - */ - - psock->s_sndcb->flags = 0; - psock->s_sndcb->priv = NULL; - psock->s_sndcb->event = NULL; - ret = OK; - } - else - { - /* Set up for the next packet transfer by setting the - * connection address to the address of the next packet - * now at the header of of the write buffer queue. - */ - - ret = sendto_next_transfer(psock, conn); - } - } - while (ret < 0); + sendto_writebuffer_release(psock, conn); /* Only one data can be sent by low level driver at once, * tell the caller stop polling the other connections. @@ -579,28 +563,11 @@ static uint16_t sendto_eventhandler(FAR struct net_driver_s *dev, else if (sendto_timeout(psock, conn)) { - FAR struct udp_wrbuffer_s *wrb; - - do - { - /* Remove and free the write buffer from the head of the write - * buffer queue. Here we know that the write queue is not empty - * because the entry at the head of the queue just timed out! - */ - - wrb = (FAR struct udp_wrbuffer_s *)sq_remfirst(&conn->write_q); - DEBUGASSERT(wrb != NULL); - - udp_wrbuffer_release(wrb); - - /* Set up for the next packet transfer by setting the connection - * address to the address of the next packet now at the header of the - * write buffer queue. - */ + /* Free the write buffer at the head of the queue and attempt to setup + * the next transfer. + */ - ret = sendto_next_transfer(psock, conn); - } - while (ret < 0); + sendto_writebuffer_release(psock, conn); } #endif /* CONFIG_NET_SOCKOPTS */ @@ -799,9 +766,8 @@ ssize_t psock_udp_sendto(FAR struct socket *psock, FAR const void *buf, ret = sendto_next_transfer(psock, conn); if (ret < 0) { - /* REVISIT: An error here is not recoverable */ - - goto errout_with_lock; + (void)sq_remlast(&conn->write_q); + goto errout_with_wrb; } /* Notify the device driver of the availability of TX data */ -- GitLab From f04dec14cc07539eccc3046ef826b9e1aaac9417 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 22 Jan 2018 19:33:14 -0600 Subject: [PATCH 099/228] net/udp and tcp: Yet another (cosmetic) change to UDP and TCP write buffer macro naming. --- net/tcp/tcp.h | 22 +++--- net/tcp/tcp_send_buffered.c | 104 ++++++++++++++-------------- net/tcp/tcp_wrbuffer_dump.c | 4 +- net/udp/udp.h | 4 +- net/udp/udp_psock_sendto_buffered.c | 6 +- 5 files changed, 70 insertions(+), 70 deletions(-) diff --git a/net/tcp/tcp.h b/net/tcp/tcp.h index bf8948da73..bfd402c00a 100644 --- a/net/tcp/tcp.h +++ b/net/tcp/tcp.h @@ -77,25 +77,25 @@ #ifdef CONFIG_NET_TCP_WRITE_BUFFERS /* TCP write buffer access macros */ -# define TCPWB_SEQNO(wrb) ((wrb)->wb_seqno) -# define TCPWB_PKTLEN(wrb) ((wrb)->wb_iob->io_pktlen) -# define TCPWB_SENT(wrb) ((wrb)->wb_sent) -# define TCPWB_NRTX(wrb) ((wrb)->wb_nrtx) -# define TCPWB_IOB(wrb) ((wrb)->wb_iob) -# define TCPWB_COPYOUT(wrb,dest,n) (iob_copyout(dest,(wrb)->wb_iob,(n),0)) -# define TCPWB_COPYIN(wrb,src,n) \ +# define TCP_WBSEQNO(wrb) ((wrb)->wb_seqno) +# define TCP_WBPKTLEN(wrb) ((wrb)->wb_iob->io_pktlen) +# define TCP_WBSENT(wrb) ((wrb)->wb_sent) +# define TCP_WBNRTX(wrb) ((wrb)->wb_nrtx) +# define TCP_WBIOB(wrb) ((wrb)->wb_iob) +# define TCP_WBCOPYOUT(wrb,dest,n) (iob_copyout(dest,(wrb)->wb_iob,(n),0)) +# define TCP_WBCOPYIN(wrb,src,n) \ (iob_copyin((wrb)->wb_iob,src,(n),0,false)) -# define TCPWB_TRYCOPYIN(wrb,src,n) \ +# define TCP_WBTRYCOPYIN(wrb,src,n) \ (iob_trycopyin((wrb)->wb_iob,src,(n),0,false)) -# define TCPWB_TRIM(wrb,n) \ +# define TCP_WBTRIM(wrb,n) \ do { (wrb)->wb_iob = iob_trimhead((wrb)->wb_iob,(n)); } while (0) #ifdef CONFIG_DEBUG_FEATURES -# define TCPWB_DUMP(msg,wrb,len,offset) \ +# define TCP_WBDUMP(msg,wrb,len,offset) \ tcp_wrbuffer_dump(msg,wrb,len,offset) # else -# define TCPWB_DUMP(msg,wrb,len,offset) +# define TCP_WBDUMP(msg,wrb,len,offset) # endif #endif diff --git a/net/tcp/tcp_send_buffered.c b/net/tcp/tcp_send_buffered.c index 5abb417e70..b8463b0643 100644 --- a/net/tcp/tcp_send_buffered.c +++ b/net/tcp/tcp_send_buffered.c @@ -98,8 +98,8 @@ # define BUF_DUMP(msg,buf,len) lib_dumpbuffer(msg,buf,len) #else # define BUF_DUMP(msg,buf,len) -# undef TCPWB_DUMP -# define TCPWB_DUMP(msg,wrb,len,offset) +# undef TCP_WBDUMP +# define TCP_WBDUMP(msg,wrb,len,offset) #endif /**************************************************************************** @@ -135,7 +135,7 @@ static void psock_insert_segment(FAR struct tcp_wrbuffer_s *wrb, for (itr = sq_peek(q); itr; itr = sq_next(itr)) { FAR struct tcp_wrbuffer_s *wrb0 = (FAR struct tcp_wrbuffer_s *)itr; - if (TCPWB_SEQNO(wrb0) < TCPWB_SEQNO(wrb)) + if (TCP_WBSEQNO(wrb0) < TCP_WBSEQNO(wrb)) { insert = itr; } @@ -417,13 +417,13 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, * the write buffer has been ACKed. */ - if (ackno > TCPWB_SEQNO(wrb)) + if (ackno > TCP_WBSEQNO(wrb)) { /* Get the sequence number at the end of the data */ - lastseq = TCPWB_SEQNO(wrb) + TCPWB_PKTLEN(wrb); + lastseq = TCP_WBSEQNO(wrb) + TCP_WBPKTLEN(wrb); ninfo("ACK: wrb=%p seqno=%u lastseq=%u pktlen=%u ackno=%u\n", - wrb, TCPWB_SEQNO(wrb), lastseq, TCPWB_PKTLEN(wrb), + wrb, TCP_WBSEQNO(wrb), lastseq, TCP_WBPKTLEN(wrb), ackno); /* Has the entire buffer been ACKed? */ @@ -450,24 +450,24 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, * buffers in the chain. */ - trimlen = ackno - TCPWB_SEQNO(wrb); - if (trimlen > TCPWB_SENT(wrb)) + trimlen = ackno - TCP_WBSEQNO(wrb); + if (trimlen > TCP_WBSENT(wrb)) { /* More data has been ACKed then we have sent? */ - trimlen = TCPWB_SENT(wrb); + trimlen = TCP_WBSENT(wrb); } ninfo("ACK: wrb=%p trim %u bytes\n", wrb, trimlen); - TCPWB_TRIM(wrb, trimlen); - TCPWB_SEQNO(wrb) = ackno; - TCPWB_SENT(wrb) -= trimlen; + TCP_WBTRIM(wrb, trimlen); + TCP_WBSEQNO(wrb) = ackno; + TCP_WBSENT(wrb) -= trimlen; /* Set the new sequence number for what remains */ ninfo("ACK: wrb=%p seqno=%u pktlen=%u\n", - wrb, TCPWB_SEQNO(wrb), TCPWB_PKTLEN(wrb)); + wrb, TCP_WBSEQNO(wrb), TCP_WBPKTLEN(wrb)); } } } @@ -478,31 +478,31 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, */ wrb = (FAR struct tcp_wrbuffer_s *)sq_peek(&conn->write_q); - if (wrb && TCPWB_SENT(wrb) > 0 && ackno > TCPWB_SEQNO(wrb)) + if (wrb && TCP_WBSENT(wrb) > 0 && ackno > TCP_WBSEQNO(wrb)) { uint32_t nacked; /* Number of bytes that were ACKed */ - nacked = ackno - TCPWB_SEQNO(wrb); - if (nacked > TCPWB_SENT(wrb)) + nacked = ackno - TCP_WBSEQNO(wrb); + if (nacked > TCP_WBSENT(wrb)) { /* More data has been ACKed then we have sent? ASSERT? */ - nacked = TCPWB_SENT(wrb); + nacked = TCP_WBSENT(wrb); } ninfo("ACK: wrb=%p seqno=%u nacked=%u sent=%u ackno=%u\n", - wrb, TCPWB_SEQNO(wrb), nacked, TCPWB_SENT(wrb), ackno); + wrb, TCP_WBSEQNO(wrb), nacked, TCP_WBSENT(wrb), ackno); /* Trim the ACKed bytes from the beginning of the write buffer. */ - TCPWB_TRIM(wrb, nacked); - TCPWB_SEQNO(wrb) = ackno; - TCPWB_SENT(wrb) -= nacked; + TCP_WBTRIM(wrb, nacked); + TCP_WBSEQNO(wrb) = ackno; + TCP_WBSENT(wrb) -= nacked; ninfo("ACK: wrb=%p seqno=%u pktlen=%u sent=%u\n", - wrb, TCPWB_SEQNO(wrb), TCPWB_PKTLEN(wrb), TCPWB_SENT(wrb)); + wrb, TCP_WBSEQNO(wrb), TCP_WBPKTLEN(wrb), TCP_WBSENT(wrb)); } } @@ -544,16 +544,16 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, */ wrb = (FAR struct tcp_wrbuffer_s *)sq_peek(&conn->write_q); - ninfo("REXMIT: wrb=%p sent=%u\n", wrb, wrb ? TCPWB_SENT(wrb) : 0); + ninfo("REXMIT: wrb=%p sent=%u\n", wrb, wrb ? TCP_WBSENT(wrb) : 0); - if (wrb != NULL && TCPWB_SENT(wrb) > 0) + if (wrb != NULL && TCP_WBSENT(wrb) > 0) { FAR struct tcp_wrbuffer_s *tmp; uint16_t sent; /* Yes.. Reset the number of bytes sent sent from the write buffer */ - sent = TCPWB_SENT(wrb); + sent = TCP_WBSENT(wrb); if (conn->unacked > sent) { conn->unacked -= sent; @@ -572,16 +572,16 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, conn->sent = 0; } - TCPWB_SENT(wrb) = 0; + TCP_WBSENT(wrb) = 0; ninfo("REXMIT: wrb=%p sent=%u, conn unacked=%d sent=%d\n", - wrb, TCPWB_SENT(wrb), conn->unacked, conn->sent); + wrb, TCP_WBSENT(wrb), conn->unacked, conn->sent); /* Increment the retransmit count on this write buffer. */ - if (++TCPWB_NRTX(wrb) >= TCP_MAXRTX) + if (++TCP_WBNRTX(wrb) >= TCP_MAXRTX) { nwarn("WARNING: Expiring wrb=%p nrtx=%u\n", - wrb, TCPWB_NRTX(wrb)); + wrb, TCP_WBNRTX(wrb)); /* The maximum retry count as been exhausted. Remove the write * buffer at the head of the queue. @@ -619,7 +619,7 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, /* Reset the number of bytes sent sent from the write buffer */ - sent = TCPWB_SENT(wrb); + sent = TCP_WBSENT(wrb); if (conn->unacked > sent) { conn->unacked -= sent; @@ -638,16 +638,16 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, conn->sent = 0; } - TCPWB_SENT(wrb) = 0; + TCP_WBSENT(wrb) = 0; ninfo("REXMIT: wrb=%p sent=%u, conn unacked=%d sent=%d\n", - wrb, TCPWB_SENT(wrb), conn->unacked, conn->sent); + wrb, TCP_WBSENT(wrb), conn->unacked, conn->sent); /* Free any write buffers that have exceed the retry count */ - if (++TCPWB_NRTX(wrb) >= TCP_MAXRTX) + if (++TCP_WBNRTX(wrb) >= TCP_MAXRTX) { nwarn("WARNING: Expiring wrb=%p nrtx=%u\n", - wrb, TCPWB_NRTX(wrb)); + wrb, TCP_WBNRTX(wrb)); /* Return the write buffer to the free list */ @@ -672,7 +672,7 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, * is pulled from the write_q again. */ - ninfo("REXMIT: Moving wrb=%p nrtx=%u\n", wrb, TCPWB_NRTX(wrb)); + ninfo("REXMIT: Moving wrb=%p nrtx=%u\n", wrb, TCP_WBNRTX(wrb)); psock_insert_segment(wrb, &conn->write_q); } @@ -727,7 +727,7 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, * window size. */ - sndlen = TCPWB_PKTLEN(wrb) - TCPWB_SENT(wrb); + sndlen = TCP_WBPKTLEN(wrb) - TCP_WBSENT(wrb); if (sndlen > conn->mss) { sndlen = conn->mss; @@ -739,16 +739,16 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, } ninfo("SEND: wrb=%p pktlen=%u sent=%u sndlen=%u\n", - wrb, TCPWB_PKTLEN(wrb), TCPWB_SENT(wrb), sndlen); + wrb, TCP_WBPKTLEN(wrb), TCP_WBSENT(wrb), sndlen); /* Set the sequence number for this segment. If we are * retransmitting, then the sequence number will already * be set for this write buffer. */ - if (TCPWB_SEQNO(wrb) == (unsigned)-1) + if (TCP_WBSEQNO(wrb) == (unsigned)-1) { - TCPWB_SEQNO(wrb) = conn->isn + conn->sent; + TCP_WBSEQNO(wrb) = conn->isn + conn->sent; } /* The TCP stack updates sndseq on receipt of ACK *before* @@ -758,7 +758,7 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, * before the packet is sent. */ - tcp_setsequence(conn->sndseq, TCPWB_SEQNO(wrb) + TCPWB_SENT(wrb)); + tcp_setsequence(conn->sndseq, TCP_WBSEQNO(wrb) + TCP_WBSENT(wrb)); #ifdef NEED_IPDOMAIN_SUPPORT /* If both IPv4 and IPv6 support are enabled, then we will need to @@ -774,7 +774,7 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, * won't actually happen until the polling cycle completes). */ - devif_iob_send(dev, TCPWB_IOB(wrb), sndlen, TCPWB_SENT(wrb)); + devif_iob_send(dev, TCP_WBIOB(wrb), sndlen, TCP_WBSENT(wrb)); /* Remember how much data we send out now so that we know * when everything has been acknowledged. Just increment @@ -796,21 +796,21 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, } ninfo("SEND: wrb=%p nrtx=%u unacked=%u sent=%u\n", - wrb, TCPWB_NRTX(wrb), conn->unacked, conn->sent); + wrb, TCP_WBNRTX(wrb), conn->unacked, conn->sent); /* Increment the count of bytes sent from this write buffer */ - TCPWB_SENT(wrb) += sndlen; + TCP_WBSENT(wrb) += sndlen; ninfo("SEND: wrb=%p sent=%u pktlen=%u\n", - wrb, TCPWB_SENT(wrb), TCPWB_PKTLEN(wrb)); + wrb, TCP_WBSENT(wrb), TCP_WBPKTLEN(wrb)); /* Remove the write buffer from the write queue if the * last of the data has been sent from the buffer. */ - DEBUGASSERT(TCPWB_SENT(wrb) <= TCPWB_PKTLEN(wrb)); - if (TCPWB_SENT(wrb) >= TCPWB_PKTLEN(wrb)) + DEBUGASSERT(TCP_WBSENT(wrb) <= TCP_WBPKTLEN(wrb)); + if (TCP_WBSENT(wrb) >= TCP_WBPKTLEN(wrb)) { FAR struct tcp_wrbuffer_s *tmp; @@ -1061,8 +1061,8 @@ ssize_t psock_tcp_send(FAR struct socket *psock, FAR const void *buf, /* Initialize the write buffer */ - TCPWB_SEQNO(wrb) = (unsigned)-1; - TCPWB_NRTX(wrb) = 0; + TCP_WBSEQNO(wrb) = (unsigned)-1; + TCP_WBNRTX(wrb) = 0; /* Copy the user data into the write buffer. We cannot wait for * buffer space if the socket was opened non-blocking. @@ -1070,16 +1070,16 @@ ssize_t psock_tcp_send(FAR struct socket *psock, FAR const void *buf, if (_SS_ISNONBLOCK(psock->s_flags)) { - result = TCPWB_TRYCOPYIN(wrb, (FAR uint8_t *)buf, len); + result = TCP_WBTRYCOPYIN(wrb, (FAR uint8_t *)buf, len); } else { - result = TCPWB_COPYIN(wrb, (FAR uint8_t *)buf, len); + result = TCP_WBCOPYIN(wrb, (FAR uint8_t *)buf, len); } /* Dump I/O buffer chain */ - TCPWB_DUMP("I/O buffer chain", wrb, TCPWB_PKTLEN(wrb), 0); + TCP_WBDUMP("I/O buffer chain", wrb, TCP_WBPKTLEN(wrb), 0); /* psock_send_eventhandler() will send data in FIFO order from the * conn->write_q @@ -1087,7 +1087,7 @@ ssize_t psock_tcp_send(FAR struct socket *psock, FAR const void *buf, sq_addlast(&wrb->wb_node, &conn->write_q); ninfo("Queued WRB=%p pktlen=%u write_q(%p,%p)\n", - wrb, TCPWB_PKTLEN(wrb), + wrb, TCP_WBPKTLEN(wrb), conn->write_q.head, conn->write_q.tail); /* Notify the device driver of the availability of TX data */ diff --git a/net/tcp/tcp_wrbuffer_dump.c b/net/tcp/tcp_wrbuffer_dump.c index a27bb60253..1af7657395 100644 --- a/net/tcp/tcp_wrbuffer_dump.c +++ b/net/tcp/tcp_wrbuffer_dump.c @@ -64,8 +64,8 @@ void tcp_wrbuffer_dump(FAR const char *msg, FAR struct tcp_wrbuffer_s *wrb, unsigned int len, unsigned int offset) { syslog(LOG_DEBUG, "%s: wrb=%p segno=%d sent=%d nrtx=%d\n", - msg, wrb, TCPWB_SEQNO(wrb), TCPWB_SENT(wrb), TCPWB_NRTX(wrb)); - iob_dump("I/O Buffer Chain", TCPWB_IOB(wrb), len, offset); + msg, wrb, TCP_WBSEQNO(wrb), TCP_WBSENT(wrb), TCP_WBNRTX(wrb)); + iob_dump("I/O Buffer Chain", TCP_WBIOB(wrb), len, offset); } #endif /* CONFIG_DEBUG_FEATURES */ diff --git a/net/udp/udp.h b/net/udp/udp.h index ee591ed078..f670f7bbfb 100644 --- a/net/udp/udp.h +++ b/net/udp/udp.h @@ -71,10 +71,10 @@ /* UDP write buffer dump macros */ # ifdef CONFIG_DEBUG_FEATURES -# define UDPWB_DUMP(msg,wrb,len,offset) \ +# define UDP_WBDUMP(msg,wrb,len,offset) \ udp_wrbuffer_dump(msg,wrb,len,offset) # else -# define UDPWB_DUMP(msg,wrb,len,offset) +# define UDP_WBDUMP(msg,wrb,len,offset) # endif #endif diff --git a/net/udp/udp_psock_sendto_buffered.c b/net/udp/udp_psock_sendto_buffered.c index b084837b6e..29308e1274 100644 --- a/net/udp/udp_psock_sendto_buffered.c +++ b/net/udp/udp_psock_sendto_buffered.c @@ -97,8 +97,8 @@ # define BUF_DUMP(msg,buf,len) lib_dumpbuffer(msg,buf,len) #else # define BUF_DUMP(msg,buf,len) -# undef UDPWB_DUMP -# define UDPWB_DUMP(msg,wrb,len,offset) +# undef UDP_WBDUMP +# define UDP_WBDUMP(msg,wrb,len,offset) #endif /**************************************************************************** @@ -747,7 +747,7 @@ ssize_t psock_udp_sendto(FAR struct socket *psock, FAR const void *buf, /* Dump I/O buffer chain */ - UDPWB_DUMP("I/O buffer chain", wrb, wrb->wb_iob->io_pktlen, 0); + UDP_WBDUMP("I/O buffer chain", wrb, wrb->wb_iob->io_pktlen, 0); /* sendto_eventhandler() will send data in FIFO order from the * conn->write_q -- GitLab From 7f245e272045b5d7238a75491f4c25c01bf66a18 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 23 Jan 2018 07:32:17 -0600 Subject: [PATCH 100/228] net/udp: UDP write buffering is basically functional but needs a lot more verification. --- net/udp/Kconfig | 1 - net/udp/udp.h | 9 ++-- net/udp/udp_psock_sendto_buffered.c | 75 ++++++++--------------------- 3 files changed, 24 insertions(+), 61 deletions(-) diff --git a/net/udp/Kconfig b/net/udp/Kconfig index 16d40a72ef..7deccfc4ca 100644 --- a/net/udp/Kconfig +++ b/net/udp/Kconfig @@ -52,7 +52,6 @@ config NET_UDP_WRITE_BUFFERS default n select NET_WRITE_BUFFERS select MM_IOB - depends on EXPERIMENTAL ---help--- Write buffers allows buffering of ongoing UDP/IP packets, providing for higher performance, streamed output. diff --git a/net/udp/udp.h b/net/udp/udp.h index f670f7bbfb..24be51dc21 100644 --- a/net/udp/udp.h +++ b/net/udp/udp.h @@ -43,6 +43,7 @@ #include #include +#include #include #include @@ -137,12 +138,12 @@ struct udp_conn_s #ifdef CONFIG_NET_UDP_WRITE_BUFFERS struct udp_wrbuffer_s { - sq_entry_t wb_node; /* Supports a singly linked list */ - union ip_addr_u wb_dest; /* Destination address */ + sq_entry_t wb_node; /* Supports a singly linked list */ + struct sockaddr_storage wb_dest; /* Destination address */ #ifdef CONFIG_NET_SOCKOPTS - systime_t wb_start; /* Start time for timeout calculation */ + systime_t wb_start; /* Start time for timeout calculation */ #endif - struct iob_s *wb_iob; /* Head of the I/O buffer chain */ + struct iob_s *wb_iob; /* Head of the I/O buffer chain */ }; #endif diff --git a/net/udp/udp_psock_sendto_buffered.c b/net/udp/udp_psock_sendto_buffered.c index 29308e1274..9f8716d355 100644 --- a/net/udp/udp_psock_sendto_buffered.c +++ b/net/udp/udp_psock_sendto_buffered.c @@ -124,8 +124,6 @@ static int sendto_next_transfer(FAR struct socket *psock, static uint16_t sendto_eventhandler(FAR struct net_driver_s *dev, FAR void *pvconn, FAR void *pvpriv, uint16_t flags); -static inline void sendto_txnotify(FAR struct socket *psock, - FAR struct udp_conn_s *conn); /**************************************************************************** * Private Functions @@ -378,9 +376,13 @@ static int sendto_next_transfer(FAR struct socket *psock, */ wrb = (FAR struct udp_wrbuffer_s *)sq_peek(&conn->write_q); - DEBUGASSERT(wrb != NULL); + if (wrb == NULL) + { + ninfo("Write buffer queue is empty\n"); + return -ENOENT; + } - ret = udp_connect(conn, (FAR const struct sockaddr *)wrb->wb_iob->io_data); + ret = udp_connect(conn, (FAR const struct sockaddr *)&wrb->wb_dest); if (ret < 0) { nerr("ERROR: udp_connect failed: %d\n", ret); @@ -443,6 +445,10 @@ static int sendto_next_transfer(FAR struct socket *psock, psock->s_sndcb->flags = (UDP_POLL | NETDEV_DOWN); psock->s_sndcb->priv = (FAR void *)psock; psock->s_sndcb->event = sendto_eventhandler; + + /* Notify the device driver of the availability of TX data */ + + netdev_txnotify_dev(dev); return OK; } @@ -499,7 +505,7 @@ static uint16_t sendto_eventhandler(FAR struct net_driver_s *dev, * buffers to send. */ - if (dev->d_sndlen <= 0 && (flags & UDP_NEWDATA) != 0 && + if (dev->d_sndlen <= 0 && (flags & UDP_NEWDATA) == 0 && (flags & UDP_POLL) != 0 && !sq_empty(&conn->write_q)) { /* Check if the destination IP address is in the ARP or Neighbor @@ -576,53 +582,6 @@ static uint16_t sendto_eventhandler(FAR struct net_driver_s *dev, return flags; } -/**************************************************************************** - * Name: sendto_txnotify - * - * Description: - * Notify the appropriate device driver that we are have data ready to - * be send (UDP) - * - * Parameters: - * psock - Socket state structure - * conn - The UDP connection structure - * - * Returned Value: - * None - * - ****************************************************************************/ - -static inline void sendto_txnotify(FAR struct socket *psock, - FAR struct udp_conn_s *conn) -{ -#ifdef CONFIG_NET_IPv4 -#ifdef CONFIG_NET_IPv6 - /* If both IPv4 and IPv6 support are enabled, then we will need to select - * the device driver using the appropriate IP domain. - */ - - if (psock->s_domain == PF_INET) -#endif - { - /* Notify the device driver that send data is available */ - - netdev_ipv4_txnotify(conn->u.ipv4.laddr, conn->u.ipv4.raddr); - } -#endif /* CONFIG_NET_IPv4 */ - -#ifdef CONFIG_NET_IPv6 -#ifdef CONFIG_NET_IPv4 - else /* if (psock->s_domain == PF_INET6) */ -#endif /* CONFIG_NET_IPv4 */ - { - /* Notify the device driver that send data is available */ - - DEBUGASSERT(psock->s_domain == PF_INET6); - netdev_ipv6_txnotify(conn->u.ipv6.laddr, conn->u.ipv6.raddr); - } -#endif /* CONFIG_NET_IPv6 */ -} - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -750,7 +709,14 @@ ssize_t psock_udp_sendto(FAR struct socket *psock, FAR const void *buf, UDP_WBDUMP("I/O buffer chain", wrb, wrb->wb_iob->io_pktlen, 0); /* sendto_eventhandler() will send data in FIFO order from the - * conn->write_q + * conn->write_q. + * + * REVISIT: Why FIFO order? Because it is easy. In a real world + * environment where there are multiple network devices this might + * be inefficient because we could be sending data to different + * device out-of-queued-order to optimize performance. Sending + * data to different networks from a single UDP socket is probably + * not a very common use case, however. */ sq_addlast(&wrb->wb_node, &conn->write_q); @@ -770,9 +736,6 @@ ssize_t psock_udp_sendto(FAR struct socket *psock, FAR const void *buf, goto errout_with_wrb; } - /* Notify the device driver of the availability of TX data */ - - sendto_txnotify(psock, conn); net_unlock(); } -- GitLab From 58b95f4629d3f768a6215463f1adc4500e3a97f4 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 23 Jan 2018 11:54:03 -0600 Subject: [PATCH 101/228] net/udp: Fix memory leak with UDP + write buffer is closed. Also update TODO and comments and refresh a configuration. --- TODO | 30 +++++++++------------ configs/viewtool-stm32f107/README.txt | 6 ----- configs/viewtool-stm32f107/netnsh/defconfig | 14 +++++++--- net/inet/inet_close.c | 18 +++++++++++-- net/tcp/tcp_netpoll.c | 6 ++++- net/udp/udp_netpoll.c | 6 ++++- 6 files changed, 49 insertions(+), 31 deletions(-) diff --git a/TODO b/TODO index dd4dca76ac..b5ab5f89da 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,4 @@ -NuttX TODO List (Last updated January 21, 2018) +NuttX TODO List (Last updated January 23, 2018) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This file summarizes known NuttX bugs, limitations, inconsistencies with @@ -19,7 +19,7 @@ nuttx/: (8) Kernel/Protected Build (3) C++ Support (6) Binary loaders (binfmt/) - (17) Network (net/, drivers/net) + (16) Network (net/, drivers/net) (4) USB (drivers/usbdev, drivers/usbhost) (0) Other drivers (drivers/) (12) Libraries (libc/, libm/) @@ -1075,23 +1075,19 @@ o Network (net/, drivers/net) Title: POLL/SELECT ON TCP/UDP SOCKETS NEEDS READ-AHEAD Description: poll()/select() only works for availability of buffered TCP/UDP read data (when read-ahead is enabled). The way writing is - handled in the network layer, all sockets must wait when send and - cannot be notified when they can send without waiting. + handled in the network layer, either (1) If CONFIG_UDP/TCP_WRITE_BUFFERS=y + then we never have to wait to send; otherwise, we always have + to wait to send. So it is impossible to notify the caller + when it can send without waiting. + + An exception "never having to wait" is the case where we are + out of memory for use in write buffering. In that case, the + blocking send()/sendto() would have to wait for the memory + to become available. Status: Open, probably will not be fixed. Priority: Medium... this does effect porting of applications that expect different behavior from poll()/select() - Title: SOCKETS DO NOT ALWAYS SUPPORT O_NONBLOCK - Description: sockets do not support all modes for O_NONBLOCK. Sockets - support nonblocking operations only (1) for TCP/IP non- - blocking read operations when read-ahead buffering is - enabled, (2) TCP/IP accept() operations when TCP/IP - connection backlog is enabled, (2) UDP/IP read() operations - when UDP read-ahead is enabled, and (3) non-blocking - operations on Unix domain sockets. - Status: Open - Priority: Low. - Title: INTERFACES TO LEAVE/JOIN IGMP MULTICAST GROUP Description: The interfaces used to leave/join IGMP multicast groups is non-standard. RFC3678 (IGMPv3) suggests ioctl() commands to do this (SIOCSIPMSFILTER) but @@ -1124,8 +1120,8 @@ o Network (net/, drivers/net) however. Others support the address filtering interfaces but have never been verifed: - C5471, LM3S, ez80, DM0x90 NIC, PIC: Do not support address - filtering. + C5471, LM3S, ez80, DM0x90 NIC, PIC, LPC54: Do not support + address filtering. Kinetis, LPC17xx, LPC43xx: Untested address filter support Status: Open diff --git a/configs/viewtool-stm32f107/README.txt b/configs/viewtool-stm32f107/README.txt index 3bb13a3166..42faf94f79 100644 --- a/configs/viewtool-stm32f107/README.txt +++ b/configs/viewtool-stm32f107/README.txt @@ -630,12 +630,6 @@ Configurations 6. USB support is disabled by default. See the section above entitled, "USB Interface" - STATUS. The first time I build the configuration, I get some undefined - external references. No idea why. Simply cleaning the apps/ directory - and rebuilding fixes the problem: - - make apps_clean all - nsh: This configuration directory provide the basic NuttShell (NSH). diff --git a/configs/viewtool-stm32f107/netnsh/defconfig b/configs/viewtool-stm32f107/netnsh/defconfig index 131d3b620b..72a2921d02 100644 --- a/configs/viewtool-stm32f107/netnsh/defconfig +++ b/configs/viewtool-stm32f107/netnsh/defconfig @@ -1,5 +1,4 @@ # CONFIG_NSH_ARGCAT is not set -# CONFIG_NSH_CMDOPT_DF_H is not set # CONFIG_NSH_CMDOPT_HEXDUMP is not set # CONFIG_NSH_CMDPARMS is not set CONFIG_ARCH_BOARD_VIEWTOOL_STM32F107=y @@ -23,9 +22,15 @@ CONFIG_NET_ARP_SEND=y CONFIG_NET_BROADCAST=y CONFIG_NET_ETH_MTU=650 CONFIG_NET_ETH_TCP_RECVWNDO=624 +CONFIG_NET_HOSTNAME="Viewtool-STM32F107" CONFIG_NET_ICMP_SOCKET=y CONFIG_NET_ICMP=y +CONFIG_NET_ICMPv6_NEIGHBOR=y +CONFIG_NET_ICMPv6_SOCKET=y +CONFIG_NET_ICMPv6=y +CONFIG_NET_IPv6=y CONFIG_NET_MAX_LISTENPORTS=40 +CONFIG_NET_ROUTE=y CONFIG_NET_SOCKOPTS=y CONFIG_NET_TCP_CONNS=40 CONFIG_NET_TCP_WRITE_BUFFERS=y @@ -56,9 +61,9 @@ CONFIG_SCHED_HPWORK=y CONFIG_SCHED_HPWORKPRIORITY=192 CONFIG_SCHED_HPWORKSTACKSIZE=1024 CONFIG_SDCLONE_DISABLE=y -CONFIG_START_DAY=21 -CONFIG_START_MONTH=9 -CONFIG_START_YEAR=2009 +CONFIG_START_DAY=23 +CONFIG_START_MONTH=1 +CONFIG_START_YEAR=2018 CONFIG_STM32_ETHMAC=y CONFIG_STM32_JTAG_FULL_ENABLE=y CONFIG_STM32_PHYSR_100MBPS=0x0000 @@ -70,6 +75,7 @@ CONFIG_STM32_PWR=y CONFIG_STM32_RMII_EXTCLK=y CONFIG_STM32_USART1=y CONFIG_SYSTEM_PING=y +CONFIG_SYSTEM_PING6=y CONFIG_TASK_NAME_SIZE=0 CONFIG_USART1_SERIAL_CONSOLE=y CONFIG_USER_ENTRYPOINT="nsh_main" diff --git a/net/inet/inet_close.c b/net/inet/inet_close.c index a36089e541..14c463c628 100644 --- a/net/inet/inet_close.c +++ b/net/inet/inet_close.c @@ -345,7 +345,7 @@ static inline int tcp_close_disconnect(FAR struct socket *psock) #ifdef CONFIG_NET_TCP_WRITE_BUFFERS /* If we have a semi-permanent write buffer callback in place, then - * is needs to be be nullifed. + * is needs to be be nullified. * * Commit f1ef2c6cdeb032eaa1833cc534a63b50c5058270: * "When a socket is closed, it should make sure that any pending write @@ -357,6 +357,9 @@ static inline int tcp_close_disconnect(FAR struct socket *psock) * data. However, to be able to actually send any new data, the send * callback must be left. The callback should be freed later when the * socket is actually destroyed." + * + * REVISIT: Where and how exactly is s_sndcb ever freed? Is there a + * memory leak here? */ psock->s_sndcb = NULL; @@ -548,7 +551,18 @@ int inet_close(FAR struct socket *psock) if (conn->crefs <= 1) { - /* Yes... free the connection structure */ + /* Yes... */ + +#ifdef CONFIG_NET_UDP_WRITE_BUFFERS + /* Free any semi-permanent write buffer callback in place. */ + + if (psock->s_sndcb != NULL) + { + udp_callback_free(conn->dev, conn, psock->s_sndcb); + psock->s_sndcb = NULL; + } +#endif + /* And free the connection structure */ conn->crefs = 0; udp_free(psock->s_conn); diff --git a/net/tcp/tcp_netpoll.c b/net/tcp/tcp_netpoll.c index 615fb84b56..3979cf7c8d 100644 --- a/net/tcp/tcp_netpoll.c +++ b/net/tcp/tcp_netpoll.c @@ -112,7 +112,11 @@ static uint16_t tcp_poll_eventhandler(FAR struct net_driver_s *dev, eventset |= POLLIN & info->fds->events; } - /* A poll is a sign that we are free to send data. */ + /* A poll is a sign that we are free to send data. + * REVISIT: This is bogus: If CONFIG_TCP_WRITE_BUFFERS=y then + * we never have to wait to send; otherwise, we always have to + * wait to send. Receiving a poll is irrelevant. + */ if ((flags & TCP_POLL) != 0) { diff --git a/net/udp/udp_netpoll.c b/net/udp/udp_netpoll.c index 0145c3303e..1479a00b96 100644 --- a/net/udp/udp_netpoll.c +++ b/net/udp/udp_netpoll.c @@ -111,7 +111,11 @@ static uint16_t udp_poll_eventhandler(FAR struct net_driver_s *dev, eventset |= (POLLIN & info->fds->events); } - /* poll is a sign that we are free to send data. */ + /* A poll is a sign that we are free to send data. + * REVISIT: This is bogus: If CONFIG_UDP_WRITE_BUFFERS=y then + * we never have to wait to send; otherwise, we always have to + * wait to send. Receiving a poll is irrelevant. + */ if ((flags & UDP_POLL) != 0) { -- GitLab From bfbedceea0607cc661cd4170f28c2448f39f7b2c Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 24 Jan 2018 06:50:20 -0600 Subject: [PATCH 102/228] Update some comments. --- net/inet/inet_sockif.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/net/inet/inet_sockif.c b/net/inet/inet_sockif.c index 9ab4be7336..d9c56ad76d 100644 --- a/net/inet/inet_sockif.c +++ b/net/inet/inet_sockif.c @@ -286,6 +286,10 @@ static sockcaps_t inet_sockcaps(FAR struct socket *psock) { #ifdef NET_TCP_HAVE_STACK case SOCK_STREAM: + /* REVISIT: Non-blocking recv() depends on CONFIG_NET_TCP_READAHEAD, + * but non-blocking send() depends on CONFIG_NET_TCP_WRITE_BUFFERS. + */ + #ifdef CONFIG_NET_TCP_READAHEAD return SOCKCAP_NONBLOCKING; #else @@ -295,6 +299,10 @@ static sockcaps_t inet_sockcaps(FAR struct socket *psock) #ifdef NET_UDP_HAVE_STACK case SOCK_DGRAM: + /* REVISIT: Non-blocking recvfrom() depends on CONFIG_NET_UDP_READAHEAD, + * but non-blocking sendto() depends on CONFIG_NET_UDP_WRITE_BUFFERS. + */ + #ifdef CONFIG_NET_UDP_READAHEAD return SOCKCAP_NONBLOCKING; #else -- GitLab From f232c862da8bb4d540b621866e1fe6d8672d704d Mon Sep 17 00:00:00 2001 From: Alexander Oryshchenko Date: Wed, 24 Jan 2018 06:51:34 -0600 Subject: [PATCH 103/228] drivers/mtd/at24xx.c: Correct page size for AT24C02 part. --- drivers/mtd/at24xx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/at24xx.c b/drivers/mtd/at24xx.c index f08cec9d61..a09b948db2 100644 --- a/drivers/mtd/at24xx.c +++ b/drivers/mtd/at24xx.c @@ -86,9 +86,9 @@ /* Get the part configuration based on the size configuration */ -#if CONFIG_AT24XX_SIZE == 2 /* AT24C02: 2Kbits = 256; 16 * 16 = 256 */ -# define AT24XX_NPAGES 16 -# define AT24XX_PAGESIZE 16 +#if CONFIG_AT24XX_SIZE == 2 /* AT24C02: 2Kbits = 256; 32 * 8 = 256 */ +# define AT24XX_NPAGES 32 +# define AT24XX_PAGESIZE 8 # define AT24XX_ADDRSIZE 1 #elif CONFIG_AT24XX_SIZE == 4 /* AT24C04: 4Kbits = 512B; 32 * 16 = 512 */ # define AT24XX_NPAGES 32 -- GitLab From 871419c3cd0253045d23a2fd0f9184061f6cdf3b Mon Sep 17 00:00:00 2001 From: Alexander Oryshchenko Date: Wed, 24 Jan 2018 06:55:14 -0600 Subject: [PATCH 104/228] arch/arm/src/stm32: Make STM32 usable with an external RTC. drivers/timers/ds3231.c: Correct some debug statments. --- arch/arm/src/stm32/stm32_irq.c | 2 +- arch/arm/src/stm32/stm32f40xxx_rtcc.c | 5 +++-- drivers/timers/ds3231.c | 12 ++++++------ 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/arch/arm/src/stm32/stm32_irq.c b/arch/arm/src/stm32/stm32_irq.c index 98adf74f36..402351aafa 100644 --- a/arch/arm/src/stm32/stm32_irq.c +++ b/arch/arm/src/stm32/stm32_irq.c @@ -387,7 +387,7 @@ void up_irqinitialize(void) up_enable_irq(STM32_IRQ_MEMFAULT); #endif -#ifdef CONFIG_RTC +#if defined(CONFIG_RTC) && !defined(CONFIG_RTC_EXTERNAL) /* RTC was initialized earlier but IRQs weren't ready at that time */ stm32_rtc_irqinitialize(); diff --git a/arch/arm/src/stm32/stm32f40xxx_rtcc.c b/arch/arm/src/stm32/stm32f40xxx_rtcc.c index 8657d6e166..460a3872d8 100644 --- a/arch/arm/src/stm32/stm32f40xxx_rtcc.c +++ b/arch/arm/src/stm32/stm32f40xxx_rtcc.c @@ -58,7 +58,7 @@ #include -#ifdef CONFIG_RTC +#if defined(CONFIG_RTC) && !defined(CONFIG_RTC_EXTERNAL) /**************************************************************************** * Pre-processor Definitions @@ -1659,4 +1659,5 @@ int stm32_rtc_rdalarm(FAR struct alm_rdalarm_s *alminfo) } #endif -#endif /* CONFIG_RTC */ +#endif /* CONFIG_RTC && !CONFIG_RTC_EXTERNAL */ + diff --git a/drivers/timers/ds3231.c b/drivers/timers/ds3231.c index 4f1e2a1c9f..113fb97743 100644 --- a/drivers/timers/ds3231.c +++ b/drivers/timers/ds3231.c @@ -321,7 +321,7 @@ int up_rtc_getdatetime(FAR struct tm *tp) ret = I2C_TRANSFER(g_ds3231.i2c, msg, 4); if (ret < 0) { - rtcerr("ERROR: I2C_TRANSFER failed: %d\n", ret) + rtcerr("ERROR: I2C_TRANSFER failed: %d\n", ret); return ret; } } @@ -415,7 +415,7 @@ int up_rtc_settime(FAR const struct timespec *tp) return -EAGAIN; } - rtc_dumptime(tp, "Setting time"); + rtcinfo("Setting time tp=(%d,%d)\n", (int)tp->tv_sec, (int)tp->tv_nsec); /* Get the broken out time */ @@ -430,18 +430,18 @@ int up_rtc_settime(FAR const struct timespec *tp) #ifdef CONFIG_LIBC_LOCALTIME if (localtime_r(&newtime, &newtm) == NULL) { - rtcerr("ERROR: localtime_r failed\n") + rtcerr("ERROR: localtime_r failed\n"); return -EINVAL; } #else if (gmtime_r(&newtime, &newtm) == NULL) { - rtcerr("ERROR: gmtime_r failed\n") + rtcerr("ERROR: gmtime_r failed\n"); return -EINVAL; } #endif - rtc_dumptime(&tm, "New time"); + rtc_dumptime(&newtm, "New time"); /* Construct the message */ /* Write starting with the seconds regiser */ @@ -536,7 +536,7 @@ int up_rtc_settime(FAR const struct timespec *tp) ret = I2C_TRANSFER(g_ds3231.i2c, msg, 3); if (ret < 0) { - rtcerr("ERROR: I2C_TRANSFER failed: %d\n", ret) + rtcerr("ERROR: I2C_TRANSFER failed: %d\n", ret); return ret; } } -- GitLab From ec6145e8f754819699997014aec840f34e6b830f Mon Sep 17 00:00:00 2001 From: Alexander Oryshchenko Date: Wed, 24 Jan 2018 06:57:17 -0600 Subject: [PATCH 105/228] arch/arm/src/stm32/stm32_spi.c: Removed unnecessary (and incorrect) speed limitation --- arch/arm/src/stm32/stm32_spi.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/arch/arm/src/stm32/stm32_spi.c b/arch/arm/src/stm32/stm32_spi.c index 71f6dbfb3a..1be51d49c2 100644 --- a/arch/arm/src/stm32/stm32_spi.c +++ b/arch/arm/src/stm32/stm32_spi.c @@ -1122,13 +1122,6 @@ static uint32_t spi_setfrequency(FAR struct spi_dev_s *dev, uint32_t frequency) uint16_t setbits; uint32_t actual; - /* Limit to max possible (if STM32_SPI_CLK_MAX is defined in board.h) */ - - if (frequency > STM32_SPI_CLK_MAX) - { - frequency = STM32_SPI_CLK_MAX; - } - /* Has the frequency changed? */ if (frequency != priv->frequency) -- GitLab From 9e965247e42ad18c6a94f124cfbc05d1b079b54f Mon Sep 17 00:00:00 2001 From: Alexander Oryshchenko Date: Wed, 24 Jan 2018 06:58:47 -0600 Subject: [PATCH 106/228] arch/arm/src/stm32/stm32f40xxx_i2c.c: Correct some recent changes to STM32F4 I2C that broke poll mode of operation. --- arch/arm/src/stm32/stm32f40xxx_i2c.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/src/stm32/stm32f40xxx_i2c.c b/arch/arm/src/stm32/stm32f40xxx_i2c.c index 86de66e7f5..9317b3608c 100644 --- a/arch/arm/src/stm32/stm32f40xxx_i2c.c +++ b/arch/arm/src/stm32/stm32f40xxx_i2c.c @@ -1273,7 +1273,7 @@ static int stm32_i2c_isr_process(struct stm32_i2c_priv_s *priv) if (priv->dcnt == -1 && priv->msgc != 0 && (status & I2C_SR1_SB) == 0) { -#ifdef CONFIG_STM32_I2C_DMA +#if defined(CONFIG_STM32_I2C_DMA) || defined(CONFIG_I2C_POLLED) return OK; #else priv->status |= I2C_SR1_TIMEOUT; @@ -2049,7 +2049,7 @@ static int stm32_i2c_isr_process(struct stm32_i2c_priv_s *priv) /* Clear interrupt flags */ -#ifndef CONFIG_STM32_I2C_DMA +#if !defined(CONFIG_STM32_I2C_DMA) && !defined(CONFIG_I2C_POLLED) state_error: #endif stm32_i2c_putreg(priv, STM32_I2C_SR1_OFFSET, 0); -- GitLab From 822e67692b127e7fe63f72b1bfd0ed9dacabc012 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 24 Jan 2018 08:52:40 -0600 Subject: [PATCH 107/228] configs/flipnclick-sam3x: Using JTAG (vs. Bossac) I was finally able to load code and verify the basic NSH configuration. Updated READMEs. Also switched to USART0 (vs UART0) for the serial console because I was not getting bi-directional communication on the VCOM. --- configs/arduino-due/README.txt | 6 +++ configs/flipnclick-sam3x/README.txt | 70 +++++++++++++++++--------- configs/flipnclick-sam3x/nsh/defconfig | 4 +- configs/freedom-k64f/README.txt | 2 +- configs/freedom-k66f/README.txt | 5 +- 5 files changed, 59 insertions(+), 28 deletions(-) diff --git a/configs/arduino-due/README.txt b/configs/arduino-due/README.txt index bb6d7f08aa..0de6bcb4d2 100644 --- a/configs/arduino-due/README.txt +++ b/configs/arduino-due/README.txt @@ -330,6 +330,12 @@ Serial Consoles Loading Code ============ + [NOTE: I believe that there have been significant changes to the more + recent tool environment such that Bossac may no longer be usable. I + don't know that for certain and perhaps someone with more knowledge of + the tools than I could make this work. See the Flip'n'Clip SAM3X README + file for additional information.] + Installing the Arduino USB Driver under Windows: ------------------------------------------------ diff --git a/configs/flipnclick-sam3x/README.txt b/configs/flipnclick-sam3x/README.txt index 6cbf47b569..8ab7a159a8 100644 --- a/configs/flipnclick-sam3x/README.txt +++ b/configs/flipnclick-sam3x/README.txt @@ -22,23 +22,11 @@ STATUS ====== 2018-01-07: Created the configuration. At present it does not work; I - believe because of tool-related issues. I do the following: - - a) Open TeraTerm, select COM7 at 1200 baud, type a few ENTERs, and - close teraterm. - - b) Execute the following command which claims to have successfully - written to FLASH. - - bossac.exe --info --debug --port COM7 --usb-port=0 --erase --write --verify -b nuttx.bin -R - - But the code does not boot. There is no indication of life. - - c) Repeat a) then - - bossac.exe --info --debug --port COM7 --usb-port=0 --verify -b nuttx.bin - - And it says that the content of the FLASH is not good. + believe because of tool-related issues. See discussion under "Loading + Code" below. + 2018-01-24: I ordered a JTAG connector and soldered that to the Flip'n'Click + and I am now successfully able to load code. The NSH configuration appears + to be fully functional. Buttons and LEDs ================ @@ -99,10 +87,11 @@ Serial Consoles serial chip connected to the first of the MCU (RX0 and TX0 on PA8 and PA9, respectively). The output from that port is visible using the Arduino tool. - Any of UART and USART0-3 may be used as a serial console. By default, - UART0 is used as the serial console in all configurations. But that is - easily changed by modifying the configuration as described under - "Configurations" below. + [NOTE: My experience so far: I get serial output on the virtual COM port + via the UART, but I receive no serial input for keyboard data entered in + the PC serial terminal. I have not investigated this problem. It may + be something as simple as the Rx pin configuration. Instead, I just + switched to USART0.] Other convenient U[S]ARTs that may be used as the Serial console include: @@ -125,9 +114,22 @@ Serial Consoles transceiver to get the signals to RS232 levels (or connect to the USB virtual COM port in the case of UART0). + Any of UART and USART0-3 may be used as a serial console. UART0 would + be the preferred default console setting. However, due to the communication + problems mentioned above, USART0 is used as the default serial console + in all configurations. But that is easily changed by modifying the + configuration as described under "Configurations" below. + Loading Code ============ + [NOTE: This text was mostly copied from the Arduino Due README.txt. I + believe, however, that there have been significant changes to the + tool environment such that Bossac may no longer be usable. I don't + know that for certain and perhaps someone with more knowledge of + the tools than I could make this work. See STATUS below for the + current issues that I see.] + Installing the Arduino USB Driver under Windows ----------------------------------------------- @@ -302,6 +304,25 @@ Loading Code $ bossac.exe --port=COM7 --usb-port=false --boot=1 Set boot flash true + STATUS: + At present this procedure does not work. I do the following: + + a) Open TeraTerm, select COM7 at 1200 baud, type a few ENTERs, and + close teraterm. + + b) Execute the following command which claims to have successfully + written to FLASH. + + bossac.exe --info --debug --port COM7 --usb-port=0 --erase --write --verify -b nuttx.bin -R + + But the code does not boot. There is no indication of life. + + c) Repeat a) then + + bossac.exe --info --debug --port COM7 --usb-port=0 --verify -b nuttx.bin + + And it says that the content of the FLASH is not good. + Uploading NuttX to the Flip&Click Using JTAG -------------------------------------------- @@ -465,15 +486,16 @@ Configurations reconfiguration process. 2. Unless stated otherwise, all configurations generate console - output on UART0 which is available both on the USB virtual COM port - and on the PWML connector (see the section "Serial Consoles" above). + output on USART0 which is available either on the Arduion Shield + connector or on mikroBUS A as described above in the section entitled + "Serial Consoles". 3. Unless otherwise stated, the configurations are setup for Cygwin under Windows: Build Setup: CONFIG_HOST_WINDOWS=y : Microsoft Windows - CONFIG_WINDIWS_CYGWIN=y : Cygwin under Windoes + CONFIG_WINDIWS_CYGWIN=y : Cygwin under Windows 3. All of these configurations are set up to build under Windows using the "GNU Tools for ARM Embedded Processors" that is maintained by ARM diff --git a/configs/flipnclick-sam3x/nsh/defconfig b/configs/flipnclick-sam3x/nsh/defconfig index 79057461ad..f0ba4aedf3 100644 --- a/configs/flipnclick-sam3x/nsh/defconfig +++ b/configs/flipnclick-sam3x/nsh/defconfig @@ -1,4 +1,5 @@ # CONFIG_ARCH_RAMFUNCS is not set +# CONFIG_SAM34_UART0 is not set CONFIG_ARCH_BOARD_FLIPNCLICK_SAM3X=y CONFIG_ARCH_BOARD="flipnclick-sam3x" CONFIG_ARCH_CHIP_ATSAM3X8E=y @@ -33,12 +34,13 @@ CONFIG_RAM_SIZE=65536 CONFIG_RAM_START=0x20000000 CONFIG_RAW_BINARY=y CONFIG_RR_INTERVAL=200 +CONFIG_SAM34_USART0=y CONFIG_SCHED_WAITPID=y CONFIG_SDCLONE_DISABLE=y CONFIG_START_DAY=28 CONFIG_START_MONTH=6 CONFIG_START_YEAR=2013 CONFIG_TASK_NAME_SIZE=0 -CONFIG_UART0_SERIAL_CONSOLE=y +CONFIG_USART0_SERIAL_CONSOLE=y CONFIG_USER_ENTRYPOINT="nsh_main" CONFIG_WDOG_INTRESERVE=0 diff --git a/configs/freedom-k64f/README.txt b/configs/freedom-k64f/README.txt index 5559b2fe5f..a2ce126b7d 100644 --- a/configs/freedom-k64f/README.txt +++ b/configs/freedom-k64f/README.txt @@ -618,7 +618,7 @@ GNU Toolchain Options ===================== The NuttX make system supports several GNU-based toolchains under Linux, - Cygwin under Windows, and Windoes native. To select a toolchain: + Cygwin under Windows, and Windows native. To select a toolchain: 1. Use 'make menuconfig' and select the toolchain that you are using under the System Type menu. diff --git a/configs/freedom-k66f/README.txt b/configs/freedom-k66f/README.txt index 7f5da7cffa..c78a3c4c80 100644 --- a/configs/freedom-k66f/README.txt +++ b/configs/freedom-k66f/README.txt @@ -621,7 +621,7 @@ GNU Toolchain Options ===================== The NuttX make system supports several GNU-based toolchains under Linux, - Cygwin under Windows, and Windoes native. To select a toolchain: + Cygwin under Windows, and Windows native. To select a toolchain: 1. Use 'make menuconfig' and select the toolchain that you are using under the System Type menu. @@ -972,4 +972,5 @@ Status 2017-02-14: nsh: SDHC DMA is not working yet. Buttons and SDIO with automounter is working. netnsh:Is building but Ehternet is not working yet. TX is called but - not IRQ is issued. \ No newline at end of file + not IRQ is issued. + -- GitLab From 1ae8daf5d5f0fc8172699ea364661d3353ad2e6b Mon Sep 17 00:00:00 2001 From: Matt Thompson Date: Wed, 24 Jan 2018 19:06:00 -0800 Subject: [PATCH 108/228] SAMDL: Added SAMD DAC header file. Fixed SAMD EVSYS header. Added SAMD TC header file. Fixed some minor typos --- arch/arm/src/samdl/chip/samd_dac.h | 136 +++++++++++++++ arch/arm/src/samdl/chip/samd_evsys.h | 34 ++-- arch/arm/src/samdl/chip/samd_tc.h | 249 +++++++++++++++++++++++++++ arch/arm/src/samdl/sam_dac.h | 77 +++++++++ arch/arm/src/samdl/sam_evsys.h | 76 ++++++++ arch/arm/src/samdl/samd_periphclks.h | 6 +- 6 files changed, 560 insertions(+), 18 deletions(-) create mode 100644 arch/arm/src/samdl/chip/samd_dac.h create mode 100644 arch/arm/src/samdl/chip/samd_tc.h create mode 100644 arch/arm/src/samdl/sam_dac.h create mode 100644 arch/arm/src/samdl/sam_evsys.h diff --git a/arch/arm/src/samdl/chip/samd_dac.h b/arch/arm/src/samdl/chip/samd_dac.h new file mode 100644 index 0000000000..274cab701e --- /dev/null +++ b/arch/arm/src/samdl/chip/samd_dac.h @@ -0,0 +1,136 @@ +/******************************************************************************************** + * arch/arm/src/samdl/chip/saml_dac.h + * + * Copyright (C) 2015 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * References: + * "Atmel SAM L21E / SAM L21G / SAM L21J Smart ARM-Based Microcontroller + * Datasheet", Atmel-42385C-SAML21_Datasheet_Preliminary-03/20/15 + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ********************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_SAMDL_CHIP_SAMD_DAC_H +#define __ARCH_ARM_SRC_SAMDL_CHIP_SAMD_DAC_H + +/******************************************************************************************** + * Included Files + ********************************************************************************************/ + +#include + +#include "chip.h" + +#ifdef CONFIG_ARCH_FAMILY_SAMD21 + +/******************************************************************************************** + * Pre-processor Definitions + ********************************************************************************************/ +/* DAC register offsets ********************************************************************/ + +#define SAM_DAC_CTRLA_OFFSET 0x0000 /* Control A Register */ +#define SAM_DAC_CTRLB_OFFSET 0x0001 /* Control B Register */ +#define SAM_DAC_EVCTRL_OFFSET 0x0002 /* Event Control Register */ +#define SAM_DAC_INTENCLR_OFFSET 0x0004 /* Interrupt Enable Clear Register */ +#define SAM_DAC_INTENSET_OFFSET 0x0005 /* Interrupt Enable Set Register */ +#define SAM_DAC_INTFLAG_OFFSET 0x0006 /* Interrupt Flag Status and Clear Register */ +#define SAM_DAC_STATUS_OFFSET 0x0007 /* Status Register */ +#define SAM_DAC_DATA0_OFFSET 0x0008 /* Data DAC0 Register */ +#define SAM_DAC_DATA1_OFFSET 0x0009 /* Data DAC1 Register */ +#define SAM_DAC_DATABUF0_OFFSET 0x000C /* Data Buffer DAC0 Register */ +#define SAM_DAC_DATABUF1_OFFSET 0x000D /* Data Buffer DAC1 Register */ + +/* DAC register addresses ******************************************************************/ + +#define SAM_DAC_CTRLA (SAM_DAC_BASE+SAM_DAC_CTRLA_OFFSET) +#define SAM_DAC_CTRLB (SAM_DAC_BASE+SAM_DAC_CTRLB_OFFSET) +#define SAM_DAC_EVCTRL (SAM_DAC_BASE+SAM_DAC_EVCTRL_OFFSET) +#define SAM_DAC_INTENCLR (SAM_DAC_BASE+SAM_DAC_INTENCLR_OFFSET) +#define SAM_DAC_INTENSET (SAM_DAC_BASE+SAM_DAC_INTENSET_OFFSET) +#define SAM_DAC_INTFLAG (SAM_DAC_BASE+SAM_DAC_INTFLAG_OFFSET) +#define SAM_DAC_STATUS (SAM_DAC_BASE+SAM_DAC_STATUS_OFFSET) +#define SAM_DAC_DATA0 (SAM_DAC_BASE+SAM_DAC_DATA0_OFFSET) +#define SAM_DAC_DATA1 (SAM_DAC_BASE+SAM_DAC_DATA1_OFFSET) +#define SAM_DAC_DATABUF0 (SAM_DAC_BASE+SAM_DAC_DATABUF0_OFFSET) +#define SAM_DAC_DATABUF1 (SAM_DAC_BASE+SAM_DAC_DATABUF1_OFFSET) + +/* DAC register bit definitions ************************************************************/ + +/* Control A Register */ + +#define DAC_CTRLA_SWRTS (1 << 0) /* Bit 0: Software reset */ +#define DAC_CTRLA_ENABLE (1 << 1) /* Bit 1: Enable DAC controller */ +#define DAC_CTRLA_RUNSTDBY (1 << 2) /* Bit 1: Run in standby */ + +/* Control B Register */ + +#define DAC_CTRLB_EOEN (1 << 0) /* Bit 0: External Output Enable (to Vout) */ +#define DAC_CTRLB_IOEN (1 << 1) /* Bit 1: Internal Output Enable (to analog comparator) */ +#define DAC_CTRLB_LEFTADJ (1 << 2) /* Bit 2: Left-Adjusted Data */ +#define DAC_CTRLB_VPD (1 << 3) /* Bit 3: Voltage Pump Disabled */ +#define DAC_CTRLB_BDWP (1 << 4) /* Bit 4: Bypass DATABUF Write protection */ +#define DAC_CTRLB_REFSEL_SHIFT (6) /* Bit 7:6: Reference selection */ +#define DAC_CTRLB_REFSEL_MASK (3 << DAC_CTRLB_REFSEL_SHIFT) +# define DAC_CTRLB_REFSEL_INTREF (0 << DAC_CTRLB_REFSEL_SHIFT) /* Internal voltage reference */ +# define DAC_CTRLB_REFSEL_VDDANA (1 << DAC_CTRLB_REFSEL_SHIFT) /* Analog voltage supply */ +# define DAC_CTRLB_REFSEL_VREFA (2 << DAC_CTRLB_REFSEL_SHIFT) /* External voltage reference */ + +/* Event Control Register */ + +#define DAC_EVCTRL_STARTEI (1 << 0) /* Bit 0: Start conversion event input */ +#define DAC_EVCTRL_EMPTYEO (1 << 1) /* Bit 1: Data buffer empty event output */ + +/* Common bit definitions for Interrupt Enable Clear Register, Interrupt Enable Set + * Register, and Interrupt Flag Status and Clear Register + */ + +#define DAC_INT_UNDERRUN (1 << 0) /* Bit 0: Underrun interrupt */ +#define DAC_INT_EMPTY (1 << 1) /* Bit 1: Data buffer empty interrupt */ +#define DAC_INT_SYNCRDY (1 << 2) /* Bit 2: Sync ready */ +#define DAC_INT_ALL 0x07 + +/* Status Register */ + +#define DAC_STATUS_SYNCBUSY (1 << 7) /* Bit 0: Sync busy */ + +/******************************************************************************************** + * Public Types + ********************************************************************************************/ + +/******************************************************************************************** + * Public Data + ********************************************************************************************/ + +/******************************************************************************************** + * Public Functions + ********************************************************************************************/ + +#endif /* CONFIG_ARCH_FAMILY_SAMD21 */ +#endif /* __ARCH_ARM_SRC_SAMDL_CHIP_SAMD_DAC_H */ diff --git a/arch/arm/src/samdl/chip/samd_evsys.h b/arch/arm/src/samdl/chip/samd_evsys.h index e1489a2622..84ea384f09 100644 --- a/arch/arm/src/samdl/chip/samd_evsys.h +++ b/arch/arm/src/samdl/chip/samd_evsys.h @@ -68,9 +68,9 @@ #define SAM_EVSYS_CTRL (SAM_EVSYS_BASE+SAM_EVSYS_CTRL_OFFSET) #define SAM_EVSYS_CHANNEL (SAM_EVSYS_BASE+SAM_EVSYS_CHANNEL_OFFSET) #define SAM_EVSYS_USER (SAM_EVSYS_BASE+SAM_EVSYS_USER_OFFSET) -#define SAM_EVSYS_CHSTATUS (SAM_EVSYS_BASE+SAM_EVSYS_CHSTATUS_OFFSET -#define SAM_EVSYS_INTENCLR (SAM_EVSYS_BASE+SAM_EVSYS_INTENCLR_OFFSET -#define SAM_EVSYS_INTENSET (SAM_EVSYS_BASE+SAM_EVSYS_INTENSET_OFFSET +#define SAM_EVSYS_CHSTATUS (SAM_EVSYS_BASE+SAM_EVSYS_CHSTATUS_OFFSET) +#define SAM_EVSYS_INTENCLR (SAM_EVSYS_BASE+SAM_EVSYS_INTENCLR_OFFSET) +#define SAM_EVSYS_INTENSET (SAM_EVSYS_BASE+SAM_EVSYS_INTENSET_OFFSET) #define SAM_EVSYS_INTFLAG (SAM_EVSYS_BASE+SAM_EVSYS_INTFLAG_OFFSET) /* EVSYS register bit definitions ***********************************************************/ @@ -302,12 +302,14 @@ /* Channel status register */ -#define EVSYS_CHSTATUS_USRRDY_SHIFT (0) /* Bits 0-7: User Ready for Channel n, n=0-7 */ -#define EVSYS_CHSTATUS_USRRDY_MASK (0xff << EVSYS_CHSTATUS_USRRDY_SHIFT) -# define EVSYS_CHSTATUS_USRRDY(n) (1 << (n)) -#define EVSYS_CHSTATUS_CHBUSY_SHIFT (8) /* Bits 8-15: Channel Busy n, n=0-7 */ -#define EVSYS_CHSTATUS_CHBUSY_MASK (0xff << EVSYS_CHSTATUS_CHBUSY_SHIFT) -# define EVSYS_CHSTATUS_CHBUSY(n) (1 << ((n) + 8)) +#ifdef CONFIG_ARCH_FAMILY_SAMD20 +# define EVSYS_CHSTATUS_USRRDY_SHIFT (0) /* Bits 0-7: User Ready for Channel n, n=0-7 */ +# define EVSYS_CHSTATUS_USRRDY_MASK (0xff << EVSYS_CHSTATUS_USRRDY_SHIFT) +# define EVSYS_CHSTATUS_USRRDY(n) (1 << (n)) +# define EVSYS_CHSTATUS_CHBUSY_SHIFT (8) /* Bits 8-15: Channel Busy n, n=0-7 */ +# define EVSYS_CHSTATUS_CHBUSY_MASK (0xff << EVSYS_CHSTATUS_CHBUSY_SHIFT) +# define EVSYS_CHSTATUS_CHBUSY(n) (1 << ((n) + 8)) +#endif #ifdef CONFIG_ARCH_FAMILY_SAMD21 # define EVSYS_CHSTATUS_USRRDYH_SHIFT (16) /* Bits 16-19: User Ready for Channel n, n=8-11 */ @@ -320,12 +322,14 @@ /* Interrupt enable clear, interrupt enable set, and interrupt flag status and clear registers */ -#define EVSYS_INT_OVR_SHIFT (0) /* Bits 0-7: Overrun channel n interrupt, n=0-7 */ -#define EVSYS_INT_OVR_MASK (0xff << EVSYS_INT_OVR_SHIFT) -# define EVSYS_INT_OVR(n) (1 << (n)) -#define EVSYS_INT_EVD_SHIFT (8) /* Bits 8-15: Event detected channel n interrupt, n=0-7 */ -#define EVSYS_INT_EVD_MASK (0xff << EVSYS_INT_EVD_SHIFT) -# define EVSYS_INT_EVD(n) (1 << ((n) + 8)) +#ifdef CONFIG_ARCH_FAMILY_SAMD20 +# define EVSYS_INT_OVR_SHIFT (0) /* Bits 0-7: Overrun channel n interrupt, n=0-7 */ +# define EVSYS_INT_OVR_MASK (0xff << EVSYS_INT_OVR_SHIFT) +# define EVSYS_INT_OVR(n) (1 << (n)) +# define EVSYS_INT_EVD_SHIFT (8) /* Bits 8-15: Event detected channel n interrupt, n=0-7 */ +# define EVSYS_INT_EVD_MASK (0xff << EVSYS_INT_EVD_SHIFT) +# define EVSYS_INT_EVD(n) (1 << ((n) + 8)) +#endif #ifdef CONFIG_ARCH_FAMILY_SAMD21 # define EVSYS_INT_OVR_SHIFT (16) /* Bits 16-19: Overrun channel n interrupt, n=8-11 */ diff --git a/arch/arm/src/samdl/chip/samd_tc.h b/arch/arm/src/samdl/chip/samd_tc.h new file mode 100644 index 0000000000..02e502af8e --- /dev/null +++ b/arch/arm/src/samdl/chip/samd_tc.h @@ -0,0 +1,249 @@ +/******************************************************************************************** + * arch/arm/src/samdl/chip/samd_tc.h + * + * Copyright (C) 2018 Gregory Nutt. All rights reserved. + * Author: Matt Thompson + * + * References: + * "Microchip SAMD21 datasheet" + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ********************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_SAMDL_CHIP_SAMD_TC_H +#define __ARCH_ARM_SRC_SAMDL_CHIP_SAMD_TC_H + +/******************************************************************************************** + * Included Files + ********************************************************************************************/ + +#include + +#include "chip.h" + +#ifdef CONFIG_ARCH_FAMILY_SAMD21 + +/******************************************************************************************** + * Pre-processor Definitions + ********************************************************************************************/ +/* TC register offsets *********************************************************************/ + +#define SAM_TC_CTRLA_OFFSET 0x0000 /* Control A register */ +#define SAM_TC_READREQ_OFFSET 0x0002 /* Read request register */ +#define SAM_TC_CTRLBCLR_OFFSET 0x0004 /* Control B clear register */ +#define SAM_TC_CTRLBSET_OFFSET 0x0005 /* Control B clear register */ +#define SAM_TC_CTRLC_OFFSET 0x0006 /* Control C register */ +#define SAM_TC_DBGCTRL_OFFSET 0x0008 /* Debug control register */ +#define SAM_TC_EVCTRL_OFFSET 0x000A /* Event control register */ +#define SAM_TC_INTENCLR_OFFSET 0x000C /* Interrupt enable clear register */ +#define SAM_TC_INTENSET_OFFSET 0x000D /* Interrupt enable set register */ +#define SAM_TC_INTFLAG_OFFSET 0x000E /* Interrupt flag register */ +#define SAM_TC_STATUS_OFFSET 0x000F /* Status register */ +#define SAM_TC_COUNT_OFFSET 0x0010 /* Count register */ +#define SAM_TC_CC0_OFFSET 0x0018 /* Capture Compare 0 register */ +#define SAM_TC_CC1_OFFSET 0x001C /* Capture Compare 1 register */ + +/* TC register addresses *******************************************************************/ + +#define SAM_TC3_CTRLA (SAM_TC3_BASE+SAM_TC_CTRLA_OFFSET) +#define SAM_TC3_READREQ (SAM_TC3_BASE+SAM_TC_READREQ_OFFSET) +#define SAM_TC3_CTRLBCLR (SAM_TC3_BASE+SAM_TC_CTRLBCLR_OFFSET) +#define SAM_TC3_CTRLBSET (SAM_TC3_BASE+SAM_TC_CTRLBSET_OFFSET) +#define SAM_TC3_CTRLC (SAM_TC3_BASE+SAM_TC_CTRLC_OFFSET) +#define SAM_TC3_DBGCTRL (SAM_TC3_BASE+SAM_TC_DBGCTRL_OFFSET) +#define SAM_TC3_EVCTRL (SAM_TC3_BASE+SAM_TC_EVCTRL_OFFSET) +#define SAM_TC3_INTENCLR (SAM_TC3_BASE+SAM_TC_INTENCLR_OFFSET) +#define SAM_TC3_INTENSET (SAM_TC3_BASE+SAM_TC_INTENSET_OFFSET) +#define SAM_TC3_INTFLAG (SAM_TC3_BASE+SAM_TC_INTFLAG_OFFSET) +#define SAM_TC3_STATUS (SAM_TC3_BASE+SAM_TC_STATUS_OFFSET) +#define SAM_TC3_COUNT (SAM_TC3_BASE+SAM_TC_COUNT_OFFSET) +#define SAM_TC3_CC0 (SAM_TC3_BASE+SAM_TC_CC0_OFFSET) +#define SAM_TC3_CC1 (SAM_TC3_BASE+SAM_TC_CC1_OFFSET) + +#define SAM_TC4_CTRLA (SAM_TC4_BASE+SAM_TC_CTRLA_OFFSET) +#define SAM_TC4_READREQ (SAM_TC4_BASE+SAM_TC_READREQ_OFFSET) +#define SAM_TC4_CTRLBCLR (SAM_TC4_BASE+SAM_TC_CTRLBCLR_OFFSET) +#define SAM_TC4_CTRLBSET (SAM_TC4_BASE+SAM_TC_CTRLBSET_OFFSET) +#define SAM_TC4_CTRLC (SAM_TC4_BASE+SAM_TC_CTRLC_OFFSET) +#define SAM_TC4_DBGCTRL (SAM_TC4_BASE+SAM_TC_DBGCTRL_OFFSET) +#define SAM_TC4_EVCTRL (SAM_TC4_BASE+SAM_TC_EVCTRL_OFFSET) +#define SAM_TC4_INTENCLR (SAM_TC4_BASE+SAM_TC_INTENCLR_OFFSET) +#define SAM_TC4_INTENSET (SAM_TC4_BASE+SAM_TC_INTENSET_OFFSET) +#define SAM_TC4_INTFLAG (SAM_TC4_BASE+SAM_TC_INTFLAG_OFFSET) +#define SAM_TC4_STATUS (SAM_TC4_BASE+SAM_TC_STATUS_OFFSET) +#define SAM_TC4_COUNT (SAM_TC4_BASE+SAM_TC_COUNT_OFFSET) +#define SAM_TC4_CC0 (SAM_TC4_BASE+SAM_TC_CC0_OFFSET) +#define SAM_TC4_CC1 (SAM_TC4_BASE+SAM_TC_CC1_OFFSET) + +#define SAM_TC5_CTRLA (SAM_TC5_BASE+SAM_TC_CTRLA_OFFSET) +#define SAM_TC5_READREQ (SAM_TC5_BASE+SAM_TC_READREQ_OFFSET) +#define SAM_TC5_CTRLBCLR (SAM_TC5_BASE+SAM_TC_CTRLBCLR_OFFSET) +#define SAM_TC5_CTRLBSET (SAM_TC5_BASE+SAM_TC_CTRLBSET_OFFSET) +#define SAM_TC5_CTRLC (SAM_TC5_BASE+SAM_TC_CTRLC_OFFSET) +#define SAM_TC5_DBGCTRL (SAM_TC5_BASE+SAM_TC_DBGCTRL_OFFSET) +#define SAM_TC5_EVCTRL (SAM_TC5_BASE+SAM_TC_EVCTRL_OFFSET) +#define SAM_TC5_INTENCLR (SAM_TC5_BASE+SAM_TC_INTENCLR_OFFSET) +#define SAM_TC5_INTENSET (SAM_TC5_BASE+SAM_TC_INTENSET_OFFSET) +#define SAM_TC5_INTFLAG (SAM_TC5_BASE+SAM_TC_INTFLAG_OFFSET) +#define SAM_TC5_STATUS (SAM_TC5_BASE+SAM_TC_STATUS_OFFSET) +#define SAM_TC5_COUNT (SAM_TC5_BASE+SAM_TC_COUNT_OFFSET) +#define SAM_TC5_CC0 (SAM_TC5_BASE+SAM_TC_CC0_OFFSET) +#define SAM_TC5_CC1 (SAM_TC5_BASE+SAM_TC_CC1_OFFSET) + +#define SAM_TC6_CTRLA (SAM_TC6_BASE+SAM_TC_CTRLA_OFFSET) +#define SAM_TC6_READREQ (SAM_TC6_BASE+SAM_TC_READREQ_OFFSET) +#define SAM_TC6_CTRLBCLR (SAM_TC6_BASE+SAM_TC_CTRLBCLR_OFFSET) +#define SAM_TC6_CTRLBSET (SAM_TC6_BASE+SAM_TC_CTRLBSET_OFFSET) +#define SAM_TC6_CTRLC (SAM_TC6_BASE+SAM_TC_CTRLC_OFFSET) +#define SAM_TC6_DBGCTRL (SAM_TC6_BASE+SAM_TC_DBGCTRL_OFFSET) +#define SAM_TC6_EVCTRL (SAM_TC6_BASE+SAM_TC_EVCTRL_OFFSET) +#define SAM_TC6_INTENCLR (SAM_TC6_BASE+SAM_TC_INTENCLR_OFFSET) +#define SAM_TC6_INTENSET (SAM_TC6_BASE+SAM_TC_INTENSET_OFFSET) +#define SAM_TC6_INTFLAG (SAM_TC6_BASE+SAM_TC_INTFLAG_OFFSET) +#define SAM_TC6_STATUS (SAM_TC6_BASE+SAM_TC_STATUS_OFFSET) +#define SAM_TC6_COUNT (SAM_TC6_BASE+SAM_TC_COUNT_OFFSET) +#define SAM_TC6_CC0 (SAM_TC6_BASE+SAM_TC_CC0_OFFSET) +#define SAM_TC6_CC1 (SAM_TC6_BASE+SAM_TC_CC1_OFFSET) + +#define SAM_TC7_CTRLA (SAM_TC7_BASE+SAM_TC_CTRLA_OFFSET) +#define SAM_TC7_READREQ (SAM_TC7_BASE+SAM_TC_READREQ_OFFSET) +#define SAM_TC7_CTRLBCLR (SAM_TC7_BASE+SAM_TC_CTRLBCLR_OFFSET) +#define SAM_TC7_CTRLBSET (SAM_TC7_BASE+SAM_TC_CTRLBSET_OFFSET) +#define SAM_TC7_CTRLC (SAM_TC7_BASE+SAM_TC_CTRLC_OFFSET) +#define SAM_TC7_DBGCTRL (SAM_TC7_BASE+SAM_TC_DBGCTRL_OFFSET) +#define SAM_TC7_EVCTRL (SAM_TC7_BASE+SAM_TC_EVCTRL_OFFSET) +#define SAM_TC7_INTENCLR (SAM_TC7_BASE+SAM_TC_INTENCLR_OFFSET) +#define SAM_TC7_INTENSET (SAM_TC7_BASE+SAM_TC_INTENSET_OFFSET) +#define SAM_TC7_INTFLAG (SAM_TC7_BASE+SAM_TC_INTFLAG_OFFSET) +#define SAM_TC7_STATUS (SAM_TC7_BASE+SAM_TC_STATUS_OFFSET) +#define SAM_TC7_COUNT (SAM_TC7_BASE+SAM_TC_COUNT_OFFSET) +#define SAM_TC7_CC0 (SAM_TC7_BASE+SAM_TC_CC0_OFFSET) +#define SAM_TC7_CC1 (SAM_TC7_BASE+SAM_TC_CC1_OFFSET) + +/* TC register bit definitions *************************************************************/ + +/* Control A register */ + +#define TC_CTRLA_SWRST (1 << 0) /* Bit 0: Software reset */ +#define TC_CTRLA_ENABLE (1 << 1) /* Bit 1: Enable */ +#define TC_CTRLA_MODE_SHIFT (2) +#define TC_CTRLA_MODE_MASK (3 << TC_CTRLA_SHIFT) +# define TC_CTRLA_MODE_COUNT16 (0 << TC_CTRLA_SHIFT) +# define TC_CTRLA_MODE_COUNT8 (1 << TC_CTRLA_SHIFT) +# define TC_CTRLA_MODE_COUNT32 (2 << TC_CTRLA_SHIFT) +#define TC_CTRLA_WAVEGEN_SHIFT (5) +#define TC_CTRLA_WAVEGEN_MASK (3 << TC_CTRLA_WAVEGEN_SHIFT) +# define TC_CTRLA_WAVEGEN_NFRQ (0 << TC_CTRLA_WAVEGEN_SHIFT) +# define TC_CTRLA_WAVEGEN_MFRQ (1 << TC_CTRLA_WAVEGEN_SHIFT) +# define TC_CTRLA_WAVEGEN_NPWM (2 << TC_CTRLA_WAVEGEN_SHIFT) +# define TC_CTRLA_WAVEGEN_MPWM (3 << TC_CTRLA_WAVEGEN_SHIFT) +#define TC_CTRLA_PRESCALER_SHIFT (8) +#define TC_CTRLA_PRESCALER_MASK (7 << TC_CTRLA_PRESCALER_SHIFT) +# define TC_CTRLA_PRESCALER_DIV1 (0 << TC_CTRLA_PRESCALER_SHIFT) +# define TC_CTRLA_PRESCALER_DIV2 (1 << TC_CTRLA_PRESCALER_SHIFT) +# define TC_CTRLA_PRESCALER_DIV4 (2 << TC_CTRLA_PRESCALER_SHIFT) +# define TC_CTRLA_PRESCALER_DIV8 (3 << TC_CTRLA_PRESCALER_SHIFT) +# define TC_CTRLA_PRESCALER_DIV16 (4 << TC_CTRLA_PRESCALER_SHIFT) +# define TC_CTRLA_PRESCALER_DIV64 (5 << TC_CTRLA_PRESCALER_SHIFT) +# define TC_CTRLA_PRESCALER_DIV256 (6 << TC_CTRLA_PRESCALER_SHIFT) +# define TC_CTRLA_PRESCALER_DIV1024 (7 << TC_CTRLA_PRESCALER_SHIFT) +#define TC_CTRLA_RUNSTDBY (1 << 11) +#define TC_CTRLA_PRESCSYNC_SHIFT (12) +#define TC_CTRLA_PRESCSYNC_MASK (3 << TC_CTRLA_PRESCSYNC_SHIFT) +# define TC_CTRLA_PRESCSYNC_GCLK (0 << TC_CTRLA_PRESCSYNC_SHIFT) +# define TC_CTRLA_PRESCSYNC_PRESC (1 << TC_CTRLA_PRESCSYNC_SHIFT) +# define TC_CTRLA_PRESCSYNC_RESYNC (2 << TC_CTRLA_PRESCSYNC_SHIFT) + +/* Read Request register */ + +#define TC_READREQ_ADDR_SHIFT (0) +#define TC_READREQ_ADDR_MASK (0x1F << TC_READREQ_ADDR_SHIFT) +#define TC_READREQ_RCONT (1 << 14) +#define TC_READREQ_RREQ (1 << 15) + +/* Control B Set/Clear register */ + +#define TC_CTRLB_DIR (1 << 0) +#define TC_CTRLB_ONESHOT (1 << 2) +#define TC_CTRLB_CMD_SHIFT (6) +#define TC_CTRLB_CMD_MASK (3 << TC_CTRLBCLR_CMD_SHIFT) +# define TC_CTRLB_CMD_NONE (0 << TC_CTRLBCLR_CMD_SHIFT) +# define TC_CTRLB_CMD_RETRIGGER (1 << TC_CTRLBCLR_CMD_SHIFT) +# define TC_CTRLB_CMD_STOP (2 << TC_CTRLBCLR_CMD_SHIFT) + +/* Control C register */ + +#define TC_CTRLC_INVEN0 (1 << 0) +#define TC_CTRLC_INVEN1 (1 << 1) +#define TC_CTRLC_CPTEN0 (1 << 4) +#define TC_CTRLC_CPTEN1 (1 << 5) + +/* Debug control register */ + +#define TC_DBGCTRL_DBGRUN (1 << 0) + +/* Event control register */ + +#define TC_EVCTRL_EVACT_SHIFT (0) +#define TC_EVCTRL_EVACT_MASK (7 << TC_EVCTRL_EVACT_SHIFT) +# define TC_EVCTRL_EVACT_OFF (0 << TC_EVCTRL_EVACT_SHIFT) +# define TC_EVCTRL_EVACT_RETRIGGER (1 << TC_EVCTRL_EVACT_SHIFT) +# define TC_EVCTRL_EVACT_COUNT (2 << TC_EVCTRL_EVACT_SHIFT) +# define TC_EVCTRL_EVACT_START (3 << TC_EVCTRL_EVACT_SHIFT) +# define TC_EVCTRL_EVACT_PPW (5 << TC_EVCTRL_EVACT_SHIFT) +# define TC_EVCTRL_EVACT_PWP (6 << TC_EVCTRL_EVACT_SHIFT) + +/* Interrupt register bits */ + +#define TC_INT_OVF (1 << 0) +#define TC_INT_ERR (1 << 1) +#define TC_INT_SYNCRDY (1 << 3) +#define TC_INT_MC0 (1 << 4) +#define TC_INT_MC1 (1 << 5) + +/* Status register */ + +#define TC_STATUS_STOP (1 << 3) +#define TC_STATUS_SLAVE (1 << 4) +#define TC_STATUS_SYNCBUSY (1 << 7) + +/******************************************************************************************** + * Public Types + ********************************************************************************************/ + +/******************************************************************************************** + * Public Data + ********************************************************************************************/ + +/******************************************************************************************** + * Public Functions + ********************************************************************************************/ + +#endif /* CONFIG_ARCH_FAMILY_SAMD21 */ +#endif /* __ARCH_ARM_SRC_SAMDL_CHIP_SAMD_TC_H */ diff --git a/arch/arm/src/samdl/sam_dac.h b/arch/arm/src/samdl/sam_dac.h new file mode 100644 index 0000000000..b78afd36c1 --- /dev/null +++ b/arch/arm/src/samdl/sam_dac.h @@ -0,0 +1,77 @@ +/**************************************************************************** + * arch/arm/src/samdl/sam_dac.h + * + * Copyright (C) 2018 Gregory Nutt. All rights reserved. + * Author: Matt Thompson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __ARCH_ARM_SRC_SAMDL_SAM_DAC_H +#define __ARCH_ARM_SRC_SAMDL_SAM_DAC_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +#include "sam_config.h" +#include "sam_port.h" + +#if defined(CONFIG_ARCH_FAMILY_SAMD20) || defined(CONFIG_ARCH_FAMILY_SAMD21) +# include "chip/samd_dac.h" +#elif defined(CONFIG_ARCH_FAMILY_SAML21) +# include "chip/saml_dac.h" +#else +# error Unrecognized SAMD/L architecture +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + + +#undef EXTERN +#if defined(__cplusplus) +} +#endif +#endif /* __ARCH_ARM_SRC_SAMDL_SAM_DAC_H */ diff --git a/arch/arm/src/samdl/sam_evsys.h b/arch/arm/src/samdl/sam_evsys.h new file mode 100644 index 0000000000..13b41fa3e5 --- /dev/null +++ b/arch/arm/src/samdl/sam_evsys.h @@ -0,0 +1,76 @@ +/**************************************************************************** + * arch/arm/src/samdl/sam_evsys.h + * + * Copyright (C) 2018 Gregory Nutt. All rights reserved. + * Author: Matt Thompson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __ARCH_ARM_SRC_SAMDL_SAM_EVSYS_H +#define __ARCH_ARM_SRC_SAMDL_SAM_EVSYS_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +#include "sam_config.h" +#include "sam_port.h" + +#if defined(CONFIG_ARCH_FAMILY_SAMD20) || defined(CONFIG_ARCH_FAMILY_SAMD21) +# include "chip/samd_evsys.h" +#elif defined(CONFIG_ARCH_FAMILY_SAML21) +# include "chip/saml_evsys.h" +#else +# error Unrecognized SAMD/L architecture +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +#undef EXTERN +#if defined(__cplusplus) +} +#endif +#endif /* __ARCH_ARM_SRC_SAMDL_SAM_EVSYS_H */ diff --git a/arch/arm/src/samdl/samd_periphclks.h b/arch/arm/src/samdl/samd_periphclks.h index 0ba3df0f87..e5de81f754 100644 --- a/arch/arm/src/samdl/samd_periphclks.h +++ b/arch/arm/src/samdl/samd_periphclks.h @@ -75,7 +75,7 @@ #define sam_apbc_enableperiph(s) modifyreg32(SAM_PM_APBCMASK,0,s) #define sam_pac2_enableperiph() sam_apbc_enableperiph(PM_APBCMASK_PAC2) -#define sam_devsys_enableperiph() sam_apbc_enableperiph(PM_APBCMASK_EVSYS) +#define sam_evsys_enableperiph() sam_apbc_enableperiph(PM_APBCMASK_EVSYS) #define sam_sercom_enableperiph(n) sam_apbc_enableperiph(PM_APBCMASK_SERCOM(n)) #define sam_sercom0_enableperiph() sam_apbc_enableperiph(PM_APBCMASK_SERCOM0) #define sam_sercom1_enableperiph() sam_apbc_enableperiph(PM_APBCMASK_SERCOM1) @@ -135,7 +135,7 @@ #define sam_apbc_disableperiph(s) modifyreg32(SAM_PM_APBCMASK,s,0) #define sam_pac2_disableperiph() sam_apbc_disableperiph(PM_APBCMASK_PAC2) -#define sam_devsys_disableperiph() sam_apbc_disableperiph(PM_APBCMASK_EVSYS) +#define sam_evsys_disableperiph() sam_apbc_disableperiph(PM_APBCMASK_EVSYS) #define sam_sercom_disableperiph(n) sam_apbc_disableperiph(PM_APBCMASK_SERCOM(n)) #define sam_sercom0_disableperiph() sam_apbc_disableperiph(PM_APBCMASK_SERCOM0) #define sam_sercom1_disableperiph() sam_apbc_disableperiph(PM_APBCMASK_SERCOM1) @@ -195,7 +195,7 @@ #define sam_apbc_isenabled(s) (getreg32(SAM_PM_APBCMASK) & (s)) != 0) #define sam_pac2_isenabled() sam_apbc_isenabled(PM_APBCMASK_PAC2) -#define sam_devsys_isenabled() sam_apbc_isenabled(PM_APBCMASK_EVSYS) +#define sam_evsys_isenabled() sam_apbc_isenabled(PM_APBCMASK_EVSYS) #define sam_sercom_isenabled(n) sam_apbc_isenabled(PM_APBCMASK_SERCOM(n)) #define sam_sercom0_isenabled() sam_apbc_isenabled(PM_APBCMASK_SERCOM0) #define sam_sercom1_isenabled() sam_apbc_isenabled(PM_APBCMASK_SERCOM1) -- GitLab From 357455ff0f551be9cdd39fc43628541ea45862b3 Mon Sep 17 00:00:00 2001 From: Matt Thompson Date: Wed, 24 Jan 2018 19:23:11 -0800 Subject: [PATCH 109/228] fix typo --- arch/arm/src/samdl/chip/samd_tc.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm/src/samdl/chip/samd_tc.h b/arch/arm/src/samdl/chip/samd_tc.h index 02e502af8e..db3c72b835 100644 --- a/arch/arm/src/samdl/chip/samd_tc.h +++ b/arch/arm/src/samdl/chip/samd_tc.h @@ -153,10 +153,10 @@ #define TC_CTRLA_SWRST (1 << 0) /* Bit 0: Software reset */ #define TC_CTRLA_ENABLE (1 << 1) /* Bit 1: Enable */ #define TC_CTRLA_MODE_SHIFT (2) -#define TC_CTRLA_MODE_MASK (3 << TC_CTRLA_SHIFT) -# define TC_CTRLA_MODE_COUNT16 (0 << TC_CTRLA_SHIFT) -# define TC_CTRLA_MODE_COUNT8 (1 << TC_CTRLA_SHIFT) -# define TC_CTRLA_MODE_COUNT32 (2 << TC_CTRLA_SHIFT) +#define TC_CTRLA_MODE_MASK (3 << TC_CTRLA_MODE_SHIFT) +# define TC_CTRLA_MODE_COUNT16 (0 << TC_CTRLA_MODE_SHIFT) +# define TC_CTRLA_MODE_COUNT8 (1 << TC_CTRLA_MODE_SHIFT) +# define TC_CTRLA_MODE_COUNT32 (2 << TC_CTRLA_MODE_SHIFT) #define TC_CTRLA_WAVEGEN_SHIFT (5) #define TC_CTRLA_WAVEGEN_MASK (3 << TC_CTRLA_WAVEGEN_SHIFT) # define TC_CTRLA_WAVEGEN_NFRQ (0 << TC_CTRLA_WAVEGEN_SHIFT) -- GitLab From 92448a1053dbf50a409c36c4284bdc597508d2b7 Mon Sep 17 00:00:00 2001 From: Matt Thompson Date: Wed, 24 Jan 2018 19:33:06 -0800 Subject: [PATCH 110/228] added missing EVCTRL register bits in TC --- arch/arm/src/samdl/chip/samd_tc.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm/src/samdl/chip/samd_tc.h b/arch/arm/src/samdl/chip/samd_tc.h index db3c72b835..fe3d2c4059 100644 --- a/arch/arm/src/samdl/chip/samd_tc.h +++ b/arch/arm/src/samdl/chip/samd_tc.h @@ -218,6 +218,11 @@ # define TC_EVCTRL_EVACT_START (3 << TC_EVCTRL_EVACT_SHIFT) # define TC_EVCTRL_EVACT_PPW (5 << TC_EVCTRL_EVACT_SHIFT) # define TC_EVCTRL_EVACT_PWP (6 << TC_EVCTRL_EVACT_SHIFT) +#define TC_EVCTRL_TCINV (1 << 4) +#define TC_EVCTRL_TCEI (1 << 5) +#define TC_EVCTRL_OVFEO (1 << 8) +#define TC_EVCTRL_MCEO0 (1 << 12) +#define TC_EVCTRL_MCEO1 (1 << 13) /* Interrupt register bits */ -- GitLab From d314feab82a4bd20ab9b7d3f4e988e5f285b8cf7 Mon Sep 17 00:00:00 2001 From: Matt Thompson Date: Thu, 25 Jan 2018 11:55:40 +0000 Subject: [PATCH 111/228] Merged in extent3d/nuttx (pull request #582) SAMDL: Added SAMD DAC header file. Fixed SAMD EVSYS header. Added SAMD TC header file. Fixed some minor typos * SAMD External Interrupt Controller (EIC) support * removed comment * SAMDL: SPI must be disabled before changing the mode bits in CTRLA register * arch/arm/src/lc823450: Assign I2S IRQ handling to CPU0 Previous commit assumed that the caller is running on CPU0. However, the caller sometimes runs at CPU1. This patch will assign the caller to CPU0 explicitly. Signed-off-by: Masayuki Ishikawa * arch/arm/src/lc823450: Change irqwarn() to ASSERT() in up_ack_irq() Signed-off-by: Masayuki Ishikawa * configs/lc823450-xgevk: Update README.txt and defconfigs Update comments on SMP in README.txt Enable SYSTEM_TIME64 in defconfigs. Enable INSTRUMENTATION in rndis configuration. Signed-off-by: Masayuki Ishikawa * configst/stm3240g-eval: Remove only bogus logic to start the NX server. That was there only to support the knxwm configuration and was implemented priorit to boardctl(BOARCIOC_NX_START). * drivers/input/ft5x06.c: Remove cool logic to disable polling when there there is no client waiting for read data. That was a great idea to save CPU cycles when there is nothing reading from the touchscrren but, unfortunately, does not work with readers that open the driver in non-blocking mode. So I think we just have to eat the CPUs even when there is nothing waiting for touchscreen input. * configs/lpcxpresso-lpc54628/lvgl: Add LittlevGL graphics demo configuration. * configs/lpcxpresso-lpc54628: Update README * include/termios.h: Update comments; fix long lines. * sched/semaphore: Add ASSERT(false) in nxsem_post() if no waiting task is found. Signed-off-by: Masayuki Ishikawa * sched/sched/sched_sporadic.c: fix compiler error when priority inheritance is enabled. Noted by eunb.song@samsung.com * Change ASSERT(false) to DEBUGPANIC(). * Documentation: Fix copy/paste error in NX graphics document. Noted by Henjiu Kang. * sched/sched: Fix some priority inheritance related issues noted during review of logic. Also add some REVISIT comments for some issues noted in the design. * Update README and some comments * Issue #85: /dev/userleds is not working for nucleo-l432kc fixed * configs/nucleo-l432kc: Fix numerous cloning errors/typos. * Update TODO list * NUCLEO F432KC typo fixed, correct name is L432KC Just README.txt and comments affected, no changes in the code * Merged in raiden00/nuttx (pull request #579) Master * stm32_hritm: add interface to get timer clock frequency stm32_hrtim: fix timer freq calculation stm32_hrtim: add compar/capture registers significant bits checking stm32_hrtim: minor changes * stm32f334-disco: add buck converter and boost converter logic Approved-by: Gregory Nutt * fs/userfs: use correct req type in userfs_truncate, remove use of undeclared buf * Merged in david_alessio/nuttx/refactor-pll-setup (pull request #581) Refactor pll setup * fix typo in #def * refactor PLL setup code... * refactored PLL/CLK config, easier, checks for correctness * call go_os_start if STACK_COLORIZED * smarter config of EXTCLK output freq * cosmetic Approved-by: Gregory Nutt * The existence of the network driver ioctl() method should depend on CONFIG_NETDEV_IOCTL rather than CONFIG_NETDEV_PHY_IOCTL. The former enables the method, the later enables a subset of possible driver IOCTLs. This change should be basically a no-operation. The affected ioctl methods only support those subset of driver IOCTLs selected by CONFIG_NETDEV_PHY_IOCTL and the network logic will tolerate a nul ioctl method. * net/tcp: Write buffering logic should not wait for a free buffer if the socket was opened non-blocking. Also, rename the TCP write buffering macros from WRB_* to TCPWB_* to make room in the namespace for write buffering with other protocols. * net/udp: Remove some conditional logic that was true if there is only a single network device, but not true in the multi-device context. * This commit adds an as-of-yet untested implemented of UDP write buffering. Squashed commit of the following: net/udp: Address most of the issues with UDP write buffering. There is a remaining issue with handling one network going down in a multi-network environment. None of this has been test but it is certainly ready for test. Hence, the feature is marked EXPERIMENTAL. net/udp: Some baby steps toward a corrected write buffering design. net/udp: Remove pesky write buffer macros. Eliminate trailing space at the end of lines. net/udp: A little more UDP write buffering logic. Still at least on big gaping hole in the design. net/udp: Undefined CONFIG_NET_SENDTO_TIMEOUT. net/udp: Crude, naive port of the TCP write buffering logic into UDP. This commit is certainly non-functional and is simply a starting point for the implementatin of UDP write buffering. net/udp: Rename udp/udp_psock_sendto.c udp/udp_psock_sendto_unbuffered.c. * net/udp: In sendto(), return EHOSTUNREACH if if the network is down. * net/udp: Resolves final design issues with UDP write buffering. 100% code complete but also 100% untested. * net/udp and tcp: Yet another (cosmetic) change to UDP and TCP write buffer macro naming. * net/udp: UDP write buffering is basically functional but needs a lot more verification. * net/udp: Fix memory leak with UDP + write buffer is closed. Also update TODO and comments and refresh a configuration. * Update some comments. * drivers/mtd/at24xx.c: Correct page size for AT24C02 part. * arch/arm/src/stm32: Make STM32 usable with an external RTC. drivers/timers/ds3231.c: Correct some debug statments. * arch/arm/src/stm32/stm32_spi.c: Removed unnecessary (and incorrect) speed limitation * arch/arm/src/stm32/stm32f40xxx_i2c.c: Correct some recent changes to STM32F4 I2C that broke poll mode of operation. * configs/flipnclick-sam3x: Using JTAG (vs. Bossac) I was finally able to load code and verify the basic NSH configuration. Updated READMEs. Also switched to USART0 (vs UART0) for the serial console because I was not getting bi-directional communication on the VCOM. * SAMDL: Added SAMD DAC header file. Fixed SAMD EVSYS header. Added SAMD TC header file. Fixed some minor typos * fix typo * added missing EVCTRL register bits in TC Approved-by: Gregory Nutt --- arch/arm/src/samdl/chip/samd_dac.h | 136 ++++++++++++++ arch/arm/src/samdl/chip/samd_evsys.h | 34 ++-- arch/arm/src/samdl/chip/samd_tc.h | 254 +++++++++++++++++++++++++++ arch/arm/src/samdl/sam_dac.h | 77 ++++++++ arch/arm/src/samdl/sam_evsys.h | 76 ++++++++ arch/arm/src/samdl/samd_periphclks.h | 6 +- 6 files changed, 565 insertions(+), 18 deletions(-) create mode 100644 arch/arm/src/samdl/chip/samd_dac.h create mode 100644 arch/arm/src/samdl/chip/samd_tc.h create mode 100644 arch/arm/src/samdl/sam_dac.h create mode 100644 arch/arm/src/samdl/sam_evsys.h diff --git a/arch/arm/src/samdl/chip/samd_dac.h b/arch/arm/src/samdl/chip/samd_dac.h new file mode 100644 index 0000000000..274cab701e --- /dev/null +++ b/arch/arm/src/samdl/chip/samd_dac.h @@ -0,0 +1,136 @@ +/******************************************************************************************** + * arch/arm/src/samdl/chip/saml_dac.h + * + * Copyright (C) 2015 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * References: + * "Atmel SAM L21E / SAM L21G / SAM L21J Smart ARM-Based Microcontroller + * Datasheet", Atmel-42385C-SAML21_Datasheet_Preliminary-03/20/15 + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ********************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_SAMDL_CHIP_SAMD_DAC_H +#define __ARCH_ARM_SRC_SAMDL_CHIP_SAMD_DAC_H + +/******************************************************************************************** + * Included Files + ********************************************************************************************/ + +#include + +#include "chip.h" + +#ifdef CONFIG_ARCH_FAMILY_SAMD21 + +/******************************************************************************************** + * Pre-processor Definitions + ********************************************************************************************/ +/* DAC register offsets ********************************************************************/ + +#define SAM_DAC_CTRLA_OFFSET 0x0000 /* Control A Register */ +#define SAM_DAC_CTRLB_OFFSET 0x0001 /* Control B Register */ +#define SAM_DAC_EVCTRL_OFFSET 0x0002 /* Event Control Register */ +#define SAM_DAC_INTENCLR_OFFSET 0x0004 /* Interrupt Enable Clear Register */ +#define SAM_DAC_INTENSET_OFFSET 0x0005 /* Interrupt Enable Set Register */ +#define SAM_DAC_INTFLAG_OFFSET 0x0006 /* Interrupt Flag Status and Clear Register */ +#define SAM_DAC_STATUS_OFFSET 0x0007 /* Status Register */ +#define SAM_DAC_DATA0_OFFSET 0x0008 /* Data DAC0 Register */ +#define SAM_DAC_DATA1_OFFSET 0x0009 /* Data DAC1 Register */ +#define SAM_DAC_DATABUF0_OFFSET 0x000C /* Data Buffer DAC0 Register */ +#define SAM_DAC_DATABUF1_OFFSET 0x000D /* Data Buffer DAC1 Register */ + +/* DAC register addresses ******************************************************************/ + +#define SAM_DAC_CTRLA (SAM_DAC_BASE+SAM_DAC_CTRLA_OFFSET) +#define SAM_DAC_CTRLB (SAM_DAC_BASE+SAM_DAC_CTRLB_OFFSET) +#define SAM_DAC_EVCTRL (SAM_DAC_BASE+SAM_DAC_EVCTRL_OFFSET) +#define SAM_DAC_INTENCLR (SAM_DAC_BASE+SAM_DAC_INTENCLR_OFFSET) +#define SAM_DAC_INTENSET (SAM_DAC_BASE+SAM_DAC_INTENSET_OFFSET) +#define SAM_DAC_INTFLAG (SAM_DAC_BASE+SAM_DAC_INTFLAG_OFFSET) +#define SAM_DAC_STATUS (SAM_DAC_BASE+SAM_DAC_STATUS_OFFSET) +#define SAM_DAC_DATA0 (SAM_DAC_BASE+SAM_DAC_DATA0_OFFSET) +#define SAM_DAC_DATA1 (SAM_DAC_BASE+SAM_DAC_DATA1_OFFSET) +#define SAM_DAC_DATABUF0 (SAM_DAC_BASE+SAM_DAC_DATABUF0_OFFSET) +#define SAM_DAC_DATABUF1 (SAM_DAC_BASE+SAM_DAC_DATABUF1_OFFSET) + +/* DAC register bit definitions ************************************************************/ + +/* Control A Register */ + +#define DAC_CTRLA_SWRTS (1 << 0) /* Bit 0: Software reset */ +#define DAC_CTRLA_ENABLE (1 << 1) /* Bit 1: Enable DAC controller */ +#define DAC_CTRLA_RUNSTDBY (1 << 2) /* Bit 1: Run in standby */ + +/* Control B Register */ + +#define DAC_CTRLB_EOEN (1 << 0) /* Bit 0: External Output Enable (to Vout) */ +#define DAC_CTRLB_IOEN (1 << 1) /* Bit 1: Internal Output Enable (to analog comparator) */ +#define DAC_CTRLB_LEFTADJ (1 << 2) /* Bit 2: Left-Adjusted Data */ +#define DAC_CTRLB_VPD (1 << 3) /* Bit 3: Voltage Pump Disabled */ +#define DAC_CTRLB_BDWP (1 << 4) /* Bit 4: Bypass DATABUF Write protection */ +#define DAC_CTRLB_REFSEL_SHIFT (6) /* Bit 7:6: Reference selection */ +#define DAC_CTRLB_REFSEL_MASK (3 << DAC_CTRLB_REFSEL_SHIFT) +# define DAC_CTRLB_REFSEL_INTREF (0 << DAC_CTRLB_REFSEL_SHIFT) /* Internal voltage reference */ +# define DAC_CTRLB_REFSEL_VDDANA (1 << DAC_CTRLB_REFSEL_SHIFT) /* Analog voltage supply */ +# define DAC_CTRLB_REFSEL_VREFA (2 << DAC_CTRLB_REFSEL_SHIFT) /* External voltage reference */ + +/* Event Control Register */ + +#define DAC_EVCTRL_STARTEI (1 << 0) /* Bit 0: Start conversion event input */ +#define DAC_EVCTRL_EMPTYEO (1 << 1) /* Bit 1: Data buffer empty event output */ + +/* Common bit definitions for Interrupt Enable Clear Register, Interrupt Enable Set + * Register, and Interrupt Flag Status and Clear Register + */ + +#define DAC_INT_UNDERRUN (1 << 0) /* Bit 0: Underrun interrupt */ +#define DAC_INT_EMPTY (1 << 1) /* Bit 1: Data buffer empty interrupt */ +#define DAC_INT_SYNCRDY (1 << 2) /* Bit 2: Sync ready */ +#define DAC_INT_ALL 0x07 + +/* Status Register */ + +#define DAC_STATUS_SYNCBUSY (1 << 7) /* Bit 0: Sync busy */ + +/******************************************************************************************** + * Public Types + ********************************************************************************************/ + +/******************************************************************************************** + * Public Data + ********************************************************************************************/ + +/******************************************************************************************** + * Public Functions + ********************************************************************************************/ + +#endif /* CONFIG_ARCH_FAMILY_SAMD21 */ +#endif /* __ARCH_ARM_SRC_SAMDL_CHIP_SAMD_DAC_H */ diff --git a/arch/arm/src/samdl/chip/samd_evsys.h b/arch/arm/src/samdl/chip/samd_evsys.h index e1489a2622..84ea384f09 100644 --- a/arch/arm/src/samdl/chip/samd_evsys.h +++ b/arch/arm/src/samdl/chip/samd_evsys.h @@ -68,9 +68,9 @@ #define SAM_EVSYS_CTRL (SAM_EVSYS_BASE+SAM_EVSYS_CTRL_OFFSET) #define SAM_EVSYS_CHANNEL (SAM_EVSYS_BASE+SAM_EVSYS_CHANNEL_OFFSET) #define SAM_EVSYS_USER (SAM_EVSYS_BASE+SAM_EVSYS_USER_OFFSET) -#define SAM_EVSYS_CHSTATUS (SAM_EVSYS_BASE+SAM_EVSYS_CHSTATUS_OFFSET -#define SAM_EVSYS_INTENCLR (SAM_EVSYS_BASE+SAM_EVSYS_INTENCLR_OFFSET -#define SAM_EVSYS_INTENSET (SAM_EVSYS_BASE+SAM_EVSYS_INTENSET_OFFSET +#define SAM_EVSYS_CHSTATUS (SAM_EVSYS_BASE+SAM_EVSYS_CHSTATUS_OFFSET) +#define SAM_EVSYS_INTENCLR (SAM_EVSYS_BASE+SAM_EVSYS_INTENCLR_OFFSET) +#define SAM_EVSYS_INTENSET (SAM_EVSYS_BASE+SAM_EVSYS_INTENSET_OFFSET) #define SAM_EVSYS_INTFLAG (SAM_EVSYS_BASE+SAM_EVSYS_INTFLAG_OFFSET) /* EVSYS register bit definitions ***********************************************************/ @@ -302,12 +302,14 @@ /* Channel status register */ -#define EVSYS_CHSTATUS_USRRDY_SHIFT (0) /* Bits 0-7: User Ready for Channel n, n=0-7 */ -#define EVSYS_CHSTATUS_USRRDY_MASK (0xff << EVSYS_CHSTATUS_USRRDY_SHIFT) -# define EVSYS_CHSTATUS_USRRDY(n) (1 << (n)) -#define EVSYS_CHSTATUS_CHBUSY_SHIFT (8) /* Bits 8-15: Channel Busy n, n=0-7 */ -#define EVSYS_CHSTATUS_CHBUSY_MASK (0xff << EVSYS_CHSTATUS_CHBUSY_SHIFT) -# define EVSYS_CHSTATUS_CHBUSY(n) (1 << ((n) + 8)) +#ifdef CONFIG_ARCH_FAMILY_SAMD20 +# define EVSYS_CHSTATUS_USRRDY_SHIFT (0) /* Bits 0-7: User Ready for Channel n, n=0-7 */ +# define EVSYS_CHSTATUS_USRRDY_MASK (0xff << EVSYS_CHSTATUS_USRRDY_SHIFT) +# define EVSYS_CHSTATUS_USRRDY(n) (1 << (n)) +# define EVSYS_CHSTATUS_CHBUSY_SHIFT (8) /* Bits 8-15: Channel Busy n, n=0-7 */ +# define EVSYS_CHSTATUS_CHBUSY_MASK (0xff << EVSYS_CHSTATUS_CHBUSY_SHIFT) +# define EVSYS_CHSTATUS_CHBUSY(n) (1 << ((n) + 8)) +#endif #ifdef CONFIG_ARCH_FAMILY_SAMD21 # define EVSYS_CHSTATUS_USRRDYH_SHIFT (16) /* Bits 16-19: User Ready for Channel n, n=8-11 */ @@ -320,12 +322,14 @@ /* Interrupt enable clear, interrupt enable set, and interrupt flag status and clear registers */ -#define EVSYS_INT_OVR_SHIFT (0) /* Bits 0-7: Overrun channel n interrupt, n=0-7 */ -#define EVSYS_INT_OVR_MASK (0xff << EVSYS_INT_OVR_SHIFT) -# define EVSYS_INT_OVR(n) (1 << (n)) -#define EVSYS_INT_EVD_SHIFT (8) /* Bits 8-15: Event detected channel n interrupt, n=0-7 */ -#define EVSYS_INT_EVD_MASK (0xff << EVSYS_INT_EVD_SHIFT) -# define EVSYS_INT_EVD(n) (1 << ((n) + 8)) +#ifdef CONFIG_ARCH_FAMILY_SAMD20 +# define EVSYS_INT_OVR_SHIFT (0) /* Bits 0-7: Overrun channel n interrupt, n=0-7 */ +# define EVSYS_INT_OVR_MASK (0xff << EVSYS_INT_OVR_SHIFT) +# define EVSYS_INT_OVR(n) (1 << (n)) +# define EVSYS_INT_EVD_SHIFT (8) /* Bits 8-15: Event detected channel n interrupt, n=0-7 */ +# define EVSYS_INT_EVD_MASK (0xff << EVSYS_INT_EVD_SHIFT) +# define EVSYS_INT_EVD(n) (1 << ((n) + 8)) +#endif #ifdef CONFIG_ARCH_FAMILY_SAMD21 # define EVSYS_INT_OVR_SHIFT (16) /* Bits 16-19: Overrun channel n interrupt, n=8-11 */ diff --git a/arch/arm/src/samdl/chip/samd_tc.h b/arch/arm/src/samdl/chip/samd_tc.h new file mode 100644 index 0000000000..fe3d2c4059 --- /dev/null +++ b/arch/arm/src/samdl/chip/samd_tc.h @@ -0,0 +1,254 @@ +/******************************************************************************************** + * arch/arm/src/samdl/chip/samd_tc.h + * + * Copyright (C) 2018 Gregory Nutt. All rights reserved. + * Author: Matt Thompson + * + * References: + * "Microchip SAMD21 datasheet" + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ********************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_SAMDL_CHIP_SAMD_TC_H +#define __ARCH_ARM_SRC_SAMDL_CHIP_SAMD_TC_H + +/******************************************************************************************** + * Included Files + ********************************************************************************************/ + +#include + +#include "chip.h" + +#ifdef CONFIG_ARCH_FAMILY_SAMD21 + +/******************************************************************************************** + * Pre-processor Definitions + ********************************************************************************************/ +/* TC register offsets *********************************************************************/ + +#define SAM_TC_CTRLA_OFFSET 0x0000 /* Control A register */ +#define SAM_TC_READREQ_OFFSET 0x0002 /* Read request register */ +#define SAM_TC_CTRLBCLR_OFFSET 0x0004 /* Control B clear register */ +#define SAM_TC_CTRLBSET_OFFSET 0x0005 /* Control B clear register */ +#define SAM_TC_CTRLC_OFFSET 0x0006 /* Control C register */ +#define SAM_TC_DBGCTRL_OFFSET 0x0008 /* Debug control register */ +#define SAM_TC_EVCTRL_OFFSET 0x000A /* Event control register */ +#define SAM_TC_INTENCLR_OFFSET 0x000C /* Interrupt enable clear register */ +#define SAM_TC_INTENSET_OFFSET 0x000D /* Interrupt enable set register */ +#define SAM_TC_INTFLAG_OFFSET 0x000E /* Interrupt flag register */ +#define SAM_TC_STATUS_OFFSET 0x000F /* Status register */ +#define SAM_TC_COUNT_OFFSET 0x0010 /* Count register */ +#define SAM_TC_CC0_OFFSET 0x0018 /* Capture Compare 0 register */ +#define SAM_TC_CC1_OFFSET 0x001C /* Capture Compare 1 register */ + +/* TC register addresses *******************************************************************/ + +#define SAM_TC3_CTRLA (SAM_TC3_BASE+SAM_TC_CTRLA_OFFSET) +#define SAM_TC3_READREQ (SAM_TC3_BASE+SAM_TC_READREQ_OFFSET) +#define SAM_TC3_CTRLBCLR (SAM_TC3_BASE+SAM_TC_CTRLBCLR_OFFSET) +#define SAM_TC3_CTRLBSET (SAM_TC3_BASE+SAM_TC_CTRLBSET_OFFSET) +#define SAM_TC3_CTRLC (SAM_TC3_BASE+SAM_TC_CTRLC_OFFSET) +#define SAM_TC3_DBGCTRL (SAM_TC3_BASE+SAM_TC_DBGCTRL_OFFSET) +#define SAM_TC3_EVCTRL (SAM_TC3_BASE+SAM_TC_EVCTRL_OFFSET) +#define SAM_TC3_INTENCLR (SAM_TC3_BASE+SAM_TC_INTENCLR_OFFSET) +#define SAM_TC3_INTENSET (SAM_TC3_BASE+SAM_TC_INTENSET_OFFSET) +#define SAM_TC3_INTFLAG (SAM_TC3_BASE+SAM_TC_INTFLAG_OFFSET) +#define SAM_TC3_STATUS (SAM_TC3_BASE+SAM_TC_STATUS_OFFSET) +#define SAM_TC3_COUNT (SAM_TC3_BASE+SAM_TC_COUNT_OFFSET) +#define SAM_TC3_CC0 (SAM_TC3_BASE+SAM_TC_CC0_OFFSET) +#define SAM_TC3_CC1 (SAM_TC3_BASE+SAM_TC_CC1_OFFSET) + +#define SAM_TC4_CTRLA (SAM_TC4_BASE+SAM_TC_CTRLA_OFFSET) +#define SAM_TC4_READREQ (SAM_TC4_BASE+SAM_TC_READREQ_OFFSET) +#define SAM_TC4_CTRLBCLR (SAM_TC4_BASE+SAM_TC_CTRLBCLR_OFFSET) +#define SAM_TC4_CTRLBSET (SAM_TC4_BASE+SAM_TC_CTRLBSET_OFFSET) +#define SAM_TC4_CTRLC (SAM_TC4_BASE+SAM_TC_CTRLC_OFFSET) +#define SAM_TC4_DBGCTRL (SAM_TC4_BASE+SAM_TC_DBGCTRL_OFFSET) +#define SAM_TC4_EVCTRL (SAM_TC4_BASE+SAM_TC_EVCTRL_OFFSET) +#define SAM_TC4_INTENCLR (SAM_TC4_BASE+SAM_TC_INTENCLR_OFFSET) +#define SAM_TC4_INTENSET (SAM_TC4_BASE+SAM_TC_INTENSET_OFFSET) +#define SAM_TC4_INTFLAG (SAM_TC4_BASE+SAM_TC_INTFLAG_OFFSET) +#define SAM_TC4_STATUS (SAM_TC4_BASE+SAM_TC_STATUS_OFFSET) +#define SAM_TC4_COUNT (SAM_TC4_BASE+SAM_TC_COUNT_OFFSET) +#define SAM_TC4_CC0 (SAM_TC4_BASE+SAM_TC_CC0_OFFSET) +#define SAM_TC4_CC1 (SAM_TC4_BASE+SAM_TC_CC1_OFFSET) + +#define SAM_TC5_CTRLA (SAM_TC5_BASE+SAM_TC_CTRLA_OFFSET) +#define SAM_TC5_READREQ (SAM_TC5_BASE+SAM_TC_READREQ_OFFSET) +#define SAM_TC5_CTRLBCLR (SAM_TC5_BASE+SAM_TC_CTRLBCLR_OFFSET) +#define SAM_TC5_CTRLBSET (SAM_TC5_BASE+SAM_TC_CTRLBSET_OFFSET) +#define SAM_TC5_CTRLC (SAM_TC5_BASE+SAM_TC_CTRLC_OFFSET) +#define SAM_TC5_DBGCTRL (SAM_TC5_BASE+SAM_TC_DBGCTRL_OFFSET) +#define SAM_TC5_EVCTRL (SAM_TC5_BASE+SAM_TC_EVCTRL_OFFSET) +#define SAM_TC5_INTENCLR (SAM_TC5_BASE+SAM_TC_INTENCLR_OFFSET) +#define SAM_TC5_INTENSET (SAM_TC5_BASE+SAM_TC_INTENSET_OFFSET) +#define SAM_TC5_INTFLAG (SAM_TC5_BASE+SAM_TC_INTFLAG_OFFSET) +#define SAM_TC5_STATUS (SAM_TC5_BASE+SAM_TC_STATUS_OFFSET) +#define SAM_TC5_COUNT (SAM_TC5_BASE+SAM_TC_COUNT_OFFSET) +#define SAM_TC5_CC0 (SAM_TC5_BASE+SAM_TC_CC0_OFFSET) +#define SAM_TC5_CC1 (SAM_TC5_BASE+SAM_TC_CC1_OFFSET) + +#define SAM_TC6_CTRLA (SAM_TC6_BASE+SAM_TC_CTRLA_OFFSET) +#define SAM_TC6_READREQ (SAM_TC6_BASE+SAM_TC_READREQ_OFFSET) +#define SAM_TC6_CTRLBCLR (SAM_TC6_BASE+SAM_TC_CTRLBCLR_OFFSET) +#define SAM_TC6_CTRLBSET (SAM_TC6_BASE+SAM_TC_CTRLBSET_OFFSET) +#define SAM_TC6_CTRLC (SAM_TC6_BASE+SAM_TC_CTRLC_OFFSET) +#define SAM_TC6_DBGCTRL (SAM_TC6_BASE+SAM_TC_DBGCTRL_OFFSET) +#define SAM_TC6_EVCTRL (SAM_TC6_BASE+SAM_TC_EVCTRL_OFFSET) +#define SAM_TC6_INTENCLR (SAM_TC6_BASE+SAM_TC_INTENCLR_OFFSET) +#define SAM_TC6_INTENSET (SAM_TC6_BASE+SAM_TC_INTENSET_OFFSET) +#define SAM_TC6_INTFLAG (SAM_TC6_BASE+SAM_TC_INTFLAG_OFFSET) +#define SAM_TC6_STATUS (SAM_TC6_BASE+SAM_TC_STATUS_OFFSET) +#define SAM_TC6_COUNT (SAM_TC6_BASE+SAM_TC_COUNT_OFFSET) +#define SAM_TC6_CC0 (SAM_TC6_BASE+SAM_TC_CC0_OFFSET) +#define SAM_TC6_CC1 (SAM_TC6_BASE+SAM_TC_CC1_OFFSET) + +#define SAM_TC7_CTRLA (SAM_TC7_BASE+SAM_TC_CTRLA_OFFSET) +#define SAM_TC7_READREQ (SAM_TC7_BASE+SAM_TC_READREQ_OFFSET) +#define SAM_TC7_CTRLBCLR (SAM_TC7_BASE+SAM_TC_CTRLBCLR_OFFSET) +#define SAM_TC7_CTRLBSET (SAM_TC7_BASE+SAM_TC_CTRLBSET_OFFSET) +#define SAM_TC7_CTRLC (SAM_TC7_BASE+SAM_TC_CTRLC_OFFSET) +#define SAM_TC7_DBGCTRL (SAM_TC7_BASE+SAM_TC_DBGCTRL_OFFSET) +#define SAM_TC7_EVCTRL (SAM_TC7_BASE+SAM_TC_EVCTRL_OFFSET) +#define SAM_TC7_INTENCLR (SAM_TC7_BASE+SAM_TC_INTENCLR_OFFSET) +#define SAM_TC7_INTENSET (SAM_TC7_BASE+SAM_TC_INTENSET_OFFSET) +#define SAM_TC7_INTFLAG (SAM_TC7_BASE+SAM_TC_INTFLAG_OFFSET) +#define SAM_TC7_STATUS (SAM_TC7_BASE+SAM_TC_STATUS_OFFSET) +#define SAM_TC7_COUNT (SAM_TC7_BASE+SAM_TC_COUNT_OFFSET) +#define SAM_TC7_CC0 (SAM_TC7_BASE+SAM_TC_CC0_OFFSET) +#define SAM_TC7_CC1 (SAM_TC7_BASE+SAM_TC_CC1_OFFSET) + +/* TC register bit definitions *************************************************************/ + +/* Control A register */ + +#define TC_CTRLA_SWRST (1 << 0) /* Bit 0: Software reset */ +#define TC_CTRLA_ENABLE (1 << 1) /* Bit 1: Enable */ +#define TC_CTRLA_MODE_SHIFT (2) +#define TC_CTRLA_MODE_MASK (3 << TC_CTRLA_MODE_SHIFT) +# define TC_CTRLA_MODE_COUNT16 (0 << TC_CTRLA_MODE_SHIFT) +# define TC_CTRLA_MODE_COUNT8 (1 << TC_CTRLA_MODE_SHIFT) +# define TC_CTRLA_MODE_COUNT32 (2 << TC_CTRLA_MODE_SHIFT) +#define TC_CTRLA_WAVEGEN_SHIFT (5) +#define TC_CTRLA_WAVEGEN_MASK (3 << TC_CTRLA_WAVEGEN_SHIFT) +# define TC_CTRLA_WAVEGEN_NFRQ (0 << TC_CTRLA_WAVEGEN_SHIFT) +# define TC_CTRLA_WAVEGEN_MFRQ (1 << TC_CTRLA_WAVEGEN_SHIFT) +# define TC_CTRLA_WAVEGEN_NPWM (2 << TC_CTRLA_WAVEGEN_SHIFT) +# define TC_CTRLA_WAVEGEN_MPWM (3 << TC_CTRLA_WAVEGEN_SHIFT) +#define TC_CTRLA_PRESCALER_SHIFT (8) +#define TC_CTRLA_PRESCALER_MASK (7 << TC_CTRLA_PRESCALER_SHIFT) +# define TC_CTRLA_PRESCALER_DIV1 (0 << TC_CTRLA_PRESCALER_SHIFT) +# define TC_CTRLA_PRESCALER_DIV2 (1 << TC_CTRLA_PRESCALER_SHIFT) +# define TC_CTRLA_PRESCALER_DIV4 (2 << TC_CTRLA_PRESCALER_SHIFT) +# define TC_CTRLA_PRESCALER_DIV8 (3 << TC_CTRLA_PRESCALER_SHIFT) +# define TC_CTRLA_PRESCALER_DIV16 (4 << TC_CTRLA_PRESCALER_SHIFT) +# define TC_CTRLA_PRESCALER_DIV64 (5 << TC_CTRLA_PRESCALER_SHIFT) +# define TC_CTRLA_PRESCALER_DIV256 (6 << TC_CTRLA_PRESCALER_SHIFT) +# define TC_CTRLA_PRESCALER_DIV1024 (7 << TC_CTRLA_PRESCALER_SHIFT) +#define TC_CTRLA_RUNSTDBY (1 << 11) +#define TC_CTRLA_PRESCSYNC_SHIFT (12) +#define TC_CTRLA_PRESCSYNC_MASK (3 << TC_CTRLA_PRESCSYNC_SHIFT) +# define TC_CTRLA_PRESCSYNC_GCLK (0 << TC_CTRLA_PRESCSYNC_SHIFT) +# define TC_CTRLA_PRESCSYNC_PRESC (1 << TC_CTRLA_PRESCSYNC_SHIFT) +# define TC_CTRLA_PRESCSYNC_RESYNC (2 << TC_CTRLA_PRESCSYNC_SHIFT) + +/* Read Request register */ + +#define TC_READREQ_ADDR_SHIFT (0) +#define TC_READREQ_ADDR_MASK (0x1F << TC_READREQ_ADDR_SHIFT) +#define TC_READREQ_RCONT (1 << 14) +#define TC_READREQ_RREQ (1 << 15) + +/* Control B Set/Clear register */ + +#define TC_CTRLB_DIR (1 << 0) +#define TC_CTRLB_ONESHOT (1 << 2) +#define TC_CTRLB_CMD_SHIFT (6) +#define TC_CTRLB_CMD_MASK (3 << TC_CTRLBCLR_CMD_SHIFT) +# define TC_CTRLB_CMD_NONE (0 << TC_CTRLBCLR_CMD_SHIFT) +# define TC_CTRLB_CMD_RETRIGGER (1 << TC_CTRLBCLR_CMD_SHIFT) +# define TC_CTRLB_CMD_STOP (2 << TC_CTRLBCLR_CMD_SHIFT) + +/* Control C register */ + +#define TC_CTRLC_INVEN0 (1 << 0) +#define TC_CTRLC_INVEN1 (1 << 1) +#define TC_CTRLC_CPTEN0 (1 << 4) +#define TC_CTRLC_CPTEN1 (1 << 5) + +/* Debug control register */ + +#define TC_DBGCTRL_DBGRUN (1 << 0) + +/* Event control register */ + +#define TC_EVCTRL_EVACT_SHIFT (0) +#define TC_EVCTRL_EVACT_MASK (7 << TC_EVCTRL_EVACT_SHIFT) +# define TC_EVCTRL_EVACT_OFF (0 << TC_EVCTRL_EVACT_SHIFT) +# define TC_EVCTRL_EVACT_RETRIGGER (1 << TC_EVCTRL_EVACT_SHIFT) +# define TC_EVCTRL_EVACT_COUNT (2 << TC_EVCTRL_EVACT_SHIFT) +# define TC_EVCTRL_EVACT_START (3 << TC_EVCTRL_EVACT_SHIFT) +# define TC_EVCTRL_EVACT_PPW (5 << TC_EVCTRL_EVACT_SHIFT) +# define TC_EVCTRL_EVACT_PWP (6 << TC_EVCTRL_EVACT_SHIFT) +#define TC_EVCTRL_TCINV (1 << 4) +#define TC_EVCTRL_TCEI (1 << 5) +#define TC_EVCTRL_OVFEO (1 << 8) +#define TC_EVCTRL_MCEO0 (1 << 12) +#define TC_EVCTRL_MCEO1 (1 << 13) + +/* Interrupt register bits */ + +#define TC_INT_OVF (1 << 0) +#define TC_INT_ERR (1 << 1) +#define TC_INT_SYNCRDY (1 << 3) +#define TC_INT_MC0 (1 << 4) +#define TC_INT_MC1 (1 << 5) + +/* Status register */ + +#define TC_STATUS_STOP (1 << 3) +#define TC_STATUS_SLAVE (1 << 4) +#define TC_STATUS_SYNCBUSY (1 << 7) + +/******************************************************************************************** + * Public Types + ********************************************************************************************/ + +/******************************************************************************************** + * Public Data + ********************************************************************************************/ + +/******************************************************************************************** + * Public Functions + ********************************************************************************************/ + +#endif /* CONFIG_ARCH_FAMILY_SAMD21 */ +#endif /* __ARCH_ARM_SRC_SAMDL_CHIP_SAMD_TC_H */ diff --git a/arch/arm/src/samdl/sam_dac.h b/arch/arm/src/samdl/sam_dac.h new file mode 100644 index 0000000000..b78afd36c1 --- /dev/null +++ b/arch/arm/src/samdl/sam_dac.h @@ -0,0 +1,77 @@ +/**************************************************************************** + * arch/arm/src/samdl/sam_dac.h + * + * Copyright (C) 2018 Gregory Nutt. All rights reserved. + * Author: Matt Thompson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __ARCH_ARM_SRC_SAMDL_SAM_DAC_H +#define __ARCH_ARM_SRC_SAMDL_SAM_DAC_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +#include "sam_config.h" +#include "sam_port.h" + +#if defined(CONFIG_ARCH_FAMILY_SAMD20) || defined(CONFIG_ARCH_FAMILY_SAMD21) +# include "chip/samd_dac.h" +#elif defined(CONFIG_ARCH_FAMILY_SAML21) +# include "chip/saml_dac.h" +#else +# error Unrecognized SAMD/L architecture +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + + +#undef EXTERN +#if defined(__cplusplus) +} +#endif +#endif /* __ARCH_ARM_SRC_SAMDL_SAM_DAC_H */ diff --git a/arch/arm/src/samdl/sam_evsys.h b/arch/arm/src/samdl/sam_evsys.h new file mode 100644 index 0000000000..13b41fa3e5 --- /dev/null +++ b/arch/arm/src/samdl/sam_evsys.h @@ -0,0 +1,76 @@ +/**************************************************************************** + * arch/arm/src/samdl/sam_evsys.h + * + * Copyright (C) 2018 Gregory Nutt. All rights reserved. + * Author: Matt Thompson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __ARCH_ARM_SRC_SAMDL_SAM_EVSYS_H +#define __ARCH_ARM_SRC_SAMDL_SAM_EVSYS_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +#include "sam_config.h" +#include "sam_port.h" + +#if defined(CONFIG_ARCH_FAMILY_SAMD20) || defined(CONFIG_ARCH_FAMILY_SAMD21) +# include "chip/samd_evsys.h" +#elif defined(CONFIG_ARCH_FAMILY_SAML21) +# include "chip/saml_evsys.h" +#else +# error Unrecognized SAMD/L architecture +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +#undef EXTERN +#if defined(__cplusplus) +} +#endif +#endif /* __ARCH_ARM_SRC_SAMDL_SAM_EVSYS_H */ diff --git a/arch/arm/src/samdl/samd_periphclks.h b/arch/arm/src/samdl/samd_periphclks.h index 0ba3df0f87..e5de81f754 100644 --- a/arch/arm/src/samdl/samd_periphclks.h +++ b/arch/arm/src/samdl/samd_periphclks.h @@ -75,7 +75,7 @@ #define sam_apbc_enableperiph(s) modifyreg32(SAM_PM_APBCMASK,0,s) #define sam_pac2_enableperiph() sam_apbc_enableperiph(PM_APBCMASK_PAC2) -#define sam_devsys_enableperiph() sam_apbc_enableperiph(PM_APBCMASK_EVSYS) +#define sam_evsys_enableperiph() sam_apbc_enableperiph(PM_APBCMASK_EVSYS) #define sam_sercom_enableperiph(n) sam_apbc_enableperiph(PM_APBCMASK_SERCOM(n)) #define sam_sercom0_enableperiph() sam_apbc_enableperiph(PM_APBCMASK_SERCOM0) #define sam_sercom1_enableperiph() sam_apbc_enableperiph(PM_APBCMASK_SERCOM1) @@ -135,7 +135,7 @@ #define sam_apbc_disableperiph(s) modifyreg32(SAM_PM_APBCMASK,s,0) #define sam_pac2_disableperiph() sam_apbc_disableperiph(PM_APBCMASK_PAC2) -#define sam_devsys_disableperiph() sam_apbc_disableperiph(PM_APBCMASK_EVSYS) +#define sam_evsys_disableperiph() sam_apbc_disableperiph(PM_APBCMASK_EVSYS) #define sam_sercom_disableperiph(n) sam_apbc_disableperiph(PM_APBCMASK_SERCOM(n)) #define sam_sercom0_disableperiph() sam_apbc_disableperiph(PM_APBCMASK_SERCOM0) #define sam_sercom1_disableperiph() sam_apbc_disableperiph(PM_APBCMASK_SERCOM1) @@ -195,7 +195,7 @@ #define sam_apbc_isenabled(s) (getreg32(SAM_PM_APBCMASK) & (s)) != 0) #define sam_pac2_isenabled() sam_apbc_isenabled(PM_APBCMASK_PAC2) -#define sam_devsys_isenabled() sam_apbc_isenabled(PM_APBCMASK_EVSYS) +#define sam_evsys_isenabled() sam_apbc_isenabled(PM_APBCMASK_EVSYS) #define sam_sercom_isenabled(n) sam_apbc_isenabled(PM_APBCMASK_SERCOM(n)) #define sam_sercom0_isenabled() sam_apbc_isenabled(PM_APBCMASK_SERCOM0) #define sam_sercom1_isenabled() sam_apbc_isenabled(PM_APBCMASK_SERCOM1) -- GitLab From 633e90225e07843bf589fcebbf4aa7b162cf8a42 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 25 Jan 2018 10:04:00 -0600 Subject: [PATCH 112/228] configs/flipnclick-sam3x (also Arduio-Due): Remove disabling of environmont, mountpoints, and poll. Add NSH arch initialization so that procfs will be automounted. Increase task name size from 0 to 32. Update README. --- configs/arduino-due/nsh/defconfig | 6 ++---- configs/flipnclick-sam3x/README.txt | 7 ++++--- configs/flipnclick-sam3x/nsh/defconfig | 6 ++---- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/configs/arduino-due/nsh/defconfig b/configs/arduino-due/nsh/defconfig index 15814e7231..a791c14a5b 100644 --- a/configs/arduino-due/nsh/defconfig +++ b/configs/arduino-due/nsh/defconfig @@ -11,9 +11,6 @@ CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y CONFIG_BOARD_LOOPSPERMSEC=6965 CONFIG_BUILTIN=y CONFIG_CXX_NEWLONG=y -CONFIG_DISABLE_ENVIRON=y -CONFIG_DISABLE_MOUNTPOINT=y -CONFIG_DISABLE_POLL=y CONFIG_EXAMPLES_NSH_CXXINITIALIZE=y CONFIG_EXAMPLES_NSH=y CONFIG_FS_PROCFS=y @@ -24,6 +21,7 @@ CONFIG_MAX_WDOGPARMS=2 CONFIG_MM_REGIONS=3 CONFIG_NFILE_DESCRIPTORS=8 CONFIG_NFILE_STREAMS=8 +CONFIG_NSH_ARCHINIT=y CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_DISABLE_IFUPDOWN=y CONFIG_NSH_FILEIOSIZE=512 @@ -40,7 +38,7 @@ CONFIG_SDCLONE_DISABLE=y CONFIG_START_DAY=28 CONFIG_START_MONTH=6 CONFIG_START_YEAR=2013 -CONFIG_TASK_NAME_SIZE=0 +CONFIG_TASK_NAME_SIZE=32 CONFIG_UART0_SERIAL_CONSOLE=y CONFIG_USER_ENTRYPOINT="nsh_main" CONFIG_WDOG_INTRESERVE=0 diff --git a/configs/flipnclick-sam3x/README.txt b/configs/flipnclick-sam3x/README.txt index 8ab7a159a8..38e9ae2dbb 100644 --- a/configs/flipnclick-sam3x/README.txt +++ b/configs/flipnclick-sam3x/README.txt @@ -349,9 +349,10 @@ Loading Code You should be able to use a 10- to 20-pin adapter to connect a SAM-ICE or J-Link debugger to the Flip&Click SAM3X. I have this Olimex adapter: - https://www.olimex.com/Products/ARM/JTAG/ARM-JTAG-20-10/ . But so far I - have been unable to get the get the SAM-ICE to communicate with the - Flip&Click. + https://www.olimex.com/Products/ARM/JTAG/ARM-JTAG-20-10/ . I have been + loading code and debugging with no problems using JTAG. + + You can find photos my setup here: http://www.nuttx.org/doku.php?id=wiki:howtos:flipnclick-sam3x Flip&Click SAM3X-specific Configuration Options =============================================== diff --git a/configs/flipnclick-sam3x/nsh/defconfig b/configs/flipnclick-sam3x/nsh/defconfig index f0ba4aedf3..68e1421dc1 100644 --- a/configs/flipnclick-sam3x/nsh/defconfig +++ b/configs/flipnclick-sam3x/nsh/defconfig @@ -9,9 +9,6 @@ CONFIG_ARCH_STACKDUMP=y CONFIG_ARCH="arm" CONFIG_BOARD_LOOPSPERMSEC=6965 CONFIG_BUILTIN=y -CONFIG_DISABLE_ENVIRON=y -CONFIG_DISABLE_MOUNTPOINT=y -CONFIG_DISABLE_POLL=y CONFIG_EXAMPLES_NSH_CXXINITIALIZE=y CONFIG_EXAMPLES_NSH=y CONFIG_FS_PROCFS=y @@ -23,6 +20,7 @@ CONFIG_MAX_WDOGPARMS=2 CONFIG_MM_REGIONS=3 CONFIG_NFILE_DESCRIPTORS=8 CONFIG_NFILE_STREAMS=8 +CONFIG_NSH_ARCHINIT=y CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_DISABLE_IFUPDOWN=y CONFIG_NSH_FILEIOSIZE=512 @@ -40,7 +38,7 @@ CONFIG_SDCLONE_DISABLE=y CONFIG_START_DAY=28 CONFIG_START_MONTH=6 CONFIG_START_YEAR=2013 -CONFIG_TASK_NAME_SIZE=0 +CONFIG_TASK_NAME_SIZE=32 CONFIG_USART0_SERIAL_CONSOLE=y CONFIG_USER_ENTRYPOINT="nsh_main" CONFIG_WDOG_INTRESERVE=0 -- GitLab From 483dfe80d913685ca8f8838967c29e08cef3c111 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 25 Jan 2018 12:45:02 -0600 Subject: [PATCH 113/228] configs/flipnclick-pic32mz and flipnclick-sam3x: Update README and add pin definitions to support SPI on all mikroBUS connectors. --- configs/flipnclick-pic32mz/README.txt | 34 +++++++++++++ configs/flipnclick-pic32mz/include/board.h | 46 +++++++++++++++++ .../src/flipnclick-pic32mz.h | 41 ++++++++++++++++ configs/flipnclick-sam3x/README.txt | 34 +++++++++++++ configs/flipnclick-sam3x/include/board.h | 42 +++++++++++++++- .../flipnclick-sam3x/src/flipnclick-sam3x.h | 49 +++++++++++++++++++ 6 files changed, 245 insertions(+), 1 deletion(-) diff --git a/configs/flipnclick-pic32mz/README.txt b/configs/flipnclick-pic32mz/README.txt index 3a1c3575d6..6e11eaffdd 100644 --- a/configs/flipnclick-pic32mz/README.txt +++ b/configs/flipnclick-pic32mz/README.txt @@ -14,6 +14,7 @@ Contents Creating Compatible NuttX HEX files Tool Issues Serial Console + SPI LEDs Configurations @@ -146,6 +147,39 @@ Serial Console transceiver to get the signals to RS232 levels (or connect to the USB virtual COM port in the case of UART0). +SPI +=== + + SPI3 is available on pins D10-D13 of the Arduino Shield connectors where + you would expect then. The SPI connector is configured as follows: + + Pin J1 Board Signal PIC32MZ + --- -- ------------ ------- + D10 8 SPI3_SCK RB14 + D10 7 SPI3_MISO RB9 + D11 6 SPI3_MOSI RB10 + D13 5 SPI3_SS RB9 + + SPI1 and SPI2 are also available on the mikroBUS Click connectors (in + addition to 5V and GND). The connectivity between connectors A and B and + between C and D differs only in the chip select pin: + + MikroBUS A: MikroBUS B: + Pin Board Signal PIC32MZ Pin Board Signal PIC32MZ + ---- ------------ ------- ---- ------------ ------- + CS SPI2_SS1 RA0 CS SPI2_SS0 RE4 + SCK SPI2_SCK RG6 SCK SPI2_SCK RG6 + MISO SPI2_MISO RC4 MISO SPI2_MISO RC4 + MOSI SPI2_MOSI RB5 MOSI SPI2_MOSI RB5 + + MikroBUS C: MikroBUS D: + Pin Board Signal PIC32MZ Pin Board Signal PIC32MZ + ---- ------------ ------- ---- ------------ ------- + CS SPI1_SS0 RD12 CS SPI1_SS1 RD13 + SCK SPI1_SCK RD1 SCK SPI1_SCK RD1 + MISO SPI1_MISO RD2 MISO SPI1_MISO RD2 + MOSI SPI1_MOSI RD3 MOSI SPI1_MOSI RD3 + LEDs and Buttons ================ diff --git a/configs/flipnclick-pic32mz/include/board.h b/configs/flipnclick-pic32mz/include/board.h index 490a8cde3f..0bcdc3dab1 100644 --- a/configs/flipnclick-pic32mz/include/board.h +++ b/configs/flipnclick-pic32mz/include/board.h @@ -303,6 +303,52 @@ #define BOARD_U5RX_PPS U5RXR_RPD14 #define BOARD_U5TX_PPS U5TX_RPD15R +/* SPI **********************************************************************/ +/* SPI3 is available on pins D10-D13 of the Arduino Shield connectors where + * you would expect then. The SPI connector is configured as follows: + * + * Pin J1 Board Signal PIC32MZ + * --- -- ------------ ------- + * D10 8 SPI3_SCK RB14 + * D10 7 SPI3_MISO RB9 + * D11 6 SPI3_MOSI RB10 + * D13 5 SPI3_SS RB9 + * + * SPI1 and SPI2 are also available on the mikroBUS Click connectors (in + * addition to 5V and GND). The connectivity between connectors A and B and + * between C and D differs only in the chip select pin: + * + * MikroBUS A: MikroBUS B: + * Pin Board Signal PIC32MZ Pin Board Signal PIC32MZ + * ---- ------------ ------- ---- ------------ ------- + * CS SPI2_SS1 RA0 CS SPI2_SS0 RE4 + * SCK SPI2_SCK RG6 SCK SPI2_SCK RG6 + * MISO SPI2_MISO RC4 MISO SPI2_MISO RC4 + * MOSI SPI2_MOSI RB5 MOSI SPI2_MOSI RB5 + * + * MikroBUS C: MikroBUS D: + * Pin Board Signal PIC32MZ Pin Board Signal PIC32MZ + * ---- ------------ ------- ---- ------------ ------- + * CS SPI1_SS0 RD12 CS SPI1_SS1 RD13 + * SCK SPI1_SCK RD1 SCK SPI1_SCK RD1 + * MISO SPI1_MISO RD2 MISO SPI1_MISO RD2 + * MOSI SPI1_MOSI RD3 MOSI SPI1_MOSI RD3 + * + * Chip select pin definitions are provided in + * configs/flipnclick-pic32mz/src/flipnclick-pic32mz.h. + * + * CLK (output) pins have no alternative pin configurations. + */ + +#define BOARD_SDI1_PPS SDI1R_RPD2 +#define BOARD_SDO1_PPS SDO1_RPD3R + +#define BOARD_SDI2_PPS SDI2R_RPC4 +#define BOARD_SDO2_PPS SDO2_RPB5R + +#define BOARD_SDI3_PPS SDI3R_RPB9 +#define BOARD_SDO3_PPS SDO3_RPB9R + /**************************************************************************** * Public Types ****************************************************************************/ diff --git a/configs/flipnclick-pic32mz/src/flipnclick-pic32mz.h b/configs/flipnclick-pic32mz/src/flipnclick-pic32mz.h index a1cbc0a8eb..ec514893eb 100644 --- a/configs/flipnclick-pic32mz/src/flipnclick-pic32mz.h +++ b/configs/flipnclick-pic32mz/src/flipnclick-pic32mz.h @@ -85,6 +85,47 @@ #define GPIO_T1 (GPIO_INPUT | GPIO_INTERRUPT | GPIO_PORTD | GPIO_PIN10) #define GPIO_T2 (GPIO_INPUT | GPIO_INTERRUPT | GPIO_PORTD | GPIO_PIN11) +/* SPI Chip Selects + * + * SPI3 is available on pins D10-D13 of the Arduino Shield connectors where + * you would expect then. The SPI connector is configured as follows: + * + * Pin J1 Board Signal PIC32MZ + * --- -- ------------ ------- + * D10 8 SPI3_SCK RB14 + * D10 7 SPI3_MISO RB9 + * D11 6 SPI3_MOSI RB10 + * D13 5 SPI3_SS RB9 + */ + +#define GPIO_ARD_CS (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORTB | GPIO_PIN14) + +/* SPI1 and SPI2 are also available on the mikroBUS Click connectors (in + * addition to 5V and GND). The connectivity between connectors A and B and + * between C and D differs only in the chip select pin: + * + * MikroBUS A: MikroBUS B: + * Pin Board Signal PIC32MZ Pin Board Signal PIC32MZ + * ---- ------------ ------- ---- ------------ ------- + * CS SPI2_SS1 RA0 CS SPI2_SS0 RE4 + * SCK SPI2_SCK RG6 SCK SPI2_SCK RG6 + * MISO SPI2_MISO RC4 MISO SPI2_MISO RC4 + * MOSI SPI2_MOSI RB5 MOSI SPI2_MOSI RB5 + * + * MikroBUS C: MikroBUS D: + * Pin Board Signal PIC32MZ Pin Board Signal PIC32MZ + * ---- ------------ ------- ---- ------------ ------- + * CS SPI1_SS0 RD12 CS SPI1_SS1 RD13 + * SCK SPI1_SCK RD1 SCK SPI1_SCK RD1 + * MISO SPI1_MISO RD2 MISO SPI1_MISO RD2 + * MOSI SPI1_MOSI RD3 MOSI SPI1_MOSI RD3 + */ + +#define GPIO_MBA_CS (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORTA | GPIO_PIN0) +#define GPIO_MBB_CS (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORTE | GPIO_PIN4) +#define GPIO_MBC_CS (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORTD | GPIO_PIN12) +#define GPIO_MBD_CS (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORTD | GPIO_PIN13) + /**************************************************************************** * Public Types ****************************************************************************/ diff --git a/configs/flipnclick-sam3x/README.txt b/configs/flipnclick-sam3x/README.txt index 38e9ae2dbb..6f28689505 100644 --- a/configs/flipnclick-sam3x/README.txt +++ b/configs/flipnclick-sam3x/README.txt @@ -14,6 +14,7 @@ Contents - STATUS - Buttons and LEDs - Serial Consoles + - SPI - Loading Code - Flip&Click SAM3X-specific Configuration Options - Configurations @@ -120,6 +121,39 @@ Serial Consoles in all configurations. But that is easily changed by modifying the configuration as described under "Configurations" below. +SPI +=== + + SPI0 is available on the Arduino compatible SPI connector (but no SPI is + available on pins D10-D13 of the main Arduino Shield connectors where + you might expect then). The SPI connector is configured as follows: + + Pin Board Signal SAM3X Pin Board Signal SAM3X + --- ------------ ----- --- ------------ ----- + 1 SPI0_MISO PA25 2 VCC-5V N/A + 3 SPI0_SCK PA27 4 SPI0_MOSI PA26 + 5 MRST NRSTB 6 GND N/A + + SPI0 is also available on each of the mikroBUS Click connectors (in + addition to 5V and GND). The connectivity differs only in the chip + select pin: + + MikroBUS A: MikroBUS B: + Pin Board Signal SAM3X Pin Board Signal SAM3X + ---- ------------ ----- ---- ------------ ----- + CS SPI0_CS0 PA28 CS PA29 PA29 + SCK SPI0_SCK PA27 SCK SPI0_SCK PA27 + MISO SPI0_MISO PA25 MISO SPI0_MISO PA25 + MOSI SPI0_MOSI PA26 MOSI SPI0_MOSI PA26 + + MikroBUS C: MikroBUS D: + Pin Board Signal SAM3X Pin Board Signal SAM3X + ---- ------------ ----- ---- ------------ ----- + CS SPI0_CS2 PB21 CS SPI0_CS3 PB23 + SCK SPI0_SCK PA27 SCK SPI0_SCK PA27 + MISO SPI0_MISO PA25 MISO SPI0_MISO PA25 + MOSI SPI0_MOSI PA26 MOSI SPI0_MOSI PA26 + Loading Code ============ diff --git a/configs/flipnclick-sam3x/include/board.h b/configs/flipnclick-sam3x/include/board.h index 0e2b42fe5d..dd72568d78 100644 --- a/configs/flipnclick-sam3x/include/board.h +++ b/configs/flipnclick-sam3x/include/board.h @@ -79,7 +79,7 @@ /* PLLA configuration. * * Divider = 1 - * Multipler = 14 + * Multiplier = 14 */ #define BOARD_CKGR_PLLAR_MUL (13 << PMC_CKGR_PLLAR_MUL_SHIFT) @@ -255,4 +255,44 @@ * There are no alternatives for these pins. */ +/* SPI: + * + * SPI0 is available on the Arduino compatible SPI connector (but no SPI is + * available on pins D10-D13 of the main Arduino Shield connectors where + * you might expect then). The SPI connector is configured as follows: + * + * Pin Board Signal SAM3X Pin Board Signal SAM3X + * --- ------------ ----- --- ------------ ----- + * 1 SPI0_MISO PA25 2 VCC-5V N/A + * 3 SPI0_SCK PA27 4 SPI0_MOSI PA26 + * 5 MRST NRSTB 6 GND N/A + * + * SPI0 is also available on each of the mikroBUS Click connectors (in + * addition to 5V and GND). The connectivity differs only in the chip + * select pin: + * + * MikroBUS A: MikroBUS B: + * Pin Board Signal SAM3X Pin Board Signal SAM3X + * ---- ------------ ----- ---- ------------ ----- + * CS SPI0_CS0 PA28 CS PA29 PA29 + * SCK SPI0_SCK PA27 SCK SPI0_SCK PA27 + * MISO SPI0_MISO PA25 MISO SPI0_MISO PA25 + * MOSI SPI0_MOSI PA26 MOSI SPI0_MOSI PA26 + * + * MikroBUS C: MikroBUS D: + * Pin Board Signal SAM3X Pin Board Signal SAM3X + * ---- ------------ ----- ---- ------------ ----- + * CS SPI0_CS2 PB21 CS SPI0_CS3 PB23 + * SCK SPI0_SCK PA27 SCK SPI0_SCK PA27 + * MISO SPI0_MISO PA25 MISO SPI0_MISO PA25 + * MOSI SPI0_MOSI PA26 MOSI SPI0_MOSI PA26 + * + * Chip select pin definitions are provided in + * configs/flipnclick-sam3x/src/flipnclick-3x.h. + * + * There are no alternative pin selections for SPI0_MSIO and SPIO_MOSI. + */ + +#define GPIO_SPI0_SPCK GPIO_SPI0_SPCK_1 + #endif /* __CONFIGS_FLIPNCLICK_SAM3X_INCLUDE_BOARD_H */ diff --git a/configs/flipnclick-sam3x/src/flipnclick-sam3x.h b/configs/flipnclick-sam3x/src/flipnclick-sam3x.h index e35dacbe6d..8887523ff7 100644 --- a/configs/flipnclick-sam3x/src/flipnclick-sam3x.h +++ b/configs/flipnclick-sam3x/src/flipnclick-sam3x.h @@ -79,6 +79,55 @@ #define GPIO_LED_D (GPIO_OUTPUT | GPIO_CFG_PULLUP | GPIO_OUTPUT_CLEAR | \ GPIO_PORT_PIOC | GPIO_PIN8) +/* SPI chip select pins. + * + * SPI0 is available on the Arduino compatible SPI connector (but no SPI is + * available on pins D10-D13 of the main Arduino Shield connectors where + * you might expect then). The SPI connector is configured as follows: + * + * Pin Board Signal SAM3X Pin Board Signal SAM3X + * --- ------------ ----- --- ------------ ----- + * 1 SPI0_MISO PA25 2 VCC-5V N/A + * 3 SPI0_SCK PA27 4 SPI0_MOSI PA26 + * 5 MRST NRSTB 6 GND N/A + * + * SPI0 is also available on each of the mikroBUS Click connectors (in + * addition to 5V and GND). The connectivity differs only in the chip + * select pin: + * + * MikroBUS A: MikroBUS B: + * Pin Board Signal SAM3X Pin Board Signal SAM3X + * ---- ------------ ----- ---- ------------ ----- + * CS SPI0_CS0 PA28 CS PA29 PA29 + * SCK SPI0_SCK PA27 SCK SPI0_SCK PA27 + * MISO SPI0_MISO PA25 MISO SPI0_MISO PA25 + * MOSI SPI0_MOSI PA26 MOSI SPI0_MOSI PA26 + * + * MikroBUS C: MikroBUS D: + * Pin Board Signal SAM3X Pin Board Signal SAM3X + * ---- ------------ ----- ---- ------------ ----- + * CS SPI0_CS2 PB21 CS SPI0_CS3 PB23 + * SCK SPI0_SCK PA27 SCK SPI0_SCK PA27 + * MISO SPI0_MISO PA25 MISO SPI0_MISO PA25 + * MOSI SPI0_MOSI PA26 MOSI SPI0_MOSI PA26 + */ + +#define GPIO_MBA_CS (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_SET | \ + GPIO_PORT_PIOA | GPIO_PIN28) +#define MBA_CSNUM 0 + +#define GPIO_MBB_CS (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_SET | \ + GPIO_PORT_PIOA | GPIO_PIN29) +#define MBB_CSNUM 1 + +#define GPIO_MBC_CS (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_SET | \ + GPIO_PORT_PIOB | GPIO_PIN21) +#define MBC_CSNUM 2 + +#define GPIO_MBD_CS (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_SET | \ + GPIO_PORT_PIOB | GPIO_PIN23) +#define MBD_CSNUM 3 + /************************************************************************************ * Public Types ************************************************************************************/ -- GitLab From 23c6debc63ea067d79f9099428ffc1f1cba46e57 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 25 Jan 2018 13:33:09 -0600 Subject: [PATCH 114/228] configs/flipnclick-sam3x: Update README and comments to discuss I2C access on all mikroBUS connectors. --- configs/flipnclick-sam3x/README.txt | 28 +++++++++++++++++++++++ configs/flipnclick-sam3x/include/board.h | 29 ++++++++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/configs/flipnclick-sam3x/README.txt b/configs/flipnclick-sam3x/README.txt index 6f28689505..bdfab6df68 100644 --- a/configs/flipnclick-sam3x/README.txt +++ b/configs/flipnclick-sam3x/README.txt @@ -15,6 +15,7 @@ Contents - Buttons and LEDs - Serial Consoles - SPI + - I2C - Loading Code - Flip&Click SAM3X-specific Configuration Options - Configurations @@ -154,6 +155,33 @@ SPI MISO SPI0_MISO PA25 MISO SPI0_MISO PA25 MOSI SPI0_MOSI PA26 MOSI SPI0_MOSI PA26 +I2C +=== + + I2C0 is available on pins D16-D17 of the Arduino Shield connectors where + you would expect then. The SPI connector is configured as follows: + + Pin Label J1 Board Signal SAM3X + --- ----- -- ------------ ----- + D16 SCL1 8 I2C0_SCL PA17 + D17 SDA1 7 I2C0_SDA PA18 + + I2C0 and I2C1 are also available on the mikroBUS Click connectors (in + addition to 5V and GND). The connectors A and B share I2C0 with the + Arduino shield connector. Connectors C and D both connect to I2C1: + + MikroBUS A: MikroBUS B: + Pin Board Signal SAM3X Pin Board Signal SAM3X + ---- ------------ ----- ---- ------------ ------- + SCL I2C0_SCL PA17 SCL I2C0_SCL PA17 + SDA I2C0_SDA PA1 SDA I2C0_SDA PA18 + + MikroBUS C: MikroBUS D: + Pin Board Signal SAM3X Pin Board Signal SAM3X + ---- ------------ ----- ---- ------------ ------- + SCL I2C1_SCL PB13 SCL I2C1_SCL PB13 + SDA I2C1_SDA PB12 SDA I2C1_SDA PB12 + Loading Code ============ diff --git a/configs/flipnclick-sam3x/include/board.h b/configs/flipnclick-sam3x/include/board.h index dd72568d78..fe0246747d 100644 --- a/configs/flipnclick-sam3x/include/board.h +++ b/configs/flipnclick-sam3x/include/board.h @@ -295,4 +295,33 @@ #define GPIO_SPI0_SPCK GPIO_SPI0_SPCK_1 +/* I2C (aka TWI): + * + * I2C0 is available on pins D16-D17 of the Arduino Shield connectors where + * you would expect then. The SPI connector is configured as follows: + * + * Pin Label J1 Board Signal SAM3X + * --- ----- -- ------------ ----- + * D16 SCL1 8 I2C0_SCL PA17 + * D17 SDA1 7 I2C0_SDA PA18 + * + * I2C0 and I2C1 are also available on the mikroBUS Click connectors (in + * addition to 5V and GND). The connectors A and B share I2C0 with the + * Arduino shield connector. Connectors C and D both connect to I2C1: + * + * MikroBUS A: MikroBUS B: + * Pin Board Signal SAM3X Pin Board Signal SAM3X + * ---- ------------ ----- ---- ------------ ------- + * SCL I2C0_SCL PA18 SCL I2C0_SCL PA18 + * SDA I2C0_SDA PA17 SDA I2C0_SDA PA17 + * + * MikroBUS C: MikroBUS D: + * Pin Board Signal SAM3X Pin Board Signal SAM3X + * ---- ------------ ----- ---- ------------ ------- + * SCL I2C1_SCL PB13 SCL I2C1_SCL PB13 + * SDA I2C1_SDA PB12 SDA I2C1_SDA PB12 + * + * There are no alternative pin selections for TWI0 and TWI1. + */ + #endif /* __CONFIGS_FLIPNCLICK_SAM3X_INCLUDE_BOARD_H */ -- GitLab From 424a3aa827b38a8698abcbf1ff24cdc22187abfa Mon Sep 17 00:00:00 2001 From: Matt Thompson Date: Thu, 25 Jan 2018 11:44:37 -0800 Subject: [PATCH 115/228] SAMDL: Added DMAC header for SAMD, fixed up sam_dmac to compile with debugging enabled --- arch/arm/src/samdl/chip/samd_dmac.h | 399 ++++++++++++++++++++++++++++ arch/arm/src/samdl/sam_dmac.c | 20 +- arch/arm/src/samdl/sam_dmac.h | 4 +- 3 files changed, 413 insertions(+), 10 deletions(-) create mode 100644 arch/arm/src/samdl/chip/samd_dmac.h diff --git a/arch/arm/src/samdl/chip/samd_dmac.h b/arch/arm/src/samdl/chip/samd_dmac.h new file mode 100644 index 0000000000..318fc38a42 --- /dev/null +++ b/arch/arm/src/samdl/chip/samd_dmac.h @@ -0,0 +1,399 @@ +/******************************************************************************************** + * arch/arm/src/samdl/chip/samd_dmac.h + * + * Copyright (C) 2015 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * Matt Thompson + * + * References: + * "Atmel SAM L21E / SAM L21G / SAM L21J Smart ARM-Based Microcontroller + * Datasheet", Atmel-42385C-SAML21_Datasheet_Preliminary-03/20/15 + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ********************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_SAMDL_CHIP_SAMD_DMAC_H +#define __ARCH_ARM_SRC_SAMDL_CHIP_SAMD_DMAC_H + +/******************************************************************************************** + * Included Files + ********************************************************************************************/ + +#include + +#include "chip.h" + +/******************************************************************************************** + * Pre-processor Definitions + ********************************************************************************************/ +/* DMAC register offsets ********************************************************************/ + +#define SAM_DMAC_CTRL_OFFSET 0x0000 /* Control Register */ +#define SAM_DMAC_CRCCTRL_OFFSET 0x0002 /* CRC Control Register */ +#define SAM_DMAC_CRCDATAIN_OFFSET 0x0004 /* CRC Data Input Register */ +#define SAM_DMAC_CRCCHKSUM_OFFSET 0x0008 /* CRC Checksum Register */ +#define SAM_DMAC_CRCSTATUS_OFFSET 0x000c /* CRC Status Register */ +#define SAM_DMAC_DBGCTRL_OFFSET 0x000d /* Debug Control Register */ +#define SAM_DMAC_QOSCTRL_OFFSET 0x000e /* Quality of Service Control Register */ +#define SAM_DMAC_SWTRIGCTRL_OFFSET 0x0010 /* Software Trigger Control Register */ +#define SAM_DMAC_PRICTRL0_OFFSET 0x0014 /* Priority Control 0 Register */ +#define SAM_DMAC_INTPEND_OFFSET 0x0020 /* Interrupt Pending Register */ +#define SAM_DMAC_INTSTATUS_OFFSET 0x0024 /* Interrupt Status Register */ +#define SAM_DMAC_BUSYCH_OFFSET 0x0028 /* Busy Channels Register */ +#define SAM_DMAC_PENDCH_OFFSET 0x002c /* Pending Channels Register */ +#define SAM_DMAC_ACTIVE_OFFSET 0x0030 /* Active Channels and Levels Register */ +#define SAM_DMAC_BASEADDR_OFFSET 0x0034 /* Descriptor Memory Section Base Address Register */ +#define SAM_DMAC_WRBADDR_OFFSET 0x0038 /* Write-Back Memory Section Base Address Register */ +#define SAM_DMAC_CHID_OFFSET 0x003f /* Channel ID Register */ +#define SAM_DMAC_CHCTRLA_OFFSET 0x0040 /* Channel Control A Register */ +#define SAM_DMAC_CHCTRLB_OFFSET 0x0044 /* Channel Control B Register */ +#define SAM_DMAC_CHINTENCLR_OFFSET 0x004c /* Channel Interrupt Enable Clear Register */ +#define SAM_DMAC_CHINTENSET_OFFSET 0x004d /* Channel Interrupt Enable Set Register */ +#define SAM_DMAC_CHINTFLAG_OFFSET 0x004e /* Channel Interrupt Flag Status and Clear Register */ +#define SAM_DMAC_CHSTATUS_OFFSET 0x004f /* Channel Status Register */ + +/* LPSRAM Registers Relative to BASEADDR or WRBADDR */ + +#define SAM_LPSRAM_BTCTRL_OFFSET 0x0000 /* Block Transfer Control Register */ +#define SAM_LPSRAM_BTCNT_OFFSET 0x0002 /* Block Transfer Count Register */ +#define SAM_LPSRAM_SRCADDR_OFFSET 0x0004 /* Block Transfer Source Address Register */ +#define SAM_LPSRAM_DSTADDR_OFFSET 0x0008 /* Block Transfer Destination Address Register */ +#define SAM_LPSRAM_DESCADDR_OFFSET 0x000c /* Next Address Descriptor Register */ + +/* DMAC register addresses ******************************************************************/ + +#define SAM_DMAC_CTRL (SAM_DMAC_BASE+SAM_DMAC_CTRL_OFFSET) +#define SAM_DMAC_CRCCTRL (SAM_DMAC_BASE+SAM_DMAC_CRCCTRL_OFFSET) +#define SAM_DMAC_CRCDATAIN (SAM_DMAC_BASE+SAM_DMAC_CRCDATAIN_OFFSET) +#define SAM_DMAC_CRCCHKSUM (SAM_DMAC_BASE+SAM_DMAC_CRCCHKSUM_OFFSET) +#define SAM_DMAC_CRCSTATUS (SAM_DMAC_BASE+SAM_DMAC_CRCSTATUS_OFFSET) +#define SAM_DMAC_DBGCTRL (SAM_DMAC_BASE+SAM_DMAC_DBGCTRL_OFFSET) +#define SAM_DMAC_QOSCTRL (SAM_DMAC_BASE+SAM_DMAC_QOSCTRL_OFFSET) +#define SAM_DMAC_SWTRIGCTRL (SAM_DMAC_BASE+SAM_DMAC_SWTRIGCTRL_OFFSET) +#define SAM_DMAC_PRICTRL0 (SAM_DMAC_BASE+SAM_DMAC_PRICTRL0_OFFSET) +#define SAM_DMAC_INTPEND (SAM_DMAC_BASE+SAM_DMAC_INTPEND_OFFSET) +#define SAM_DMAC_INTSTATUS (SAM_DMAC_BASE+SAM_DMAC_INTSTATUS_OFFSET) +#define SAM_DMAC_BUSYCH (SAM_DMAC_BASE+SAM_DMAC_BUSYCH_OFFSET) +#define SAM_DMAC_PENDCH (SAM_DMAC_BASE+SAM_DMAC_PENDCH_OFFSET) +#define SAM_DMAC_ACTIVE (SAM_DMAC_BASE+SAM_DMAC_ACTIVE_OFFSET) +#define SAM_DMAC_BASEADDR (SAM_DMAC_BASE+SAM_DMAC_BASEADDR_OFFSET) +#define SAM_DMAC_WRBADDR (SAM_DMAC_BASE+SAM_DMAC_WRBADDR_OFFSET) +#define SAM_DMAC_CHID (SAM_DMAC_BASE+SAM_DMAC_CHID_OFFSET) +#define SAM_DMAC_CHCTRLA (SAM_DMAC_BASE+SAM_DMAC_CHCTRLA_OFFSET) +#define SAM_DMAC_CHCTRLB (SAM_DMAC_BASE+SAM_DMAC_CHCTRLB_OFFSET) +#define SAM_DMAC_CHINTENCLR (SAM_DMAC_BASE+SAM_DMAC_CHINTENCLR_OFFSET) +#define SAM_DMAC_CHINTENSET (SAM_DMAC_BASE+SAM_DMAC_CHINTENSET_OFFSET) +#define SAM_DMAC_CHINTFLAG (SAM_DMAC_BASE+SAM_DMAC_CHINTFLAG_OFFSET) +#define SAM_DMAC_CHSTATUS (SAM_DMAC_BASE+SAM_DMAC_CHSTATUS_OFFSET) + +/* DMAC register bit definitions ************************************************************/ + +/* Control Register */ + +#define DMAC_CTRL_SWRST (1 << 0) /* Bit 0: Software Reset */ +#define DMAC_CTRL_DMAENABLE (1 << 1) /* Bit 1: DMA Enable */ +#define DMAC_CTRL_CRCENABLE (1 << 2) /* Bit 2: CRC Enable */ +#define DMAC_CTRL_LVLEN0 (1 << 8) /* Bit 8: Priority level 0 Enable */ +#define DMAC_CTRL_LVLEN1 (1 << 9) /* Bit 9: Priority level 1 Enable */ +#define DMAC_CTRL_LVLEN2 (1 << 10) /* Bit 10: Priority level 2 Enable */ +#define DMAC_CTRL_LVLEN3 (1 << 11) /* Bit 10: Priority level 2 Enable */ + +/* CRC Control Register */ + +#define DMAC_CRCCTRL_CRCBEATSIZE_SHIFT (0) /* Bits 0-1: CRC beat size */ +#define DMAC_CRCCTRL_CRCBEATSIZE_MASK (3 < DMAC_CRCCTRL_CRCBEATSIZE_SHIFT) +# define DMAC_CRCCTRL_CRCBEATSIZE_BYTE (0 < DMAC_CRCCTRL_CRCBEATSIZE_SHIFT) /* 8-bit bus transfer */ +# define DMAC_CRCCTRL_CRCBEATSIZE_HWORD (1 < DMAC_CRCCTRL_CRCBEATSIZE_SHIFT) /* 16-bit bus transfer */ +# define DMAC_CRCCTRL_CRCBEATSIZE_WORD (2 < DMAC_CRCCTRL_CRCBEATSIZE_SHIFT) /* 32-bit bus transfer */ +#define DMAC_CRCCTRL_CRCPOLY_SHIFT (2) /* Bits 2-3: CRC polynomial type */ +#define DMAC_CRCCTRL_CRCPOLY_MASK (3 < DMAC_CRCCTRL_CRCPOLY_SHIFT) +# define DMAC_CRCCTRL_CRCPOLY_CRC16 (0 < DMAC_CRCCTRL_CRCPOLY_SHIFT) /* CRC-16 (CRC-CCITT) */ +# define DMAC_CRCCTRL_CRCPOLY_CRC32 (1 < DMAC_CRCCTRL_CRCPOLY_SHIFT) /* CRC32 (IEEE 802.3) */ +#define DMAC_CRCCTRL_CRCSRC_SHIFT (8) /* Bits 8-13: CRC Input Source */ +#define DMAC_CRCCTRL_CRCSRC_MASK (0x3f < DMAC_CRCCTRL_CRCSRC_SHIFT) +# define DMAC_CRCCTRL_CRCSRC_NOACTION (0 < DMAC_CRCCTRL_CRCSRC_SHIFT) /* No action */ +# define DMAC_CRCCTRL_CRCSRC_IO (1 < DMAC_CRCCTRL_CRCSRC_SHIFT) /* I/O interface */ +# define DMAC_CRCCTRL_CRCSRC_CHAN(n) (((uint32_t)(n) + 0x20) < DMAC_CRCCTRL_CRCSRC_SHIFT) + +/* CRC Data Input Register (32-bit value) */ +/* CRC Checksum Register (32-bit value) */ + +/* CRC Status Register */ + +#define DMAC_CRCSTATUS_CRCBUSY (1 << 0) /* Bit 0: CRC module busy */ +#define DMAC_CRCSTATUS_CRCZERO (1 << 1) /* Bit 1: CRC zero */ + +/* Debug Control Register */ + +#define DMAC_DBGCTRL_DBGRUN (1 << 0) /* Bit 0: Debug run */ + +/* Quality of Service Control Register */ + +#define DMAC_QOSCTRL_WRBQOS_SHIFT (0) /* Bits 0-1: Write back quality of service */ +#define DMAC_QOSCTRL_WRBQOS_MASK (3 << DMAC_QOSCTRL_WRBQOS_SHIFT) +# define DMAC_QOSCTRL_WRBQOS_DISABLE (0 << DMAC_QOSCTRL_WRBQOS_SHIFT) /* Background */ +# define DMAC_QOSCTRL_WRBQOS_LOW (1 << DMAC_QOSCTRL_WRBQOS_SHIFT) /* Sensitive bandwidth */ +# define DMAC_QOSCTRL_WRBQOS_MEDIUM (2 << DMAC_QOSCTRL_WRBQOS_SHIFT) /* Sensitive latency */ +# define DMAC_QOSCTRL_WRBQOS_HIGH (3 << DMAC_QOSCTRL_WRBQOS_SHIFT) /* Critical latency */ +#define DMAC_QOSCTRL_FQOS_SHIFT (2) /* Bits 2-3: Fetch quality of service */ +#define DMAC_QOSCTRL_FQOS_MASK (3 << DMAC_QOSCTRL_FQOS_SHIFT) +# define DMAC_QOSCTRL_FQOS_DISABLE (0 << DMAC_QOSCTRL_FQOS_SHIFT) /* Background */ +# define DMAC_QOSCTRL_FQOS_LOW (1 << DMAC_QOSCTRL_FQOS_SHIFT) /* Sensitive bandwidth */ +# define DMAC_QOSCTRL_FQOS_MEDIUM (2 << DMAC_QOSCTRL_FQOS_SHIFT) /* Sensitive latency */ +# define DMAC_QOSCTRL_FQOS_HIGH (3 << DMAC_QOSCTRL_FQOS_SHIFT) /* Critical latency */ +#define DMAC_QOSCTRL_DQOS_SHIFT (4) /* Bits 4-5: Data transfer quality of service */ +#define DMAC_QOSCTRL_DQOS_MASK (3 << DMAC_QOSCTRL_DQOS_SHIFT) +# define DMAC_QOSCTRL_DQOS_DISABLE (0 << DMAC_QOSCTRL_DQOS_SHIFT) /* Background */ +# define DMAC_QOSCTRL_DQOS_LOW (1 << DMAC_QOSCTRL_DQOS_SHIFT) /* Sensitive bandwidth */ +# define DMAC_QOSCTRL_DQOS_MEDIUM (2 << DMAC_QOSCTRL_DQOS_SHIFT) /* Sensitive latency */ +# define DMAC_QOSCTRL_DQOS_HIGH (3 << DMAC_QOSCTRL_DQOS_SHIFT) /* Critical latency */ + +/* Common bit definitions for: Software Trigger Control Register, Interrupt Status Register, + * Busy Channels Register, and Pending Channels Register + */ + +#define DMAC_CHAN(n) (1 << (n)) /* DMAC Channel n, n=0-11 */ + +/* Priority Control 0 Register */ + +#define DMAC_PRICTRL0_LVLPRI0_SHIFT (0) /* Bits 0-3: Level 0 channel priority number */ +#define DMAC_PRICTRL0_LVLPRI0_MASK (15 << DMAC_PRICTRL0_LVLPRI0_SHIFT) +# define DMAC_PRICTRL0_LVLPRI0(n) ((uint32_t)(n) << DMAC_PRICTRL0_LVLPRI0_SHIFT) +#define DMAC_PRICTRL0_RRLVLEN0 (1 << 7) /* Bit 7: Level 0 round-robin arbitrarion enable */ +#define DMAC_PRICTRL0_LVLPRI1_SHIFT (8) /* Bits 8-11: Level 1 channel priority number */ +#define DMAC_PRICTRL0_LVLPRI1_MASK (15 << DMAC_PRICTRL0_LVLPRI1_SHIFT) +# define DMAC_PRICTRL0_LVLPRI1(n) ((uint32_t)(n) << DMAC_PRICTRL0_LVLPRI1_SHIFT) +#define DMAC_PRICTRL0_RRLVLEN1 (1 << 15) /* Bit 15: Level 1 round-robin arbitrarion enable */ +#define DMAC_PRICTRL0_LVLPRI2_SHIFT (16) /* Bits 16-18: Level 2 channel priority number */ +#define DMAC_PRICTRL0_LVLPRI2_MASK (7 << DMAC_PRICTRL0_LVLPRI2_SHIFT) +# define DMAC_PRICTRL0_LVLPRI2(n) ((uint32_t)(n) << DMAC_PRICTRL0_LVLPRI2_SHIFT) +#define DMAC_PRICTRL0_RRLVLEN2 (1 << 23) /* Bit 23: Level 2 round-robin arbitrarion enable */ +#define DMAC_PRICTRL0_LVLPRI3_SHIFT (24) /* Bits 24-27: Level 3 channel priority number */ +#define DMAC_PRICTRL0_LVLPRI3_MASK (7 << DMAC_PRICTRL0_LVLPRI3_SHIFT) +# define DMAC_PRICTRL0_LVLPRI3(n) ((uint32_t)(n) << DMAC_PRICTRL0_LVLPRI3_SHIFT) +#define DMAC_PRICTRL0_RRLVLEN3 (1 << 31) /* Bit 23: Level 3 round-robin arbitrarion enable */ + +/* Interrupt Pending Register */ + +#define DMAC_INTPEND_ID_SHIFT (0) /* Bit 0-3: Channel ID */ +#define DMAC_INTPEND_ID_MASK (15 << DMAC_INTPEND_ID_SHIFT) +#define DMAC_INTPEND_TERR (1 << 8) /* Bit 8: Transfer error */ +#define DMAC_INTPEND_TCMPL (1 << 9) /* Bit 9: Transfer complete */ +#define DMAC_INTPEND_SUSP (1 << 10) /* Bit 10: Channel suspend */ +#define DMAC_INTPEND_FERR (1 << 13) /* Bit 13: Fetch error */ +#define DMAC_INTPEND_BUSY (1 << 14) /* Bit 14: Busy */ +#define DMAC_INTPEND_PEND (1 << 15) /* Bit 15: Pending */ + +/* Interrupt Status Register */ +/* Busy Channels Register */ +/* Pending Channels Register */ + +/* Active Channels and Levels Register */ + +#define DMAC_ACTIVE_LVLEX0 (1 << 0) /* Bit 0: Level 0 channel trigger request executing */ +#define DMAC_ACTIVE_LVLEX1 (1 << 1) /* Bit 1: Level 1 channel trigger request executing */ +#define DMAC_ACTIVE_LVLEX2 (1 << 2) /* Bit 2: Level 2 channel trigger request executing */ +#define DMAC_ACTIVE_LVLEX3 (1 << 3) /* Bit 3: Level 3 channel trigger request executing */ +#define DMAC_ACTIVE_ID_SHIFT (8) /* Bits 8-11: Active channel ID */ +#define DMAC_ACTIVE_ID_MASK (15 << DMAC_ACTIVE_ID_SHIFT) +#define DMAC_ACTIVE_ABUSY (1 << 15) /* Bit 15: Active channel busy */ +#define DMAC_ACTIVE_BTCNT_SHIFT (16) /* Bit 16-31: Active channel block transfer count */ +#define DMAC_ACTIVE_BTCNT_MASK (0xffff << DMAC_ACTIVE_BTCNT_SHIFT) + +/* Descriptor Memory Section Base Address Register (32-bit address) */ +/* Write-Back Memory Section Base Address Register (31-bit address) */ + +/* Channel ID Register */ + +#define DMAC_CHID_MASK 0x0f /* Bits 0-3: Channel ID */ + +/* Channel Control A Register */ + +#define DMAC_CHCTRLA_SWRST (1 << 0) /* Bit 0: Channel software reset */ +#define DMAC_CHCTRLA_ENABLE (1 << 1) /* Bit 1: Channel enable */ + +/* Channel Control B Register */ + +#define DMAC_CHCTRLB_EVACT_SHIFT (0) /* Bits 0-2: Event input action */ +#define DMAC_CHCTRLB_EVACT_MASK (7 << DMAC_CHCTRLB_EVACT_SHIFT) +# define DMAC_CHCTRLB_EVACT_NOACT (0 << DMAC_CHCTRLB_EVACT_SHIFT) /* No action */ +# define DMAC_CHCTRLB_EVACT_TRIG (1 << DMAC_CHCTRLB_EVACT_SHIFT) /* Normal Transfer and Conditional Transfer on Strobe +trigger */ +# define DMAC_CHCTRLB_EVACT_CTRIG (2 << DMAC_CHCTRLB_EVACT_SHIFT) /* Conditional transfer trigger */ +# define DMAC_CHCTRLB_EVACT_CBLOCK (3 << DMAC_CHCTRLB_EVACT_SHIFT) /* Conditional block transfer */ +# define DMAC_CHCTRLB_EVACT_SUSPEND (4 << DMAC_CHCTRLB_EVACT_SHIFT) /* Channel suspend operation */ +# define DMAC_CHCTRLB_EVACT_RESUME (5 << DMAC_CHCTRLB_EVACT_SHIFT) /* Channel resume operation */ +# define DMAC_CHCTRLB_EVACT_SSKIP (6 << DMAC_CHCTRLB_EVACT_SHIFT) /* Skip next block suspend action */ +#define DMAC_CHCTRLB_EVIE (1 << 3) /* Bit 3: Channel event input enable */ +#define DMAC_CHCTRLB_EVOE (1 << 4) /* Bit 4: Channel event output enable */ +#define DMAC_CHCTRLB_LVL_SHIFT (5) /* Bits 5-6: Channel arbitration level */ +#define DMAC_CHCTRLB_LVL_MASK (3 << DMAC_CHCTRLB_LVL_SHIFT) +# define DMAC_CHCTRLB_LVL(n) ((uint32_t)(n) << DMAC_CHCTRLB_LVL_SHIFT) +# define DMAC_CHCTRLB_LVL_LVL0 (0 << DMAC_CHCTRLB_LVL_SHIFT) /* Channel priority level 0 */ +# define DMAC_CHCTRLB_LVL_LVL1 (1 << DMAC_CHCTRLB_LVL_SHIFT) /* Channel priority level 1 */ +# define DMAC_CHCTRLB_LVL_LVL2 (2 << DMAC_CHCTRLB_LVL_SHIFT) /* Channel priority level 2 */ +# define DMAC_CHCTRLB_LVL_LVL3 (3 << DMAC_CHCTRLB_LVL_SHIFT) /* Channel priority level 3 */ +#define DMAC_CHCTRLB_TRIGSRC_SHIFT (8) /* Bits 8-13: Trigger source */ +#define DMAC_CHCTRLB_TRIGSRC_MASK (0x3f << DMAC_CHCTRLB_TRIGSRC_SHIFT) + #define DMAC_CHCTRLB_TRIGSRC(n) ((uint32_t)(n) << DMAC_CHCTRLB_TRIGSRC_SHIFT) +#define DMAC_CHCTRLB_TRIGACT_SHIFT (22) /* Bits 22-23: Trigger action */ +#define DMAC_CHCTRLB_TRIGACT_MASK (3 << DMAC_CHCTRLB_TRIGACT_SHIFT) +# define DMAC_CHCTRLB_TRIGACT_BLOCK (0 << DMAC_CHCTRLB_TRIGACT_SHIFT) /* One trigger required for each action */ +# define DMAC_CHCTRLB_TRIGACT_BEAT (2 << DMAC_CHCTRLB_TRIGACT_SHIFT) /* One trigger required for beat transfer */ +# define DMAC_CHCTRLB_TRIGACT_TRANSACT (3 << DMAC_CHCTRLB_TRIGACT_SHIFT) /* One trigger required for each transaction */ +#define DMAC_CHCTRLB_CMD_SHIFT (24) /* Bits 24-25: Software command */ +#define DMAC_CHCTRLB_CMD_MASK (3 << DMAC_CHCTRLB_CMD_SHIFT) +# define DMAC_CHCTRLB_CMD_NOACTION (0 << DMAC_CHCTRLB_CMD_SHIFT) /* No action */ +# define DMAC_CHCTRLB_CMD_SUSPEND (1 << DMAC_CHCTRLB_CMD_SHIFT) /* Channel suspend operation */ +# define DMAC_CHCTRLB_CMD_RESUME (2 << DMAC_CHCTRLB_CMD_SHIFT) /* Channel resume operation */ + +/* Values for use with the DMAC_CHCTRLB_TRIGSRC(n) macro: */ + +#define DMAC_TRIGSRC_DISABLE (0) /* Only software/event triggers */ +#define DMAC_TRIGSRC_SERCOM0_RX (1) /* SERCOM0 RX Trigger */ +#define DMAC_TRIGSRC_SERCOM0_TX (2) /* SERCOM0 TX Trigger */ +#define DMAC_TRIGSRC_SERCOM1_RX (3) /* SERCOM1 RX Trigger */ +#define DMAC_TRIGSRC_SERCOM1_TX (4) /* SERCOM1 TX Trigger */ +#define DMAC_TRIGSRC_SERCOM2_RX (5) /* SERCOM2 RX Trigger */ +#define DMAC_TRIGSRC_SERCOM2_TX (6) /* SERCOM2 TX Trigger */ +#define DMAC_TRIGSRC_SERCOM3_RX (7) /* SERCOM3 RX Trigger */ +#define DMAC_TRIGSRC_SERCOM3_TX (8) /* SERCOM3 TX Trigger */ +#define DMAC_TRIGSRC_SERCOM4_RX (9) /* SERCOM4 RX Trigger */ +#define DMAC_TRIGSRC_SERCOM4_TX (10) /* SERCOM4 TX Trigger */ +#define DMAC_TRIGSRC_SERCOM5_RX (11) /* SERCOM4 RX Trigger */ +#define DMAC_TRIGSRC_SERCOM5_TX (12) /* SERCOM4 TX Trigger */ +#define DMAC_TRIGSRC_TCC0_OVF (13) /* TCC0 Overflow Trigger */ +#define DMAC_TRIGSRC_TCC0_MC0 (14) /* TCC0 Match/Compare 0 Trigger */ +#define DMAC_TRIGSRC_TCC0_MC1 (15) /* TCC0 Match/Compare 1 Trigger */ +#define DMAC_TRIGSRC_TCC0_MC2 (16) /* TCC0 Match/Compare 2 Trigger */ +#define DMAC_TRIGSRC_TCC0_MC3 (17) /* TCC0 Match/Compare 3 Trigger */ +#define DMAC_TRIGSRC_TCC1_OVF (18) /* TCC1 Overflow Trigger */ +#define DMAC_TRIGSRC_TCC1_MC0 (19) /* TCC1 Match/Compare 0 Trigger */ +#define DMAC_TRIGSRC_TCC1_MC1 (20) /* TCC1 Match/Compare 1 Trigger */ +#define DMAC_TRIGSRC_TCC2_OVF (21) /* TCC2 Overflow Trigger */ +#define DMAC_TRIGSRC_TCC2_MC0 (22) /* TCC2 Match/Compare 0 Trigger */ +#define DMAC_TRIGSRC_TCC2_MC1 (23) /* TCC2 Match/Compare 1 Trigger */ +#define DMAC_TRIGSRC_TC0_OVF (24) /* TC0 Overflow Trigger */ +#define DMAC_TRIGSRC_TC0_MC0 (25) /* TC0 Match/Compare 0 Trigger */ +#define DMAC_TRIGSRC_TC0 MC1 (26) /* TC0 Match/Compare 1 Trigger */ +#define DMAC_TRIGSRC_TC1_OVF (27) /* TC1 Overflow Trigger */ +#define DMAC_TRIGSRC_TC1_MC0 (28) /* TC1 Match/Compare 0 Trigger */ +#define DMAC_TRIGSRC_TC1_MC1 (29) /* TC1 Match/Compare 1 Trigger */ +#define DMAC_TRIGSRC_TC2_OVF (30) /* TC2 Overflow Trigger */ +#define DMAC_TRIGSRC_TC2_MC0 (31) /* TC2 Match/Compare 0 Trigger */ +#define DMAC_TRIGSRC_TC2_MC1 (32) /* TC2 Match/Compare 1 Trigger */ +#define DMAC_TRIGSRC_TC3_OVF (33) /* TC3 Overflow Trigger */ +#define DMAC_TRIGSRC_TC3_MC0 (34) /* TC3 Match/Compare 0 Trigger */ +#define DMAC_TRIGSRC_TC3_MC1 (35) /* TC3 Match/Compare 1 Trigger */ +#define DMAC_TRIGSRC_TC4_OVF (36) /* TC4 Overflow Trigger */ +#define DMAC_TRIGSRC_TC4_MC0 (37) /* TC4 Match/Compare 0 Trigger */ +#define DMAC_TRIGSRC_TC4_MC1 (38) /* TC4 Match/Compare 1 Trigger */ +#define DMAC_TRIGSRC_ADC_RESRDY (39) /* ADC Result Ready Trigger */ +#define DMAC_TRIGSRC_DAC_EMPTY (40) /* DAC0 Empty Trigger */ +#define DMAC_TRIGSRC_I2S0_RX (41) /* I2S0 RX Trigger */ +#define DMAC_TRIGSRC_I2S1_RX (42) /* I2S1 RX Trigger */ +#define DMAC_TRIGSRC_I2S0_TX (43) /* I2S0 TX Trigger */ +#define DMAC_TRIGSRC_I2S1_TX (44) /* I2S1 TX Trigger */ + +/* Common register bit definitions: Channel Interrupt Enable Clear Register, Channel Interrupt + * Enable Set Register, and Channel Interrupt Flag Status and Clear Register + */ + +#define DMAC_INT_TERR (1 << 0) /* Bit 0: Transfer error interrupt */ +#define DMAC_INT_TCMPL (1 << 1) /* Bit 1: Channel transfer complete interrupt */ +#define DMAC_INT_SUSP (1 << 2) /* Bit 2: Channel suspend interrupt */ +#define DMAC_INT_ALL (0x07) + +/* Channel Status Register */ + +#define DMAC_CHSTATUS_PEND (1 << 0) /* Bit 0: Chennel pending */ +#define DMAC_CHSTATUS_BUSY (1 << 1) /* Bit 1: Channel busy */ +#define DMAC_CHSTATUS_FERR (1 << 2) /* Bit 2: Channel fetch error */ + +/* Block Transfer Control Register */ + +#define LPSRAM_BTCTRL_VALID (1 << 0) /* Bit 0: Descriptor valid */ +#define LPSRAM_BTCTRL_EVOSEL_SHIFT (1) /* Bits 1-2: Event output selection */ +#define LPSRAM_BTCTRL_EVOSEL_MASK (3 << LPSRAM_BTCTRL_EVOSEL_SHIFT) +# define LPSRAM_BTCTRL_EVOSEL_DISABLE (0 << LPSRAM_BTCTRL_EVOSEL_SHIFT) /* Event generation disabled */ +# define LPSRAM_BTCTRL_EVOSEL_BLOCK (1 << LPSRAM_BTCTRL_EVOSEL_SHIFT) /* Event strobe when block transfer complete */ +# define LPSRAM_BTCTRL_EVOSEL_BEAT (3 << LPSRAM_BTCTRL_EVOSEL_SHIFT) /* Event strobe when beat transfer complete */ +#define LPSRAM_BTCTRL_BLOCKACT_SHIFT (3) /* Bits 3-4: Block action */ +#define LPSRAM_BTCTRL_BLOCKACT_MASK (3 << LPSRAM_BTCTRL_BLOCKACT_SHIFT) +# define LPSRAM_BTCTRL_BLOCKACT_NOACT (0 << LPSRAM_BTCTRL_BLOCKACT_SHIFT) /* Channel disabled if last block transfer */ +# define LPSRAM_BTCTRL_BLOCKACT_INT (1 << LPSRAM_BTCTRL_BLOCKACT_SHIFT) /* Channel disabled if last block transfer + block int */ +# define LPSRAM_BTCTRL_BLOCKACT_SUSPEND (2 << LPSRAM_BTCTRL_BLOCKACT_SHIFT) /* Channel suspend operation is completed */ +# define LPSRAM_BTCTRL_BLOCKACT_BOTH (3 << LPSRAM_BTCTRL_BLOCKACT_SHIFT) /* Both channel suspend operation + block int */ +#define LPSRAM_BTCTRL_BEATSIZE_SHIFT (8) /* Bits 8-9: Beat size */ +#define LPSRAM_BTCTRL_BEATSIZE_MASK (3 << LPSRAM_BTCTRL_BEATSIZE_SHIFT) +# define LPSRAM_BTCTRL_BEATSIZE_BYTE (0 << LPSRAM_BTCTRL_BEATSIZE_SHIFT) /* 8-bit bus transfer */ +# define LPSRAM_BTCTRL_BEATSIZE_HWORD (1 << LPSRAM_BTCTRL_BEATSIZE_SHIFT) /* 16-bit bus transfer */ +# define LPSRAM_BTCTRL_BEATSIZE_WORD (2 << LPSRAM_BTCTRL_BEATSIZE_SHIFT) /* 32-bit bus transfer */ +#define LPSRAM_BTCTRL_SRCINC (1 << 10) /* Bit 10: Source address increment enable */ +#define LPSRAM_BTCTRL_DSTINC (1 << 11) /* Bit 11: Destination address increment enable */ +#define LPSRAM_BTCTRL_STEPSEL (1 << 12) /* Bit 12: Step selection */ +#define LPSRAM_BTCTRL_STEPSIZE_SHIFT (13) /* Bits 13-15: Address increment step */ +#define LPSRAM_BTCTRL_STEPSIZE_MASK (7 << LPSRAM_BTCTRL_STEPSIZE_SHIFT) +# define LPSRAM_BTCTRL_STEPSIZE_X1 (0 << LPSRAM_BTCTRL_STEPSIZE_SHIFT) /* Next ADDR = ADDR + (BEATSIZE+1) * 1 */ +# define LPSRAM_BTCTRL_STEPSIZE_X2 (1 << LPSRAM_BTCTRL_STEPSIZE_SHIFT) /* Next ADDR = ADDR + (BEATSIZE+1) * 2 */ +# define LPSRAM_BTCTRL_STEPSIZE_X4 (2 << LPSRAM_BTCTRL_STEPSIZE_SHIFT) /* Next ADDR = ADDR + (BEATSIZE+1) * 4 */ +# define LPSRAM_BTCTRL_STEPSIZE_X8 (3 << LPSRAM_BTCTRL_STEPSIZE_SHIFT) /* Next ADDR = ADDR + (BEATSIZE+1) * 8 */ +# define LPSRAM_BTCTRL_STEPSIZE_X16 (4 << LPSRAM_BTCTRL_STEPSIZE_SHIFT) /* Next ADDR = ADDR + (BEATSIZE+1) * 16 */ +# define LPSRAM_BTCTRL_STEPSIZE_X32 (5 << LPSRAM_BTCTRL_STEPSIZE_SHIFT) /* Next ADDR = ADDR + (BEATSIZE+1) * 32 */ +# define LPSRAM_BTCTRL_STEPSIZE_X64 (6 << LPSRAM_BTCTRL_STEPSIZE_SHIFT) /* Next ADDR = ADDR + (BEATSIZE+1) * 64 */ +# define LPSRAM_BTCTRL_STEPSIZE_X128 (7 << LPSRAM_BTCTRL_STEPSIZE_SHIFT) /* Next ADDR = ADDR + (BEATSIZE+1) * 128 */ + +/* Block Transfer Count Register (16-bit count) */ +/* Block Transfer Source Address Register (32-bit address) */ +/* Block Transfer Destination Address Register (32-bit address) */ +/* Next Address Descriptor Register (32-bit address) */ + +/******************************************************************************************** + * Public Types + ********************************************************************************************/ +/* DMA descriptor */ + +struct dma_desc_s +{ + uint16_t btctrl; /* Block Transfer Control Register */ + uint16_t btcnt; /* Block Transfer Count Register */ + uint32_t srcaddr; /* Block Transfer Source Address Register */ + uint32_t dstaddr; /* Block Transfer Destination Address Register */ + uint32_t descaddr; /* Next Address Descriptor Register */ +}; + +/******************************************************************************************** + * Public Data + ********************************************************************************************/ + +/******************************************************************************************** + * Public Functions + ********************************************************************************************/ + +#endif /* __ARCH_ARM_SRC_SAMDL_CHIP_SAMD_DMAC_H */ diff --git a/arch/arm/src/samdl/sam_dmac.c b/arch/arm/src/samdl/sam_dmac.c index 5ca812ea4f..cf4d495b3a 100644 --- a/arch/arm/src/samdl/sam_dmac.c +++ b/arch/arm/src/samdl/sam_dmac.c @@ -500,7 +500,7 @@ static struct dma_desc_s *sam_append_desc(struct sam_dmach_s *dmach, { /* There is no previous link. This is the new head of the list */ - DEBUGASSERT(desc == g_base_desc[dmach->dc_chan]); + DEBUGASSERT(desc == &g_base_desc[dmach->dc_chan]); } #if CONFIG_SAMDL_DMAC_NDESC > 0 @@ -627,7 +627,7 @@ static int sam_txbuffer(struct sam_dmach_s *dmach, uint32_t paddr, uint16_t btcnt; uint16_t tmp; - DEBUGASSERT(dmac->dc_dir == DMADIR_UNKOWN || dmac->dc_dir == DMADIR_TX); + DEBUGASSERT(dmach->dc_dir == DMADIR_UNKOWN || dmach->dc_dir == DMADIR_TX); /* Set up the Block Transfer Control Register configuration: * @@ -703,7 +703,7 @@ static int sam_rxbuffer(struct sam_dmach_s *dmach, uint32_t paddr, uint16_t btcnt; uint16_t tmp; - DEBUGASSERT(dmac->dc_dir == DMADIR_UNKOWN || dmac->dc_dir == DMADIR_RX); + DEBUGASSERT(dmach->dc_dir == DMADIR_UNKOWN || dmach->dc_dir == DMADIR_RX); /* Set up the Block Transfer Control Register configuration: * @@ -1218,10 +1218,13 @@ int sam_dmastart(DMA_HANDLE handle, dma_callback_t callback, void *arg) /* Enable the channel */ ctrla = DMAC_CHCTRLA_ENABLE; + +#ifdef CONFIG_ARCH_FAMILY_SAML21 if (dmach->dc_flags & DMACH_FLAG_RUNINSTDBY) { ctrla |= DMAC_CHCTRLA_RUNSTDBY; } +#endif putreg8(ctrla, SAM_DMAC_CHCTRLA); @@ -1272,19 +1275,18 @@ void sam_dmastop(DMA_HANDLE handle) #ifdef CONFIG_DEBUG_DMA_INFO void sam_dmasample(DMA_HANDLE handle, struct sam_dmaregs_s *regs) { - struct sam_dmach_s *dmach = (struct sam_dmach_s *)handle; - uintptr_t base; irqstate_t flags; /* Sample DMAC registers. */ flags = enter_critical_section(); + regs->ctrl = getreg16(SAM_DMAC_CTRL); /* Control Register */ regs->crcctrl = getreg16(SAM_DMAC_CRCCTRL); /* CRC Control Register */ regs->crcdatain = getreg32(SAM_DMAC_CRCDATAIN); /* CRC Data Input Register */ regs->crcchksum = getreg32(SAM_DMAC_CRCCHKSUM); /* CRC Checksum Register */ regs->crcstatus = getreg8(SAM_DMAC_CRCSTATUS); /* CRC Status Register */ - regs->errctrl = getreg8(SAM_DMAC_DBGCTRL); /* Debug Control Register */ + regs->dbgctrl = getreg8(SAM_DMAC_DBGCTRL); /* Debug Control Register */ regs->qosctrl = getreg8(SAM_DMAC_QOSCTRL); /* Quality of Service Control Register */ regs->swtrigctrl = getreg32(SAM_DMAC_SWTRIGCTRL); /* Software Trigger Control Register */ regs->prictrl0 = getreg32(SAM_DMAC_PRICTRL0); /* Priority Control 0 Register */ @@ -1300,6 +1302,8 @@ void sam_dmasample(DMA_HANDLE handle, struct sam_dmaregs_s *regs) regs->chctrlb = getreg32(SAM_DMAC_CHCTRLB); /* Channel Control B Register */ regs->chintflag = getreg8(SAM_DMAC_CHINTFLAG); /* Channel Interrupt Flag Status and Clear Register */ regs->chstatus = getreg8(SAM_DMAC_CHSTATUS); /* Channel Status Register */ + + leave_critical_section(flags); } #endif /* CONFIG_DEBUG_DMA_INFO */ @@ -1325,13 +1329,13 @@ void sam_dmadump(DMA_HANDLE handle, const struct sam_dmaregs_s *regs, dmainfo(" CTRL: %04x CRCCTRL: %04x CRCDATAIN: %08x CRCCHKSUM: %08x\n", regs->ctrl, regs->crcctrl, regs->crcdatain, regs->crcchksum); dmainfo(" CRCSTATUS: %02x DBGCTRL: %02x QOSCTRL: %02x SWTRIGCTRL: %08x\n", - regs->crcstatus, regs->errctrl, regs->qosctrl, regs->swtrigctrl); + regs->crcstatus, regs->dbgctrl, regs->qosctrl, regs->swtrigctrl); dmainfo(" PRICTRL0: %08x INTPEND: %04x INSTSTATUS: %08x BUSYCH: %08x\n", regs->prictrl0, regs->intpend, regs->intstatus, regs->busych); dmainfo(" PENDCH: %08x ACTIVE: %08x BASEADDR: %08x WRBADDR: %08x\n", regs->pendch, regs->active, regs->baseaddr, regs->wrbaddr); dmainfo(" CHID: %02x CHCRTRLA: %02x CHCRTRLB: %08x CHINFLAG: %02x\n", - regs->chid, regs->chctrla, regs->chctrlb, regs->chintflag, + regs->chid, regs->chctrla, regs->chctrlb, regs->chintflag); dmainfo(" CHSTATUS: %02x\n", regs->chstatus); } diff --git a/arch/arm/src/samdl/sam_dmac.h b/arch/arm/src/samdl/sam_dmac.h index 2a6937dd68..f7b7a18b7b 100644 --- a/arch/arm/src/samdl/sam_dmac.h +++ b/arch/arm/src/samdl/sam_dmac.h @@ -50,8 +50,8 @@ #ifdef CONFIG_SAMDL_DMAC -#if defined(CONFIG_ARCH_FAMILY_SAMD20) -# error Missing support for the SAMD20 architecture +#if defined(CONFIG_ARCH_FAMILY_SAMD20) || defined(CONFIG_ARCH_FAMILY_SAMD21) +# include "chip/samd_dmac.h" #elif defined(CONFIG_ARCH_FAMILY_SAML21) # include "chip/saml_dmac.h" #else -- GitLab From 2bc4967c0fd12ddc50256dc867d58532a54d761d Mon Sep 17 00:00:00 2001 From: Matt Thompson Date: Thu, 25 Jan 2018 20:15:58 +0000 Subject: [PATCH 116/228] Merged in extent3d/nuttx (pull request #583) SAMDL: Added DMAC header for SAMD, fixed up sam_dmac to compile with debugging enabled --- arch/arm/src/samdl/chip/samd_dmac.h | 399 ++++++++++++++++++++++++++++ arch/arm/src/samdl/sam_dmac.c | 20 +- arch/arm/src/samdl/sam_dmac.h | 4 +- 3 files changed, 413 insertions(+), 10 deletions(-) create mode 100644 arch/arm/src/samdl/chip/samd_dmac.h diff --git a/arch/arm/src/samdl/chip/samd_dmac.h b/arch/arm/src/samdl/chip/samd_dmac.h new file mode 100644 index 0000000000..318fc38a42 --- /dev/null +++ b/arch/arm/src/samdl/chip/samd_dmac.h @@ -0,0 +1,399 @@ +/******************************************************************************************** + * arch/arm/src/samdl/chip/samd_dmac.h + * + * Copyright (C) 2015 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * Matt Thompson + * + * References: + * "Atmel SAM L21E / SAM L21G / SAM L21J Smart ARM-Based Microcontroller + * Datasheet", Atmel-42385C-SAML21_Datasheet_Preliminary-03/20/15 + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ********************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_SAMDL_CHIP_SAMD_DMAC_H +#define __ARCH_ARM_SRC_SAMDL_CHIP_SAMD_DMAC_H + +/******************************************************************************************** + * Included Files + ********************************************************************************************/ + +#include + +#include "chip.h" + +/******************************************************************************************** + * Pre-processor Definitions + ********************************************************************************************/ +/* DMAC register offsets ********************************************************************/ + +#define SAM_DMAC_CTRL_OFFSET 0x0000 /* Control Register */ +#define SAM_DMAC_CRCCTRL_OFFSET 0x0002 /* CRC Control Register */ +#define SAM_DMAC_CRCDATAIN_OFFSET 0x0004 /* CRC Data Input Register */ +#define SAM_DMAC_CRCCHKSUM_OFFSET 0x0008 /* CRC Checksum Register */ +#define SAM_DMAC_CRCSTATUS_OFFSET 0x000c /* CRC Status Register */ +#define SAM_DMAC_DBGCTRL_OFFSET 0x000d /* Debug Control Register */ +#define SAM_DMAC_QOSCTRL_OFFSET 0x000e /* Quality of Service Control Register */ +#define SAM_DMAC_SWTRIGCTRL_OFFSET 0x0010 /* Software Trigger Control Register */ +#define SAM_DMAC_PRICTRL0_OFFSET 0x0014 /* Priority Control 0 Register */ +#define SAM_DMAC_INTPEND_OFFSET 0x0020 /* Interrupt Pending Register */ +#define SAM_DMAC_INTSTATUS_OFFSET 0x0024 /* Interrupt Status Register */ +#define SAM_DMAC_BUSYCH_OFFSET 0x0028 /* Busy Channels Register */ +#define SAM_DMAC_PENDCH_OFFSET 0x002c /* Pending Channels Register */ +#define SAM_DMAC_ACTIVE_OFFSET 0x0030 /* Active Channels and Levels Register */ +#define SAM_DMAC_BASEADDR_OFFSET 0x0034 /* Descriptor Memory Section Base Address Register */ +#define SAM_DMAC_WRBADDR_OFFSET 0x0038 /* Write-Back Memory Section Base Address Register */ +#define SAM_DMAC_CHID_OFFSET 0x003f /* Channel ID Register */ +#define SAM_DMAC_CHCTRLA_OFFSET 0x0040 /* Channel Control A Register */ +#define SAM_DMAC_CHCTRLB_OFFSET 0x0044 /* Channel Control B Register */ +#define SAM_DMAC_CHINTENCLR_OFFSET 0x004c /* Channel Interrupt Enable Clear Register */ +#define SAM_DMAC_CHINTENSET_OFFSET 0x004d /* Channel Interrupt Enable Set Register */ +#define SAM_DMAC_CHINTFLAG_OFFSET 0x004e /* Channel Interrupt Flag Status and Clear Register */ +#define SAM_DMAC_CHSTATUS_OFFSET 0x004f /* Channel Status Register */ + +/* LPSRAM Registers Relative to BASEADDR or WRBADDR */ + +#define SAM_LPSRAM_BTCTRL_OFFSET 0x0000 /* Block Transfer Control Register */ +#define SAM_LPSRAM_BTCNT_OFFSET 0x0002 /* Block Transfer Count Register */ +#define SAM_LPSRAM_SRCADDR_OFFSET 0x0004 /* Block Transfer Source Address Register */ +#define SAM_LPSRAM_DSTADDR_OFFSET 0x0008 /* Block Transfer Destination Address Register */ +#define SAM_LPSRAM_DESCADDR_OFFSET 0x000c /* Next Address Descriptor Register */ + +/* DMAC register addresses ******************************************************************/ + +#define SAM_DMAC_CTRL (SAM_DMAC_BASE+SAM_DMAC_CTRL_OFFSET) +#define SAM_DMAC_CRCCTRL (SAM_DMAC_BASE+SAM_DMAC_CRCCTRL_OFFSET) +#define SAM_DMAC_CRCDATAIN (SAM_DMAC_BASE+SAM_DMAC_CRCDATAIN_OFFSET) +#define SAM_DMAC_CRCCHKSUM (SAM_DMAC_BASE+SAM_DMAC_CRCCHKSUM_OFFSET) +#define SAM_DMAC_CRCSTATUS (SAM_DMAC_BASE+SAM_DMAC_CRCSTATUS_OFFSET) +#define SAM_DMAC_DBGCTRL (SAM_DMAC_BASE+SAM_DMAC_DBGCTRL_OFFSET) +#define SAM_DMAC_QOSCTRL (SAM_DMAC_BASE+SAM_DMAC_QOSCTRL_OFFSET) +#define SAM_DMAC_SWTRIGCTRL (SAM_DMAC_BASE+SAM_DMAC_SWTRIGCTRL_OFFSET) +#define SAM_DMAC_PRICTRL0 (SAM_DMAC_BASE+SAM_DMAC_PRICTRL0_OFFSET) +#define SAM_DMAC_INTPEND (SAM_DMAC_BASE+SAM_DMAC_INTPEND_OFFSET) +#define SAM_DMAC_INTSTATUS (SAM_DMAC_BASE+SAM_DMAC_INTSTATUS_OFFSET) +#define SAM_DMAC_BUSYCH (SAM_DMAC_BASE+SAM_DMAC_BUSYCH_OFFSET) +#define SAM_DMAC_PENDCH (SAM_DMAC_BASE+SAM_DMAC_PENDCH_OFFSET) +#define SAM_DMAC_ACTIVE (SAM_DMAC_BASE+SAM_DMAC_ACTIVE_OFFSET) +#define SAM_DMAC_BASEADDR (SAM_DMAC_BASE+SAM_DMAC_BASEADDR_OFFSET) +#define SAM_DMAC_WRBADDR (SAM_DMAC_BASE+SAM_DMAC_WRBADDR_OFFSET) +#define SAM_DMAC_CHID (SAM_DMAC_BASE+SAM_DMAC_CHID_OFFSET) +#define SAM_DMAC_CHCTRLA (SAM_DMAC_BASE+SAM_DMAC_CHCTRLA_OFFSET) +#define SAM_DMAC_CHCTRLB (SAM_DMAC_BASE+SAM_DMAC_CHCTRLB_OFFSET) +#define SAM_DMAC_CHINTENCLR (SAM_DMAC_BASE+SAM_DMAC_CHINTENCLR_OFFSET) +#define SAM_DMAC_CHINTENSET (SAM_DMAC_BASE+SAM_DMAC_CHINTENSET_OFFSET) +#define SAM_DMAC_CHINTFLAG (SAM_DMAC_BASE+SAM_DMAC_CHINTFLAG_OFFSET) +#define SAM_DMAC_CHSTATUS (SAM_DMAC_BASE+SAM_DMAC_CHSTATUS_OFFSET) + +/* DMAC register bit definitions ************************************************************/ + +/* Control Register */ + +#define DMAC_CTRL_SWRST (1 << 0) /* Bit 0: Software Reset */ +#define DMAC_CTRL_DMAENABLE (1 << 1) /* Bit 1: DMA Enable */ +#define DMAC_CTRL_CRCENABLE (1 << 2) /* Bit 2: CRC Enable */ +#define DMAC_CTRL_LVLEN0 (1 << 8) /* Bit 8: Priority level 0 Enable */ +#define DMAC_CTRL_LVLEN1 (1 << 9) /* Bit 9: Priority level 1 Enable */ +#define DMAC_CTRL_LVLEN2 (1 << 10) /* Bit 10: Priority level 2 Enable */ +#define DMAC_CTRL_LVLEN3 (1 << 11) /* Bit 10: Priority level 2 Enable */ + +/* CRC Control Register */ + +#define DMAC_CRCCTRL_CRCBEATSIZE_SHIFT (0) /* Bits 0-1: CRC beat size */ +#define DMAC_CRCCTRL_CRCBEATSIZE_MASK (3 < DMAC_CRCCTRL_CRCBEATSIZE_SHIFT) +# define DMAC_CRCCTRL_CRCBEATSIZE_BYTE (0 < DMAC_CRCCTRL_CRCBEATSIZE_SHIFT) /* 8-bit bus transfer */ +# define DMAC_CRCCTRL_CRCBEATSIZE_HWORD (1 < DMAC_CRCCTRL_CRCBEATSIZE_SHIFT) /* 16-bit bus transfer */ +# define DMAC_CRCCTRL_CRCBEATSIZE_WORD (2 < DMAC_CRCCTRL_CRCBEATSIZE_SHIFT) /* 32-bit bus transfer */ +#define DMAC_CRCCTRL_CRCPOLY_SHIFT (2) /* Bits 2-3: CRC polynomial type */ +#define DMAC_CRCCTRL_CRCPOLY_MASK (3 < DMAC_CRCCTRL_CRCPOLY_SHIFT) +# define DMAC_CRCCTRL_CRCPOLY_CRC16 (0 < DMAC_CRCCTRL_CRCPOLY_SHIFT) /* CRC-16 (CRC-CCITT) */ +# define DMAC_CRCCTRL_CRCPOLY_CRC32 (1 < DMAC_CRCCTRL_CRCPOLY_SHIFT) /* CRC32 (IEEE 802.3) */ +#define DMAC_CRCCTRL_CRCSRC_SHIFT (8) /* Bits 8-13: CRC Input Source */ +#define DMAC_CRCCTRL_CRCSRC_MASK (0x3f < DMAC_CRCCTRL_CRCSRC_SHIFT) +# define DMAC_CRCCTRL_CRCSRC_NOACTION (0 < DMAC_CRCCTRL_CRCSRC_SHIFT) /* No action */ +# define DMAC_CRCCTRL_CRCSRC_IO (1 < DMAC_CRCCTRL_CRCSRC_SHIFT) /* I/O interface */ +# define DMAC_CRCCTRL_CRCSRC_CHAN(n) (((uint32_t)(n) + 0x20) < DMAC_CRCCTRL_CRCSRC_SHIFT) + +/* CRC Data Input Register (32-bit value) */ +/* CRC Checksum Register (32-bit value) */ + +/* CRC Status Register */ + +#define DMAC_CRCSTATUS_CRCBUSY (1 << 0) /* Bit 0: CRC module busy */ +#define DMAC_CRCSTATUS_CRCZERO (1 << 1) /* Bit 1: CRC zero */ + +/* Debug Control Register */ + +#define DMAC_DBGCTRL_DBGRUN (1 << 0) /* Bit 0: Debug run */ + +/* Quality of Service Control Register */ + +#define DMAC_QOSCTRL_WRBQOS_SHIFT (0) /* Bits 0-1: Write back quality of service */ +#define DMAC_QOSCTRL_WRBQOS_MASK (3 << DMAC_QOSCTRL_WRBQOS_SHIFT) +# define DMAC_QOSCTRL_WRBQOS_DISABLE (0 << DMAC_QOSCTRL_WRBQOS_SHIFT) /* Background */ +# define DMAC_QOSCTRL_WRBQOS_LOW (1 << DMAC_QOSCTRL_WRBQOS_SHIFT) /* Sensitive bandwidth */ +# define DMAC_QOSCTRL_WRBQOS_MEDIUM (2 << DMAC_QOSCTRL_WRBQOS_SHIFT) /* Sensitive latency */ +# define DMAC_QOSCTRL_WRBQOS_HIGH (3 << DMAC_QOSCTRL_WRBQOS_SHIFT) /* Critical latency */ +#define DMAC_QOSCTRL_FQOS_SHIFT (2) /* Bits 2-3: Fetch quality of service */ +#define DMAC_QOSCTRL_FQOS_MASK (3 << DMAC_QOSCTRL_FQOS_SHIFT) +# define DMAC_QOSCTRL_FQOS_DISABLE (0 << DMAC_QOSCTRL_FQOS_SHIFT) /* Background */ +# define DMAC_QOSCTRL_FQOS_LOW (1 << DMAC_QOSCTRL_FQOS_SHIFT) /* Sensitive bandwidth */ +# define DMAC_QOSCTRL_FQOS_MEDIUM (2 << DMAC_QOSCTRL_FQOS_SHIFT) /* Sensitive latency */ +# define DMAC_QOSCTRL_FQOS_HIGH (3 << DMAC_QOSCTRL_FQOS_SHIFT) /* Critical latency */ +#define DMAC_QOSCTRL_DQOS_SHIFT (4) /* Bits 4-5: Data transfer quality of service */ +#define DMAC_QOSCTRL_DQOS_MASK (3 << DMAC_QOSCTRL_DQOS_SHIFT) +# define DMAC_QOSCTRL_DQOS_DISABLE (0 << DMAC_QOSCTRL_DQOS_SHIFT) /* Background */ +# define DMAC_QOSCTRL_DQOS_LOW (1 << DMAC_QOSCTRL_DQOS_SHIFT) /* Sensitive bandwidth */ +# define DMAC_QOSCTRL_DQOS_MEDIUM (2 << DMAC_QOSCTRL_DQOS_SHIFT) /* Sensitive latency */ +# define DMAC_QOSCTRL_DQOS_HIGH (3 << DMAC_QOSCTRL_DQOS_SHIFT) /* Critical latency */ + +/* Common bit definitions for: Software Trigger Control Register, Interrupt Status Register, + * Busy Channels Register, and Pending Channels Register + */ + +#define DMAC_CHAN(n) (1 << (n)) /* DMAC Channel n, n=0-11 */ + +/* Priority Control 0 Register */ + +#define DMAC_PRICTRL0_LVLPRI0_SHIFT (0) /* Bits 0-3: Level 0 channel priority number */ +#define DMAC_PRICTRL0_LVLPRI0_MASK (15 << DMAC_PRICTRL0_LVLPRI0_SHIFT) +# define DMAC_PRICTRL0_LVLPRI0(n) ((uint32_t)(n) << DMAC_PRICTRL0_LVLPRI0_SHIFT) +#define DMAC_PRICTRL0_RRLVLEN0 (1 << 7) /* Bit 7: Level 0 round-robin arbitrarion enable */ +#define DMAC_PRICTRL0_LVLPRI1_SHIFT (8) /* Bits 8-11: Level 1 channel priority number */ +#define DMAC_PRICTRL0_LVLPRI1_MASK (15 << DMAC_PRICTRL0_LVLPRI1_SHIFT) +# define DMAC_PRICTRL0_LVLPRI1(n) ((uint32_t)(n) << DMAC_PRICTRL0_LVLPRI1_SHIFT) +#define DMAC_PRICTRL0_RRLVLEN1 (1 << 15) /* Bit 15: Level 1 round-robin arbitrarion enable */ +#define DMAC_PRICTRL0_LVLPRI2_SHIFT (16) /* Bits 16-18: Level 2 channel priority number */ +#define DMAC_PRICTRL0_LVLPRI2_MASK (7 << DMAC_PRICTRL0_LVLPRI2_SHIFT) +# define DMAC_PRICTRL0_LVLPRI2(n) ((uint32_t)(n) << DMAC_PRICTRL0_LVLPRI2_SHIFT) +#define DMAC_PRICTRL0_RRLVLEN2 (1 << 23) /* Bit 23: Level 2 round-robin arbitrarion enable */ +#define DMAC_PRICTRL0_LVLPRI3_SHIFT (24) /* Bits 24-27: Level 3 channel priority number */ +#define DMAC_PRICTRL0_LVLPRI3_MASK (7 << DMAC_PRICTRL0_LVLPRI3_SHIFT) +# define DMAC_PRICTRL0_LVLPRI3(n) ((uint32_t)(n) << DMAC_PRICTRL0_LVLPRI3_SHIFT) +#define DMAC_PRICTRL0_RRLVLEN3 (1 << 31) /* Bit 23: Level 3 round-robin arbitrarion enable */ + +/* Interrupt Pending Register */ + +#define DMAC_INTPEND_ID_SHIFT (0) /* Bit 0-3: Channel ID */ +#define DMAC_INTPEND_ID_MASK (15 << DMAC_INTPEND_ID_SHIFT) +#define DMAC_INTPEND_TERR (1 << 8) /* Bit 8: Transfer error */ +#define DMAC_INTPEND_TCMPL (1 << 9) /* Bit 9: Transfer complete */ +#define DMAC_INTPEND_SUSP (1 << 10) /* Bit 10: Channel suspend */ +#define DMAC_INTPEND_FERR (1 << 13) /* Bit 13: Fetch error */ +#define DMAC_INTPEND_BUSY (1 << 14) /* Bit 14: Busy */ +#define DMAC_INTPEND_PEND (1 << 15) /* Bit 15: Pending */ + +/* Interrupt Status Register */ +/* Busy Channels Register */ +/* Pending Channels Register */ + +/* Active Channels and Levels Register */ + +#define DMAC_ACTIVE_LVLEX0 (1 << 0) /* Bit 0: Level 0 channel trigger request executing */ +#define DMAC_ACTIVE_LVLEX1 (1 << 1) /* Bit 1: Level 1 channel trigger request executing */ +#define DMAC_ACTIVE_LVLEX2 (1 << 2) /* Bit 2: Level 2 channel trigger request executing */ +#define DMAC_ACTIVE_LVLEX3 (1 << 3) /* Bit 3: Level 3 channel trigger request executing */ +#define DMAC_ACTIVE_ID_SHIFT (8) /* Bits 8-11: Active channel ID */ +#define DMAC_ACTIVE_ID_MASK (15 << DMAC_ACTIVE_ID_SHIFT) +#define DMAC_ACTIVE_ABUSY (1 << 15) /* Bit 15: Active channel busy */ +#define DMAC_ACTIVE_BTCNT_SHIFT (16) /* Bit 16-31: Active channel block transfer count */ +#define DMAC_ACTIVE_BTCNT_MASK (0xffff << DMAC_ACTIVE_BTCNT_SHIFT) + +/* Descriptor Memory Section Base Address Register (32-bit address) */ +/* Write-Back Memory Section Base Address Register (31-bit address) */ + +/* Channel ID Register */ + +#define DMAC_CHID_MASK 0x0f /* Bits 0-3: Channel ID */ + +/* Channel Control A Register */ + +#define DMAC_CHCTRLA_SWRST (1 << 0) /* Bit 0: Channel software reset */ +#define DMAC_CHCTRLA_ENABLE (1 << 1) /* Bit 1: Channel enable */ + +/* Channel Control B Register */ + +#define DMAC_CHCTRLB_EVACT_SHIFT (0) /* Bits 0-2: Event input action */ +#define DMAC_CHCTRLB_EVACT_MASK (7 << DMAC_CHCTRLB_EVACT_SHIFT) +# define DMAC_CHCTRLB_EVACT_NOACT (0 << DMAC_CHCTRLB_EVACT_SHIFT) /* No action */ +# define DMAC_CHCTRLB_EVACT_TRIG (1 << DMAC_CHCTRLB_EVACT_SHIFT) /* Normal Transfer and Conditional Transfer on Strobe +trigger */ +# define DMAC_CHCTRLB_EVACT_CTRIG (2 << DMAC_CHCTRLB_EVACT_SHIFT) /* Conditional transfer trigger */ +# define DMAC_CHCTRLB_EVACT_CBLOCK (3 << DMAC_CHCTRLB_EVACT_SHIFT) /* Conditional block transfer */ +# define DMAC_CHCTRLB_EVACT_SUSPEND (4 << DMAC_CHCTRLB_EVACT_SHIFT) /* Channel suspend operation */ +# define DMAC_CHCTRLB_EVACT_RESUME (5 << DMAC_CHCTRLB_EVACT_SHIFT) /* Channel resume operation */ +# define DMAC_CHCTRLB_EVACT_SSKIP (6 << DMAC_CHCTRLB_EVACT_SHIFT) /* Skip next block suspend action */ +#define DMAC_CHCTRLB_EVIE (1 << 3) /* Bit 3: Channel event input enable */ +#define DMAC_CHCTRLB_EVOE (1 << 4) /* Bit 4: Channel event output enable */ +#define DMAC_CHCTRLB_LVL_SHIFT (5) /* Bits 5-6: Channel arbitration level */ +#define DMAC_CHCTRLB_LVL_MASK (3 << DMAC_CHCTRLB_LVL_SHIFT) +# define DMAC_CHCTRLB_LVL(n) ((uint32_t)(n) << DMAC_CHCTRLB_LVL_SHIFT) +# define DMAC_CHCTRLB_LVL_LVL0 (0 << DMAC_CHCTRLB_LVL_SHIFT) /* Channel priority level 0 */ +# define DMAC_CHCTRLB_LVL_LVL1 (1 << DMAC_CHCTRLB_LVL_SHIFT) /* Channel priority level 1 */ +# define DMAC_CHCTRLB_LVL_LVL2 (2 << DMAC_CHCTRLB_LVL_SHIFT) /* Channel priority level 2 */ +# define DMAC_CHCTRLB_LVL_LVL3 (3 << DMAC_CHCTRLB_LVL_SHIFT) /* Channel priority level 3 */ +#define DMAC_CHCTRLB_TRIGSRC_SHIFT (8) /* Bits 8-13: Trigger source */ +#define DMAC_CHCTRLB_TRIGSRC_MASK (0x3f << DMAC_CHCTRLB_TRIGSRC_SHIFT) + #define DMAC_CHCTRLB_TRIGSRC(n) ((uint32_t)(n) << DMAC_CHCTRLB_TRIGSRC_SHIFT) +#define DMAC_CHCTRLB_TRIGACT_SHIFT (22) /* Bits 22-23: Trigger action */ +#define DMAC_CHCTRLB_TRIGACT_MASK (3 << DMAC_CHCTRLB_TRIGACT_SHIFT) +# define DMAC_CHCTRLB_TRIGACT_BLOCK (0 << DMAC_CHCTRLB_TRIGACT_SHIFT) /* One trigger required for each action */ +# define DMAC_CHCTRLB_TRIGACT_BEAT (2 << DMAC_CHCTRLB_TRIGACT_SHIFT) /* One trigger required for beat transfer */ +# define DMAC_CHCTRLB_TRIGACT_TRANSACT (3 << DMAC_CHCTRLB_TRIGACT_SHIFT) /* One trigger required for each transaction */ +#define DMAC_CHCTRLB_CMD_SHIFT (24) /* Bits 24-25: Software command */ +#define DMAC_CHCTRLB_CMD_MASK (3 << DMAC_CHCTRLB_CMD_SHIFT) +# define DMAC_CHCTRLB_CMD_NOACTION (0 << DMAC_CHCTRLB_CMD_SHIFT) /* No action */ +# define DMAC_CHCTRLB_CMD_SUSPEND (1 << DMAC_CHCTRLB_CMD_SHIFT) /* Channel suspend operation */ +# define DMAC_CHCTRLB_CMD_RESUME (2 << DMAC_CHCTRLB_CMD_SHIFT) /* Channel resume operation */ + +/* Values for use with the DMAC_CHCTRLB_TRIGSRC(n) macro: */ + +#define DMAC_TRIGSRC_DISABLE (0) /* Only software/event triggers */ +#define DMAC_TRIGSRC_SERCOM0_RX (1) /* SERCOM0 RX Trigger */ +#define DMAC_TRIGSRC_SERCOM0_TX (2) /* SERCOM0 TX Trigger */ +#define DMAC_TRIGSRC_SERCOM1_RX (3) /* SERCOM1 RX Trigger */ +#define DMAC_TRIGSRC_SERCOM1_TX (4) /* SERCOM1 TX Trigger */ +#define DMAC_TRIGSRC_SERCOM2_RX (5) /* SERCOM2 RX Trigger */ +#define DMAC_TRIGSRC_SERCOM2_TX (6) /* SERCOM2 TX Trigger */ +#define DMAC_TRIGSRC_SERCOM3_RX (7) /* SERCOM3 RX Trigger */ +#define DMAC_TRIGSRC_SERCOM3_TX (8) /* SERCOM3 TX Trigger */ +#define DMAC_TRIGSRC_SERCOM4_RX (9) /* SERCOM4 RX Trigger */ +#define DMAC_TRIGSRC_SERCOM4_TX (10) /* SERCOM4 TX Trigger */ +#define DMAC_TRIGSRC_SERCOM5_RX (11) /* SERCOM4 RX Trigger */ +#define DMAC_TRIGSRC_SERCOM5_TX (12) /* SERCOM4 TX Trigger */ +#define DMAC_TRIGSRC_TCC0_OVF (13) /* TCC0 Overflow Trigger */ +#define DMAC_TRIGSRC_TCC0_MC0 (14) /* TCC0 Match/Compare 0 Trigger */ +#define DMAC_TRIGSRC_TCC0_MC1 (15) /* TCC0 Match/Compare 1 Trigger */ +#define DMAC_TRIGSRC_TCC0_MC2 (16) /* TCC0 Match/Compare 2 Trigger */ +#define DMAC_TRIGSRC_TCC0_MC3 (17) /* TCC0 Match/Compare 3 Trigger */ +#define DMAC_TRIGSRC_TCC1_OVF (18) /* TCC1 Overflow Trigger */ +#define DMAC_TRIGSRC_TCC1_MC0 (19) /* TCC1 Match/Compare 0 Trigger */ +#define DMAC_TRIGSRC_TCC1_MC1 (20) /* TCC1 Match/Compare 1 Trigger */ +#define DMAC_TRIGSRC_TCC2_OVF (21) /* TCC2 Overflow Trigger */ +#define DMAC_TRIGSRC_TCC2_MC0 (22) /* TCC2 Match/Compare 0 Trigger */ +#define DMAC_TRIGSRC_TCC2_MC1 (23) /* TCC2 Match/Compare 1 Trigger */ +#define DMAC_TRIGSRC_TC0_OVF (24) /* TC0 Overflow Trigger */ +#define DMAC_TRIGSRC_TC0_MC0 (25) /* TC0 Match/Compare 0 Trigger */ +#define DMAC_TRIGSRC_TC0 MC1 (26) /* TC0 Match/Compare 1 Trigger */ +#define DMAC_TRIGSRC_TC1_OVF (27) /* TC1 Overflow Trigger */ +#define DMAC_TRIGSRC_TC1_MC0 (28) /* TC1 Match/Compare 0 Trigger */ +#define DMAC_TRIGSRC_TC1_MC1 (29) /* TC1 Match/Compare 1 Trigger */ +#define DMAC_TRIGSRC_TC2_OVF (30) /* TC2 Overflow Trigger */ +#define DMAC_TRIGSRC_TC2_MC0 (31) /* TC2 Match/Compare 0 Trigger */ +#define DMAC_TRIGSRC_TC2_MC1 (32) /* TC2 Match/Compare 1 Trigger */ +#define DMAC_TRIGSRC_TC3_OVF (33) /* TC3 Overflow Trigger */ +#define DMAC_TRIGSRC_TC3_MC0 (34) /* TC3 Match/Compare 0 Trigger */ +#define DMAC_TRIGSRC_TC3_MC1 (35) /* TC3 Match/Compare 1 Trigger */ +#define DMAC_TRIGSRC_TC4_OVF (36) /* TC4 Overflow Trigger */ +#define DMAC_TRIGSRC_TC4_MC0 (37) /* TC4 Match/Compare 0 Trigger */ +#define DMAC_TRIGSRC_TC4_MC1 (38) /* TC4 Match/Compare 1 Trigger */ +#define DMAC_TRIGSRC_ADC_RESRDY (39) /* ADC Result Ready Trigger */ +#define DMAC_TRIGSRC_DAC_EMPTY (40) /* DAC0 Empty Trigger */ +#define DMAC_TRIGSRC_I2S0_RX (41) /* I2S0 RX Trigger */ +#define DMAC_TRIGSRC_I2S1_RX (42) /* I2S1 RX Trigger */ +#define DMAC_TRIGSRC_I2S0_TX (43) /* I2S0 TX Trigger */ +#define DMAC_TRIGSRC_I2S1_TX (44) /* I2S1 TX Trigger */ + +/* Common register bit definitions: Channel Interrupt Enable Clear Register, Channel Interrupt + * Enable Set Register, and Channel Interrupt Flag Status and Clear Register + */ + +#define DMAC_INT_TERR (1 << 0) /* Bit 0: Transfer error interrupt */ +#define DMAC_INT_TCMPL (1 << 1) /* Bit 1: Channel transfer complete interrupt */ +#define DMAC_INT_SUSP (1 << 2) /* Bit 2: Channel suspend interrupt */ +#define DMAC_INT_ALL (0x07) + +/* Channel Status Register */ + +#define DMAC_CHSTATUS_PEND (1 << 0) /* Bit 0: Chennel pending */ +#define DMAC_CHSTATUS_BUSY (1 << 1) /* Bit 1: Channel busy */ +#define DMAC_CHSTATUS_FERR (1 << 2) /* Bit 2: Channel fetch error */ + +/* Block Transfer Control Register */ + +#define LPSRAM_BTCTRL_VALID (1 << 0) /* Bit 0: Descriptor valid */ +#define LPSRAM_BTCTRL_EVOSEL_SHIFT (1) /* Bits 1-2: Event output selection */ +#define LPSRAM_BTCTRL_EVOSEL_MASK (3 << LPSRAM_BTCTRL_EVOSEL_SHIFT) +# define LPSRAM_BTCTRL_EVOSEL_DISABLE (0 << LPSRAM_BTCTRL_EVOSEL_SHIFT) /* Event generation disabled */ +# define LPSRAM_BTCTRL_EVOSEL_BLOCK (1 << LPSRAM_BTCTRL_EVOSEL_SHIFT) /* Event strobe when block transfer complete */ +# define LPSRAM_BTCTRL_EVOSEL_BEAT (3 << LPSRAM_BTCTRL_EVOSEL_SHIFT) /* Event strobe when beat transfer complete */ +#define LPSRAM_BTCTRL_BLOCKACT_SHIFT (3) /* Bits 3-4: Block action */ +#define LPSRAM_BTCTRL_BLOCKACT_MASK (3 << LPSRAM_BTCTRL_BLOCKACT_SHIFT) +# define LPSRAM_BTCTRL_BLOCKACT_NOACT (0 << LPSRAM_BTCTRL_BLOCKACT_SHIFT) /* Channel disabled if last block transfer */ +# define LPSRAM_BTCTRL_BLOCKACT_INT (1 << LPSRAM_BTCTRL_BLOCKACT_SHIFT) /* Channel disabled if last block transfer + block int */ +# define LPSRAM_BTCTRL_BLOCKACT_SUSPEND (2 << LPSRAM_BTCTRL_BLOCKACT_SHIFT) /* Channel suspend operation is completed */ +# define LPSRAM_BTCTRL_BLOCKACT_BOTH (3 << LPSRAM_BTCTRL_BLOCKACT_SHIFT) /* Both channel suspend operation + block int */ +#define LPSRAM_BTCTRL_BEATSIZE_SHIFT (8) /* Bits 8-9: Beat size */ +#define LPSRAM_BTCTRL_BEATSIZE_MASK (3 << LPSRAM_BTCTRL_BEATSIZE_SHIFT) +# define LPSRAM_BTCTRL_BEATSIZE_BYTE (0 << LPSRAM_BTCTRL_BEATSIZE_SHIFT) /* 8-bit bus transfer */ +# define LPSRAM_BTCTRL_BEATSIZE_HWORD (1 << LPSRAM_BTCTRL_BEATSIZE_SHIFT) /* 16-bit bus transfer */ +# define LPSRAM_BTCTRL_BEATSIZE_WORD (2 << LPSRAM_BTCTRL_BEATSIZE_SHIFT) /* 32-bit bus transfer */ +#define LPSRAM_BTCTRL_SRCINC (1 << 10) /* Bit 10: Source address increment enable */ +#define LPSRAM_BTCTRL_DSTINC (1 << 11) /* Bit 11: Destination address increment enable */ +#define LPSRAM_BTCTRL_STEPSEL (1 << 12) /* Bit 12: Step selection */ +#define LPSRAM_BTCTRL_STEPSIZE_SHIFT (13) /* Bits 13-15: Address increment step */ +#define LPSRAM_BTCTRL_STEPSIZE_MASK (7 << LPSRAM_BTCTRL_STEPSIZE_SHIFT) +# define LPSRAM_BTCTRL_STEPSIZE_X1 (0 << LPSRAM_BTCTRL_STEPSIZE_SHIFT) /* Next ADDR = ADDR + (BEATSIZE+1) * 1 */ +# define LPSRAM_BTCTRL_STEPSIZE_X2 (1 << LPSRAM_BTCTRL_STEPSIZE_SHIFT) /* Next ADDR = ADDR + (BEATSIZE+1) * 2 */ +# define LPSRAM_BTCTRL_STEPSIZE_X4 (2 << LPSRAM_BTCTRL_STEPSIZE_SHIFT) /* Next ADDR = ADDR + (BEATSIZE+1) * 4 */ +# define LPSRAM_BTCTRL_STEPSIZE_X8 (3 << LPSRAM_BTCTRL_STEPSIZE_SHIFT) /* Next ADDR = ADDR + (BEATSIZE+1) * 8 */ +# define LPSRAM_BTCTRL_STEPSIZE_X16 (4 << LPSRAM_BTCTRL_STEPSIZE_SHIFT) /* Next ADDR = ADDR + (BEATSIZE+1) * 16 */ +# define LPSRAM_BTCTRL_STEPSIZE_X32 (5 << LPSRAM_BTCTRL_STEPSIZE_SHIFT) /* Next ADDR = ADDR + (BEATSIZE+1) * 32 */ +# define LPSRAM_BTCTRL_STEPSIZE_X64 (6 << LPSRAM_BTCTRL_STEPSIZE_SHIFT) /* Next ADDR = ADDR + (BEATSIZE+1) * 64 */ +# define LPSRAM_BTCTRL_STEPSIZE_X128 (7 << LPSRAM_BTCTRL_STEPSIZE_SHIFT) /* Next ADDR = ADDR + (BEATSIZE+1) * 128 */ + +/* Block Transfer Count Register (16-bit count) */ +/* Block Transfer Source Address Register (32-bit address) */ +/* Block Transfer Destination Address Register (32-bit address) */ +/* Next Address Descriptor Register (32-bit address) */ + +/******************************************************************************************** + * Public Types + ********************************************************************************************/ +/* DMA descriptor */ + +struct dma_desc_s +{ + uint16_t btctrl; /* Block Transfer Control Register */ + uint16_t btcnt; /* Block Transfer Count Register */ + uint32_t srcaddr; /* Block Transfer Source Address Register */ + uint32_t dstaddr; /* Block Transfer Destination Address Register */ + uint32_t descaddr; /* Next Address Descriptor Register */ +}; + +/******************************************************************************************** + * Public Data + ********************************************************************************************/ + +/******************************************************************************************** + * Public Functions + ********************************************************************************************/ + +#endif /* __ARCH_ARM_SRC_SAMDL_CHIP_SAMD_DMAC_H */ diff --git a/arch/arm/src/samdl/sam_dmac.c b/arch/arm/src/samdl/sam_dmac.c index 5ca812ea4f..cf4d495b3a 100644 --- a/arch/arm/src/samdl/sam_dmac.c +++ b/arch/arm/src/samdl/sam_dmac.c @@ -500,7 +500,7 @@ static struct dma_desc_s *sam_append_desc(struct sam_dmach_s *dmach, { /* There is no previous link. This is the new head of the list */ - DEBUGASSERT(desc == g_base_desc[dmach->dc_chan]); + DEBUGASSERT(desc == &g_base_desc[dmach->dc_chan]); } #if CONFIG_SAMDL_DMAC_NDESC > 0 @@ -627,7 +627,7 @@ static int sam_txbuffer(struct sam_dmach_s *dmach, uint32_t paddr, uint16_t btcnt; uint16_t tmp; - DEBUGASSERT(dmac->dc_dir == DMADIR_UNKOWN || dmac->dc_dir == DMADIR_TX); + DEBUGASSERT(dmach->dc_dir == DMADIR_UNKOWN || dmach->dc_dir == DMADIR_TX); /* Set up the Block Transfer Control Register configuration: * @@ -703,7 +703,7 @@ static int sam_rxbuffer(struct sam_dmach_s *dmach, uint32_t paddr, uint16_t btcnt; uint16_t tmp; - DEBUGASSERT(dmac->dc_dir == DMADIR_UNKOWN || dmac->dc_dir == DMADIR_RX); + DEBUGASSERT(dmach->dc_dir == DMADIR_UNKOWN || dmach->dc_dir == DMADIR_RX); /* Set up the Block Transfer Control Register configuration: * @@ -1218,10 +1218,13 @@ int sam_dmastart(DMA_HANDLE handle, dma_callback_t callback, void *arg) /* Enable the channel */ ctrla = DMAC_CHCTRLA_ENABLE; + +#ifdef CONFIG_ARCH_FAMILY_SAML21 if (dmach->dc_flags & DMACH_FLAG_RUNINSTDBY) { ctrla |= DMAC_CHCTRLA_RUNSTDBY; } +#endif putreg8(ctrla, SAM_DMAC_CHCTRLA); @@ -1272,19 +1275,18 @@ void sam_dmastop(DMA_HANDLE handle) #ifdef CONFIG_DEBUG_DMA_INFO void sam_dmasample(DMA_HANDLE handle, struct sam_dmaregs_s *regs) { - struct sam_dmach_s *dmach = (struct sam_dmach_s *)handle; - uintptr_t base; irqstate_t flags; /* Sample DMAC registers. */ flags = enter_critical_section(); + regs->ctrl = getreg16(SAM_DMAC_CTRL); /* Control Register */ regs->crcctrl = getreg16(SAM_DMAC_CRCCTRL); /* CRC Control Register */ regs->crcdatain = getreg32(SAM_DMAC_CRCDATAIN); /* CRC Data Input Register */ regs->crcchksum = getreg32(SAM_DMAC_CRCCHKSUM); /* CRC Checksum Register */ regs->crcstatus = getreg8(SAM_DMAC_CRCSTATUS); /* CRC Status Register */ - regs->errctrl = getreg8(SAM_DMAC_DBGCTRL); /* Debug Control Register */ + regs->dbgctrl = getreg8(SAM_DMAC_DBGCTRL); /* Debug Control Register */ regs->qosctrl = getreg8(SAM_DMAC_QOSCTRL); /* Quality of Service Control Register */ regs->swtrigctrl = getreg32(SAM_DMAC_SWTRIGCTRL); /* Software Trigger Control Register */ regs->prictrl0 = getreg32(SAM_DMAC_PRICTRL0); /* Priority Control 0 Register */ @@ -1300,6 +1302,8 @@ void sam_dmasample(DMA_HANDLE handle, struct sam_dmaregs_s *regs) regs->chctrlb = getreg32(SAM_DMAC_CHCTRLB); /* Channel Control B Register */ regs->chintflag = getreg8(SAM_DMAC_CHINTFLAG); /* Channel Interrupt Flag Status and Clear Register */ regs->chstatus = getreg8(SAM_DMAC_CHSTATUS); /* Channel Status Register */ + + leave_critical_section(flags); } #endif /* CONFIG_DEBUG_DMA_INFO */ @@ -1325,13 +1329,13 @@ void sam_dmadump(DMA_HANDLE handle, const struct sam_dmaregs_s *regs, dmainfo(" CTRL: %04x CRCCTRL: %04x CRCDATAIN: %08x CRCCHKSUM: %08x\n", regs->ctrl, regs->crcctrl, regs->crcdatain, regs->crcchksum); dmainfo(" CRCSTATUS: %02x DBGCTRL: %02x QOSCTRL: %02x SWTRIGCTRL: %08x\n", - regs->crcstatus, regs->errctrl, regs->qosctrl, regs->swtrigctrl); + regs->crcstatus, regs->dbgctrl, regs->qosctrl, regs->swtrigctrl); dmainfo(" PRICTRL0: %08x INTPEND: %04x INSTSTATUS: %08x BUSYCH: %08x\n", regs->prictrl0, regs->intpend, regs->intstatus, regs->busych); dmainfo(" PENDCH: %08x ACTIVE: %08x BASEADDR: %08x WRBADDR: %08x\n", regs->pendch, regs->active, regs->baseaddr, regs->wrbaddr); dmainfo(" CHID: %02x CHCRTRLA: %02x CHCRTRLB: %08x CHINFLAG: %02x\n", - regs->chid, regs->chctrla, regs->chctrlb, regs->chintflag, + regs->chid, regs->chctrla, regs->chctrlb, regs->chintflag); dmainfo(" CHSTATUS: %02x\n", regs->chstatus); } diff --git a/arch/arm/src/samdl/sam_dmac.h b/arch/arm/src/samdl/sam_dmac.h index 2a6937dd68..f7b7a18b7b 100644 --- a/arch/arm/src/samdl/sam_dmac.h +++ b/arch/arm/src/samdl/sam_dmac.h @@ -50,8 +50,8 @@ #ifdef CONFIG_SAMDL_DMAC -#if defined(CONFIG_ARCH_FAMILY_SAMD20) -# error Missing support for the SAMD20 architecture +#if defined(CONFIG_ARCH_FAMILY_SAMD20) || defined(CONFIG_ARCH_FAMILY_SAMD21) +# include "chip/samd_dmac.h" #elif defined(CONFIG_ARCH_FAMILY_SAML21) # include "chip/saml_dmac.h" #else -- GitLab From e15fc0b65a0835082bb14b0b2d55df44938beee0 Mon Sep 17 00:00:00 2001 From: Frank Benkert Date: Fri, 26 Jan 2018 07:52:18 -0600 Subject: [PATCH 117/228] arch/arm/src/samv7/sam_lowputc.c: Fix undefined variable when using USART1 for other purposes than UART (e.g. SPI). --- arch/arm/src/samv7/sam_config.h | 8 ++++++-- arch/arm/src/samv7/sam_lowputc.c | 23 +++-------------------- 2 files changed, 9 insertions(+), 22 deletions(-) diff --git a/arch/arm/src/samv7/sam_config.h b/arch/arm/src/samv7/sam_config.h index 05e6db84f1..f9e37ac3f3 100644 --- a/arch/arm/src/samv7/sam_config.h +++ b/arch/arm/src/samv7/sam_config.h @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/samv7/sam-config.h * - * Copyright (C) 2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2015, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -144,7 +144,11 @@ # undef CONFIG_SAMV7_USART2 #endif -/* Are any USARTs enabled? */ +/* Are any USARTs enabled? + * + * REVISIT: Setting HAVE_UART_DEVICE only makes sense of the USART is being + * used as a UART. + */ #if defined(CONFIG_SAMV7_USART0) || defined(CONFIG_SAMV7_USART1) || \ defined(CONFIG_SAMV7_USART2) diff --git a/arch/arm/src/samv7/sam_lowputc.c b/arch/arm/src/samv7/sam_lowputc.c index c9d4b6e9ce..614a9defd9 100644 --- a/arch/arm/src/samv7/sam_lowputc.c +++ b/arch/arm/src/samv7/sam_lowputc.c @@ -172,26 +172,6 @@ #endif /* HAVE_SERIAL_CONSOLE */ -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -277,6 +257,9 @@ void sam_lowsetup(void) uint64_t divb3; uint32_t intpart; uint32_t fracpart; +#endif +#if (defined(HAVE_SERIAL_CONSOLE) && !defined(CONFIG_SUPPRESS_UART_CONFIG)) || \ + defined(CONFIG_SAMV7_USART1) uint32_t regval; #endif -- GitLab From 9e60dffc5aa1645c27c4fa92fb064fada0934daa Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 26 Jan 2018 08:50:21 -0600 Subject: [PATCH 118/228] arch/srm/src/stm32f7: Remove confusing, redundant, and misleading STM32_BKP_BASE definitions. --- arch/arm/src/stm32f7/chip/stm32f72xx73xx_memorymap.h | 1 - arch/arm/src/stm32f7/chip/stm32f74xx75xx_memorymap.h | 1 - arch/arm/src/stm32f7/chip/stm32f76xx77xx_memorymap.h | 1 - 3 files changed, 3 deletions(-) diff --git a/arch/arm/src/stm32f7/chip/stm32f72xx73xx_memorymap.h b/arch/arm/src/stm32f7/chip/stm32f72xx73xx_memorymap.h index 669fd36abd..c786506f76 100644 --- a/arch/arm/src/stm32f7/chip/stm32f72xx73xx_memorymap.h +++ b/arch/arm/src/stm32f7/chip/stm32f72xx73xx_memorymap.h @@ -112,7 +112,6 @@ #define STM32_TIM14_BASE 0x40002000 /* 0x40002000-0x400023ff: TIM14 */ #define STM32_LPTIM1_BASE 0x40002400 /* 0x40002400-0x400027ff: LPTIM1 */ #define STM32_RTC_BASE 0x40002800 /* 0x40002800-0x40002bff: RTC & BKP Registers */ -#define STM32_BKP_BASE 0x40002800 /* 0x40002800-0x40002bff: RTC & BKP Registers */ #define STM32_WWDG_BASE 0x40002c00 /* 0x40002c00-0x40002fff: WWDG */ #define STM32_IWDG_BASE 0x40003000 /* 0x40003000-0x400033ff: IWDG */ #define STM32_SPI2_BASE 0x40003800 /* 0x40003800-0x40003bff: SPI2 / I2S2 */ diff --git a/arch/arm/src/stm32f7/chip/stm32f74xx75xx_memorymap.h b/arch/arm/src/stm32f7/chip/stm32f74xx75xx_memorymap.h index 89d5223845..55b8481512 100644 --- a/arch/arm/src/stm32f7/chip/stm32f74xx75xx_memorymap.h +++ b/arch/arm/src/stm32f7/chip/stm32f74xx75xx_memorymap.h @@ -113,7 +113,6 @@ #define STM32_TIM14_BASE 0x40002000 /* 0x40002000-0x400023ff: TIM14 */ #define STM32_LPTIM1_BASE 0x40002400 /* 0x40002400-0x400027ff: LPTIM1 */ #define STM32_RTC_BASE 0x40002800 /* 0x40002800-0x40002bff: RTC & BKP Registers */ -#define STM32_BKP_BASE 0x40002800 /* 0x40002800-0x40002bff: RTC & BKP Registers */ #define STM32_WWDG_BASE 0x40002c00 /* 0x40002c00-0x40002fff: WWDG */ #define STM32_IWDG_BASE 0x40003000 /* 0x40003000-0x400033ff: IWDG */ #define STM32_SPI2_BASE 0x40003800 /* 0x40003800-0x40003bff: SPI2 / I2S2 */ diff --git a/arch/arm/src/stm32f7/chip/stm32f76xx77xx_memorymap.h b/arch/arm/src/stm32f7/chip/stm32f76xx77xx_memorymap.h index 0c27a36e93..6d988895e0 100644 --- a/arch/arm/src/stm32f7/chip/stm32f76xx77xx_memorymap.h +++ b/arch/arm/src/stm32f7/chip/stm32f76xx77xx_memorymap.h @@ -113,7 +113,6 @@ #define STM32_TIM14_BASE 0x40002000 /* 0x40002000-0x400023ff: TIM14 */ #define STM32_LPTIM1_BASE 0x40002400 /* 0x40002400-0x400027ff: LPTIM1 */ #define STM32_RTC_BASE 0x40002800 /* 0x40002800-0x40002bff: RTC & BKP Registers */ -#define STM32_BKP_BASE 0x40002800 /* 0x40002800-0x40002bff: RTC & BKP Registers */ #define STM32_WWDG_BASE 0x40002c00 /* 0x40002c00-0x40002fff: WWDG */ #define STM32_IWDG_BASE 0x40003000 /* 0x40003000-0x400033ff: IWDG */ #define STM32_CAN3_BASE 0x40003400 /* 0x40003400-0x400037ff: CAN3 */ -- GitLab From fc387b9aa0b2ee23dbecfa61d17530ea0c21fdf3 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 26 Jan 2018 11:18:46 -0600 Subject: [PATCH 119/228] arch/arm/src/stm32: Remove bogus definitions of STM32_BKP_BASE from the F2, F3, and F4 memory maps. Unlike the F1, these parts do not have a separate BKP address region. The BKP registers are with the RTCC address regions. --- arch/arm/src/stm32/chip/stm32f20xxx_memorymap.h | 1 - arch/arm/src/stm32/chip/stm32f30xxx_memorymap.h | 3 +-- arch/arm/src/stm32/chip/stm32f33xxx_memorymap.h | 3 +-- arch/arm/src/stm32/chip/stm32f37xxx_memorymap.h | 3 +-- arch/arm/src/stm32/chip/stm32f40xxx_memorymap.h | 1 - arch/arm/src/stm32/stm32.h | 1 - 6 files changed, 3 insertions(+), 9 deletions(-) diff --git a/arch/arm/src/stm32/chip/stm32f20xxx_memorymap.h b/arch/arm/src/stm32/chip/stm32f20xxx_memorymap.h index 9c64929a0b..b1b4f41c34 100644 --- a/arch/arm/src/stm32/chip/stm32f20xxx_memorymap.h +++ b/arch/arm/src/stm32/chip/stm32f20xxx_memorymap.h @@ -129,7 +129,6 @@ #define STM32_TIM13_BASE 0x40001c00 /* 0x40001c00-0x40001fff: TIM13 timer */ #define STM32_TIM14_BASE 0x40002000 /* 0x40002000-0x400023ff: TIM14 timer */ #define STM32_RTC_BASE 0x40002800 /* 0x40002800-0x40002bff: RTC & BKP registers */ -#define STM32_BKP_BASE 0x40002850 #define STM32_WWDG_BASE 0x40002c00 /* 0x40002c00-0x40002fff: Window watchdog (WWDG) */ #define STM32_IWDG_BASE 0x40003000 /* 0x40003000-0x400033ff: Independent watchdog (IWDG) */ #define STM32_I2S2EXT_BASE 0x40003400 /* 0x40003400-0x400037ff: I2S2ext */ diff --git a/arch/arm/src/stm32/chip/stm32f30xxx_memorymap.h b/arch/arm/src/stm32/chip/stm32f30xxx_memorymap.h index a7cbc46117..30308dd93b 100644 --- a/arch/arm/src/stm32/chip/stm32f30xxx_memorymap.h +++ b/arch/arm/src/stm32/chip/stm32f30xxx_memorymap.h @@ -92,8 +92,7 @@ #define STM32_TIM4_BASE 0x40000800 /* 0x40000800-0x40000bff TIM4 */ #define STM32_TIM6_BASE 0x40001000 /* 0x40001000-0x400013ff TIM6 */ #define STM32_TIM7_BASE 0x40001400 /* 0x40001400-0x400017ff TIM7 */ -#define STM32_RTC_BASE 0x40002800 /* 0x40002800-0x40002bff RTC */ -#define STM32_BKP_BASE 0x40002850 /* 0x40002850-0x4000288c BKP */ +#define STM32_RTC_BASE 0x40002800 /* 0x40002800-0x40002bff RTC and BKP */ #define STM32_WWDG_BASE 0x40002c00 /* 0x40002c00-0x40002fff WWDG */ #define STM32_IWDG_BASE 0x40003000 /* 0x40003000-0x400033ff IWDG */ #define STM32_I2S2EXT_BASE 0x40003400 /* 0x40003400-0x400037ff I2S2ext */ diff --git a/arch/arm/src/stm32/chip/stm32f33xxx_memorymap.h b/arch/arm/src/stm32/chip/stm32f33xxx_memorymap.h index 85e5ce175d..90af97f036 100644 --- a/arch/arm/src/stm32/chip/stm32f33xxx_memorymap.h +++ b/arch/arm/src/stm32/chip/stm32f33xxx_memorymap.h @@ -93,8 +93,7 @@ #define STM32_TIM3_BASE 0x40000400 /* 0x40000400-0x400007ff TIM3 */ #define STM32_TIM6_BASE 0x40001000 /* 0x40001000-0x400013ff TIM6 */ #define STM32_TIM7_BASE 0x40001400 /* 0x40001400-0x400017ff TIM7 */ -#define STM32_RTC_BASE 0x40002800 /* 0x40002800-0x40002bff RTC */ -#define STM32_BKP_BASE 0x40002850 /* 0x40002850-0x400028cc BKP */ +#define STM32_RTC_BASE 0x40002800 /* 0x40002800-0x40002bff RTC and BKP */ #define STM32_WWDG_BASE 0x40002c00 /* 0x40002c00-0x40002fff WWDG */ #define STM32_IWDG_BASE 0x40003000 /* 0x40003000-0x400033ff IWDG */ #define STM32_USART2_BASE 0x40004400 /* 0x40004400-0x400047ff USART2 */ diff --git a/arch/arm/src/stm32/chip/stm32f37xxx_memorymap.h b/arch/arm/src/stm32/chip/stm32f37xxx_memorymap.h index 49bfa2ecf2..2089ad0be8 100644 --- a/arch/arm/src/stm32/chip/stm32f37xxx_memorymap.h +++ b/arch/arm/src/stm32/chip/stm32f37xxx_memorymap.h @@ -93,8 +93,7 @@ #define STM32_TIM12_BASE 0x40001800 /* 0x40001800-0x40001bff TIM12 */ #define STM32_TIM13_BASE 0x40001c00 /* 0x40001c00-0x40001fff TIM13 */ #define STM32_TIM14_BASE 0x40002000 /* 0x40002000-0x400023ff TIM14 */ -#define STM32_RTC_BASE 0x40002800 /* 0x40002800-0x40002bff RTC */ -#define STM32_BKP_BASE 0x40002850 /* 0x40002850-0x400028cc BKP */ +#define STM32_RTC_BASE 0x40002800 /* 0x40002800-0x40002bff RTC and BKP */ #define STM32_WWDG_BASE 0x40002c00 /* 0x40002c00-0x40002fff WWDG */ #define STM32_IWDG_BASE 0x40003000 /* 0x40003000-0x400033ff IWDG */ #define STM32_SPI2_BASE 0x40003800 /* 0x40003800-0x40003bff SPI2, or */ diff --git a/arch/arm/src/stm32/chip/stm32f40xxx_memorymap.h b/arch/arm/src/stm32/chip/stm32f40xxx_memorymap.h index 8b493e916c..8bd7d5e16a 100644 --- a/arch/arm/src/stm32/chip/stm32f40xxx_memorymap.h +++ b/arch/arm/src/stm32/chip/stm32f40xxx_memorymap.h @@ -129,7 +129,6 @@ #define STM32_TIM13_BASE 0x40001c00 /* 0x40001c00-0x40001fff: TIM13 timer */ #define STM32_TIM14_BASE 0x40002000 /* 0x40002000-0x400023ff: TIM14 timer */ #define STM32_RTC_BASE 0x40002800 /* 0x40002800-0x40002bff: RTC & BKP registers */ -#define STM32_BKP_BASE 0x40002850 #define STM32_WWDG_BASE 0x40002c00 /* 0x40002c00-0x40002fff: Window watchdog (WWDG) */ #define STM32_IWDG_BASE 0x40003000 /* 0x40003000-0x400033ff: Independent watchdog (IWDG) */ #define STM32_I2S2EXT_BASE 0x40003400 /* 0x40003400-0x400037ff: I2S2ext */ diff --git a/arch/arm/src/stm32/stm32.h b/arch/arm/src/stm32/stm32.h index 56225ee211..fe61cd4811 100644 --- a/arch/arm/src/stm32/stm32.h +++ b/arch/arm/src/stm32/stm32.h @@ -57,7 +57,6 @@ #include "chip.h" #include "stm32_adc.h" -//#include "stm32_bkp.h" #include "stm32_can.h" #include "stm32_comp.h" #include "stm32_dbgmcu.h" -- GitLab From bffa425233cce5a382df5351e6d6e805ecdd9fd5 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 26 Jan 2018 11:26:40 -0600 Subject: [PATCH 120/228] arch/arm/src/stm32: stm32_bkp.h should only be used for STM32 F1 --- arch/arm/src/stm32/stm32_bkp.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/arm/src/stm32/stm32_bkp.h b/arch/arm/src/stm32/stm32_bkp.h index 21399c38bd..aefb746b75 100644 --- a/arch/arm/src/stm32/stm32_bkp.h +++ b/arch/arm/src/stm32/stm32_bkp.h @@ -42,8 +42,10 @@ #include -#include "chip.h" -#include "chip/stm32_bkp.h" +#ifdef CONFIG_STM32_STM32F10XX +# include "chip.h" +# include "chip/stm32_bkp.h" +#endif /************************************************************************************ * Pre-processor Definitions -- GitLab From 49d07162bfd0f8824c5e5766977dd33fdca8ce0e Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 26 Jan 2018 11:34:48 -0600 Subject: [PATCH 121/228] arch/arm/src/stm32: stm32_rtcc.h should be used to access BKP registers on F2, F3, and F4. --- arch/arm/src/stm32/stm32_bkp.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/arm/src/stm32/stm32_bkp.h b/arch/arm/src/stm32/stm32_bkp.h index aefb746b75..9e2533bed3 100644 --- a/arch/arm/src/stm32/stm32_bkp.h +++ b/arch/arm/src/stm32/stm32_bkp.h @@ -42,9 +42,17 @@ #include +/* Only the STM32 F1 family has a dedicated address region for BKP memory. For F2, + * F3, and F3 parts, the bKP registers lie in the same address region as the RTCC + * and the definitions in chip/stm32_rtcc.h should be used to access backup + * registers. NOTE: These definitions are not interchangeable! + */ + +#include "chip.h" #ifdef CONFIG_STM32_STM32F10XX -# include "chip.h" # include "chip/stm32_bkp.h" +#else +# include "chip/stm32_rtcc.h" #endif /************************************************************************************ -- GitLab From 12e3e47d3c5b00b4885949218e0cc6a56e758093 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 27 Jan 2018 09:37:46 -0600 Subject: [PATCH 122/228] Update comments, mostly spelling errors. --- arch/arm/src/stm32/stm32_bkp.h | 2 +- configs/flipnclick-sam3x/README.txt | 2 +- .../flipnclick-sam3x/src/flipnclick-sam3x.h | 6 ++-- sched/irq/irq_csection.c | 4 +-- sched/module/mod_procfs.c | 2 +- sched/sched/sched_addreadytorun.c | 4 +-- sched/task/task_posixspawn.c | 3 +- sched/task/task_setup.c | 30 +++++++++---------- sched/task/task_vfork.c | 1 + 9 files changed, 28 insertions(+), 26 deletions(-) diff --git a/arch/arm/src/stm32/stm32_bkp.h b/arch/arm/src/stm32/stm32_bkp.h index 9e2533bed3..4478ffd633 100644 --- a/arch/arm/src/stm32/stm32_bkp.h +++ b/arch/arm/src/stm32/stm32_bkp.h @@ -43,7 +43,7 @@ #include /* Only the STM32 F1 family has a dedicated address region for BKP memory. For F2, - * F3, and F3 parts, the bKP registers lie in the same address region as the RTCC + * F3, and F4 parts, the bKP registers lie in the same address region as the RTCC * and the definitions in chip/stm32_rtcc.h should be used to access backup * registers. NOTE: These definitions are not interchangeable! */ diff --git a/configs/flipnclick-sam3x/README.txt b/configs/flipnclick-sam3x/README.txt index bdfab6df68..9a63b8baa5 100644 --- a/configs/flipnclick-sam3x/README.txt +++ b/configs/flipnclick-sam3x/README.txt @@ -397,7 +397,7 @@ Loading Code 3 GND GND 4 JTAG_TCK SWDCLK/TCK SAM3X pin 28, Pulled up on board 5 GND GND - 6 JTAG_TDO SWO/EXta/TRACECTL SAM3X pin 30, ulled up on board + 6 JTAG_TDO SWO/EXta/TRACECTL SAM3X pin 30, Pulled up on board 7 N/C Key 8 JTAG_TDI NC/EXTb/TDI SAM3X pin 29, Pulled up on board 9 GND GNDDetect diff --git a/configs/flipnclick-sam3x/src/flipnclick-sam3x.h b/configs/flipnclick-sam3x/src/flipnclick-sam3x.h index 8887523ff7..26b4e5e029 100644 --- a/configs/flipnclick-sam3x/src/flipnclick-sam3x.h +++ b/configs/flipnclick-sam3x/src/flipnclick-sam3x.h @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __CONFIGS_FLIPNCLICK_SAM3X_SRC_ARDUNO_DUE_H -#define __CONFIGS_FLIPNCLICK_SAM3X_SRC_ARDUNO_DUE_H +#ifndef __CONFIGS_FLIPNCLICK_SAM3X_SRC_FLIPNCLICK_SAM3X_H +#define __CONFIGS_FLIPNCLICK_SAM3X_SRC_FLIPNCLICK_SAM3X_H /************************************************************************************ * Included Files @@ -159,5 +159,5 @@ int sam_bringup(void); #endif /* __ASSEMBLY__ */ -#endif /* __CONFIGS_FLIPNCLICK_SAM3X_SRC_ARDUNO_DUE_H */ +#endif /* __CONFIGS_FLIPNCLICK_SAM3X_SRC_FLIPNCLICK_SAM3X_H */ diff --git a/sched/irq/irq_csection.c b/sched/irq/irq_csection.c index cfba38111e..63e0be9f66 100644 --- a/sched/irq/irq_csection.c +++ b/sched/irq/irq_csection.c @@ -99,7 +99,7 @@ volatile uint8_t g_cpu_nestcount[CONFIG_SMP_NCPUS]; * spinlock. * - Another task on CPUm attempts to enter the critical section but has * to wait, spinning to get g_cpu_irqlock with interrupts disabled. - * - The task on CPUn causes a new task to become ready-torun and the + * - The task on CPUn causes a new task to become ready-to-run and the * scheduler selects CPUm. CPUm is requested to pause via a pause * interrupt. * - But the task on CPUm is also attempting to enter the critical @@ -641,7 +641,7 @@ bool irq_cpu_locked(int cpu) { /* In this case g_cpu_irqlock should be unlocked. However, if * the lock was established in the interrupt handler AND there are - * no bits set in g_cpu_irqset, that probabaly means only that + * no bits set in g_cpu_irqset, that probably means only that * critical section was established from an interrupt handler. * Return false in either case. */ diff --git a/sched/module/mod_procfs.c b/sched/module/mod_procfs.c index d900165c99..c658189604 100644 --- a/sched/module/mod_procfs.c +++ b/sched/module/mod_procfs.c @@ -286,7 +286,7 @@ static int modprocfs_dup(FAR const struct file *oldp, FAR struct file *newp) return -ENOMEM; } - /* The copy the file attribtes from the old attributes to the new */ + /* The copy the file attributes from the old attributes to the new */ memcpy(newpriv, oldpriv, sizeof(struct modprocfs_file_s)); diff --git a/sched/sched/sched_addreadytorun.c b/sched/sched/sched_addreadytorun.c index 95b7bf6474..dcd07ac9a6 100644 --- a/sched/sched/sched_addreadytorun.c +++ b/sched/sched/sched_addreadytorun.c @@ -141,7 +141,7 @@ bool sched_addreadytorun(FAR struct tcb_s *btcb) * * If the currently active task has preemption disabled and the new TCB * would cause this task to be pre-empted, the new task is added to the - * g_pendingtasks list instead. Thepending tasks will be made + * g_pendingtasks list instead. The pending tasks will be made * ready-to-run when preemption isunlocked. * * Inputs: @@ -405,7 +405,7 @@ bool sched_addreadytorun(FAR struct tcb_s *btcb) /* No context switch. Assign the CPU and set the assigned state. * * REVISIT: I have seen this assertion fire. Apparently another - * CPU may add another, higher prioirity task to the same + * CPU may add another, higher priority task to the same * g_assignedtasks[] list sometime after sched_cpu_select() was * called above, leaving this TCB in the wrong task list if task_state * is TSTATE_TASK_ASSIGNED). diff --git a/sched/task/task_posixspawn.c b/sched/task/task_posixspawn.c index 1922690aab..0792101884 100644 --- a/sched/task/task_posixspawn.c +++ b/sched/task/task_posixspawn.c @@ -351,7 +351,8 @@ int posix_spawn(FAR pid_t *pid, FAR const char *path, pid, path, file_actions, attr, argv); /* If there are no file actions to be performed and there is no change to - * the signal mask, then start the new child task directly from the parent task. + * the signal mask, then start the new child task directly from the parent + * task. */ #ifndef CONFIG_DISABLE_SIGNALS diff --git a/sched/task/task_setup.c b/sched/task/task_setup.c index b051117090..fc2ff3f6c8 100644 --- a/sched/task/task_setup.c +++ b/sched/task/task_setup.c @@ -57,6 +57,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* This is an artificial limit to detect error conditions where an argv[] * list is not properly terminated. */ @@ -445,8 +446,8 @@ static int thread_schedsetup(FAR struct tcb_s *tcb, int priority, * Assign the task name. * * Input Parameters: - * tcb - Address of the new task's TCB - * name - Name of the new task + * tcb - Address of the new task's TCB + * name - Name of the new task * * Return Value: * None @@ -657,11 +658,11 @@ int task_schedsetup(FAR struct task_tcb_s *tcb, int priority, start_t start, * pthread_schedsetup() is called from pthread_create(), * * Input Parameters: - * tcb - Address of the new task's TCB - * priority - Priority of the new task - * start - Start-up function (probably pthread_start()) - * entry - Entry point of the new pthread - * ttype - Type of the new thread: task, pthread, or kernel thread + * tcb - Address of the new task's TCB + * priority - Priority of the new task + * start - Start-up function (probably pthread_start()) + * entry - Entry point of the new pthread + * ttype - Type of the new thread: task, pthread, or kernel thread * * Return Value: * OK on success; ERROR on failure. @@ -700,14 +701,13 @@ int pthread_schedsetup(FAR struct pthread_tcb_s *tcb, int priority, * task runs in. * * Input Parameters: - * tcb - Address of the new task's TCB - * name - Name of the new task (not used) - * argv - A pointer to an array of input parameters. - * Up to CONFIG_MAX_TASK_ARG parameters may be - * provided. If fewer than CONFIG_MAX_TASK_ARG - * parameters are passed, the list should be - * terminated with a NULL argv[] value. - * If no parameters are required, argv may be NULL. + * tcb - Address of the new task's TCB + * name - Name of the new task (not used) + * argv - A pointer to an array of input parameters. Up to + * CONFIG_MAX_TASK_ARG parameters may be provided. If fewer than + * CONFIG_MAX_TASK_ARG parameters are passed, the list should be + * terminated with a NULL argv[] value. If no parameters are + * required, argv may be NULL. * * Return Value: * OK diff --git a/sched/task/task_vfork.c b/sched/task/task_vfork.c index 7c15868cc9..7b4f53a123 100644 --- a/sched/task/task_vfork.c +++ b/sched/task/task_vfork.c @@ -57,6 +57,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* vfork() requires architecture-specific support as well as waipid(). */ #if defined(CONFIG_ARCH_HAVE_VFORK) && defined(CONFIG_SCHED_WAITPID) -- GitLab From c0a79a8e4540aed0d2c2936e2361655cd51c359f Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 27 Jan 2018 12:42:51 -0600 Subject: [PATCH 123/228] configs/flipnclick-sam3x: Fix an error in the control of one LED. LEDs should not be pulled up since they are active high. --- configs/flipnclick-sam3x/README.txt | 4 ++-- configs/flipnclick-sam3x/include/board.h | 2 +- configs/flipnclick-sam3x/src/flipnclick-sam3x.h | 10 +++++----- configs/flipnclick-sam3x/src/sam_autoleds.c | 10 +++++----- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/configs/flipnclick-sam3x/README.txt b/configs/flipnclick-sam3x/README.txt index 9a63b8baa5..564002f3d3 100644 --- a/configs/flipnclick-sam3x/README.txt +++ b/configs/flipnclick-sam3x/README.txt @@ -71,8 +71,8 @@ Buttons and LEDs LED_PANIC The system has crashed 2Hz N/C N/C N/C N/C LED_IDLE MCU is is sleep mode ---- Not used ----- - Thus if LED L is glowing on and all other LEDs are off (except LED D which - was left on but is no longer controlled by NuttX and so may be in any + Thus if LED L is glowing faintly and all other LEDs are off (except LED D + which was left on but is no longer controlled by NuttX and so may be in any state), NuttX has successfully booted and is, apparently, running normally and taking interrupts. If any of LEDs A-D are statically set, then NuttX failed to boot and the LED indicates the initialization phase where the diff --git a/configs/flipnclick-sam3x/include/board.h b/configs/flipnclick-sam3x/include/board.h index fe0246747d..f69677b409 100644 --- a/configs/flipnclick-sam3x/include/board.h +++ b/configs/flipnclick-sam3x/include/board.h @@ -211,7 +211,7 @@ #define LED_PANIC 4 /* The system has crashed 2Hz N/C N/C N/C N/C */ #undef LED_IDLE /* MCU is is sleep mode ---- Not used ----- */ -/* Thus if LED L is glowing on and all other LEDs are off (except LED D which +/* Thus if LED L is faintly glowing and all other LEDs are off (except LED D which * was left on but is no longer controlled by NuttX and so may be in any state), * NuttX has successfully booted and is, apparently, running normally and taking * interrupts. If any of LEDs A-D are statically set, then NuttX failed to boot diff --git a/configs/flipnclick-sam3x/src/flipnclick-sam3x.h b/configs/flipnclick-sam3x/src/flipnclick-sam3x.h index 26b4e5e029..0b07395f19 100644 --- a/configs/flipnclick-sam3x/src/flipnclick-sam3x.h +++ b/configs/flipnclick-sam3x/src/flipnclick-sam3x.h @@ -68,15 +68,15 @@ * A high output value illuminates the LEDs. */ -#define GPIO_LED_L (GPIO_OUTPUT | GPIO_CFG_PULLUP | GPIO_OUTPUT_CLEAR | \ +#define GPIO_LED_L (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ GPIO_PORT_PIOB | GPIO_PIN27) -#define GPIO_LED_A (GPIO_OUTPUT | GPIO_CFG_PULLUP | GPIO_OUTPUT_CLEAR | \ +#define GPIO_LED_A (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ GPIO_PORT_PIOC | GPIO_PIN6) -#define GPIO_LED_B (GPIO_OUTPUT | GPIO_CFG_PULLUP | GPIO_OUTPUT_CLEAR | \ +#define GPIO_LED_B (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ GPIO_PORT_PIOC | GPIO_PIN5) -#define GPIO_LED_C (GPIO_OUTPUT | GPIO_CFG_PULLUP | GPIO_OUTPUT_CLEAR | \ +#define GPIO_LED_C (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ GPIO_PORT_PIOC | GPIO_PIN7) -#define GPIO_LED_D (GPIO_OUTPUT | GPIO_CFG_PULLUP | GPIO_OUTPUT_CLEAR | \ +#define GPIO_LED_D (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ GPIO_PORT_PIOC | GPIO_PIN8) /* SPI chip select pins. diff --git a/configs/flipnclick-sam3x/src/sam_autoleds.c b/configs/flipnclick-sam3x/src/sam_autoleds.c index 3f0b450178..ff309be24a 100644 --- a/configs/flipnclick-sam3x/src/sam_autoleds.c +++ b/configs/flipnclick-sam3x/src/sam_autoleds.c @@ -64,8 +64,8 @@ * LED_PANIC The system has crashed 2Hz N/C N/C N/C N/C * LED_IDLE MCU is is sleep mode ---- Not used ----- * - * Thus if LED L is glowing on and all other LEDs are off (except LED D - * which was left on but is no longer controlled by NuttX and so may be in + * Thus if LED L is faintly glowing and all other LEDs are off (except LED + * D which was left on but is no longer controlled by NuttX and so may be in * any state), NuttX has successfully booted and is, apparently, running * normally and taking interrupts. If any of LEDs A-D are statically set, * then NuttX failed to boot and the LED indicates the initialization phase @@ -99,7 +99,7 @@ #ifdef CONFIG_ARCH_LEDS /**************************************************************************** - * Processor Definitinos + * Processor Definitions ****************************************************************************/ /* LED indices */ @@ -123,7 +123,7 @@ static void board_autoled_setone(int ledndx) sam_gpiowrite(GPIO_LED_L, ledon[INDEX_LED_L]); sam_gpiowrite(GPIO_LED_A, ledon[INDEX_LED_A]); sam_gpiowrite(GPIO_LED_B, ledon[INDEX_LED_B]); - sam_gpiowrite(GPIO_LED_C, ledon[INDEX_LED_D]); + sam_gpiowrite(GPIO_LED_C, ledon[INDEX_LED_C]); sam_gpiowrite(GPIO_LED_D, ledon[INDEX_LED_D]); } @@ -176,7 +176,7 @@ void board_autoled_on(int led) board_autoled_setone(INDEX_LED_B); break; - case 2: + case 2: board_autoled_setone(INDEX_LED_C); break; -- GitLab From 67d09e831b897fc5e04c8ecc16302d064bcdb573 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 27 Jan 2018 13:34:58 -0600 Subject: [PATCH 124/228] Fix recurring typo: *tino->*tion --- ChangeLog | 2 +- ReleaseNotes | 2 +- arch/arm/src/sama5/Kconfig | 2 +- arch/arm/src/samv7/sam_qspi.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 055d540aea..ee37fbdd33 100755 --- a/ChangeLog +++ b/ChangeLog @@ -17445,7 +17445,7 @@ * The lcdrw example has been removed because it violates the portable OS interface (2017-10-14). * All configurations that use NXIMAGE or NXHELLO must select - NX_MULTIUSER. All configuratinos that use examples/nxterm must enable + NX_MULTIUSER. All configurations that use examples/nxterm must enable CONFIG_LIB_BOARDCTL (2017-10-14). * configs/stm32f103-minimum: Add support for LM75 in the stm32f103-minimum board. From Alan Carvalho de Assis (2017-10-14). diff --git a/ReleaseNotes b/ReleaseNotes index d3302c654e..aaa960e996 100644 --- a/ReleaseNotes +++ b/ReleaseNotes @@ -16669,7 +16669,7 @@ detailed bugfix information): * Examples/Tests: apps/examples: - All configurations that use NXIMAGE or NXHELLO must select - NX_MULTIUSER. All configuratinos that use examples/nxterm must + NX_MULTIUSER. All configurations that use examples/nxterm must enable CONFIG_LIB_BOARDCTL. - All configurations that use NXLINES must select NX_MULTIUSER. All configurations that use the NX server need to have larger POSIX diff --git a/arch/arm/src/sama5/Kconfig b/arch/arm/src/sama5/Kconfig index ae701198f1..35f4efe98c 100644 --- a/arch/arm/src/sama5/Kconfig +++ b/arch/arm/src/sama5/Kconfig @@ -165,7 +165,7 @@ config SAMA5_HAVE_VDEC bool default n -# Summary configuratinos +# Summary configurations config SAMA5_FLEXCOM bool diff --git a/arch/arm/src/samv7/sam_qspi.c b/arch/arm/src/samv7/sam_qspi.c index e2ff6dea79..80ce719c80 100644 --- a/arch/arm/src/samv7/sam_qspi.c +++ b/arch/arm/src/samv7/sam_qspi.c @@ -1737,7 +1737,7 @@ struct qspi_dev_s *sam_qspi_initialize(int intf) #ifdef CONFIG_SAMV7_QSPI if (intf == 0) { - /* If this function is called multiple times, the following operatinos + /* If this function is called multiple times, the following operations * will be performed multiple times. */ -- GitLab From cec8709ec186eef189e08a1fe9f8ed08a0cfae52 Mon Sep 17 00:00:00 2001 From: raiden00pl Date: Sat, 27 Jan 2018 15:27:52 +0100 Subject: [PATCH 125/228] stm32/Kconfig: fix COMP7 dependency stm32_hrtim: add HRTIM push-pull mode configuration stm32f334-disco: add buck-boost converter mode --- arch/arm/src/stm32/Kconfig | 32 +++++++++++- arch/arm/src/stm32/stm32_hrtim.c | 65 ++++++++++++++++++++---- arch/arm/src/stm32/stm32_hrtim.h | 4 -- configs/stm32f334-disco/src/stm32_smps.c | 26 ++++++++-- 4 files changed, 108 insertions(+), 19 deletions(-) diff --git a/arch/arm/src/stm32/Kconfig b/arch/arm/src/stm32/Kconfig index 141058ece8..02441b567d 100644 --- a/arch/arm/src/stm32/Kconfig +++ b/arch/arm/src/stm32/Kconfig @@ -2195,7 +2195,7 @@ config STM32_COMP6 config STM32_COMP7 bool "COMP7" default n - depends on STM32_HAVE_COMP6 + depends on STM32_HAVE_COMP7 config STM32_BKP bool "BKP" @@ -5864,6 +5864,11 @@ config STM32_HRTIM_DEADTIME depends on STM32_HRTIM_PWM default n +config STM32_HRTIM_PUSHPULL + bool "HRTIM push-pull mode" + depends on STM32_HRTIM_PWM + default n + config STM32_HRTIM_DMA bool "HRTIM DMA" default n @@ -6041,6 +6046,11 @@ config STM32_HRTIM_TIMA_DT default n depends on (STM32_HRTIM_DEADTIME && STM32_HRTIM_TIMA_PWM) +config STM32_HRTIM_TIMA_PSHPLL + bool "HRTIM TIMA PWM Push-pull mode" + default n + depends on (STM32_HRTIM_PUSHPULL && STM32_HRTIM_TIMA_PWM) + endmenu # "HRTIM Timer A Configuration" menu "HRTIM Timer B Configuration" @@ -6106,6 +6116,11 @@ config STM32_HRTIM_TIMB_DT default n depends on (STM32_HRTIM_DEADTIME && STM32_HRTIM_TIMB_PWM) +config STM32_HRTIM_TIMB_PSHPLL + bool "HRTIM TIMB PWM Push-pull mode" + default n + depends on (STM32_HRTIM_PUSHPULL && STM32_HRTIM_TIMB_PWM) + endmenu # "HRTIM Timer B Configuration" menu "HRTIM Timer C Configuration" @@ -6171,6 +6186,11 @@ config STM32_HRTIM_TIMC_DT default n depends on (STM32_HRTIM_DEADTIME && STM32_HRTIM_TIMC_PWM) +config STM32_HRTIM_TIMC_PSHPLL + bool "HRTIM TIMC PWM Push-pull mode" + default n + depends on (STM32_HRTIM_PUSHPULL && STM32_HRTIM_TIMC_PWM) + endmenu # "HRTIM Timer C Configuration" menu "HRTIM Timer D Configuration" @@ -6236,6 +6256,11 @@ config STM32_HRTIM_TIMD_DT default n depends on (STM32_HRTIM_DEADTIME && STM32_HRTIM_TIMD_PWM) +config STM32_HRTIM_TIMD_PSHPLL + bool "HRTIM TIMD PWM Push-pull mode" + default n + depends on (STM32_HRTIM_PUSHPULL && STM32_HRTIM_TIMD_PWM) + endmenu # "HRTIM Timer D Configuration" menu "HRTIM Timer E Configuration" @@ -6301,6 +6326,11 @@ config STM32_HRTIM_TIME_DT default n depends on (STM32_HRTIM_DEADTIME && STM32_HRTIM_TIME_PWM) +config STM32_HRTIM_TIME_PSHPLL + bool "HRTIM TIME PWM Push-pull mode" + default n + depends on (STM32_HRTIM_PUSHPULL && STM32_HRTIM_TIME_PWM) + endmenu # "HRTIM Timer E Configuration" endif # STM32_HRTIM1 diff --git a/arch/arm/src/stm32/stm32_hrtim.c b/arch/arm/src/stm32/stm32_hrtim.c index 121b0e2e4f..af1c032c38 100644 --- a/arch/arm/src/stm32/stm32_hrtim.c +++ b/arch/arm/src/stm32/stm32_hrtim.c @@ -180,6 +180,29 @@ # error "CONFIG_STM32_HRTIM_CHOPPER must be set" # endif #endif +#if defined(CONFIG_STM32_HRTIM_TIMA_PSHPLL) || defined(CONFIG_STM32_HRTIM_TIMB_PSHPLL) || \ + defined(CONFIG_STM32_HRTIM_TIMC_PSHPLL) || defined(CONFIG_STM32_HRTIM_TIMD_PSHPLL) || \ + defined(CONFIG_STM32_HRTIM_TIME_PSHPLL) +# ifndef CONFIG_STM32_HRTIM_PUSHPULL +# error "CONFIG_STM32_HRTIM_PUSHPULL must be set" +# endif +#endif + +#if defined(CONFIG_STM32_HRTIM_TIMA_DT) && defined(CONFIG_STM32_HRTIM_TIMA_PSHPLL) +# error "The deadtime cannot be used simultaneously with the push-pull mode" +#endif +#if defined(CONFIG_STM32_HRTIM_TIMB_DT) && defined(CONFIG_STM32_HRTIM_TIMB_PSHPLL) +# error "The deadtime cannot be used simultaneously with the push-pull mode" +#endif +#if defined(CONFIG_STM32_HRTIM_TIMC_DT) && defined(CONFIG_STM32_HRTIM_TIMC_PSHPLL) +# error "The deadtime cannot be used simultaneously with the push-pull mode" +#endif +#if defined(CONFIG_STM32_HRTIM_TIMD_DT) && defined(CONFIG_STM32_HRTIM_TIMD_PSHPLL) +# error "The deadtime cannot be used simultaneously with the push-pull mode" +#endif +#if defined(CONFIG_STM32_HRTIM_TIME_DT) && defined(CONFIG_STM32_HRTIM_TIME_PSHPLL) +# error "The deadtime cannot be used simultaneously with the push-pull mode" +#endif #if defined(CONFIG_STM32_HRTIM_ADC1_TRG1) || defined(CONFIG_STM32_HRTIM_ADC1_TRG2) || \ defined(CONFIG_STM32_HRTIM_ADC1_TRG3) || defined(CONFIG_STM32_HRTIM_ADC1_TRG4) || \ @@ -305,7 +328,7 @@ struct stm32_hrtim_timout_s #ifdef CONFIG_STM32_HRTIM_CHOPPER struct stm32_hrtim_chopper_s { - uint16_t start:4; /* Chopper start pulsewidth */ + uint16_t start_pulse:4; /* Chopper start pulsewidth */ uint16_t freq:4; /* Chopper carrier frequency value */ uint16_t duty:3; /* Chopper duty cycle */ uint16_t _res:5; /* Reserved */ @@ -345,6 +368,8 @@ struct stm32_hrtim_tim_burst_s struct stm32_hrtim_pwm_s { + uint8_t pushpull:1; + uint8_t res:7; struct stm32_hrtim_timout_s ch1; /* Channel 1 Set/Reset configuration*/ struct stm32_hrtim_timout_s ch2; /* Channel 2 Set/Reset configuration */ @@ -786,6 +811,9 @@ static struct stm32_hrtim_slave_priv_s g_tima_priv = #ifdef CONFIG_STM32_HRTIM_TIMA_PWM .pwm = { +#ifdef CONFIG_STM32_HRTIM_TIMA_PSHPLL + .pushpull = 1, +#endif #ifdef CONFIG_STM32_HRTIM_TIMA_PWM_CH1 .ch1 = { @@ -883,6 +911,9 @@ static struct stm32_hrtim_slave_priv_s g_timb_priv = #ifdef CONFIG_STM32_HRTIM_TIMB_PWM .pwm = { +#ifdef CONFIG_STM32_HRTIM_TIMB_PSHPLL + .pushpull = 1, +#endif #ifdef CONFIG_STM32_HRTIM_TIMB_PWM_CH1 .ch1 = { @@ -980,6 +1011,9 @@ static struct stm32_hrtim_slave_priv_s g_timc_priv = #ifdef CONFIG_STM32_HRTIM_TIMC_PWM .pwm = { +#ifdef CONFIG_STM32_HRTIM_TIMC_PSHPLL + .pushpull = 1, +#endif #ifdef CONFIG_STM32_HRTIM_TIMC_PWM_CH1 .ch1 = { @@ -1077,6 +1111,9 @@ static struct stm32_hrtim_slave_priv_s g_timd_priv = #ifdef CONFIG_STM32_HRTIM_TIMD_PWM .pwm = { +#ifdef CONFIG_STM32_HRTIM_TIMD_PSHPLL + .pushpull = 1, +#endif #ifdef CONFIG_STM32_HRTIM_TIMD_PWM_CH1 .ch1 = { @@ -1174,6 +1211,9 @@ static struct stm32_hrtim_slave_priv_s g_time_priv = #ifdef CONFIG_STM32_HRTIM_TIME_PWM .pwm = { +#ifdef CONFIG_STM32_HRTIM_TIME_PSHPLL + .pushpull = 1, +#endif #ifdef CONFIG_STM32_HRTIM_TIME_PWM_CH1 .ch1 = { @@ -1518,7 +1558,7 @@ static const struct stm32_hrtim_ops_s g_hrtim1ops = .burst_pre_get = hrtim_burst_pre_get, #endif #ifdef CONFIG_STM32_HRTIM_CHOPPER - .chopper_enable = hrtim_chopper_enable + .chopper_enable = hrtim_chopper_enable, #endif #ifdef CONFIG_STM32_HRTIM_DEADTIME .deadtime_update = hrtim_deadtime_update, @@ -2808,6 +2848,15 @@ static int hrtim_tim_outputs_config(FAR struct stm32_hrtim_s *priv, uint8_t time } #endif +#ifdef CONFIG_STM32_HRTIM_PUSHPULL + if (slave->pwm.pushpull == 1) + { + /* Enable push-pull mode */ + + hrtim_tim_modifyreg(priv, timer, STM32_HRTIM_TIM_CR_OFFSET, 0, HRTIM_TIMCR_PSHPLL); + } +#endif + errout: return ret; } @@ -3640,13 +3689,13 @@ static int hrtim_chopper_enable(FAR struct hrtim_dev_s *dev, uint8_t timer, { /* Set enable bit */ - hrtim_tim_modifyreg(priv, index, STM32_HRTIM_TIM_OUTR_OFFSET, 0, val); + hrtim_tim_modifyreg(priv, timer, STM32_HRTIM_TIM_OUTR_OFFSET, 0, val); } else { /* Clear enable bit */ - hrtim_tim_modifyreg(priv, index, STM32_HRTIM_TIM_OUTR_OFFSET, val, 0); + hrtim_tim_modifyreg(priv, timer, STM32_HRTIM_TIM_OUTR_OFFSET, val, 0); } errout: @@ -3698,6 +3747,7 @@ static int hrtim_tim_chopper_cfg(FAR struct stm32_hrtim_s *priv, hrtim_tim_putreg(priv, timer, STM32_HRTIM_TIM_CHPR_OFFSET, regval); +errout: return OK; } @@ -4511,13 +4561,6 @@ static void hrtim_tim_mode_set(FAR struct stm32_hrtim_s *priv, uint8_t timer, regval |= HRTIM_CMNCR_CONT; } - /* Configure push-pull mode. Only Slaves */ - - if (mode & HRTIM_MODE_PSHPLL && timer != HRTIM_TIMER_MASTER) - { - regval |= HRTIM_TIMCR_PSHPLL; - } - /* Write register */ hrtim_tim_putreg(priv, timer, STM32_HRTIM_TIM_CR_OFFSET, regval); diff --git a/arch/arm/src/stm32/stm32_hrtim.h b/arch/arm/src/stm32/stm32_hrtim.h index da02364460..ee021a9d82 100644 --- a/arch/arm/src/stm32/stm32_hrtim.h +++ b/arch/arm/src/stm32/stm32_hrtim.h @@ -415,10 +415,6 @@ enum stm32_hrtim_mode_e HRTIM_MODE_HALF = (1 << 1), /* Half mode */ HRTIM_MODE_RETRIG = (1 << 2), /* Re-triggerable mode */ HRTIM_MODE_CONT = (1 << 3), /* Continuous mode */ - - /* Only slave Timers */ - - HRTIM_MODE_PSHPLL = (1 << 7), /* Push-Pull mode */ }; /* HRTIM Slave Timer auto-delayed mode diff --git a/configs/stm32f334-disco/src/stm32_smps.c b/configs/stm32f334-disco/src/stm32_smps.c index b1ae43e216..12f85667b1 100644 --- a/configs/stm32f334-disco/src/stm32_smps.c +++ b/configs/stm32f334-disco/src/stm32_smps.c @@ -748,7 +748,6 @@ static void smps_duty_set(struct smps_priv_s *priv, struct smps_lower_dev_s *low { per = HRTIM_PER_GET(hrtim, HRTIM_TIMER_TIMA); - if (out < priv->v_in) out = priv->v_in; if (out >= BOOST_VOLT_MAX) out = BOOST_VOLT_MAX; @@ -767,9 +766,24 @@ static void smps_duty_set(struct smps_priv_s *priv, struct smps_lower_dev_s *low case CONVERTER_MODE_BUCKBOOST: { - /* do something */ + /* Buck converter is set to fixed duty cycle (80%). + * Now we need set boost converter + */ + + per = HRTIM_PER_GET(hrtim, HRTIM_TIMER_TIMA); -#warning TODO: buck boost mode + if (out < priv->v_in) out = priv->v_in; + if (out >= BOOST_VOLT_MAX) out = BOOST_VOLT_MAX; + + duty = 1.0 - priv->v_in/out; + +#warning TODO: current limit in buck boost mode + + cmp = (uint16_t)(per * duty); + + /* Set T12 duty cycle. T5 is complementary to T12 */ + + HRTIM_CMP_SET(hrtim, HRTIM_TIMER_TIMB, HRTIM_CMP1, cmp); break; } @@ -857,6 +871,12 @@ static void smps_conv_mode_set(struct smps_priv_s *priv, struct smps_lower_dev_s HRTIM_OUTPUT_SET_SET(hrtim, HRTIM_OUT_TIMB_CH1, HRTIM_OUT_SET_PER); HRTIM_OUTPUT_RST_SET(hrtim, HRTIM_OUT_TIMB_CH1, HRTIM_OUT_RST_CMP1); + /* Set fixed duty cycle (80%) on buck converter (T4 and T11) */ + + HRTIM_CMP_SET(hrtim, HRTIM_TIMER_TIMA, HRTIM_CMP1, + 0.8 * ((uint16_t)HRTIM_PER_GET(hrtim, HRTIM_TIMER_TIMA))); + + break; } -- GitLab From 6c277d082fc98b0b1005719bb87a0c34751e3803 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sun, 28 Jan 2018 07:42:02 -0600 Subject: [PATCH 126/228] configs/flipnclick-pic32mz: Apply same LED fix as for flipnclick-sam3x. The LED code is cloned. --- configs/flipnclick-pic32mz/README.txt | 4 ++-- configs/flipnclick-pic32mz/include/board.h | 2 +- configs/flipnclick-pic32mz/src/pic32mz_autoleds.c | 9 +++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/configs/flipnclick-pic32mz/README.txt b/configs/flipnclick-pic32mz/README.txt index 6e11eaffdd..72afa5a2ed 100644 --- a/configs/flipnclick-pic32mz/README.txt +++ b/configs/flipnclick-pic32mz/README.txt @@ -218,8 +218,8 @@ LEDs and Buttons LED_PANIC The system has crashed 2Hz N/C N/C N/C N/C LED_IDLE MCU is is sleep mode ---- Not used ----- - Thus if LED L is glowing on and all other LEDs are off (except LED D which - was left on but is no longer controlled by NuttX and so may be in any + Thus if LED L is glowing faintly and all other LEDs are off (except LED D + which was left on but is no longer controlled by NuttX and so may be in any state), NuttX has successfully booted and is, apparently, running normally and taking interrupts. If any of LEDs A-D are statically set, then NuttX failed to boot and the LED indicates the initialization phase where the diff --git a/configs/flipnclick-pic32mz/include/board.h b/configs/flipnclick-pic32mz/include/board.h index 0bcdc3dab1..87e48bc000 100644 --- a/configs/flipnclick-pic32mz/include/board.h +++ b/configs/flipnclick-pic32mz/include/board.h @@ -240,7 +240,7 @@ #define LED_PANIC 4 /* The system has crashed 2Hz N/C N/C N/C N/C */ #undef LED_IDLE /* MCU is is sleep mode ---- Not used ----- */ -/* Thus if LED L is glowing on and all other LEDs are off (except LED D which +/* Thus if LED L is faintly glowing and all other LEDs are off (except LED D which * was left on but is no longer controlled by NuttX and so may be in any state), * NuttX has successfully booted and is, apparently, running normally and taking * interrupts. If any of LEDs A-D are statically set, then NuttX failed to boot diff --git a/configs/flipnclick-pic32mz/src/pic32mz_autoleds.c b/configs/flipnclick-pic32mz/src/pic32mz_autoleds.c index 01d05ea00d..fc229ea532 100644 --- a/configs/flipnclick-pic32mz/src/pic32mz_autoleds.c +++ b/configs/flipnclick-pic32mz/src/pic32mz_autoleds.c @@ -57,6 +57,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* There are four LEDs on the top, red side of the board. Only one can be * controlled by software: * @@ -89,8 +90,8 @@ * LED_PANIC The system has crashed 2Hz N/C N/C N/C N/C * LED_IDLE MCU is is sleep mode ---- Not used ----- * - * Thus if LED L is glowing on and all other LEDs are off (except LED D - * which was left on but is no longer controlled by NuttX and so may be in + * Thus if LED L is faintly glowing and all other LEDs are off (except LED + * D which was left on but is no longer controlled by NuttX and so may be in * any state), NuttX has successfully booted and is, apparently, running * normally and taking interrupts. If any of LEDs A-D are statically set, * then NuttX failed to boot and the LED indicates the initialization phase @@ -122,7 +123,7 @@ static void board_autoled_setone(int ledndx) pic32mz_gpiowrite(GPIO_LED_L, ledon[INDEX_LED_L]); pic32mz_gpiowrite(GPIO_LED_A, ledon[INDEX_LED_A]); pic32mz_gpiowrite(GPIO_LED_B, ledon[INDEX_LED_B]); - pic32mz_gpiowrite(GPIO_LED_C, ledon[INDEX_LED_D]); + pic32mz_gpiowrite(GPIO_LED_C, ledon[INDEX_LED_C]); pic32mz_gpiowrite(GPIO_LED_D, ledon[INDEX_LED_D]); } @@ -175,7 +176,7 @@ void board_autoled_on(int led) board_autoled_setone(INDEX_LED_B); break; - case 2: + case 2: board_autoled_setone(INDEX_LED_C); break; -- GitLab From c5e231beddddae8f34540e269e54b458acca06df Mon Sep 17 00:00:00 2001 From: Matt Thompson Date: Sun, 28 Jan 2018 21:11:37 -0800 Subject: [PATCH 127/228] SAMDL: Added Analog Comparator headers and basic initialization --- arch/arm/src/samdl/Make.defs | 4 + arch/arm/src/samdl/chip/samd_ac.h | 209 ++++++++++++++++++++++++++++++ arch/arm/src/samdl/sam_ac.c | 177 +++++++++++++++++++++++++ arch/arm/src/samdl/sam_ac.h | 81 ++++++++++++ 4 files changed, 471 insertions(+) create mode 100644 arch/arm/src/samdl/chip/samd_ac.h create mode 100644 arch/arm/src/samdl/sam_ac.c create mode 100644 arch/arm/src/samdl/sam_ac.h diff --git a/arch/arm/src/samdl/Make.defs b/arch/arm/src/samdl/Make.defs index 1ce9c0e5b8..e62eba81f3 100644 --- a/arch/arm/src/samdl/Make.defs +++ b/arch/arm/src/samdl/Make.defs @@ -106,3 +106,7 @@ endif ifeq ($(CONFIG_SAMDL_EIC),y) CHIP_CSRCS += sam_eic.c endif + +ifeq ($(CONFIG_SAMDL_AC),y) +CHIP_CSRCS += sam_ac.c +endif diff --git a/arch/arm/src/samdl/chip/samd_ac.h b/arch/arm/src/samdl/chip/samd_ac.h new file mode 100644 index 0000000000..31c8964020 --- /dev/null +++ b/arch/arm/src/samdl/chip/samd_ac.h @@ -0,0 +1,209 @@ +/******************************************************************************************** + * arch/arm/src/samdl/chip/samd_ac.h + * + * Copyright (C) 2018 Gregory Nutt. All rights reserved. + * Author: Matt Thompson + * + * References: + * "Atmel SAM L21E / SAM L21G / SAM L21J Smart ARM-Based Microcontroller + * Datasheet", Atmel-42385C-SAML21_Datasheet_Preliminary-03/20/15 + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ********************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_SAMDL_CHIP_SAMD_AC_H +#define __ARCH_ARM_SRC_SAMDL_CHIP_SAMD_AC_H + +/******************************************************************************************** + * Included Files + ********************************************************************************************/ + +#include + +#include "chip.h" + +#ifdef CONFIG_ARCH_FAMILY_SAMD21 + +/******************************************************************************************** + * Pre-processor Definitions + ********************************************************************************************/ +/* AC register offsets **********************************************************************/ + +#define SAM_AC_CTRLA_OFFSET 0x0000 /* Control A Register */ +#define SAM_AC_CTRLB_OFFSET 0x0001 /* Control B Register */ +#define SAM_AC_EVCTRL_OFFSET 0x0002 /* Event Control Register */ +#define SAM_AC_INTENCLR_OFFSET 0x0004 /* Interrupt Enable Clear Register */ +#define SAM_AC_INTENSET_OFFSET 0x0005 /* Interrupt Enable Set Register */ +#define SAM_AC_INTFLAG_OFFSET 0x0006 /* Interrupt Flag Status and Clear Register */ +#define SAM_AC_STATUSA_OFFSET 0x0008 /* Status A Register */ +#define SAM_AC_STATUSB_OFFSET 0x0009 /* Status B Register */ +#define SAM_AC_STATUSC_OFFSET 0x000A /* Status C Register */ +#define SAM_AC_WINCTRL_OFFSET 0x000C /* Window Control Register */ +#define SAM_AC_COMPCTRL0_OFFSET 0x0010 /* Comparator 0 Control Register */ +#define SAM_AC_COMPCTRL1_OFFSET 0x0014 /* Comparator 1 Control Register */ +#define SAM_AC_SCALER0_OFFSET 0x0020 /* Scaler 0 Register */ +#define SAM_AC_SCALER1_OFFSET 0x0021 /* Scaler 1 Register */ + +/* AC register addresses *******************************************************************/ + +#define SAM_AC_CTRLA (SAM_AC_BASE+SAM_AC_CTRLA_OFFSET) +#define SAM_AC_CTRLB (SAM_AC_BASE+SAM_AC_CTRLB_OFFSET) +#define SAM_AC_EVCTRL (SAM_AC_BASE+SAM_AC_EVCTRL_OFFSET) +#define SAM_AC_INTENCLR (SAM_AC_BASE+SAM_AC_INTENCLR_OFFSET) +#define SAM_AC_INTENSET (SAM_AC_BASE+SAM_AC_INTENSET_OFFSET) +#define SAM_AC_INTFLAG (SAM_AC_BASE+SAM_AC_INTFLAG_OFFSET) +#define SAM_AC_STATUSA (SAM_AC_BASE+SAM_AC_STATUSA_OFFSET) +#define SAM_AC_STATUSB (SAM_AC_BASE+SAM_AC_STATUSB_OFFSET) +#define SAM_AC_STATUSC (SAM_AC_BASE+SAM_AC_STATUSC_OFFSET) +#define SAM_AC_WINCTRL (SAM_AC_BASE+SAM_AC_WINCTRL_OFFSET) +#define SAM_AC_COMPCTRL0 (SAM_AC_BASE+SAM_AC_COMPCTRL0_OFFSET) +#define SAM_AC_COMPCTRL1 (SAM_AC_BASE+SAM_AC_COMPCTRL1_OFFSET) +#define SAM_AC_SCALER0 (SAM_AC_BASE+SAM_AC_SCALER0_OFFSET) +#define SAM_AC_SCALER1 (SAM_AC_BASE+SAM_AC_SCALER1_OFFSET) + +/* AC register bit definitions ************************************************************/ + +/* Control A Register */ + +#define AC_CTRLA_SWRTS (1 << 0) /* Bit 0: Software reset */ +#define AC_CTRLA_ENABLE (1 << 1) /* Bit 1: Enable AC */ +#define AC_CTRLA_RUNSTDBY (1 << 2) /* Bit 2: Run in standby */ +#define AC_CTRLA_LPMUX (1 << 7) /* Bit 7: Low-Power Mux */ + +/* Control B Register */ + +#define AC_CTRLB_START0 (1 << 0) /* Bit 0: Comparator 0 start */ +#define AC_CTRLB_START1 (1 << 1) /* Bit 1: Comparator 1 start */ + +/* Event Control Register */ + +#define AC_EVCTRL_COMPEO0 (1 << 0) /* Bit 0: Comparator 0 Event Output enable */ +#define AC_EVCTRL_COMPEO1 (1 << 1) /* Bit 1: Comparator 1 Event Output enable */ +#define AC_EVCTRL_WINEO0 (1 << 4) /* Bit 4: Window 0 Event Output enable */ +#define AC_EVCTRL_COMPEI0 (1 << 8) /* Bit 8: Comparator 0 Event Input enable */ +#define AC_EVCTRL_COMPEI1 (1 << 9) /* Bit 9: Comparator 1 Event Input enable */ + +/* Common bit definitions for Interrupt Enable Clear Register, Interrupt Enable Set + * Register, and Interrupt Flag Status and Clear Register + */ + +#define AC_INT_COMP0 (1 << 0) /* Bit 0: Comparator 0 */ +#define AC_INT_COMP1 (1 << 1) /* Bit 1: Comparator 1 */ +#define AC_INT_WIN0 (1 << 4) /* Bit 4: Window 0 */ +#define AC_INT_ALL 0x13 + +/* Status A Register */ + +#define AC_STATUSA_STATE0 (1 << 0) /* Bit 0: State 0 - Output state of comparator 0 */ +#define AC_STATUSA_STATE1 (1 << 1) /* Bit 1: State 1 - Output state of comparator 1 */ +#define AC_STATUSA_WSTATE_SHIFT (4) +#define AC_STATUSA_WSTATE_MASK (3 << AC_STATUSA_WSTATE_SHIFT) +# define AC_STATUSA_WSTATE_ABOVE (0 << AC_STATUSA_WSTATE_SHIFT) +# define AC_STATUSA_WSTATE_INSIDE (1 << AC_STATUSA_WSTATE_SHIFT) +# define AC_STATUSA_WSTATE_BELOW (2 << AC_STATUSA_WSTATE_SHIFT) + +/* Status B Register */ + +#define AC_STATUSB_READY0 (1 << 0) /* Bit 0: Ready 0 - Comparator 0 ready status */ +#define AC_STATUSB_READY1 (1 << 1) /* Bit 1: Ready 1 - Comparator 1 ready status */ +#define AC_STATUSB_SYNCBUSY (1 << 7) /* Bit 7: Synchronoziation ready */ + +/* Status C Register */ + +/* Window Control Register */ + +#define AC_WINCTRL_WEN0 (1 << 0) /* Bit 0: Window enable (both comparators) */ +#define AC_WINCTRL_WINTSEL_SHIFT (1) +#define AC_WINCTRL_WINTSEL_MASK (3 << AC_WINCTRL_WINTSEL_SHIFT) +# define AC_WINCTRL_WINTSEL_ABOVE (0 << AC_WINCTRL_WINTSEL_SHIFT) +# define AC_WINCTRL_WINTSEL_INSIDE (1 << AC_WINCTRL_WINTSEL_SHIFT) +# define AC_WINCTRL_WINTSEL_BELOW (2 << AC_WINCTRL_WINTSEL_SHIFT) +# define AC_WINCTRL_WINTSEL_OUTSIDE (3 << AC_WINCTRL_WINTSEL_SHIFT) + +/* Comparator Control Registers */ + +#define AC_COMPCTRL_ENABLE (1 << 0) /* Bit 0: Enable Comparator */ +#define AC_COMPCTRL_SINGLE (1 << 1) /* Bit 1: Single Shot Mode */ +#define AC_COMPCTRL_SPEED_SHIFT (2) +#define AC_COMPCTRL_SPEED_MASK (3 << AC_COMPCTRL_SPEED_SHIFT) +# define AC_COMPCTRL_SPEED_LOW (0 << AC_COMPCTRL_SPEED_SHIFT) +# define AC_COMPCTRL_SPEED_HIGH (1 << AC_COMPCTRL_SPEED_SHIFT) +#define AC_COMPCTRL_INTSEL_SHIFT (5) +#define AC_COMPCTRL_INTSEL_MASK (3 << AC_COMPCTRL_INTSEL_SHIFT) +# define AC_COMPCTRL_INTSEL_TOGGLE (0 << AC_COMPCTRL_INTSEL_SHIFT) +# define AC_COMPCTRL_INTSEL_RISING (1 << AC_COMPCTRL_INTSEL_SHIFT) +# define AC_COMPCTRL_INTSEL_FALLING (2 << AC_COMPCTRL_INTSEL_SHIFT) +# define AC_COMPCTRL_INTSEL_EOC (3 << AC_COMPCTRL_INTSEL_SHIFT) +#define AC_COMPCTRL_MUXNEG_SHIFT (8) +#define AC_COMPCTRL_MUXNEG_MASK (7 << AC_COMPCTRL_MUXNEG_SHIFT) +# define AC_COMPCTRL_MUXNEG_PIN0 (0 << AC_COMPCTRL_MUXNEG_SHIFT) +# define AC_COMPCTRL_MUXNEG_PIN1 (1 << AC_COMPCTRL_MUXNEG_SHIFT) +# define AC_COMPCTRL_MUXNEG_PIN2 (2 << AC_COMPCTRL_MUXNEG_SHIFT) +# define AC_COMPCTRL_MUXNEG_PIN3 (3 << AC_COMPCTRL_MUXNEG_SHIFT) +# define AC_COMPCTRL_MUXNEG_GND (4 << AC_COMPCTRL_MUXNEG_SHIFT) +# define AC_COMPCTRL_MUXNEG_VSCALE (5 << AC_COMPCTRL_MUXNEG_SHIFT) +# define AC_COMPCTRL_MUXNEG_BANDGAP (6 << AC_COMPCTRL_MUXNEG_SHIFT) +# define AC_COMPCTRL_MUXNEG_DAC (7 << AC_COMPCTRL_MUXNEG_SHIFT) +#define AC_COMPCTRL_MUXPOS_SHIFT (12) +#define AC_COMPCTRL_MUXPOS_MASK (3 << AC_COMPCTRL_MUXPOS_SHIFT) +# define AC_COMPCTRL_MUXPOS_PIN0 (0 << AC_COMPCTRL_MUXPOS_SHIFT) +# define AC_COMPCTRL_MUXPOS_PIN1 (1 << AC_COMPCTRL_MUXPOS_SHIFT) +# define AC_COMPCTRL_MUXPOS_PIN2 (2 << AC_COMPCTRL_MUXPOS_SHIFT) +# define AC_COMPCTRL_MUXPOS_PIN3 (3 << AC_COMPCTRL_MUXPOS_SHIFT) +#define AC_COMPCTRL_SWAP (1 << 13) /* Bit 13: Swap Inputs and Invert */ +#define AC_COMPCTRL_OUT_SHIFT (16) +#define AC_COMPCTRL_OUT_MASK (3 << AC_COMPCTRL_OUT_SHIFT) +# define AC_COMPCTRL_OUT_OFF (0 << AC_COMPCTRL_OUT_SHIFT) +# define AC_COMPCTRL_OUT_ASYNC (1 << AC_COMPCTRL_OUT_SHIFT) +# define AC_COMPCTRL_OUT_SYNC (2 << AC_COMPCTRL_OUT_SHIFT) +#define AC_COMPCTRL_HYST (1 << 19) /* Bit 19: Hysteresis Enable */ +#define AC_COMPCTRL_FLEN_SHIFT (24) +#define AC_COMPCTRL_FLEN_MASK (7 << AC_COMPCTRL_FLEN_SHIFT) +# define AC_COMPCTRL_FLEN_OFF (0 << AC_COMPCTRL_FLEN_SHIFT) +# define AC_COMPCTRL_FLEN_MAJ3 (1 << AC_COMPCTRL_FLEN_SHIFT) +# define AC_COMPCTRL_FLEN_MAJ5 (2 << AC_COMPCTRL_FLEN_SHIFT) + +/* Scaler Registers */ + +#define AC_COMPCTRL_SCALER_MASK (0x3f) + +/******************************************************************************************** + * Public Types + ********************************************************************************************/ + +/******************************************************************************************** + * Public Data + ********************************************************************************************/ + +/******************************************************************************************** + * Public Functions + ********************************************************************************************/ + +#endif /* CONFIG_ARCH_FAMILY_SAMD21 */ +#endif /* __ARCH_ARM_SRC_SAMDL_CHIP_SAMD_AC_H */ diff --git a/arch/arm/src/samdl/sam_ac.c b/arch/arm/src/samdl/sam_ac.c new file mode 100644 index 0000000000..62872da31d --- /dev/null +++ b/arch/arm/src/samdl/sam_ac.c @@ -0,0 +1,177 @@ +/**************************************************************************** + * arch/arm/src/samdl/sam_ac.c + * + * Copyright (C) 2018 Gregory Nutt. All rights reserved. + * Author: Matt Thompson + * + * References: + * 1. "Microchip SAM D21E / SAM D21G / SAM D21J Datasheet" + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include + +#include "up_arch.h" + +#include "sam_config.h" + +#include "sam_pm.h" +#include "sam_gclk.h" +#include "sam_periphclks.h" +#include "sam_ac.h" +#include "sam_port.h" + +#include +#include +#include + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +static int sam_ac_isr(int irq, FAR void *context, FAR void *arg) +{ + return OK; +} + +static void sam_ac_syncwait(void) +{ + while ((getreg8(SAM_AC_STATUSB) & AC_STATUSB_SYNCBUSY) != 0); +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: sam_ac_initialize + * + * Description: + * Initialize the Analog Comparator (AC). + * + * Input Parameters: + * gclkgen - GCLK Generator + * + * Returned Value: + * None + * + ****************************************************************************/ + +int sam_ac_initialize(uint8_t gclkgen) +{ + uint16_t regval; + + sam_ac_enableperiph(); + + /* The Analog Comparators use two GCLKs */ + + /* Enable comparator digital GCLK which provides the sampling rate */ + + regval = GCLK_CLKCTRL_ID_ACDIG | GCLK_CLKCTRL_GEN(gclkgen) | GCLK_CLKCTRL_CLKEN; + putreg16(regval, SAM_GCLK_CLKCTRL); + + /* Enable comparator analog GCLK */ + + regval = GCLK_CLKCTRL_ID_ACANA | GCLK_CLKCTRL_GEN(gclkgen) | GCLK_CLKCTRL_CLKEN; + putreg16(regval, SAM_GCLK_CLKCTRL); + + putreg8(AC_CTRLA_ENABLE, SAM_AC_CTRLA); + sam_ac_syncwait(); + + irq_attach(SAM_IRQ_AC, sam_ac_isr, NULL); + + up_enable_irq(SAM_IRQ_AC); + + return OK; +} + +int sam_ac_config(uint8_t channel, uint32_t compctrl) +{ + switch(channel) + { + case 0: + putreg32(compctrl, SAM_AC_COMPCTRL0); + break; + case 1: + putreg32(compctrl, SAM_AC_COMPCTRL1); + break; + default: + return -ENODEV; + } + + sam_ac_syncwait(); + + return OK; +} + +int sam_ac_enable(uint8_t channel, bool enable) +{ + uint32_t regval; + switch(channel) + { + case 0: + regval = getreg32(SAM_AC_COMPCTRL0); + if(enable == true) + regval |= AC_COMPCTRL_ENABLE; + else + regval &= ~AC_COMPCTRL_ENABLE; + putreg32(regval, SAM_AC_COMPCTRL0); + break; + case 1: + regval = getreg32(SAM_AC_COMPCTRL1); + if(enable == true) + regval |= AC_COMPCTRL_ENABLE; + else + regval &= ~AC_COMPCTRL_ENABLE; + putreg32(regval, SAM_AC_COMPCTRL1); + break; + default: + return -ENODEV; + } + + sam_ac_syncwait(); + + return OK; +} diff --git a/arch/arm/src/samdl/sam_ac.h b/arch/arm/src/samdl/sam_ac.h new file mode 100644 index 0000000000..bdf4b5928d --- /dev/null +++ b/arch/arm/src/samdl/sam_ac.h @@ -0,0 +1,81 @@ +/**************************************************************************** + * arch/arm/src/samdl/sam_ac.h + * + * Copyright (C) 2018 Gregory Nutt. All rights reserved. + * Author: Matt Thompson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __ARCH_ARM_SRC_SAMDL_SAM_AC_H +#define __ARCH_ARM_SRC_SAMDL_SAM_AC_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +#include "sam_config.h" +#include "sam_port.h" + +#if defined(CONFIG_ARCH_FAMILY_SAMD20) || defined(CONFIG_ARCH_FAMILY_SAMD21) +# include "chip/samd_ac.h" +#elif defined(CONFIG_ARCH_FAMILY_SAML21) +# include "chip/saml_ac.h" +#else +# error Unrecognized SAMD/L architecture +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +int sam_ac_initialize(uint8_t gclkgen); +int sam_ac_config(uint8_t channel, uint32_t compctrl); +int sam_ac_enable(uint8_t channel, bool enable); + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + + +#undef EXTERN +#if defined(__cplusplus) +} +#endif +#endif /* __ARCH_ARM_SRC_SAMDL_SAM_AC_H */ -- GitLab From eef8bb7fc5bcae0cc981992db16ce1dfd18225de Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 29 Jan 2018 07:17:17 -0600 Subject: [PATCH 128/228] Update README --- README.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.txt b/README.txt index 719fe60d17..032554efca 100644 --- a/README.txt +++ b/README.txt @@ -76,10 +76,10 @@ ENVIRONMENTS is that it is closer to a native Windows environment and uses only a minimal of add-on POSIX-land tools. - - NuttX can also be installed and built on a native Windows system, but - with some potential tool-related issues (see the discussion "Native - Windows Build" under "Building NuttX" below). GNUWin32 is used to - provide compatible native windows tools. + NuttX can also be installed and built on a native Windows system, but with + some potential tool-related issues (see the discussion "Native Windows + Build" under "Building NuttX" below). GNUWin32 is used to provide + compatible native windows tools. Installing Cygwin ----------------- @@ -635,7 +635,7 @@ Instantiating "Canned" Configurations refreshing the configuration as described below. NOTE: NuttX uses only compressed defconfig files. For the NuttX - defconfig files, this refrshing step is *NOT* optional; it is also + defconfig files, this refreshing step is *NOT* optional; it is also necessary to uncompress and regenerate the full making file. This is discussed further below. -- GitLab From a0cd71133402d82d4c966465c3fc52ae782d2bfd Mon Sep 17 00:00:00 2001 From: Bob Feretich Date: Mon, 29 Jan 2018 07:23:52 -0600 Subject: [PATCH 129/228] I have a SPI bus with both Mode 0 and Mode 3 devices on it. After performing SPI I/O to a Mode 0 device, switching to a Mode 3 device locked up the SPI interface. Only zeroes would be read. I traced the reason for the lock-up to arm/arm/src/stm32f7/stm32_spi.c function spi_setmode(). Changing the mode causes a spurious SPI clock transmission that confuses the stm32f7 SPI input hardware. This problem is solved by (1) changing the SPI mode with SPI (and perhaps DMA) disabled, and (2) flushing the receive FIFO if the mode change results in garbage in the FIFO. --- arch/arm/src/stm32f7/stm32_spi.c | 35 +++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/arch/arm/src/stm32f7/stm32_spi.c b/arch/arm/src/stm32f7/stm32_spi.c index 8ddf22bd3a..9278ebaad7 100644 --- a/arch/arm/src/stm32f7/stm32_spi.c +++ b/arch/arm/src/stm32f7/stm32_spi.c @@ -36,7 +36,7 @@ /************************************************************************************ * The external functions, stm32_spi1/2/3/4/5/6select and stm32_spi1/2/3/4/5/6status - * must be * provided by board-specific logic. They are implementations of the select + * must be provided by board-specific logic. They are implementations of the select * and status methods of the SPI interface defined by struct spi_ops_s (see * include/nuttx/spi/spi.h). All other methods (including stm32_spibus_initialize()) * are provided by common STM32 logic. To use this common SPI logic on your @@ -1190,6 +1190,9 @@ static void spi_setmode(FAR struct spi_dev_s *dev, enum spi_mode_e mode) FAR struct stm32_spidev_s *priv = (FAR struct stm32_spidev_s *)dev; uint16_t setbits; uint16_t clrbits; +#ifdef CONFIG_STM32F7_SPI_DMA + uint16_t cr2bits; +#endif spiinfo("mode=%d\n", mode); @@ -1225,9 +1228,39 @@ static void spi_setmode(FAR struct spi_dev_s *dev, enum spi_mode_e mode) return; } + /* Disable SPI then change mode */ + spi_modifycr1(priv, 0, SPI_CR1_SPE); spi_modifycr1(priv, setbits, clrbits); + +#ifdef CONFIG_STM32F7_SPI_DMA + /* Enabling SPI causes a spurious received character indication + * which confuse the DMA controller so we disable DMA during that + * enabling; and flush the SPI RX FIFO before re-enabling DMA. + */ + + cr2bits = spi_getreg(priv, STM32_SPI_CR2_OFFSET); + spi_modifycr2(priv, 0, SPI_CR2_RXDMAEN | SPI_CR2_TXDMAEN); +#endif + + /* Re-enable SPI */ + spi_modifycr1(priv, SPI_CR1_SPE, 0); + while ((spi_getreg(priv, STM32_SPI_SR_OFFSET) & SPI_SR_FRLVL_MASK) != 0) + { + /* Flush SPI read FIFO */ + + spi_getreg(priv, STM32_SPI_DR_OFFSET); + } + +#ifdef CONFIG_STM32F7_SPI_DMA + + /* Re-enable DMA (with SPI disabled) */ + + spi_modifycr1(priv, 0, SPI_CR1_SPE); + spi_modifycr2(priv, cr2bits & (SPI_CR2_RXDMAEN | SPI_CR2_TXDMAEN), 0); + spi_modifycr1(priv, SPI_CR1_SPE, 0); +#endif /* Save the mode so that subsequent re-configurations will be faster */ -- GitLab From dafa72edc302d132bbd9265dfe77551e5e9413fc Mon Sep 17 00:00:00 2001 From: Juha Niskanen Date: Mon, 29 Jan 2018 07:56:06 -0600 Subject: [PATCH 130/228] drivers/sensors: add support to MAX44009 ambient light sensor --- drivers/sensors/Kconfig | 28 + drivers/sensors/Make.defs | 4 + drivers/sensors/max44009.c | 957 +++++++++++++++++++++++++++++++ include/nuttx/sensors/ioctl.h | 28 +- include/nuttx/sensors/max44009.h | 118 ++++ 5 files changed, 1123 insertions(+), 12 deletions(-) create mode 100644 drivers/sensors/max44009.c create mode 100644 include/nuttx/sensors/max44009.h diff --git a/drivers/sensors/Kconfig b/drivers/sensors/Kconfig index cfff74ff63..3eb524dc52 100644 --- a/drivers/sensors/Kconfig +++ b/drivers/sensors/Kconfig @@ -338,6 +338,34 @@ config ADXL345_REGDEBUG endif # SENSORS_ADXL345 +config SENSORS_MAX44009 + bool "Maxim MAX44009 ALS sensor" + default n + select I2C + ---help--- + Enables MAX44009 Ambient Light Sensor + +if SENSORS_MAX44009 + +config MAX44009_I2C_FREQUENCY + int "MAX44009 I2C frequency" + default 400000 + range 1 400000 + +config DEBUG_MAX44009 + bool "Enable debug support for the MAX44009" + default n + ---help--- + Enables debug support for the MAX44009 + +config MAX44009_NPOLLWAITERS + int "Number of waiters to poll" + default 1 + ---help--- + Number of waiters to poll + +endif # SENSORS_MAX44009 + config SENSORS_MAX31855 bool "Maxim MAX31855 Driver" default n diff --git a/drivers/sensors/Make.defs b/drivers/sensors/Make.defs index 42b6e6f0b8..c4cfe3af0d 100644 --- a/drivers/sensors/Make.defs +++ b/drivers/sensors/Make.defs @@ -105,6 +105,10 @@ ifeq ($(CONFIG_SENSORS_LM92),y) CSRCS += lm92.c endif +ifeq ($(CONFIG_SENSORS_MAX44009),y) + CSRCS += max44009.c +endif + ifeq ($(CONFIG_SENSORS_MB7040),y) CSRCS += mb7040.c endif diff --git a/drivers/sensors/max44009.c b/drivers/sensors/max44009.c new file mode 100644 index 0000000000..eaf6724934 --- /dev/null +++ b/drivers/sensors/max44009.c @@ -0,0 +1,957 @@ +/**************************************************************************** + * drivers/sensors/max44009.c + * + * Copyright (C) 2014-2018 Haltian Ltd. All rights reserved. + * Authors: Dmitry Nikolaev + * Juha Niskanen + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +/**************************************************************************** + * Pre-Processor Definitions + ****************************************************************************/ + +#ifdef CONFIG_DEBUG_MAX44009 +# define max44009_dbg(x, ...) _info(x, ##__VA_ARGS__) +#else +# define max44009_dbg(x, ...) sninfo(x, ##__VA_ARGS__) +#endif + +#ifndef CONFIG_MAX44009_I2C_FREQUENCY +# define CONFIG_MAX44009_I2C_FREQUENCY 400000 +#endif + +/* Registers */ + +#define MAX44009_INT_STS 0x0 +#define MAX44009_INT_EN 0x01 +#define MAX44009_CONFIG 0x02 +#define MAX44009_LUX_HBYTE 0x03 +#define MAX44009_LUX_LBYTE 0x04 +#define MAX44009_UP_THRESH_BYTE 0x05 +#define MAX44009_LOW_THRESH_BYTE 0x06 +#define MAX44009_THRESH_TIMER 0x07 + +/* Other constants */ + +#define MAX44009_I2C_RETRIES 10 + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +struct max44009_dev_s +{ + FAR struct max44009_config_s *config; + sem_t dev_sem; + FAR struct i2c_master_s *i2c; + uint8_t addr; + uint8_t cref; + bool int_pending; +#ifndef CONFIG_DISABLE_POLL + struct pollfd *fds[CONFIG_MAX44009_NPOLLWAITERS]; +#endif +}; + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +static int max44009_open(FAR struct file *filep); +static int max44009_close(FAR struct file *filep); +static ssize_t max44009_read(FAR struct file *filep, FAR char *buffer, + size_t buflen); +static ssize_t max44009_write(FAR struct file *filep, FAR const char *buffer, + size_t buflen); +static int max44009_ioctl(FAR struct file *filep, int cmd, unsigned long arg); +#ifndef CONFIG_DISABLE_POLL +static int max44009_poll(FAR struct file *filep, FAR struct pollfd *fds, + bool setup); +#endif + +static int max44009_read_data(FAR struct max44009_dev_s *priv, + FAR struct max44009_data_s *data); + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static const struct file_operations g_alsops = +{ + max44009_open, /* open */ + max44009_close, /* close */ + max44009_read, /* read */ + max44009_write, /* write */ + NULL, /* seek */ + max44009_ioctl /* ioctl */ +#ifndef CONFIG_DISABLE_POLL + , max44009_poll /* poll */ +#endif +#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS + , NULL /* unlink */ +#endif +}; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +static int max44009_do_transfer(FAR struct max44009_dev_s *dev, + FAR struct i2c_msg_s *msgv, + size_t nmsg) +{ + int ret = -EIO; + int retries; + + for (retries = 0; retries < MAX44009_I2C_RETRIES; retries++) + { + ret = I2C_TRANSFER(dev->i2c, msgv, nmsg); + if (ret >= 0) + { + return 0; + } + else + { +#ifdef CONFIG_I2C_RESET + /* Some error. Try to reset I2C bus and keep trying. */ + + if (retries == MAX44009_I2C_RETRIES - 1) + { + break; + } + + ret = I2C_RESET(dev->i2c); + if (ret < 0) + { + max44009_dbg("I2C_RESET failed: %d\n", ret); + return ret; + } +#endif + } + } + + max44009_dbg("xfer failed: %d\n", ret); + return ret; +} + +static int max44009_write_reg8(FAR struct max44009_dev_s *dev, + FAR const uint8_t *command) +{ + struct i2c_msg_s msgv[2] = + { + { + .frequency = CONFIG_MAX44009_I2C_FREQUENCY, + .addr = dev->addr, + .flags = 0, + .buffer = (void *)&command[0], + .length = 1 + }, + { + .frequency = CONFIG_MAX44009_I2C_FREQUENCY, + .addr = dev->addr, + .flags = I2C_M_NORESTART, + .buffer = (void *)&command[1], + .length = 1 + } + }; + + return max44009_do_transfer(dev, msgv, 2); +} + +static int max44009_read_reg8(FAR struct max44009_dev_s *dev, + FAR uint8_t *command, + FAR uint8_t *value) +{ + struct i2c_msg_s msgv[2] = + { + { + .frequency = CONFIG_MAX44009_I2C_FREQUENCY, + .addr = dev->addr, + .flags = 0, + .buffer = command, + .length = 1 + }, + { + .frequency = CONFIG_MAX44009_I2C_FREQUENCY, + .addr = dev->addr, + .flags = I2C_M_READ, + .buffer = value, + .length = 1 + } + }; + + return max44009_do_transfer(dev, msgv, 2); +} + +static int max44009_open(FAR struct file *filep) +{ + FAR struct inode *inode; + FAR struct max44009_dev_s *priv; + unsigned int use_count; + int ret; + + DEBUGASSERT(filep); + inode = filep->f_inode; + + DEBUGASSERT(inode && inode->i_private); + priv = (FAR struct max44009_dev_s *)inode->i_private; + + do + { + ret = nxsem_wait(&priv->dev_sem); + + /* The only case that an error should occur here is if the wait was + * awakened by a signal. + */ + + DEBUGASSERT(ret == OK || ret == -EINTR); + } + while (ret == -EINTR); + + use_count = priv->cref + 1; + if (use_count == 1) + { + /* First user, do power on. */ + + ret = priv->config->set_power(priv->config, true); + if (ret < 0) + { + max44009_dbg("Cannot power on sensor: %d\n", ret); + goto out_sem; + } + + priv->config->irq_enable(priv->config, true); + priv->cref = use_count; + } + else + { + DEBUGASSERT(use_count < UINT8_MAX && use_count > priv->cref); + + priv->cref = use_count; + ret = 0; + } + + max44009_dbg("Sensor is powered on\n"); + +out_sem: + nxsem_post(&priv->dev_sem); + return ret; +} + +static int max44009_close(FAR struct file *filep) +{ + FAR struct inode *inode; + FAR struct max44009_dev_s *priv; + int use_count; + int ret; + + DEBUGASSERT(filep); + inode = filep->f_inode; + + DEBUGASSERT(inode && inode->i_private); + priv = (FAR struct max44009_dev_s *)inode->i_private; + + do + { + ret = nxsem_wait(&priv->dev_sem); + + /* The only case that an error should occur here is if the wait was + * awakened by a signal. + */ + + DEBUGASSERT(ret == OK || ret == -EINTR); + } + while (ret == -EINTR); + + use_count = priv->cref - 1; + if (use_count == 0) + { + priv->config->irq_enable(priv->config, false); + + /* Last user, do power off. */ + + (void)priv->config->set_power(priv->config, false); + priv->cref = use_count; + } + else + { + DEBUGASSERT(use_count > 0); + + priv->cref = use_count; + } + + max44009_dbg("CLOSED\n"); + nxsem_post(&priv->dev_sem); + return OK; +} + +static ssize_t max44009_read(FAR struct file *filep, FAR char *buffer, + size_t buflen) +{ + FAR struct inode *inode; + FAR struct max44009_dev_s *priv; + ssize_t length = 0; + int ret; + struct max44009_data_s data; + + DEBUGASSERT(filep); + inode = filep->f_inode; + + DEBUGASSERT(inode && inode->i_private); + priv = (FAR struct max44009_dev_s *)inode->i_private; + + do + { + ret = nxsem_wait(&priv->dev_sem); + + /* The only case that an error should occur here is if the wait was + * awakened by a signal. + */ + + DEBUGASSERT(ret == OK || ret == -EINTR); + } + while (ret == -EINTR); + + ret = max44009_read_data(priv, &data); + if (ret < 0) + { + max44009_dbg("failed to read the sensor\n"); + } + else + { + /* This interface is mainly intended for easy debugging in nsh. */ + + length = snprintf(buffer, buflen, "%u.%03hu", data.lux, data.mlux); + if (length > buflen) + { + length = buflen; + } + } + + nxsem_post(&priv->dev_sem); + return length; +} + +static ssize_t max44009_write(FAR struct file *filep, FAR const char *buffer, + size_t buflen) +{ + ssize_t length = 0; + return length; +} + +static int max44009_set_interrupt_bit(FAR struct max44009_dev_s *priv, + bool is_activated) +{ + int ret; + uint8_t cmd[2]; + + cmd[0] = MAX44009_INT_EN; + cmd[1] = is_activated ? (1 << 0) : 0; + + ret = max44009_write_reg8(priv, cmd); + if (ret < 0) + { + max44009_dbg("Cannot set interrupt bit\n"); + } + + return ret; +} + +static int max44009_set_manual_mode(FAR struct max44009_dev_s *priv, + bool is_manual) +{ + int ret; + uint8_t value = 0; + const uint8_t manual_bit = (1 << 6); + uint8_t cmd[2]; + + cmd[0] = MAX44009_CONFIG; + ret = max44009_read_reg8(priv, &cmd[0], &value); + if (ret < 0) + { + max44009_dbg("Cannot read config register\n"); + goto fail; + } + + if (is_manual) + { + value |= manual_bit; + } + else + { + value &= ~manual_bit; + } + + cmd[1] = value; + ret = max44009_write_reg8(priv, cmd); + if (ret < 0) + { + max44009_dbg("Cannot set manual bit in config register\n"); + } + +fail: + return ret; +} + +static int max44009_set_continuous_mode(FAR struct max44009_dev_s *priv, + bool is_cont) +{ + int ret; + uint8_t value = 0; + const uint8_t cont_bit = (1 << 7); + uint8_t cmd[2]; + + cmd[0] = MAX44009_CONFIG; + ret = max44009_read_reg8(priv, &cmd[0], &value); + if (ret < 0) + { + max44009_dbg("Cannot read config register\n"); + goto fail; + } + + if (is_cont) + { + value |= cont_bit; + } + else + { + value &= ~cont_bit; + } + + cmd[1] = value; + ret = max44009_write_reg8(priv, cmd); + if (ret < 0) + { + max44009_dbg("Cannot set cont bit in config register\n"); + } + +fail: + return ret; +} + +static int max44009_set_current_div_ratio(FAR struct max44009_dev_s *priv, + bool is_cdr) +{ + int ret; + uint8_t value = 0; + const uint8_t cdr_bit = (1 << 3); + uint8_t cmd[2]; + + cmd[0] = MAX44009_CONFIG; + ret = max44009_read_reg8(priv, &cmd[0], &value); + if (ret < 0) + { + max44009_dbg("Cannot read config register\n"); + goto fail; + } + + if (is_cdr) + { + value |= cdr_bit; + } + else + { + value &= ~cdr_bit; + } + + cmd[1] = value; + ret = max44009_write_reg8(priv, cmd); + if (ret < 0) + { + max44009_dbg("Cannot set cdr bit in config register\n"); + } + +fail: + return ret; +} + +static int max44009_set_integration_time(FAR struct max44009_dev_s *priv, + enum max44009_integration_time_e + integration_time) +{ + int ret; + uint8_t value = 0; + const uint8_t tim_bits = integration_time << 0; + const uint8_t tim_mask = 0x07; + uint8_t cmd[2]; + + cmd[0] = MAX44009_CONFIG; + ret = max44009_read_reg8(priv, &cmd[0], &value); + if (ret < 0) + { + max44009_dbg("Cannot read config register\n"); + goto fail; + } + + value &= ~tim_mask; + value |= tim_bits; + + cmd[1] = value; + ret = max44009_write_reg8(priv, cmd); + if (ret < 0) + { + max44009_dbg("Cannot set tim bits in config register\n"); + } + +fail: + return ret; +} + +static int max44009_set_threshold_timer(FAR struct max44009_dev_s *priv, + uint8_t threshold_timer) +{ + int ret; + uint8_t cmd[2]; + + cmd[0] = MAX44009_THRESH_TIMER; + cmd[1] = threshold_timer; + + ret = max44009_write_reg8(priv, cmd); + if (ret < 0) + { + max44009_dbg("Threshold timer cannot be set\n"); + } + + return ret; +} + +static int max44009_set_threshold(FAR struct max44009_dev_s *priv, + FAR struct max44009_threshold_s *settings) +{ + int ret; + uint8_t cmd[2]; + + cmd[0] = MAX44009_UP_THRESH_BYTE; + cmd[1] = settings->upper_threshold; + ret = max44009_write_reg8(priv, cmd); + if (ret < 0) + { + max44009_dbg("Cannot set upper threshold\n"); + goto fail; + } + + cmd[0] = MAX44009_LOW_THRESH_BYTE; + cmd[1] = settings->lower_threshold; + ret = max44009_write_reg8(priv, cmd); + if (ret < 0) + { + max44009_dbg("Cannot set lower threshold\n"); + goto fail; + } + + ret = max44009_set_threshold_timer(priv, settings->threshold_timer); + if (ret < 0) + { + max44009_dbg("Cannot set threshold timer\n"); + goto fail; + } + + ret = max44009_set_interrupt_bit(priv, true); + if (ret < 0) + { + max44009_dbg("Cannot set interrupt\n"); + goto fail; + } + +fail: + return ret; +} + +static int max44009_selftest(FAR struct max44009_dev_s *priv, + FAR struct max44009_data_s * data) +{ + int ret; + uint8_t reg_addr = MAX44009_THRESH_TIMER; + uint8_t value = 0; + + ret = max44009_set_threshold_timer(priv, data->test_value); + if (ret < 0) + { + max44009_dbg("Cannot write test-value\n"); + goto fail; + } + + ret = max44009_read_reg8(priv, ®_addr, &value); + if (ret < 0) + { + max44009_dbg("Cannot read written value\n"); + goto fail; + } + + if (value != data->test_value) + { + max44009_dbg("Test failed\n"); + ret = -EIO; + } + +fail: + return ret; +} + +static int max44009_init_device(FAR struct max44009_dev_s *priv, + FAR struct max44009_init_s * settings) +{ + int ret; + + ret = max44009_set_manual_mode(priv, settings->is_manual); + if (ret < 0) + { + max44009_dbg("Cannot init manual mode\n"); + goto fail; + } + + ret = max44009_set_continuous_mode(priv, settings->is_cont); + if (ret < 0) + { + max44009_dbg("Cannot init cont mode\n"); + goto fail; + } + + if (settings->is_manual) + { + ret = max44009_set_current_div_ratio(priv, settings->is_cdr); + if (ret < 0) + { + max44009_dbg("Cannot init cdr mode\n"); + goto fail; + } + + ret = max44009_set_integration_time(priv, settings->integr_time); + if (ret < 0) + { + max44009_dbg("Cannot init tim mode\n"); + goto fail; + } + } + +fail: + return ret; +} + +static int max44009_read_data(FAR struct max44009_dev_s *priv, + FAR struct max44009_data_s *data) +{ + int ret; + uint8_t lvalue; + uint8_t hvalue; + uint8_t reg_addr; + uint32_t val; + + reg_addr = MAX44009_INT_STS; + ret = max44009_read_reg8(priv, ®_addr, &hvalue); + if (ret < 0) + { + max44009_dbg("Cannot read interrupt status register\n"); + } + + reg_addr = MAX44009_LUX_HBYTE; + ret = max44009_read_reg8(priv, ®_addr, &hvalue); + if (ret < 0) + { + max44009_dbg("Cannot read high bits from lux register\n"); + return ret; + } + + /* LUX HBYTE has (starting with MSB): E3.E2.E1.E0.M7.M6.M5.M4 + * LUX LBYTE has : --.--.--.--.M3.M2.M1.M0 + * + * E[3..0] = Exponent, M[7..0]: Mantissa. + * + * Lux can be calculated as (full resolution): (M[7..0] << E[3..0]) * 0.045. + * + * Lux can also be calculated using only HBYTE: + * (M[7..4] << E[3..0]) * 0.72 + * == (M[7..4] << E[3..0]) * 2^4 * 0.045 + * == (M[7..4] << E[3..0]) * (1 << 4) * 0.045 + * == (M[7..4] << (E[3..0] + 4)) * 0.045 + */ + + reg_addr = MAX44009_LUX_LBYTE; + ret = max44009_read_reg8(priv, ®_addr, &lvalue); + if (ret < 0) + { + max44009_dbg("Cannot read low bits from lux register\n"); + return ret; + } + + /* Merge HBYTE and LBYTE to 16-bit integer: + * --.--.--.--.E3.E2.E1.E0.M7.M6.M5.M4.M3.M2.M1.M0 */ + + data->raw_value = (hvalue << 4) | (lvalue & 0xf); + + /* Add raw value to entropy pool. */ + + add_sensor_randomness(data->raw_value); + + /* Convert raw value to lux and millilux. */ + + val = data->raw_value & 0xff; + val = val << ((data->raw_value & 0x0f00) >> 8); + + /* lux is the raw output multiplied by 0.045. */ + + data->lux = (val * 45) / 1000; + data->mlux = (val * 45) % 1000; + + return ret; +} + +static int max44009_ioctl(FAR struct file *filep, int cmd, unsigned long arg) +{ + FAR struct inode *inode; + FAR struct max44009_dev_s *priv; + int ret; + + DEBUGASSERT(filep); + inode = filep->f_inode; + + DEBUGASSERT(inode && inode->i_private); + priv = (FAR struct max44009_dev_s *)inode->i_private; + + do + { + ret = nxsem_wait(&priv->dev_sem); + + /* The only case that an error should occur here is if the wait was + * awakened by a signal. + */ + + DEBUGASSERT(ret == OK || ret == -EINTR); + } + while (ret == -EINTR); + + switch (cmd) + { + case SNIOC_INIT: + ret = max44009_init_device(priv, (FAR struct max44009_init_s *)arg); + break; + + case SNIOC_THRESHOLD: + ret = max44009_set_threshold(priv, + (FAR struct max44009_threshold_s *)arg); + break; + + case SNIOC_READ_RAW_DATA: + case SNIOC_READ_CONVERT_DATA: + ret = max44009_read_data(priv, (FAR struct max44009_data_s *)arg); + break; + + case SNIOC_START_SELFTEST: + ret = max44009_selftest(priv, (FAR struct max44009_data_s *)arg); + break; + + default: + ret = -ENOTTY; + break; + } + + nxsem_post(&priv->dev_sem); + return ret; +} + +#ifndef CONFIG_DISABLE_POLL +static void max44009_notify(FAR struct max44009_dev_s *priv) +{ + DEBUGASSERT(priv != NULL); + + int i; + + /* If there are threads waiting on poll() for data to become available, + * then wake them up now. NOTE: we wake up all waiting threads because we + * do not know that they are going to do. If they all try to read the + * data, then some make end up blocking after all. + */ + + for (i = 0; i < CONFIG_MAX44009_NPOLLWAITERS; i++) + { + FAR struct pollfd *fds = priv->fds[i]; + if (fds) + { + fds->revents |= POLLIN; + max44009_dbg("Report events: %02x\n", fds->revents); + nxsem_post(fds->sem); + priv->int_pending = false; + } + } +} + +static int max44009_poll(FAR struct file *filep, FAR struct pollfd *fds, + bool setup) +{ + FAR struct inode *inode; + FAR struct max44009_dev_s *priv; + int ret; + int i; + + DEBUGASSERT(filep && fds); + inode = filep->f_inode; + + DEBUGASSERT(inode && inode->i_private); + priv = (FAR struct max44009_dev_s *)inode->i_private; + + do + { + ret = nxsem_wait(&priv->dev_sem); + + /* The only case that an error should occur here is if the wait was + * awakened by a signal. + */ + + DEBUGASSERT(ret == OK || ret == -EINTR); + } + while (ret == -EINTR); + + if (setup) + { + /* Ignore waits that do not include POLLIN */ + + if ((fds->events & POLLIN) == 0) + { + ret = -EDEADLK; + goto out; + } + + /* This is a request to set up the poll. Find an available slot for the + * poll structure reference */ + + for (i = 0; i < CONFIG_MAX44009_NPOLLWAITERS; i++) + { + /* Find an available slot */ + + if (!priv->fds[i]) + { + /* Bind the poll structure and this slot */ + + priv->fds[i] = fds; + fds->priv = &priv->fds[i]; + break; + } + } + + if (i >= CONFIG_MAX44009_NPOLLWAITERS) + { + fds->priv = NULL; + ret = -EBUSY; + goto out; + } + if (priv->int_pending) + { + max44009_notify(priv); + } + } + else if (fds->priv) + { + /* This is a request to tear down the poll. */ + + struct pollfd **slot = (struct pollfd **)fds->priv; + DEBUGASSERT(slot != NULL); + + /* Remove all memory of the poll setup */ + + *slot = NULL; + fds->priv = NULL; + } +out: + nxsem_post(&priv->dev_sem); + return ret; +} +#endif /* !CONFIG_DISABLE_POLL */ + +static int max44009_int_handler(int irq, FAR void *context, FAR void *arg) +{ + FAR struct max44009_dev_s *priv = (FAR struct max44009_dev_s *)arg; + irqstate_t flags; + + DEBUGASSERT(priv != NULL); + + flags = enter_critical_section(); + priv->int_pending = true; + leave_critical_section(flags); +#ifndef CONFIG_DISABLE_POLL + max44009_notify(priv); +#endif + max44009_dbg("MAX44009 interrupt\n"); + + return OK; +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int max44009_register(FAR const char *devpath, FAR struct i2c_master_s *i2c, + uint8_t addr, FAR struct max44009_config_s *config) +{ + struct max44009_dev_s *priv; + int ret; + + priv = kmm_zalloc(sizeof(struct max44009_dev_s)); + if (!priv) + { + max44009_dbg("Memory cannot be allocated for ALS sensor\n"); + return -ENOMEM; + } + + priv->addr = addr; + priv->i2c = i2c; + priv->config = config; + nxsem_init(&priv->dev_sem, 0, 1); + + ret = register_driver(devpath, &g_alsops, 0666, priv); + max44009_dbg("Registered with %d\n", ret); + if (ret < 0) + { + kmm_free(priv); + max44009_dbg("Error occurred during the driver registering\n"); + return ret; + } + + priv->config->irq_attach(priv->config, max44009_int_handler, priv); + priv->config->irq_enable(priv->config, false); + return ret; +} diff --git a/include/nuttx/sensors/ioctl.h b/include/nuttx/sensors/ioctl.h index 62d33b9f52..3f6add61d0 100644 --- a/include/nuttx/sensors/ioctl.h +++ b/include/nuttx/sensors/ioctl.h @@ -118,10 +118,10 @@ /* IOCTL commands to the HTS221 & LPS25H */ #define SNIOC_CFGR _SNIOC(0x002a) +#define SNIOC_GET_DEV_ID _SNIOC(0x002b) /* IOCTL commands unique to the HTS221 */ -#define SNIOC_GET_DEV_ID _SNIOC(0x002b) #define SNIOC_START_CONVERSION _SNIOC(0x002c) #define SNIOC_CHECK_STATUS_REG _SNIOC(0x002d) #define SNIOC_READ_RAW_DATA _SNIOC(0x002e) @@ -130,19 +130,23 @@ /* IOCTL commands unique to the LPS25H */ -#define SNIOC_GET_DEV_ID _SNIOC(0x0031) -#define SNIOC_TEMPERATURE_OUT _SNIOC(0x0032) -#define SNIOC_PRESSURE_OUT _SNIOC(0x0033) -#define SNIOC_SENSOR_OFF _SNIOC(0x0034) +#define SNIOC_TEMPERATURE_OUT _SNIOC(0x0031) +#define SNIOC_PRESSURE_OUT _SNIOC(0x0032) +#define SNIOC_SENSOR_OFF _SNIOC(0x0033) /* IOCTL commands unique to the LIS2DH */ -#define SNIOC_WRITESETUP _SNIOC(0x0035) /* Arg: uint8_t value */ -#define SNIOC_WRITE_INT1THRESHOLD _SNIOC(0x0036) /* Arg: uint8_t value */ -#define SNIOC_WRITE_INT2THRESHOLD _SNIOC(0x0037) /* Arg: uint8_t value */ -#define SNIOC_RESET_HPFILTER _SNIOC(0x0038) /* Arg: uint8_t value */ -#define SNIOC_START_SELFTEST _SNIOC(0x0039) /* Arg: uint8_t value */ -#define SNIOC_WHO_AM_I _SNIOC(0x003a) -#define SNIOC_READ_TEMP _SNIOC(0x003b) /* Arg: int16_t value */ +#define SNIOC_WRITESETUP _SNIOC(0x0034) /* Arg: uint8_t value */ +#define SNIOC_WRITE_INT1THRESHOLD _SNIOC(0x0035) /* Arg: uint8_t value */ +#define SNIOC_WRITE_INT2THRESHOLD _SNIOC(0x0036) /* Arg: uint8_t value */ +#define SNIOC_RESET_HPFILTER _SNIOC(0x0037) /* Arg: uint8_t value */ +#define SNIOC_START_SELFTEST _SNIOC(0x0038) /* Arg: uint8_t value */ +#define SNIOC_WHO_AM_I _SNIOC(0x0039) +#define SNIOC_READ_TEMP _SNIOC(0x003a) /* Arg: int16_t value */ + +/* IOCTL commands unique to the MAX44009 */ + +#define SNIOC_INIT _SNIOC(0x003b) +#define SNIOC_THRESHOLD _SNIOC(0x003c) #endif /* __INCLUDE_NUTTX_SENSORS_IOCTL_H */ diff --git a/include/nuttx/sensors/max44009.h b/include/nuttx/sensors/max44009.h new file mode 100644 index 0000000000..9cf1a2723b --- /dev/null +++ b/include/nuttx/sensors/max44009.h @@ -0,0 +1,118 @@ +/**************************************************************************** + * include/nuttx/sensors/max44009.h + * + * Copyright (C) 2014-2018 Haltian Ltd. All rights reserved. + * Authors: Dmitry Nikolaev + * Juha Niskanen + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __INCLUDE_NUTTX_SENSORS_MAX44009 +#define __INCLUDE_NUTTX_SENSORS_MAX44009 + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +struct i2c_master_s; + +/* Integration time, ms */ + +enum max44009_integration_time_e +{ + MAX44009_INTEGR_TIME_800 = 0x0, /* Preferred mode for boosting + * low-light sensitivity */ + MAX44009_INTEGR_TIME_400, + MAX44009_INTEGR_TIME_200, + MAX44009_INTEGR_TIME_100, /* Preferred mode for high-brightness + * applications */ + MAX44009_INTEGR_TIME_50, /* Manual mode only */ + MAX44009_INTEGR_TIME_25, /* Manual mode only */ + MAX44009_INTEGR_TIME_12_5, /* Manual mode only */ + MAX44009_INTEGR_TIME_6_25 /* Manual mode only */ +}; + +/* Board configuration data structure */ + +struct max44009_config_s +{ + CODE int (*irq_attach)(FAR struct max44009_config_s * state, xcpt_t isr, FAR void *arg); + CODE void (*irq_enable)(FAR const struct max44009_config_s * state, bool enable); + CODE int (*set_power)(FAR const struct max44009_config_s * state, bool on); +}; + +/* Configuration structure for MAX44009 */ + +struct max44009_init_s +{ + bool is_cont; /* Needs more power, if it's in continuous + * mode. This one is useful in test-mode for + * instance */ + bool is_manual; /* Timer's settings must be specified manually */ + bool is_cdr; /* Current division ratio: false - All of the + * photodiode current goes to the ADC, true - + * 1/8 (must be used in high-brightness + * situations) */ + enum max44009_integration_time_e integr_time; /* Integration time */ +}; + +struct max44009_threshold_s +{ + uint8_t upper_threshold; /* Upper threshold high-byte */ + uint8_t lower_threshold; /* Lower threshold high-byte */ + uint8_t threshold_timer; /* 0 - interrupt will be triggered as soon as + * the light level exceeds either threshold */ +} ; + +/* Data transfer structure */ + +struct max44009_data_s +{ + uint32_t lux; /* Converted lux value */ + uint16_t mlux; /* Converted millilux (decimals for lux) */ + uint16_t raw_value; /* Raw unconverted value */ + uint8_t test_value; /* For self-test only */ +}; + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +int max44009_register(FAR const char *devpath, FAR struct i2c_master_s *i2c, + uint8_t addr, FAR struct max44009_config_s *config); + +#endif /* __INCLUDE_NUTTX_SENSORS_MAX44009 */ -- GitLab From fce345113f5b3bbe56c86ebf06d2ec7e19f02936 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 29 Jan 2018 10:50:14 -0600 Subject: [PATCH 131/228] tools/logparser: Add a tool which (when it matures) will help me to convert git logs to ChangeLog format. --- tools/Makefile.host | 18 +- tools/README.txt | 5 + tools/logparser.c | 552 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 572 insertions(+), 3 deletions(-) create mode 100644 tools/logparser.c diff --git a/tools/Makefile.host b/tools/Makefile.host index 297470dc6e..c4fb6860d1 100644 --- a/tools/Makefile.host +++ b/tools/Makefile.host @@ -1,7 +1,8 @@ ############################################################################ # Makefile.host # -# Copyright (C) 2007, 2008, 2011-2012, 2015, 2017 Gregory Nutt. All rights reserved. +# Copyright (C) 2007, 2008, 2011-2012, 2015, 2017-2018 Gregory Nutt. All +# rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -70,13 +71,15 @@ endif all: b16$(HOSTEXEEXT) bdf-converter$(HOSTEXEEXT) cmpconfig$(HOSTEXEEXT) \ configure$(HOSTEXEEXT) mkconfig$(HOSTEXEEXT) mkdeps$(HOSTEXEEXT) \ mksymtab$(HOSTEXEEXT) mksyscall$(HOSTEXEEXT) mkversion$(HOSTEXEEXT) \ - cnvwindeps$(HOSTEXEEXT) nxstyle$(HOSTEXEEXT) initialconfig$(HOSTEXEEXT) + cnvwindeps$(HOSTEXEEXT) nxstyle$(HOSTEXEEXT) initialconfig$(HOSTEXEEXT) \ + logparser$(HOSTEXEEXT) default: mkconfig$(HOSTEXEEXT) mksyscall$(HOSTEXEEXT) mkdeps$(HOSTEXEEXT) \ cnvwindeps$(HOSTEXEEXT) ifdef HOSTEXEEXT .PHONY: b16 bdf-converter cmpconfig clean configure kconfig2html mkconfig \ - mkdeps cnvwindeps mksymtab mksyscall mkversion + mkdeps mksymtab mksyscall mkversion cnvwindeps nxstyle initialconfig \ + logparser else .PHONY: clean endif @@ -182,6 +185,15 @@ ifdef HOSTEXEEXT initialconfig: initialconfig$(HOSTEXEEXT) endif +# logparser - Convert a git log to ChangeLog format. + +logparser$(HOSTEXEEXT): logparser.c + $(Q) $(HOSTCC) $(HOSTCFLAGS) -o logparser$(HOSTEXEEXT) logparser.c + +ifdef HOSTEXEEXT +logparser: logparser$(HOSTEXEEXT) +endif + # cnvwindeps - Convert dependences generated by a Windows native toolchain # for use in a Cygwin/POSIX build environment diff --git a/tools/README.txt b/tools/README.txt index b332d495a3..2f678745ba 100644 --- a/tools/README.txt +++ b/tools/README.txt @@ -655,6 +655,11 @@ kconfig.bat - option env="APPSDIR" + default "../apps" +logparser.c +----------- + + Convert a git log to ChangeLog format. + mkimage.sh ---------- diff --git a/tools/logparser.c b/tools/logparser.c new file mode 100644 index 0000000000..7704bcbb4d --- /dev/null +++ b/tools/logparser.c @@ -0,0 +1,552 @@ +/**************************************************************************** + * tools/logparser.c + * + * Copyright (C) 2018 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#define LINESIZE (PATH_MAX > 4096 ? PATH_MAX : 4096) + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +enum parse_state_e +{ + STATE_IDLE = 0, /* Finished last, ready to start next */ + STATE_HEADER, /* Started next, parsing header */ + STATE_ENDHEADER, /* Finished the header looking for the start of the body */ + STATE_BODY, /* Parsing the body */ +}; + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static char g_line[LINESIZE+1]; +static unsigned long g_lineno; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/* Skip over any spaces */ + +static char *skip_space(char *ptr) +{ + while (*ptr && isspace((int)*ptr)) ptr++; + return ptr; +} + +/* Find the end of a variable string */ + +static void trim_end(char *startptr, char *endptr) +{ + while (endptr != startptr && isspace((int)*endptr)) + { + *endptr = '\0'; + endptr--; + } +} + +/* check for a blank line */ + +static bool blank_line(void) +{ + char *ptr = g_line; + + while (*ptr != '\0') + { + if (!isspace((int)*ptr)) + { + return false; + } + + ptr++; + } + + return true; +} + +/* Convert git log date string */ + +static char *parse_date(char *ptr) +{ + char *next; + char *endptr; + char *alloc; + unsigned int mon; + unsigned long date; + unsigned long year; + + /* Form: DOW MON DD HH:MM:SS YYYY GMT + * Eg. Mon Jan 29 07:17:17 2018 -0600 + */ + + /* Skip the day of the week */ + + next = strchr(ptr, ' '); + if (next == NULL) + { + fprintf(stderr, "ERROR line %ld: Did not find day of the week\n", g_lineno); + exit(EXIT_FAILURE); + } + + ptr = skip_space(next); + + /* Get the month */ + + next = strchr(ptr, ' '); + if (next == NULL) + { + fprintf(stderr, "ERROR line %ld: Did not find month\n", g_lineno); + exit(EXIT_FAILURE); + } + + endptr = next; + next = skip_space(next); + trim_end(ptr, endptr); + + if (strncmp(ptr, "Jan", 3) == 0) + { + mon = 1; + } + else if (strncmp(ptr, "Feb", 3) == 0) + { + mon = 2; + } + else if (strncmp(ptr, "Mar", 3) == 0) + { + mon = 3; + } + else if (strncmp(ptr, "Apr", 3) == 0) + { + mon = 4; + } + else if (strncmp(ptr, "May", 3) == 0) + { + mon = 5; + } + else if (strncmp(ptr, "Jun", 3) == 0) + { + mon = 6; + } + else if (strncmp(ptr, "Jul", 3) == 0) + { + mon = 7; + } + else if (strncmp(ptr, "Aug", 3) == 0) + { + mon = 8; + } + else if (strncmp(ptr, "Sep", 3) == 0) + { + mon = 9; + } + else if (strncmp(ptr, "Oct", 3) == 0) + { + mon = 10; + } + else if (strncmp(ptr, "Nov", 3) == 0) + { + mon = 11; + } + else if (strncmp(ptr, "Dec", 3) == 0) + { + mon = 12; + } + else + { + fprintf(stderr, "ERROR line %ld: Unrecognized month %s\n", g_lineno, ptr); + exit(EXIT_FAILURE); + } + + /* Get the day of the month */ + + ptr = next; + next = strchr(ptr, ' '); + if (next == NULL) + { + fprintf(stderr, "ERROR line %ld: Did not find day of the month\n", g_lineno); + exit(EXIT_FAILURE); + } + + endptr = next; + next = skip_space(next); + trim_end(ptr, endptr); + + date = strtoul(ptr, &endptr, 10); + if (*endptr != '\0' || date > 31) + { + fprintf(stderr, "ERROR line %ld: Invalid date\n", g_lineno); + exit(EXIT_FAILURE); + } + + /* Skip over the time */ + + ptr = next; + next = strchr(ptr, ' '); + if (next == NULL) + { + fprintf(stderr, "ERROR line %ld: Did not find day of the month\n", g_lineno); + exit(EXIT_FAILURE); + } + + /* Get the year */ + + ptr = skip_space(next); + next = strchr(ptr, ' '); + if (next == NULL) + { + fprintf(stderr, "ERROR line %ld: Did not find year\n", g_lineno); + exit(EXIT_FAILURE); + } + + trim_end(ptr, next); + year = strtoul(ptr, &endptr, 10); + if (*endptr != '\0' || year < 2007 || year >= 3000) + { + fprintf(stderr, "ERROR line %ld: Invalid year: %s\n", g_lineno, ptr); + exit(EXIT_FAILURE); + } + + /* Then create the final date string */ + + asprintf(&alloc, "(%04lu-%02u-%02lu)", year, mon, date); + if (alloc == NULL) + { + fprintf(stderr, "ERROR line %ld: asprintf failed\n", g_lineno); + exit(EXIT_FAILURE); + } + + return alloc; +} + +/* Parse the entire file */ + +static void parse_file(FILE *stream) +{ + enum parse_state_e state; + bool lastblank; + bool firstline; + bool consumed; + bool merge; + char *name; + char *date; + char *ptr; + + /* Loop until the entire file has been parsed. */ + + g_lineno = 0; + state = STATE_IDLE; + name = NULL; + date = NULL; + consumed = true; + firstline = true; + merge = false; + + for (; ; ) + { + /* Read the next line from the file (unless it was not consumed on the + * previous pass through the loop. + */ + + if (consumed) + { + g_line[LINESIZE] = '\0'; + if (!fgets(g_line, LINESIZE, stream)) + { + /* Check if the body was terminated with the end of file */ + + if (state == STATE_BODY) + { + /* End of body. Add author, date, and final newline */ + + printf(" From %s %s.\n", name, date); + free(name); + free(date); + } + else if (state != STATE_IDLE) + { + fprintf(stderr, "ERROR line %ld: Unexpected EOF in state %d\n", + g_lineno, state); + exit(EXIT_FAILURE); + } + + return; + } + + g_lineno++; + consumed = false; + } + + ptr = g_line; + + /* Process the line depending upon the state of the parser */ + + switch (state) + { + case STATE_IDLE: /* Finished last, ready to start next */ + if (blank_line()) + { + consumed = true; + break; + } + + if (isspace(g_line[0])) + { + fprintf(stderr, "ERROR line %lu: Unexpected whitespace in state %d\n", + g_lineno, state); + exit(EXIT_FAILURE); + } + + /* Change state and fall through */ + + state = STATE_HEADER; + + case STATE_HEADER: /* Started next, parsing header */ + if (!isspace(g_line[0])) + { + if (strncmp(g_line, "commit ", 7) == 0) + { + /* Skip commit line */ + } + else if (strncmp(g_line, "Merge: ", 6) == 0) + { + /* Skip merges */ + + merge = true; + } + else if (strncmp(g_line, "Author: ", 8) == 0) + { + char *endptr; + + /* Extract the name */ + + ptr += 7; + ptr = skip_space(ptr); + endptr = strchr(ptr, '<'); + if (endptr == NULL) + { + fprintf(stderr, "ERROR line %lu: No email address after name, state %d\n", + g_lineno, state); + exit(EXIT_FAILURE); + } + + if (name != NULL) + { + fprintf(stderr, "ERROR line %lu: Duplicate name, state %d\n", + g_lineno, state); + exit(EXIT_FAILURE); + } + + /* Copy and save the name string */ + + trim_end(ptr, endptr - 1); + name = strdup(ptr); + if (name == NULL) + { + fprintf(stderr, "ERROR line %lu: Failed to duplicate name, state %d\n", + g_lineno, state); + exit(EXIT_FAILURE); + } + } + else if (strncmp(g_line, "Date: ", 6) ==0) + { + if (date != NULL) + { + fprintf(stderr, "ERROR line %lu: Duplicate date, state %d\n", + g_lineno, state); + exit(EXIT_FAILURE); + } + + /* Extract the date */ + + ptr += 6; + ptr = skip_space(ptr); + date = parse_date(ptr); + } + else + { + fprintf(stderr, "ERROR line %lu: Unrecognized header line in state %d\n", + g_lineno, state); + exit(EXIT_FAILURE); + } + + consumed = true; + break; + } + + /* Change state and fall through */ + + if (name == NULL || date == NULL) + { + fprintf(stderr, "ERROR line %lu: name or date not found in header. State %d\n", + g_lineno, state); + exit(EXIT_FAILURE); + } + + state = STATE_ENDHEADER; + + case STATE_ENDHEADER: /* Finished the header looking for the start of the body */ + if (blank_line()) + { + consumed = true; + break; + } + + if (!isspace(g_line[0])) + { + fprintf(stderr, "ERROR line %lu: Unexpected in state %d\n", + g_lineno, state); + exit(EXIT_FAILURE); + } + + /* Change state and fall through */ + + state = STATE_BODY; + lastblank = false; + + case STATE_BODY: /* Parsing the body */ + if (blank_line()) + { + lastblank = true; + consumed = true; + break; + } + + if (isspace(g_line[0])) + { + char *endptr; + + /* Remove the newline from the end */ + + ptr = skip_space(ptr); + endptr = &ptr[strlen(ptr) - 1]; + trim_end(ptr, endptr); + + /* Was this paragraph preceded by a blank line? */ + + if (!merge) + { + if (lastblank) + { + putchar('\n'); + } + + if (firstline) + { + printf("\t* %s", ptr); + } + else + { + printf("\n\t %s", ptr); + } + } + + consumed = true; + lastblank = false; + firstline = false; + break; + } + + /* End of body. Add author, date, and final newline */ + + if (!merge) + { + printf(" From %s %s.\n", name, date); + } + + /* Revert to IDLE state */ + + free(name); + name = NULL; + date = NULL; + free(date); + state = STATE_IDLE; + firstline = true; + merge = false; + break; + + default: + fprintf(stderr, "ERROR line %lu: Bad state %d\n", g_lineno, state); + exit(EXIT_FAILURE); + } + } +} + +static void show_usage(const char *progname) +{ + fprintf(stderr, "USAGE: %s \n", progname); + exit(EXIT_FAILURE); +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int main(int argc, char **argv, char **envp) +{ + FILE *stream; + + if (argc != 2) + { + fprintf(stderr, "Unexpected number of arguments\n"); + show_usage(argv[0]); + } + + stream = fopen(argv[1], "r"); + if (!stream) + { + fprintf(stderr, "open %s failed: %s\n", argv[1], strerror(errno)); + return EXIT_FAILURE; + } + + parse_file(stream); + fclose(stream); + return EXIT_SUCCESS; +} \ No newline at end of file -- GitLab From 4b44a84bc957a7ce2cf96df63b3adcf2dc425096 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 29 Jan 2018 11:51:43 -0600 Subject: [PATCH 132/228] tools/logparser.c: Fix some issues, improve output a little. --- tools/logparser.c | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/tools/logparser.c b/tools/logparser.c index 7704bcbb4d..e535c0512a 100644 --- a/tools/logparser.c +++ b/tools/logparser.c @@ -469,28 +469,44 @@ static void parse_file(FILE *stream) endptr = &ptr[strlen(ptr) - 1]; trim_end(ptr, endptr); - /* Was this paragraph preceded by a blank line? */ + /* Skip over certain crap lines added by GIT; Skip over + * merge entries. + */ - if (!merge) + if (strncmp(ptr, "Merged in ", 10) != 0 && + strncmp(ptr, "Approved-by: ", 13) != 0 && + !merge) { - if (lastblank) + /* Change leading "* " to "- " */ + + if (ptr[0] == '*' && ptr[1] == ' ') { - putchar('\n'); + *ptr = '-'; } + /* Is this the first paragraph in the body? */ + if (firstline) { printf("\t* %s", ptr); } else { + /* Was this paragraph preceded by a blank line? */ + + if (lastblank) + { + putchar('\n'); + } + printf("\n\t %s", ptr); } + + firstline = false; + lastblank = false; } consumed = true; - lastblank = false; - firstline = false; break; } @@ -505,8 +521,9 @@ static void parse_file(FILE *stream) free(name); name = NULL; - date = NULL; free(date); + date = NULL; + state = STATE_IDLE; firstline = true; merge = false; -- GitLab From 8956a6001f08d60a2a14bd0ca2c05e3d9c3e0f32 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 29 Jan 2018 13:13:29 -0600 Subject: [PATCH 133/228] tools/logparser.c: A few more minor enhancements. Also add #define _GNU_SOURCE to all C files that call asprintf() --- tools/initialconfig.c | 1 + tools/kconfig2html.c | 1 + tools/logparser.c | 31 +++++++++++++++++++------------ 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/tools/initialconfig.c b/tools/initialconfig.c index 90246dbe63..8bbce57bac 100644 --- a/tools/initialconfig.c +++ b/tools/initialconfig.c @@ -37,6 +37,7 @@ * Included Files ****************************************************************************/ +#define _GNU_SOURCE #include #include #include diff --git a/tools/kconfig2html.c b/tools/kconfig2html.c index 1f7ab89847..fffa51b3e2 100644 --- a/tools/kconfig2html.c +++ b/tools/kconfig2html.c @@ -37,6 +37,7 @@ * Included Files ****************************************************************************/ +#define _GNU_SOURCE #include #include #include diff --git a/tools/logparser.c b/tools/logparser.c index e535c0512a..39f038d329 100644 --- a/tools/logparser.c +++ b/tools/logparser.c @@ -37,6 +37,7 @@ * Included Files ****************************************************************************/ +#define _GNU_SOURCE #include #include #include @@ -462,6 +463,7 @@ static void parse_file(FILE *stream) if (isspace(g_line[0])) { char *endptr; + char *tmp; /* Remove the newline from the end */ @@ -469,21 +471,24 @@ static void parse_file(FILE *stream) endptr = &ptr[strlen(ptr) - 1]; trim_end(ptr, endptr); - /* Skip over certain crap lines added by GIT; Skip over - * merge entries. - */ + /* Change leading "* " to "- " */ - if (strncmp(ptr, "Merged in ", 10) != 0 && - strncmp(ptr, "Approved-by: ", 13) != 0 && - !merge) + tmp = ptr; + if (ptr[0] == '*' && ptr[1] == ' ') { - /* Change leading "* " to "- " */ + *ptr = '-'; + tmp = ptr + 2; + } - if (ptr[0] == '*' && ptr[1] == ' ') - { - *ptr = '-'; - } + /* Skip over certain crap body lines added by GIT; Skip over + * merge entries altogether. + */ + if (strncmp(tmp, "Merged in ", 10) != 0 && + strncmp(tmp, "Approved-by: ", 13) != 0 && + strncmp(tmp, "Signed-off-by: ", 15) != 0 && + !merge) + { /* Is this the first paragraph in the body? */ if (firstline) @@ -492,7 +497,9 @@ static void parse_file(FILE *stream) } else { - /* Was this paragraph preceded by a blank line? */ + /* This paragraph is not the first, was it separated + * from the previous paragraph by a blank line? + */ if (lastblank) { -- GitLab From 20016b841a76bf1b8e2a8b4721e1471491b56ca4 Mon Sep 17 00:00:00 2001 From: Matt Thompson Date: Mon, 29 Jan 2018 19:20:00 +0000 Subject: [PATCH 134/228] Merged in extent3d/nuttx (pull request #587) SAMDL: Added Timer Compare for Control registers header Approved-by: Gregory Nutt --- arch/arm/src/samdl/chip/samd_tcc.h | 463 +++++++++++++++++++++++++++++ 1 file changed, 463 insertions(+) create mode 100644 arch/arm/src/samdl/chip/samd_tcc.h diff --git a/arch/arm/src/samdl/chip/samd_tcc.h b/arch/arm/src/samdl/chip/samd_tcc.h new file mode 100644 index 0000000000..f7274f992e --- /dev/null +++ b/arch/arm/src/samdl/chip/samd_tcc.h @@ -0,0 +1,463 @@ +/******************************************************************************************** + * arch/arm/src/samdl/chip/samd_tcc.h + * + * Copyright (C) 2018 Gregory Nutt. All rights reserved. + * Author: Matt Thompson + * + * References: + * "Microchip SAMD21 datasheet" + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ********************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_SAMDL_CHIP_SAMD_TCC_H +#define __ARCH_ARM_SRC_SAMDL_CHIP_SAMD_TCC_H + +/******************************************************************************************** + * Included Files + ********************************************************************************************/ + +#include + +#include "chip.h" + +#ifdef CONFIG_ARCH_FAMILY_SAMD21 + +/******************************************************************************************** + * Pre-processor Definitions + ********************************************************************************************/ +/* TCC register offsets *********************************************************************/ + +#define SAM_TCC_CTRLA_OFFSET 0x0000 /* Control A register */ +#define SAM_TCC_CTRLBCLR_OFFSET 0x0004 /* Control B clear register */ +#define SAM_TCC_CTRLBSET_OFFSET 0x0005 /* Control B clear register */ +#define SAM_TCC_SYNCBUSY_OFFSET 0x0008 /* Sync Busy register */ +#define SAM_TCC_FCTRLA_OFFSET 0x000C /* Fault control A register */ +#define SAM_TCC_FCTRLB_OFFSET 0x0010 /* Fault control B register */ +#define SAM_TCC_WEXCTRL_OFFSET 0x0014 /* Waveform extension control register */ +#define SAM_TCC_DRVCTRL_OFFSET 0x0018 /* Event control register */ +#define SAM_TCC_DBGCTRL_OFFSET 0x001E /* Debug control register */ +#define SAM_TCC_EVCTRL_OFFSET 0x0020 /* Event control register */ +#define SAM_TCC_INTENCLR_OFFSET 0x0024 /* Interrupt enable clear register */ +#define SAM_TCC_INTENSET_OFFSET 0x0028 /* Interrupt enable set register */ +#define SAM_TCC_INTFLAG_OFFSET 0x002C /* Interrupt flag register */ +#define SAM_TCC_STATUS_OFFSET 0x0030 /* Status register */ +#define SAM_TCC_COUNT_OFFSET 0x0034 /* Count register */ +#define SAM_TCC_PATT_OFFSET 0x0038 /* Pattern register */ +#define SAM_TCC_WAVE_OFFSET 0x003C /* Waveform register */ +#define SAM_TCC_PER_OFFSET 0x0040 /* Period register */ +#define SAM_TCC_CC0_OFFSET 0x0044 /* Capture Compare 0 register */ +#define SAM_TCC_CC1_OFFSET 0x0048 /* Capture Compare 1 register */ +#define SAM_TCC_CC2_OFFSET 0x004C /* Capture Compare 2 register */ +#define SAM_TCC_CC3_OFFSET 0x0050 /* Capture Compare 3 register */ +#define SAM_TCC_PATTB_OFFSET 0x0064 /* Capture Compare 3 register */ +#define SAM_TCC_WAVEB_OFFSET 0x0068 /* Capture Compare 3 register */ +#define SAM_TCC_PERB_OFFSET 0x006C /* Capture Compare 3 register */ +#define SAM_TCC_CCB0_OFFSET 0x0070 /* Capture Compare B0 register */ +#define SAM_TCC_CCB1_OFFSET 0x0074 /* Capture Compare B0 register */ +#define SAM_TCC_CCB2_OFFSET 0x0078 /* Capture Compare B0 register */ +#define SAM_TCC_CCB3_OFFSET 0x007C /* Capture Compare B0 register */ + +/* TC register addresses *******************************************************************/ + +#define SAM_TCC0_CTRLA (SAM_TCC0_BASE+SAM_TCC_CTRLA_OFFSET) +#define SAM_TCC0_CTRLBCLR (SAM_TCC0_BASE+SAM_TCC_CTRLBCLR_OFFSET) +#define SAM_TCC0_CTRLBSET (SAM_TCC0_BASE+SAM_TCC_CTRLBSET_OFFSET) +#define SAM_TCC0_SYNCBUSY (SAM_TCC0_BASE+SAM_TCC_SYNCBUSY_OFFSET) +#define SAM_TCC0_FCTRLA (SAM_TCC0_BASE+SAM_TCC_FCTRLA_OFFSET) +#define SAM_TCC0_FCTRLB (SAM_TCC0_BASE+SAM_TCC_FCTRLB_OFFSET) +#define SAM_TCC0_WEXCTRL (SAM_TCC0_BASE+SAM_TCC_WEXCTRL_OFFSET) +#define SAM_TCC0_DRVCTRL (SAM_TCC0_BASE+SAM_TCC_DRVCTRL_OFFSET) +#define SAM_TCC0_DBGCTRL (SAM_TCC0_BASE+SAM_TCC_DBGCTRL_OFFSET) +#define SAM_TCC0_EVCTRL (SAM_TCC0_BASE+SAM_TCC_EVCTRL_OFFSET) +#define SAM_TCC0_INTENCLR (SAM_TCC0_BASE+SAM_TCC_INTENCLR_OFFSET) +#define SAM_TCC0_INTENSET (SAM_TCC0_BASE+SAM_TCC_INTENSET_OFFSET) +#define SAM_TCC0_INTFLAG (SAM_TCC0_BASE+SAM_TCC_INTFLAG_OFFSET) +#define SAM_TCC0_STATUS (SAM_TCC0_BASE+SAM_TCC_STATUS_OFFSET) +#define SAM_TCC0_COUNT (SAM_TCC0_BASE+SAM_TCC_COUNT_OFFSET) +#define SAM_TCC0_PATT (SAM_TCC0_BASE+SAM_TCC_PATT_OFFSET) +#define SAM_TCC0_WAVE (SAM_TCC0_BASE+SAM_TCC_WAVE_OFFSET) +#define SAM_TCC0_PER (SAM_TCC0_BASE+SAM_TCC_PER_OFFSET) +#define SAM_TCC0_CC0 (SAM_TCC0_BASE+SAM_TCC_CC0_OFFSET) +#define SAM_TCC0_CC1 (SAM_TCC0_BASE+SAM_TCC_CC1_OFFSET) +#define SAM_TCC0_CC2 (SAM_TCC0_BASE+SAM_TCC_CC2_OFFSET) +#define SAM_TCC0_CC3 (SAM_TCC0_BASE+SAM_TCC_CC3_OFFSET) +#define SAM_TCC0_PATTB (SAM_TCC0_BASE+SAM_TCC_PATTB_OFFSET) +#define SAM_TCC0_WAVEB (SAM_TCC0_BASE+SAM_TCC_WAVEB_OFFSET) +#define SAM_TCC0_PERB (SAM_TCC0_BASE+SAM_TCC_PERB_OFFSET) +#define SAM_TCC0_CCB0 (SAM_TCC0_BASE+SAM_TCC_CCB0_OFFSET) +#define SAM_TCC0_CCB1 (SAM_TCC0_BASE+SAM_TCC_CCB1_OFFSET) +#define SAM_TCC0_CCB2 (SAM_TCC0_BASE+SAM_TCC_CCB2_OFFSET) +#define SAM_TCC0_CCB3 (SAM_TCC0_BASE+SAM_TCC_CCB3_OFFSET) + +#define SAM_TCC1_CTRLA (SAM_TCC1_BASE+SAM_TCC_CTRLA_OFFSET) +#define SAM_TCC1_CTRLBCLR (SAM_TCC1_BASE+SAM_TCC_CTRLBCLR_OFFSET) +#define SAM_TCC1_CTRLBSET (SAM_TCC1_BASE+SAM_TCC_CTRLBSET_OFFSET) +#define SAM_TCC1_SYNCBUSY (SAM_TCC1_BASE+SAM_TCC_SYNCBUSY_OFFSET) +#define SAM_TCC1_FCTRLA (SAM_TCC1_BASE+SAM_TCC_FCTRLA_OFFSET) +#define SAM_TCC1_FCTRLB (SAM_TCC1_BASE+SAM_TCC_FCTRLB_OFFSET) +#define SAM_TCC1_WEXCTRL (SAM_TCC1_BASE+SAM_TCC_WEXCTRL_OFFSET) +#define SAM_TCC1_DRVCTRL (SAM_TCC1_BASE+SAM_TCC_DRVCTRL_OFFSET) +#define SAM_TCC1_DBGCTRL (SAM_TCC1_BASE+SAM_TCC_DBGCTRL_OFFSET) +#define SAM_TCC1_EVCTRL (SAM_TCC1_BASE+SAM_TCC_EVCTRL_OFFSET) +#define SAM_TCC1_INTENCLR (SAM_TCC1_BASE+SAM_TCC_INTENCLR_OFFSET) +#define SAM_TCC1_INTENSET (SAM_TCC1_BASE+SAM_TCC_INTENSET_OFFSET) +#define SAM_TCC1_INTFLAG (SAM_TCC1_BASE+SAM_TCC_INTFLAG_OFFSET) +#define SAM_TCC1_STATUS (SAM_TCC1_BASE+SAM_TCC_STATUS_OFFSET) +#define SAM_TCC1_COUNT (SAM_TCC1_BASE+SAM_TCC_COUNT_OFFSET) +#define SAM_TCC1_PATT (SAM_TCC1_BASE+SAM_TCC_PATT_OFFSET) +#define SAM_TCC1_WAVE (SAM_TCC1_BASE+SAM_TCC_WAVE_OFFSET) +#define SAM_TCC1_PER (SAM_TCC1_BASE+SAM_TCC_PER_OFFSET) +#define SAM_TCC1_CC0 (SAM_TCC1_BASE+SAM_TCC_CC0_OFFSET) +#define SAM_TCC1_CC1 (SAM_TCC1_BASE+SAM_TCC_CC1_OFFSET) +#define SAM_TCC1_CC2 (SAM_TCC1_BASE+SAM_TCC_CC2_OFFSET) +#define SAM_TCC1_CC3 (SAM_TCC1_BASE+SAM_TCC_CC3_OFFSET) +#define SAM_TCC1_PATTB (SAM_TCC1_BASE+SAM_TCC_PATTB_OFFSET) +#define SAM_TCC1_WAVEB (SAM_TCC1_BASE+SAM_TCC_WAVEB_OFFSET) +#define SAM_TCC1_PERB (SAM_TCC1_BASE+SAM_TCC_PERB_OFFSET) +#define SAM_TCC1_CCB0 (SAM_TCC1_BASE+SAM_TCC_CCB0_OFFSET) +#define SAM_TCC1_CCB1 (SAM_TCC1_BASE+SAM_TCC_CCB1_OFFSET) +#define SAM_TCC1_CCB2 (SAM_TCC1_BASE+SAM_TCC_CCB2_OFFSET) +#define SAM_TCC1_CCB3 (SAM_TCC1_BASE+SAM_TCC_CCB3_OFFSET) + +#define SAM_TCC2_CTRLA (SAM_TCC2_BASE+SAM_TCC_CTRLA_OFFSET) +#define SAM_TCC2_CTRLBCLR (SAM_TCC2_BASE+SAM_TCC_CTRLBCLR_OFFSET) +#define SAM_TCC2_CTRLBSET (SAM_TCC2_BASE+SAM_TCC_CTRLBSET_OFFSET) +#define SAM_TCC2_SYNCBUSY (SAM_TCC2_BASE+SAM_TCC_SYNCBUSY_OFFSET) +#define SAM_TCC2_FCTRLA (SAM_TCC2_BASE+SAM_TCC_FCTRLA_OFFSET) +#define SAM_TCC2_FCTRLB (SAM_TCC2_BASE+SAM_TCC_FCTRLB_OFFSET) +#define SAM_TCC2_WEXCTRL (SAM_TCC2_BASE+SAM_TCC_WEXCTRL_OFFSET) +#define SAM_TCC2_DRVCTRL (SAM_TCC2_BASE+SAM_TCC_DRVCTRL_OFFSET) +#define SAM_TCC2_DBGCTRL (SAM_TCC2_BASE+SAM_TCC_DBGCTRL_OFFSET) +#define SAM_TCC2_EVCTRL (SAM_TCC2_BASE+SAM_TCC_EVCTRL_OFFSET) +#define SAM_TCC2_INTENCLR (SAM_TCC2_BASE+SAM_TCC_INTENCLR_OFFSET) +#define SAM_TCC2_INTENSET (SAM_TCC2_BASE+SAM_TCC_INTENSET_OFFSET) +#define SAM_TCC2_INTFLAG (SAM_TCC2_BASE+SAM_TCC_INTFLAG_OFFSET) +#define SAM_TCC2_STATUS (SAM_TCC2_BASE+SAM_TCC_STATUS_OFFSET) +#define SAM_TCC2_COUNT (SAM_TCC2_BASE+SAM_TCC_COUNT_OFFSET) +#define SAM_TCC2_PATT (SAM_TCC2_BASE+SAM_TCC_PATT_OFFSET) +#define SAM_TCC2_WAVE (SAM_TCC2_BASE+SAM_TCC_WAVE_OFFSET) +#define SAM_TCC2_PER (SAM_TCC2_BASE+SAM_TCC_PER_OFFSET) +#define SAM_TCC2_CC0 (SAM_TCC2_BASE+SAM_TCC_CC0_OFFSET) +#define SAM_TCC2_CC1 (SAM_TCC2_BASE+SAM_TCC_CC1_OFFSET) +#define SAM_TCC2_CC2 (SAM_TCC2_BASE+SAM_TCC_CC2_OFFSET) +#define SAM_TCC2_CC3 (SAM_TCC2_BASE+SAM_TCC_CC3_OFFSET) +#define SAM_TCC2_PATTB (SAM_TCC2_BASE+SAM_TCC_PATTB_OFFSET) +#define SAM_TCC2_WAVEB (SAM_TCC2_BASE+SAM_TCC_WAVEB_OFFSET) +#define SAM_TCC2_PERB (SAM_TCC2_BASE+SAM_TCC_PERB_OFFSET) +#define SAM_TCC2_CCB0 (SAM_TCC2_BASE+SAM_TCC_CCB0_OFFSET) +#define SAM_TCC2_CCB1 (SAM_TCC2_BASE+SAM_TCC_CCB1_OFFSET) +#define SAM_TCC2_CCB2 (SAM_TCC2_BASE+SAM_TCC_CCB2_OFFSET) +#define SAM_TCC2_CCB3 (SAM_TCC2_BASE+SAM_TCC_CCB3_OFFSET) + +/* TC register bit definitions *************************************************************/ + +/* Control A register */ + +#define TCC_CTRLA_SWRST (1 << 0) /* Bit 0: Software reset */ +#define TCC_CTRLA_ENABLE (1 << 1) /* Bit 1: Enable */ +#define TCC_CTRLA_RES_SHIFT (5) +#define TCC_CTRLA_RES_MASK (3 << TCC_CTRLA_RES_SHIFT) +# define TCC_CTRLA_RES_NONE (0 << TCC_CTRLA_RES_SHIFT) +# define TCC_CTRLA_RES_DITH4 (1 << TCC_CTRLA_RES_SHIFT) +# define TCC_CTRLA_RES_DITH5 (2 << TCC_CTRLA_RES_SHIFT) +# define TCC_CTRLA_RES_DITH6 (3 << TCC_CTRLA_RES_SHIFT) +#define TCC_CTRLA_PRESCALER_SHIFT (8) +#define TCC_CTRLA_PRESCALER_MASK (7 << TCC_CTRLA_PRESCALER_SHIFT) +# define TCC_CTRLA_PRESCALER_DIV1 (0 << TCC_CTRLA_PRESCALER_SHIFT) +# define TCC_CTRLA_PRESCALER_DIV2 (1 << TCC_CTRLA_PRESCALER_SHIFT) +# define TCC_CTRLA_PRESCALER_DIV4 (2 << TCC_CTRLA_PRESCALER_SHIFT) +# define TCC_CTRLA_PRESCALER_DIV8 (3 << TCC_CTRLA_PRESCALER_SHIFT) +# define TCC_CTRLA_PRESCALER_DIV16 (4 << TCC_CTRLA_PRESCALER_SHIFT) +# define TCC_CTRLA_PRESCALER_DIV64 (5 << TCC_CTRLA_PRESCALER_SHIFT) +# define TCC_CTRLA_PRESCALER_DIV256 (6 << TCC_CTRLA_PRESCALER_SHIFT) +# define TCC_CTRLA_PRESCALER_DIV1024 (7 << TCC_CTRLA_PRESCALER_SHIFT) +#define TCC_CTRLA_RUNSTDBY (1 << 11) +#define TCC_CTRLA_PRESCSYNC_SHIFT (12) +#define TCC_CTRLA_PRESCSYNC_MASK (3 << TCC_CTRLA_PRESCSYNC_SHIFT) +# define TCC_CTRLA_PRESCSYNC_GCLK (0 << TCC_CTRLA_PRESCSYNC_SHIFT) +# define TCC_CTRLA_PRESCSYNC_PRESC (1 << TCC_CTRLA_PRESCSYNC_SHIFT) +# define TCC_CTRLA_PRESCSYNC_RESYNC (2 << TCC_CTRLA_PRESCSYNC_SHIFT) +#define TCC_CTRLA_ALOCK (1 << 14) +#define TCC_CTRLA_CPTEN0 (1 << 24) +#define TCC_CTRLA_CPTEN1 (1 << 25) +#define TCC_CTRLA_CPTEN2 (1 << 26) +#define TCC_CTRLA_CPTEN3 (1 << 27) + +/* Control B Set/Clear register */ + +#define TCC_CTRLB_DIR (1 << 0) +#define TCC_CTRLB_LUPD (1 << 1) +#define TCC_CTRLB_ONESHOT (1 << 2) +#define TCC_CTRLB_IDXCMD_SHIFT (3) +#define TCC_CTRLB_IDXCMD_MASK (3 << TCC_CTRLB_IDXCMD_SHIFT) +# define TCC_CTRLB_IDXCMD_DISABLE (0 << TCC_CTRLB_IDXCMD_SHIFT) +# define TCC_CTRLB_IDXCMD_SET (1 << TCC_CTRLB_IDXCMD_SHIFT) +# define TCC_CTRLB_IDXCMD_CLEAR (2 << TCC_CTRLB_IDXCMD_SHIFT) +# define TCC_CTRLB_IDXCMD_HOLD (3 << TCC_CTRLB_IDXCMD_SHIFT) +#define TCC_CTRLB_CMD_SHIFT (6) +#define TCC_CTRLB_CMD_MASK (7 << TCC_CTRLB_CMD_SHIFT) +# define TCC_CTRLB_CMD_NONE (0 << TCC_CTRLB_CMD_SHIFT) +# define TCC_CTRLB_CMD_RETRIGGER (1 << TCC_CTRLB_CMD_SHIFT) +# define TCC_CTRLB_CMD_STOP (2 << TCC_CTRLB_CMD_SHIFT) +# define TCC_CTRLB_CMD_UPDATE (3 << TCC_CTRLB_CMD_SHIFT) +# define TCC_CTRLB_CMD_READSYNC (4 << TCC_CTRLB_CMD_SHIFT) + +/* Sync Busy register */ + +#define TCC_SYNCBUSY_SWRST (1 << 0) +#define TCC_SYNCBUSY_ENABLE (1 << 1) +#define TCC_SYNCBUSY_CTRLB (1 << 2) +#define TCC_SYNCBUSY_STATUS (1 << 3) +#define TCC_SYNCBUSY_COUNT (1 << 4) +#define TCC_SYNCBUSY_PATT (1 << 5) +#define TCC_SYNCBUSY_WAVE (1 << 6) +#define TCC_SYNCBUSY_PER (1 << 7) +#define TCC_SYNCBUSY_CC0 (1 << 8) +#define TCC_SYNCBUSY_CC1 (1 << 9) +#define TCC_SYNCBUSY_CC2 (1 << 10) +#define TCC_SYNCBUSY_CC3 (1 << 11) +#define TCC_SYNCBUSY_PATTB (1 << 16) +#define TCC_SYNCBUSY_WAVEB (1 << 17) +#define TCC_SYNCBUSY_PERB (1 << 18) +#define TCC_SYNCBUSY_CCB0 (1 << 19) +#define TCC_SYNCBUSY_CCB1 (1 << 20) +#define TCC_SYNCBUSY_CCB2 (1 << 21) +#define TCC_SYNCBUSY_CCB3 (1 << 22) + +/* Fault Control A and B */ + +#define TCC_FCTRL_SRC_SHIFT (0) +#define TCC_FCTRL_SRC_MASK (3 << TCC_FCTRL_SRC_SHIFT) +# define TCC_FCTRL_SRC_DISABLE (0 << TCC_FCTRL_SRC_SHIFT) +# define TCC_FCTRL_SRC_ENABLE (1 << TCC_FCTRL_SRC_SHIFT) +# define TCC_FCTRL_SRC_INVERT (2 << TCC_FCTRL_SRC_SHIFT) +# define TCC_FCTRL_SRC_ALTFAULT (3 << TCC_FCTRL_SRC_SHIFT) +#define TCC_FCTRL_KEEP (1 << 3) +#define TCC_FCTRL_QUAL (1 << 4) +#define TCC_FCTRL_BLANK_SHIFT (5) +#define TCC_FCTRL_BLANK_MASK (3 << TCC_FCTRL_BLANK_SHIFT) +# define TCC_FCTRL_BLANK_START (0 << TCC_FCTRL_BLANK_SHIFT) +# define TCC_FCTRL_BLANK_RISE (1 << TCC_FCTRL_BLANK_SHIFT) +# define TCC_FCTRL_BLANK_FALL (2 << TCC_FCTRL_BLANK_SHIFT) +# define TCC_FCTRL_BLANK_BOTH (3 << TCC_FCTRL_BLANK_SHIFT) +#define TCC_FCTRL_RESTART (1 << 7) +#define TCC_FCTRL_HALT_SHIFT (8) +#define TCC_FCTRL_HALT_MASK (3 << TCC_FCTRL_HALT_SHIFT) +# define TCC_FCTRL_HALT_DISABLE (0 << TCC_FCTRL_HALT_SHIFT) +# define TCC_FCTRL_HALT_HW (1 << TCC_FCTRL_HALT_SHIFT) +# define TCC_FCTRL_HALT_SW (2 << TCC_FCTRL_HALT_SHIFT) +# define TCC_FCTRL_HALT_NR (3 << TCC_FCTRL_HALT_SHIFT) +#define TCC_FCTRL_CHSEL_SHIFT (10) +#define TCC_FCTRL_CHSEL_MASK (3 << TCC_FCTRL_CHSEL_SHIFT) +# define TCC_FCTRL_CHSEL_CC0 (0 << TCC_FCTRL_CHSEL_SHIFT) +# define TCC_FCTRL_CHSEL_CC1 (1 << TCC_FCTRL_CHSEL_SHIFT) +# define TCC_FCTRL_CHSEL_CC2 (2 << TCC_FCTRL_CHSEL_SHIFT) +# define TCC_FCTRL_CHSEL_CC3 (3 << TCC_FCTRL_CHSEL_SHIFT) +#define TCC_FCTRL_CAPTURE_SHIFT (12) +#define TCC_FCTRL_CAPTURE_MASK (7 << TCC_FCTRL_CAPTURE_SHIFT) +# define TCC_FCTRL_CAPTURE_DISABLE (0 << TCC_FCTRL_CAPTURE_SHIFT) +# define TCC_FCTRL_CAPTURE_CAPT (1 << TCC_FCTRL_CAPTURE_SHIFT) +# define TCC_FCTRL_CAPTURE_CAPTMIN (2 << TCC_FCTRL_CAPTURE_SHIFT) +# define TCC_FCTRL_CAPTURE_CAPTMAX (3 << TCC_FCTRL_CAPTURE_SHIFT) +# define TCC_FCTRL_CAPTURE_LOCMIN (4 << TCC_FCTRL_CAPTURE_SHIFT) +# define TCC_FCTRL_CAPTURE_LOCMAX (5 << TCC_FCTRL_CAPTURE_SHIFT) +# define TCC_FCTRL_CAPTURE_DERIV0 (6 << TCC_FCTRL_CAPTURE_SHIFT) +#define TCC_FCTRL_BLANKVAL_SHIFT (16) +#define TCC_FCTRL_BLANKVAL_MASK (0xff << TCC_FCTRL_BLANKVAL_SHIFT) +#define TCC_FCTRL_FILTERVAL_SHIFT (24) +#define TCC_FCTRL_FILTERVAL_MASK (0xf << TCC_FCTRL_FILTERVAL_SHIFT) + +/* Waveform Extension Control register */ + +#define TCC_WEXCTRL_OTMX_SHIFT (0) +#define TCC_WEXCTRL_OTMX_MASK (3 << TCC_WEXCTRL_OTMX_SHIFT) +#define TCC_WEXCTRL_DTIEN0 (1 << 8) +#define TCC_WEXCTRL_DTIEN1 (1 << 9) +#define TCC_WEXCTRL_DTIEN2 (1 << 10) +#define TCC_WEXCTRL_DTIEN3 (1 << 11) +#define TCC_WEXCTRL_DTLS_SHIFT (16) +#define TCC_WEXCTRL_DTLS_MASK (0xff << TCC_WEXCTRL_DTLS_SHIFT) +#define TCC_WEXCTRL_DTHS_SHIFT (24) +#define TCC_WEXCTRL_DTHS_MASK (0xff << TCC_WEXCTRL_DTHS_SHIFT) + +/* Driver Control register */ + +#define TCC_DRVCTRL_NRE(n) (1 << n) +#define TCC_DRVCTRL_NRV(n) (1 << (8+n)) +#define TCC_DRVCTRL_INVEN(n) (1 << (16+n)) +#define TCC_DRVCTRL_FILTERVAL0_SHIFT (24) +#define TCC_DRVCTRL_FILTERVAL0_MASK (0xf << TCC_DRVCTRL_FILTERVAL0_SHIFT) +#define TCC_DRVCTRL_FILTERVAL1_SHIFT (28) +#define TCC_DRVCTRL_FILTERVAL1_MASK (0xf << TCC_DRVCTRL_FILTERVAL1_SHIFT) + +/* Debug control register */ + +#define TCC_DBGCTRL_DBGRUN (1 << 0) +#define TCC_DBGCTRL_FDDBD (1 << 2) + +/* Event control register */ + +#define TCC_EVCTRL_EVACT0_SHIFT (0) +#define TCC_EVCTRL_EVACT0_MASK (7 << TCC_EVCTRL_EVACT0_SHIFT) +# define TCC_EVCTRL_EVACT0_OFF (0 << TCC_EVCTRL_EVACT0_SHIFT) +# define TCC_EVCTRL_EVACT0_RETRIGGER (1 << TCC_EVCTRL_EVACT0_SHIFT) +# define TCC_EVCTRL_EVACT0_COUNTEV (2 << TCC_EVCTRL_EVACT0_SHIFT) +# define TCC_EVCTRL_EVACT0_START (3 << TCC_EVCTRL_EVACT0_SHIFT) +# define TCC_EVCTRL_EVACT0_INC (4 << TCC_EVCTRL_EVACT0_SHIFT) +# define TCC_EVCTRL_EVACT0_COUNT (5 << TCC_EVCTRL_EVACT0_SHIFT) +# define TCC_EVCTRL_EVACT0_FAULT (7 << TCC_EVCTRL_EVACT0_SHIFT) +#define TCC_EVCTRL_EVACT1_SHIFT (3) +#define TCC_EVCTRL_EVACT1_MASK (7 << TCC_EVCTRL_EVACT1_SHIFT) +# define TCC_EVCTRL_EVACT1_OFF (0 << TCC_EVCTRL_EVACT1_SHIFT) +# define TCC_EVCTRL_EVACT1_RETRIGGER (1 << TCC_EVCTRL_EVACT1_SHIFT) +# define TCC_EVCTRL_EVACT1_DIR (2 << TCC_EVCTRL_EVACT1_SHIFT) +# define TCC_EVCTRL_EVACT1_STOP (3 << TCC_EVCTRL_EVACT1_SHIFT) +# define TCC_EVCTRL_EVACT1_DEC (4 << TCC_EVCTRL_EVACT1_SHIFT) +# define TCC_EVCTRL_EVACT1_PPW (5 << TCC_EVCTRL_EVACT1_SHIFT) +# define TCC_EVCTRL_EVACT1_PWP (6 << TCC_EVCTRL_EVACT1_SHIFT) +# define TCC_EVCTRL_EVACT1_FAULT (7 << TCC_EVCTRL_EVACT1_SHIFT) +#define TCC_EVCTRL_CNTSEL_SHIFT (6) +#define TCC_EVCTRL_CNTSEL_MASK (3 << TCC_EVCTRL_CNTSEL_SHIFT) +# define TCC_EVCTRL_CNTSEL_BEGIN (0 << TCC_EVCTRL_CNTSEL_SHIFT) +# define TCC_EVCTRL_CNTSEL_END (1 << TCC_EVCTRL_CNTSEL_SHIFT) +# define TCC_EVCTRL_CNTSEL_BETWEEN (2 << TCC_EVCTRL_CNTSEL_SHIFT) +# define TCC_EVCTRL_CNTSEL_BOUNDARY (3 << TCC_EVCTRL_CNTSEL_SHIFT) +#define TCC_EVCTRL_OVFEO (1 << 8) +#define TCC_EVCTRL_TRGEO (1 << 9) +#define TCC_EVCTRL_CNTEO (1 << 10) +#define TCC_EVCTRL_TCINV0 (1 << 12) +#define TCC_EVCTRL_TCINV1 (1 << 13) +#define TCC_EVCTRL_TCEI0 (1 << 14) +#define TCC_EVCTRL_TCEI1 (1 << 15) +#define TCC_EVCTRL_MCEI0 (1 << 16) +#define TCC_EVCTRL_MCEI1 (1 << 17) +#define TCC_EVCTRL_MCEI2 (1 << 18) +#define TCC_EVCTRL_MCEI3 (1 << 19) +#define TCC_EVCTRL_MCEO0 (1 << 24) +#define TCC_EVCTRL_MCEO1 (1 << 25) +#define TCC_EVCTRL_MCEO2 (1 << 26) +#define TCC_EVCTRL_MCEO3 (1 << 27) + +/* Interrupt register bits */ + +#define TCC_INT_OVF (1 << 0) +#define TCC_INT_TRG (1 << 1) +#define TCC_INT_CNT (1 << 2) +#define TCC_INT_ERR (1 << 3) +#define TCC_INT_DFS (1 << 11) +#define TCC_INT_FAULTA (1 << 12) +#define TCC_INT_FAULTB (1 << 13) +#define TCC_INT_FAULT0 (1 << 14) +#define TCC_INT_FAULT1 (1 << 15) +#define TCC_INT_MC0 (1 << 16) +#define TCC_INT_MC1 (1 << 17) +#define TCC_INT_MC2 (1 << 18) +#define TCC_INT_MC3 (1 << 19) + +/* Status register */ + +#define TCC_STATUS_STOP (1 << 0) +#define TCC_STATUS_IDX (1 << 1) +#define TCC_STATUS_DFS (1 << 3) +#define TCC_STATUS_PATTBV (1 << 5) +#define TCC_STATUS_WAVEBV (1 << 6) +#define TCC_STATUS_PERBV (1 << 7) +#define TCC_STATUS_FAULTAIN (1 << 8) +#define TCC_STATUS_FAULTBIN (1 << 9) +#define TCC_STATUS_FAULT0IN (1 << 10) +#define TCC_STATUS_FAULT1IN (1 << 11) +#define TCC_STATUS_FAULTA (1 << 12) +#define TCC_STATUS_FAULTB (1 << 13) +#define TCC_STATUS_FAULT0 (1 << 14) +#define TCC_STATUS_FAULT1 (1 << 15) +#define TCC_STATUS_CCBV0 (1 << 16) +#define TCC_STATUS_CCBV1 (1 << 17) +#define TCC_STATUS_CCBV2 (1 << 18) +#define TCC_STATUS_CCBV3 (1 << 19) +#define TCC_STATUS_CMP0 (1 << 24) +#define TCC_STATUS_CMP1 (1 << 25) +#define TCC_STATUS_CMP2 (1 << 26) +#define TCC_STATUS_CMP3 (1 << 27) + +/* Waveform register */ + +#define TCC_WAVE_WAVEGEN_SHIFT (0) +#define TCC_WAVE_WAVEGEN_MASK (7 << TCC_WAVE_WAVEGEN_SHIFT) +# define TCC_WAVE_WAVEGEN_NFRQ (0 << TCC_WAVE_WAVEGEN_SHIFT) +# define TCC_WAVE_WAVEGEN_MFRQ (1 << TCC_WAVE_WAVEGEN_SHIFT) +# define TCC_WAVE_WAVEGEN_NPWM (2 << TCC_WAVE_WAVEGEN_SHIFT) +# define TCC_WAVE_WAVEGEN_DSCRITICAL (4 << TCC_WAVE_WAVEGEN_SHIFT) +# define TCC_WAVE_WAVEGEN_DSBOTTOM (5 << TCC_WAVE_WAVEGEN_SHIFT) +# define TCC_WAVE_WAVEGEN_DSBOTH (6 << TCC_WAVE_WAVEGEN_SHIFT) +# define TCC_WAVE_WAVEGEN_DSTOP (7 << TCC_WAVE_WAVEGEN_SHIFT) +#define TCC_WAVE_RAMP_SHIFT (4) +#define TCC_WAVE_RAMP_MASK (3 << TCC_WAVE_RAMP_SHIFT) +# define TCC_WAVE_RAMP_RAMP1 (0 << TCC_WAVE_RAMP_SHIFT) +# define TCC_WAVE_RAMP_RAMP2A (1 << TCC_WAVE_RAMP_SHIFT) +# define TCC_WAVE_RAMP_RAMP2 (2 << TCC_WAVE_RAMP_SHIFT) +#define TCC_WAVE_CIPEREN (1 << 7) +#define TCC_WAVE_CICCEN0 (1 << 8) +#define TCC_WAVE_CICCEN1 (1 << 9) +#define TCC_WAVE_CICCEN2 (1 << 10) +#define TCC_WAVE_CICCEN3 (1 << 11) +#define TCC_WAVE_POL0 (1 << 16) +#define TCC_WAVE_POL1 (1 << 17) +#define TCC_WAVE_POL2 (1 << 18) +#define TCC_WAVE_POL3 (1 << 19) +#define TCC_WAVE_SWAP0 (1 << 24) +#define TCC_WAVE_SWAP1 (1 << 25) +#define TCC_WAVE_SWAP2 (1 << 26) +#define TCC_WAVE_SWAP3 (1 << 27) + +/* Period, CCx, PERB, CCBx register */ + +#define TCC_DITHER_SHIFT (0) +#define TCC_DITHER_MASK (0x3f << TCC_PER_DITHER_SHIFT) +# define TCC_DITHER_NONE (0 << TCC_DITHER_SHIFT) +# define TCC_DITHER_DITH4 (1 << TCC_DITHER_SHIFT) +# define TCC_DITHER_DITH5 (2 << TCC_DITHER_SHIFT) +# define TCC_DITHER_DITH6 (3 << TCC_DITHER_SHIFT) +#define TCC_VALUE_SHIFT (6) +#define TCC_VALUE_MASK (0x3ff << TCC_VALUE_SHIFT) + +/******************************************************************************************** + * Public Types + ********************************************************************************************/ + +/******************************************************************************************** + * Public Data + ********************************************************************************************/ + +/******************************************************************************************** + * Public Functions + ********************************************************************************************/ + +#endif /* CONFIG_ARCH_FAMILY_SAMD21 */ +#endif /* __ARCH_ARM_SRC_SAMDL_CHIP_SAMD_TCC_H */ -- GitLab From 947191780f4f372bf9b7a6c514f91aa165c3a95b Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 30 Jan 2018 08:21:51 -0600 Subject: [PATCH 135/228] tools: Trivial. define _GNU_SOURCE to be 1, don't just define it. --- tools/initialconfig.c | 2 +- tools/kconfig2html.c | 2 +- tools/logparser.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/initialconfig.c b/tools/initialconfig.c index 8bbce57bac..d9024bcf8a 100644 --- a/tools/initialconfig.c +++ b/tools/initialconfig.c @@ -37,7 +37,7 @@ * Included Files ****************************************************************************/ -#define _GNU_SOURCE +#define _GNU_SOURCE 1 #include #include #include diff --git a/tools/kconfig2html.c b/tools/kconfig2html.c index fffa51b3e2..37b4330da4 100644 --- a/tools/kconfig2html.c +++ b/tools/kconfig2html.c @@ -37,7 +37,7 @@ * Included Files ****************************************************************************/ -#define _GNU_SOURCE +#define _GNU_SOURCE 1 #include #include #include diff --git a/tools/logparser.c b/tools/logparser.c index 39f038d329..fe9def44d8 100644 --- a/tools/logparser.c +++ b/tools/logparser.c @@ -37,7 +37,7 @@ * Included Files ****************************************************************************/ -#define _GNU_SOURCE +#define _GNU_SOURCE 1 #include #include #include -- GitLab From 170a50c6904dcc7701ca6e33af102fcd8ec7a899 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 30 Jan 2018 11:07:36 -0600 Subject: [PATCH 136/228] Squashed commit of the following: sched/sched: Correct some build issues introduced by last set of changes. sched/sched: Add new internal OS function nxsched_setaffinity() that is identical to sched_isetaffinity() except that it does not modify the errno value. All usage of sched_setaffinity() within the OS is replaced with nxsched_setaffinity(). sched/sched: Internal functions sched_reprioritize() and sched_setpriority() no longer movidify the errno value. Also renamed to nxsched_reprioritize() and sched_setpriority(). sched/sched: Add new internal OS function nxsched_getscheduler() that is identical to sched_getscheduler() except that it does not modify the errno value. All usage of sched_getscheduler() within the OS is replaced with nxsched_getscheduler(). sched/sched: Add new internal OS function nxsched_setparam() that is identical to sched_setparam() except that it does not modify the errno value. All usage of sched_setparam() within the OS is replaced with nxsched_setparam(). sched/sched: Add new internal OS function nxsched_getparam() that is identical to sched_getparam() except that it does not modify the errno value (actually, the previous value erroneously neglected to set the errno value to begin with, but this fixes both issues). All usage of sched_getparam() within the OS is replaced with nxsched_getparam(). --- TODO | 12 +- arch/arm/src/lc823450/lc823450_i2s.c | 5 +- binfmt/binfmt_loadmodule.c | 8 +- configs/lc823450-xgevk/src/lc823450_bringup.c | 4 +- configs/sim/src/sim_touchscreen.c | 7 +- fs/aio/aioc_contain.c | 5 +- include/nuttx/sched.h | 167 +++++++++++++++++- libc/spawn/lib_psa_init.c | 18 +- sched/paging/pg_miss.c | 4 +- sched/paging/pg_worker.c | 9 +- sched/pthread/pthread_create.c | 22 +-- sched/pthread/pthread_getschedparam.c | 31 ++-- sched/pthread/pthread_setaffinity.c | 19 +- sched/pthread/pthread_setschedprio.c | 24 +-- sched/sched/sched.h | 8 +- sched/sched/sched_getaffinity.c | 6 +- sched/sched/sched_getparam.c | 77 ++++++-- sched/sched/sched_getscheduler.c | 66 +++++-- sched/sched/sched_reprioritize.c | 18 +- sched/sched/sched_setaffinity.c | 78 +++++--- sched/sched/sched_setparam.c | 96 +++++++--- sched/sched/sched_setpriority.c | 16 +- sched/sched/sched_setscheduler.c | 23 ++- sched/sched/sched_sporadic.c | 16 +- sched/sched/sched_yield.c | 7 +- sched/semaphore/sem_holder.c | 13 +- sched/task/task_posixspawn.c | 11 +- sched/task/task_spawn.c | 15 +- sched/task/task_spawnparms.c | 24 ++- sched/wqueue/kwork_inherit.c | 12 +- 30 files changed, 590 insertions(+), 231 deletions(-) diff --git a/TODO b/TODO index b5ab5f89da..05108babcc 100644 --- a/TODO +++ b/TODO @@ -255,11 +255,13 @@ o Task/Scheduler (sched/) message queue used in the OS. I am keeping this issue open because (1) there are some known remaining calls that that will modify the errno (such as dup(), dup2(), - sched_getparam(), sched_reprioritize(). sched_setaffinity(), - task_activate(), mq_open(), mq_close(), and others) and (2) - there may still be calls that create cancellation points. - Need to check things like open(), close(), read(), write(), - and possibly others. + task_activate(), mq_open(), mq_close(), and others) and + (2) there may still be calls that create cancellation + points. Need to check things like open(), close(), read(), + write(), and possibly others. + 2018-01-30: This change has been completed for the case of + scheduler functions used within the OS: sched_getparam(), + sched_setparam(), sched_getscheduler(), and sched_setaffinity(), Status: Open Priority: Low. Things are working OK the way they are. But the design diff --git a/arch/arm/src/lc823450/lc823450_i2s.c b/arch/arm/src/lc823450/lc823450_i2s.c index fb9efa28df..e3ed25364d 100644 --- a/arch/arm/src/lc823450/lc823450_i2s.c +++ b/arch/arm/src/lc823450/lc823450_i2s.c @@ -45,6 +45,7 @@ #include #include +#include #include #include #include @@ -477,7 +478,7 @@ FAR struct i2s_dev_s *lc823450_i2sdev_initialize(void) /* Set the new affinity which assigns to CPU0 */ - sched_setaffinity(getpid(), sizeof(cpuset1), &cpuset1); + (void)nxsched_setaffinity(getpid(), sizeof(cpuset1), &cpuset1); nxsig_usleep(10 * 1000); #endif @@ -486,7 +487,7 @@ FAR struct i2s_dev_s *lc823450_i2sdev_initialize(void) #ifdef CONFIG_SMP /* Restore the original affinity */ - sched_setaffinity(getpid(), sizeof(cpuset0), &cpuset0); + (void)nxsched_setaffinity(getpid(), sizeof(cpuset0), &cpuset0); nxsig_usleep(10 * 1000); #endif diff --git a/binfmt/binfmt_loadmodule.c b/binfmt/binfmt_loadmodule.c index 375616203a..ea5def2acb 100644 --- a/binfmt/binfmt_loadmodule.c +++ b/binfmt/binfmt_loadmodule.c @@ -1,7 +1,7 @@ /**************************************************************************** * binfmt/binfmt_loadmodule.c * - * Copyright (C) 2009, 2014, 2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2009, 2014, 2017-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -43,6 +43,7 @@ #include #include +#include #include #include @@ -88,11 +89,10 @@ static int load_default_priority(FAR struct binary_s *bin) /* Get the priority of this thread */ - ret = sched_getparam(0, ¶m); + ret = nxsched_getparam(0, ¶m); if (ret < 0) { - ret = -get_errno(); - berr("ERROR: sched_getparam failed: %d\n", ret); + berr("ERROR: nxsched_getparam failed: %d\n", ret); return ret; } diff --git a/configs/lc823450-xgevk/src/lc823450_bringup.c b/configs/lc823450-xgevk/src/lc823450_bringup.c index 8b41c839fe..d80e5f0a02 100644 --- a/configs/lc823450-xgevk/src/lc823450_bringup.c +++ b/configs/lc823450-xgevk/src/lc823450_bringup.c @@ -49,6 +49,8 @@ # include #endif +#include + #ifdef CONFIG_RNDIS # include #endif @@ -132,7 +134,7 @@ int lc823450_bringup(void) /* NOTE: pid=4 is assumed to be lpwork */ - sched_setaffinity(4, sizeof(cpu_set_t), &cpuset); + (void)nxsched_setaffinity(4, sizeof(cpu_set_t), &cpuset); #endif /* If we got here then perhaps not all initialization was successful, but diff --git a/configs/sim/src/sim_touchscreen.c b/configs/sim/src/sim_touchscreen.c index c3b15a8e5d..c9e9a58f28 100644 --- a/configs/sim/src/sim_touchscreen.c +++ b/configs/sim/src/sim_touchscreen.c @@ -1,7 +1,7 @@ /**************************************************************************** * config/sim/src/sim_touchscreen.c * - * Copyright (C) 2011, 2016-2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2011, 2016-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -48,6 +48,7 @@ #include #include +#include #include #include #include @@ -171,10 +172,10 @@ int sim_tsc_setup(int minor) /* Set the client task priority */ param.sched_priority = CONFIG_SIM_CLIENTPRIO; - ret = sched_setparam(0, ¶m); + ret = nxsched_setparam(0, ¶m); if (ret < 0) { - gerr("ERROR: sched_setparam failed: %d\n" , ret); + gerr("ERROR: nxsched_setparam failed: %d\n" , ret); return ret; } diff --git a/fs/aio/aioc_contain.c b/fs/aio/aioc_contain.c index ac492abbc3..ee8f18a683 100644 --- a/fs/aio/aioc_contain.c +++ b/fs/aio/aioc_contain.c @@ -1,7 +1,7 @@ /**************************************************************************** * fs/aio/aioc_contain.c * - * Copyright (C) 2014, 2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2014, 2017-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -42,6 +42,7 @@ #include #include +#include #include #include @@ -139,7 +140,7 @@ FAR struct aio_container_s *aio_contain(FAR struct aiocb *aiocbp) aioc->aioc_pid = getpid(); #ifdef CONFIG_PRIORITY_INHERITANCE - DEBUGVERIFY(sched_getparam (aioc->aioc_pid, ¶m)); + DEBUGVERIFY(nxsched_getparam (aioc->aioc_pid, ¶m)); aioc->aioc_prio = param.sched_priority; #endif diff --git a/include/nuttx/sched.h b/include/nuttx/sched.h index 86046e4d71..c251059a8b 100644 --- a/include/nuttx/sched.h +++ b/include/nuttx/sched.h @@ -1,7 +1,7 @@ /******************************************************************************** * include/nuttx/sched.h * - * Copyright (C) 2007-2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -178,6 +178,34 @@ #define SPORADIC_FLAG_REPLENISH (1 << 2) /* Bit 2: Replenishment cycle */ /* Bits 3-7: Available */ +/* Most internal nxsched_* interfaces are not available in the user space in + * PROTECTED and KERNEL builds. In that context, the application semaphore + * interfaces must be used. The differences between the two sets of + * interfaces are: (1) the nxsched_* interfaces do not cause cancellation + * points and (2) they do not modify the errno variable. + * + * This is only important when compiling libraries (libc or libnx) that are + * used both by the OS (libkc.a and libknx.a) or by the applications + * (libuc.a and libunx.a). The that case, the correct interface must be + * used for the build context. + */ + +#if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__) +# define _SCHED_GETPARAM(t,p) nxsched_getparam(t,p) +# define _SCHED_SETPARAM(t,p) nxsched_setparam(t,p) +# define _SCHED_GETSCHEDULER(t) nxsched_getscheduler(t) +# define _SCHED_SETAFFINITY(t,c,m) nxsched_setaffinity(t,c,m) +# define _SCHED_ERRNO(r) (-(r)) +# define _SCHED_ERRVAL(r) (r) +#else +# define _SCHED_GETPARAM(t,p) sched_getparam(t,p) +# define _SCHED_SETPARAM(t,p) sched_setparam(t,p) +# define _SCHED_GETSCHEDULER(t) sched_getscheduler(t) +# define _SCHED_SETAFFINITY(t,c,m) sched_setaffinity(t,c,m) +# define _SCHED_ERRNO(r) errno +# define _SCHED_ERRVAL(r) (-errno) +#endif + /******************************************************************************** * Public Type Definitions ********************************************************************************/ @@ -879,6 +907,143 @@ void sched_suspend_scheduler(FAR struct tcb_s *tcb); # define sched_suspend_scheduler(tcb) #endif +/**************************************************************************** + * Name: nxsched_getparam + * + * Description: + * This function gets the scheduling priority of the task specified by + * pid. It is identical in function, differing only in its return value: + * This function does not modify the errno variable. + * + * This is a non-standard, internal OS function and is not intended for + * use by application logic. Applications should use the standard + * sched_getparam(). + * + * Inputs: + * pid - the task ID of the task. If pid is zero, the priority + * of the calling task is returned. + * param - A structure whose member sched_priority is the integer + * priority. The task's priority is copied to the sched_priority + * element of this structure. + * + * Return Value: + * 0 (OK) if successful, otherwise a negated errno value is returned to + * indicate the nature of the failure.. + * + * This function can fail if param is null (EINVAL) or if pid does + * not correspond to any task (ESRCH). + * + ****************************************************************************/ + +struct sched_param; /* Forward reference */ +int nxsched_getparam (pid_t pid, FAR struct sched_param *param); + +/**************************************************************************** + * Name: nxsched_setparam + * + * Description: + * This function sets the priority of a specified task. It is identical + * to the function sched_setparam(), differing only in its return value: + * This function does not modify the errno variable. + * + * NOTE: Setting a task's priority to the same value has a similar effect + * to sched_yield() -- The task will be moved to after all other tasks + * with the same priority. + * + * This is a non-standard, internal OS function and is not intended for + * use by application logic. Applications should use the standard + * sched_setparam(). + * + * Inputs: + * pid - the task ID of the task to reprioritize. If pid is zero, the + * priority of the calling task is changed. + * param - A structure whose member sched_priority is the integer priority. + * The range of valid priority numbers is from SCHED_PRIORITY_MIN + * through SCHED_PRIORITY_MAX. + * + * Return Value: + * 0 (OK) if successful, otherwise a negated errno value is returned to + * indicate the nature of the failure.. + * + * EINVAL The parameter 'param' is invalid or does not make sense for the + * current scheduling policy. + * EPERM The calling task does not have appropriate privileges. + * ESRCH The task whose ID is pid could not be found. + * + ****************************************************************************/ + +struct sched_param; /* Forward reference */ +int nxsched_setparam(pid_t pid, FAR const struct sched_param *param); + +/**************************************************************************** + * Name: nxsched_getscheduler + * + * Description: + * sched_getscheduler() returns the scheduling policy currently + * applied to the task identified by pid. If pid equals zero, the + * policy of the calling task will be retrieved. + * + * This functions is identical to the function sched_getscheduler(), + * differing only in its return value: This function does not modify + * the errno variable. + * + * This is a non-standard, internal OS function and is not intended for + * use by application logic. Applications should use the standard + * sched_getscheduler(). + * + * Inputs: + * pid - the task ID of the task to query. If pid is zero, the + * calling task is queried. + * + * Return Value: + * On success, sched_getscheduler() returns the policy for the task + * (either SCHED_FIFO or SCHED_RR). On error, a negated errno value + * returned: + * + * ESRCH The task whose ID is pid could not be found. + * + ****************************************************************************/ + +int nxsched_getscheduler(pid_t pid); + +/**************************************************************************** + * Name: nxsched_setaffinity + * + * Description: + * sched_setaffinity() sets the CPU affinity mask of the thread whose ID + * is pid to the value specified by mask. If pid is zero, then the + * calling thread is used. The argument cpusetsize is the length (i + * bytes) of the data pointed to by mask. Normally this argument would + * be specified as sizeof(cpu_set_t). + * + * If the thread specified by pid is not currently running on one of the + * CPUs specified in mask, then that thread is migrated to one of the + * CPUs specified in mask. + * + * nxsched_setaffinity() is identical to the function sched_setparam(), + * differing only in its return value: This function does not modify + * the errno variable. This is a non-standard, internal OS function and + * is not intended for use by application logic. Applications should + * use the standard sched_setparam(). + * + * Inputs: + * pid - The ID of thread whose affinity set will be modified. + * cpusetsize - Size of cpuset. MUST be sizeofcpu_set_t(). + * mask - The location to return the thread's new affinity set. + * + * Return Value: + * 0 if successful. Otherwise, ERROR (-1) is returned, and errno is + * set appropriately: + * + * ESRCH The task whose ID is pid could not be found. + * + ****************************************************************************/ + +#ifdef CONFIG_SMP +int nxsched_setaffinity(pid_t pid, size_t cpusetsize, + FAR const cpu_set_t *mask); +#endif + #undef EXTERN #if defined(__cplusplus) } diff --git a/libc/spawn/lib_psa_init.c b/libc/spawn/lib_psa_init.c index 4ee16ff626..64d58afc74 100644 --- a/libc/spawn/lib_psa_init.c +++ b/libc/spawn/lib_psa_init.c @@ -1,7 +1,7 @@ /**************************************************************************** * libc/string/lib_psa_init.c * - * Copyright (C) 2013-2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2013-2015, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -44,9 +44,7 @@ #include #include -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ +#include /**************************************************************************** * Public Functions @@ -82,17 +80,23 @@ int posix_spawnattr_init(posix_spawnattr_t *attr) /* Set the default priority to the same priority as this task */ - ret = sched_getparam(0, ¶m); + ret = _SCHED_GETPARAM(0, ¶m); if (ret < 0) { - return errno; + return _SCHED_ERRNO(ret); } attr->priority = param.sched_priority; /* Set the default scheduler policy to the policy of this task */ - attr->policy = sched_getscheduler(0); + ret = _SCHED_GETSCHEDULER(0); + if (ret < 0) + { + return _SCHED_ERRNO(ret); + } + + attr->policy = ret; #ifndef CONFIG_DISABLE_SIGNALS /* Empty signal mask */ diff --git a/sched/paging/pg_miss.c b/sched/paging/pg_miss.c index 6bec634e06..75beda6827 100644 --- a/sched/paging/pg_miss.c +++ b/sched/paging/pg_miss.c @@ -1,7 +1,7 @@ /**************************************************************************** * sched/paging/pg_miss.c * - * Copyright (C) 2010, 2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2010, 2017-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -162,7 +162,7 @@ void pg_miss(void) pginfo("New worker priority. %d->%d\n", wtcb->sched_priority, ftcb->sched_priority); - sched_setpriority(wtcb, ftcb->sched_priority); + (void)nxsched_setpriority(wtcb, ftcb->sched_priority); } /* Signal the page fill worker thread. diff --git a/sched/paging/pg_worker.c b/sched/paging/pg_worker.c index 1c8ee188a4..a2ded4c1ae 100644 --- a/sched/paging/pg_worker.c +++ b/sched/paging/pg_worker.c @@ -2,7 +2,7 @@ * sched/paging/pg_worker.c * Page fill worker thread implementation. * - * Copyright (C) 2010-2011, 2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2010-2011, 2017-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -48,6 +48,7 @@ #include #include +#include #include #include #include @@ -185,7 +186,7 @@ static void pg_callback(FAR struct tcb_s *tcb, int result) { pginfo("New worker priority. %d->%d\n", wtcb->sched_priority, priority); - sched_setpriority(wtcb, priority); + (void)nxsched_setpriority(wtcb, priority); } /* Save the page fill result (don't permit the value -EBUSY) */ @@ -296,7 +297,7 @@ static inline bool pg_dequeue(void) pginfo("New worker priority. %d->%d\n", wtcb->sched_priority, priority); - sched_setpriority(wtcb, priority); + (void)nxsched_setpriority(wtcb, priority); } /* Return with g_pftcb holding the pointer to @@ -458,7 +459,7 @@ static inline void pg_alldone(void) g_pftcb = NULL; pginfo("New worker priority. %d->%d\n", wtcb->sched_priority, CONFIG_PAGING_DEFPRIO); - sched_setpriority(wtcb, CONFIG_PAGING_DEFPRIO); + (void)nxsched_setpriority(wtcb, CONFIG_PAGING_DEFPRIO); } /**************************************************************************** diff --git a/sched/pthread/pthread_create.c b/sched/pthread/pthread_create.c index 54d5afec54..da612bb1a7 100644 --- a/sched/pthread/pthread_create.c +++ b/sched/pthread/pthread_create.c @@ -1,7 +1,8 @@ /**************************************************************************** * sched/pthread/pthread_create.c * - * Copyright (C) 2007-2009, 2011, 2013-2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011, 2013-2018 Gregory Nutt. All rights + * reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -49,6 +50,7 @@ #include #include +#include #include #include #include @@ -193,7 +195,7 @@ static void pthread_start(void) if (ptcb->cmn.sched_priority > ptcb->cmn.init_priority) { - DEBUGVERIFY(sched_setpriority(&ptcb->cmn, ptcb->cmn.init_priority)); + DEBUGVERIFY(nxsched_setpriority(&ptcb->cmn, ptcb->cmn.init_priority)); } /* Pass control to the thread entry point. In the kernel build this has to @@ -321,19 +323,19 @@ int pthread_create(FAR pthread_t *thread, FAR const pthread_attr_t *attr, * thread. */ - ret = sched_getparam(0, ¶m); - if (ret == ERROR) + ret = nxsched_getparam(0, ¶m); + if (ret < 0) { - errcode = get_errno(); + errcode = -ret; goto errout_with_join; } /* Get the scheduler policy for this thread */ - policy = sched_getscheduler(0); - if (policy == ERROR) + policy = nxsched_getscheduler(0); + if (policy < 0) { - errcode = get_errno(); + errcode = -policy; goto errout_with_join; } } @@ -547,10 +549,10 @@ int pthread_create(FAR pthread_t *thread, FAR const pthread_attr_t *attr, if (ptcb->cmn.sched_priority < parent->sched_priority) { - ret = sched_setpriority(&ptcb->cmn, parent->sched_priority); + ret = nxsched_setpriority(&ptcb->cmn, parent->sched_priority); if (ret < 0) { - ret = get_errno(); + ret = -ret; } } } diff --git a/sched/pthread/pthread_getschedparam.c b/sched/pthread/pthread_getschedparam.c index a71bc488cd..0167f172a1 100644 --- a/sched/pthread/pthread_getschedparam.c +++ b/sched/pthread/pthread_getschedparam.c @@ -1,7 +1,7 @@ /**************************************************************************** * sched/pthread/pthread_getschedparam.c * - * Copyright (C) 2007, 2008, 2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008, 2015, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -37,11 +37,16 @@ * Included Files ****************************************************************************/ +#include + #include #include #include #include #include + +#include + #include "pthread/pthread.h" /**************************************************************************** @@ -90,30 +95,34 @@ int pthread_getschedparam(pthread_t thread, FAR int *policy, sinfo("Thread ID=%d policy=0x%p param=0x%p\n", thread, policy, param); - if (!policy || !param) + if (policy == NULL || param == NULL) { ret = EINVAL; } else { - /* Get the schedparams of the thread. */ + /* Get the scheduler parameters of the thread. */ - ret = sched_getparam((pid_t)thread, param); - if (ret != OK) + ret = nxsched_getparam((pid_t)thread, param); + if (ret < 0) { - ret = EINVAL; + ret = -ret; } - /* Return the policy. */ + /* Get the scheduler policy. */ - *policy = sched_getscheduler((pid_t)thread); - if (*policy == ERROR) + ret = nxsched_getscheduler((pid_t)thread); + if (ret < 0) { - ret = get_errno(); + ret = -ret; + } + else + { + *policy = ret; + ret = OK; } } sinfo("Returning %d\n", ret); return ret; } - diff --git a/sched/pthread/pthread_setaffinity.c b/sched/pthread/pthread_setaffinity.c index cf8ccf639f..87f91e9be9 100644 --- a/sched/pthread/pthread_setaffinity.c +++ b/sched/pthread/pthread_setaffinity.c @@ -1,7 +1,7 @@ /**************************************************************************** * sched/pthread/pthread_setaffinity.c * - * Copyright (C) 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -45,6 +45,8 @@ #include #include +#include + #include "pthread/pthread.h" #ifdef CONFIG_SMP @@ -88,18 +90,11 @@ int pthread_setaffinity_np(pthread_t thread, size_t cpusetsize, DEBUGASSERT(thread > 0 && cpusetsize == sizeof(cpu_set_t) && cpuset != NULL); - /* Let sched_setaffinity do all of the work */ - - ret = sched_setaffinity((pid_t)thread, cpusetsize, cpuset); - if (ret < 0) - { - /* If sched_setaffinity() fails, return the errno */ + /* Let nxsched_setaffinity do all of the work, adjusting the return value */ - ret = get_errno(); - DEBUGASSERT(ret > 0); - } - - return ret; + ret = nxsched_setaffinity((pid_t)thread, cpusetsize, cpuset); + return ret < 0 ? -ret : OK; } #endif /* CONFIG_SMP */ + diff --git a/sched/pthread/pthread_setschedprio.c b/sched/pthread/pthread_setschedprio.c index cf31d9f013..e698d3bf29 100644 --- a/sched/pthread/pthread_setschedprio.c +++ b/sched/pthread/pthread_setschedprio.c @@ -1,7 +1,7 @@ /**************************************************************************** * sched/pthread/pthread_setschedprio.c * - * Copyright (C) 2007, 2009, 2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2009, 2015, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -38,10 +38,14 @@ ****************************************************************************/ #include + #include #include #include + +#include #include + #include "sched/sched.h" /**************************************************************************** @@ -83,25 +87,21 @@ int pthread_setschedprio(pthread_t thread, int prio) * modified. */ - ret = sched_getparam((pid_t)thread, ¶m); + ret = nxsched_getparam((pid_t)thread, ¶m); if (ret < 0) { - goto errout_with_errno; + return -ret; } #endif - /* Call sched_setparam() to change the priority */ + /* Call nxsched_setparam() to change the priority */ param.sched_priority = prio; - ret = sched_setparam((pid_t)thread, ¶m); - if (ret >= 0) + ret = nxsched_setparam((pid_t)thread, ¶m); + if (ret < 0) { - return OK; + return -ret; } -#ifdef CONFIG_SCHED_SPORADIC -errout_with_errno: -#endif - ret = get_errno(); - return ret; + return OK; } diff --git a/sched/sched/sched.h b/sched/sched/sched.h index d083dc6a59..3dbbeeac6a 100644 --- a/sched/sched/sched.h +++ b/sched/sched/sched.h @@ -380,15 +380,15 @@ void sched_mergeprioritized(FAR dq_queue_t *list1, FAR dq_queue_t *list2, bool sched_mergepending(void); void sched_addblocked(FAR struct tcb_s *btcb, tstate_t task_state); void sched_removeblocked(FAR struct tcb_s *btcb); -int sched_setpriority(FAR struct tcb_s *tcb, int sched_priority); +int nxsched_setpriority(FAR struct tcb_s *tcb, int sched_priority); /* Priority inheritance support */ #ifdef CONFIG_PRIORITY_INHERITANCE -int sched_reprioritize(FAR struct tcb_s *tcb, int sched_priority); +int nxsched_reprioritize(FAR struct tcb_s *tcb, int sched_priority); #else -# define sched_reprioritize(tcb,sched_priority) \ - sched_setpriority(tcb,sched_priority) +# define nxsched_reprioritize(tcb,sched_priority) \ + nxsched_setpriority(tcb,sched_priority) #endif /* Support for tickless operation */ diff --git a/sched/sched/sched_getaffinity.c b/sched/sched/sched_getaffinity.c index e7d355b50f..fb0814027c 100644 --- a/sched/sched/sched_getaffinity.c +++ b/sched/sched/sched_getaffinity.c @@ -1,7 +1,7 @@ /**************************************************************************** * sched/sched/sched_getaffinity.c * - * Copyright (C) 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -44,6 +44,8 @@ #include #include +#include + #include "sched/sched.h" /**************************************************************************** @@ -51,7 +53,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: sched_getscheduler + * Name: sched_getaffinity * * Description: * sched_getaffinity() writes the affinity mask of the thread whose ID diff --git a/sched/sched/sched_getparam.c b/sched/sched/sched_getparam.c index 72833d9471..e96c445164 100644 --- a/sched/sched/sched_getparam.c +++ b/sched/sched/sched_getparam.c @@ -1,7 +1,7 @@ /**************************************************************************** * sched/sched/sched_getparam.c * - * Copyright (C) 2007, 2009, 2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2009, 2015, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -41,6 +41,9 @@ #include #include +#include + +#include #include "clock/clock.h" #include "sched/sched.h" @@ -50,11 +53,16 @@ ****************************************************************************/ /**************************************************************************** - * Name: sched_getparam + * Name: nxsched_getparam * * Description: - * This function gets the scheduling priority of the task - * specified by pid. + * This function gets the scheduling priority of the task specified by + * pid. It is identical to the function sched_getparam(), differing only + * in its return value: This function does not modify the errno variable. + * + * This is a non-standard, internal OS function and is not intended for + * use by application logic. Applications should use the standard + * sched_getparam(). * * Inputs: * pid - the task ID of the task. If pid is zero, the priority @@ -64,49 +72,48 @@ * element of this structure. * * Return Value: - * 0 (OK) if successful, otherwise -1 (ERROR). - * - * This function can fail if param is null or if pid does - * not correspond to any task. + * 0 (OK) if successful, otherwise a negated errno value is returned to + * indicate the nature of the failure.. * - * Assumptions: + * This function can fail if param is null (EINVAL) or if pid does + * not correspond to any task (ESRCH). * ****************************************************************************/ -int sched_getparam (pid_t pid, FAR struct sched_param *param) +int nxsched_getparam (pid_t pid, FAR struct sched_param *param) { FAR struct tcb_s *rtcb; FAR struct tcb_s *tcb; int ret = OK; - if (!param) + if (param == NULL) { - return ERROR; + return -EINVAL; } /* Check if the task to restart is the calling task */ rtcb = this_task(); - if ((pid == 0) || (pid == rtcb->pid)) + if (pid == 0 || pid == rtcb->pid) { /* Return the priority if the calling task. */ param->sched_priority = (int)rtcb->sched_priority; } - /* Ths pid is not for the calling task, we will have to look it up */ + /* This PID is not for the calling task, we will have to look it up */ else { - /* Get the TCB associated with this pid */ + /* Get the TCB associated with this PID */ sched_lock(); tcb = sched_gettcb(pid); if (!tcb) { - /* This pid does not correspond to any known task */ + /* This PID does not correspond to any known task */ - ret = ERROR; + ret = -ESRCH; } else { @@ -150,3 +157,39 @@ int sched_getparam (pid_t pid, FAR struct sched_param *param) return ret; } +/**************************************************************************** + * Name: sched_getparam + * + * Description: + * This function gets the scheduling priority of the task specified by + * pid. This function is a simply wrapper around nxsched_getparam() that + * sets the errno value in the event of an error. + * + * Inputs: + * pid - the task ID of the task. If pid is zero, the priority + * of the calling task is returned. + * param - A structure whose member sched_priority is the integer + * priority. The task's priority is copied to the sched_priority + * element of this structure. + * + * Return Value: + * 0 (OK) if successful, otherwise -1 (ERROR) with the errno value set + * to indicate the nature of the problem. + * + * This function can fail if param is null (EINVAL) or if pid does + * not correspond to any task (ESRCH). + * + ****************************************************************************/ + +int sched_getparam (pid_t pid, FAR struct sched_param *param) +{ + int ret = nxsched_getparam(pid, param); + if (ret < 0) + { + set_errno(-ret); + ret = ERROR; + } + + return ret; +} + diff --git a/sched/sched/sched_getscheduler.c b/sched/sched/sched_getscheduler.c index 47ba73fa9c..1ca4cf64ed 100644 --- a/sched/sched/sched_getscheduler.c +++ b/sched/sched/sched_getscheduler.c @@ -1,7 +1,7 @@ /**************************************************************************** * sched/sched/sched_getscheduler.c * - * Copyright (C) 2007, 2009, 2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2009, 2015, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -43,6 +43,7 @@ #include #include +#include #include #include "sched/sched.h" @@ -52,36 +53,42 @@ ****************************************************************************/ /**************************************************************************** - * Name: sched_getscheduler + * Name: nxsched_getscheduler * * Description: * sched_getscheduler() returns the scheduling policy currently - * applied to the task identified by pid. If pid equals zero, the + * applied to the task identified by pid. If pid equals zero, the * policy of the calling task will be retrieved. * + * This functions is identical to the function sched_getscheduler(), + * differing only in its return value: This function does not modify + * the errno variable. + * + * This is a non-standard, internal OS function and is not intended for + * use by application logic. Applications should use the standard + * sched_getscheduler(). + * * Inputs: * pid - the task ID of the task to query. If pid is zero, the * calling task is queried. * * Return Value: * On success, sched_getscheduler() returns the policy for the task - * (either SCHED_FIFO or SCHED_RR). On error, ERROR (-1) is - * returned, and errno is set appropriately: + * (either SCHED_FIFO or SCHED_RR). On error, a negated errno value + * returned: * * ESRCH The task whose ID is pid could not be found. * - * Assumptions: - * ****************************************************************************/ -int sched_getscheduler(pid_t pid) +int nxsched_getscheduler(pid_t pid) { FAR struct tcb_s *tcb; int policy; /* Verify that the PID corresponds to a real task */ - if (!pid) + if (pid == 0) { tcb = this_task(); } @@ -90,10 +97,9 @@ int sched_getscheduler(pid_t pid) tcb = sched_gettcb(pid); } - if (!tcb) + if (tcb == NULL) { - set_errno(ESRCH); - return ERROR; + return -ESRCH; } /* Return the scheduling policy from the TCB. NOTE that the user- @@ -103,3 +109,39 @@ int sched_getscheduler(pid_t pid) policy = (tcb->flags & TCB_FLAG_POLICY_MASK) >> TCB_FLAG_POLICY_SHIFT; return policy + 1; } + +/**************************************************************************** + * Name: sched_getscheduler + * + * Description: + * sched_getscheduler() returns the scheduling policy currently + * applied to the task identified by pid. If pid equals zero, the + * policy of the calling task will be retrieved. + * + * sched_getscheduler() is a simply wrapper around nxsched_getscheduler() + * that sets the errno value in the event of an error. + * + * Inputs: + * pid - the task ID of the task to query. If pid is zero, the + * calling task is queried. + * + * Return Value: + * On success, sched_getscheduler() returns the policy for the task + * (either SCHED_FIFO or SCHED_RR). On error, ERROR (-1) is + * returned, and errno is set appropriately: + * + * ESRCH The task whose ID is pid could not be found. + * + ****************************************************************************/ + +int sched_getscheduler(pid_t pid) +{ + int ret = nxsched_getscheduler(pid); + if (ret < 0) + { + set_errno(-ret); + ret = ERROR; + } + + return ret; +} diff --git a/sched/sched/sched_reprioritize.c b/sched/sched/sched_reprioritize.c index d9431cf165..66112c3da0 100644 --- a/sched/sched/sched_reprioritize.c +++ b/sched/sched/sched_reprioritize.c @@ -1,7 +1,7 @@ /**************************************************************************** * sched/sched/sched_reprioritize.c * - * Copyright (C) 2009, 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2009, 2012, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -43,6 +43,8 @@ #include #include +#include + #include "sched/sched.h" #ifdef CONFIG_PRIORITY_INHERITANCE @@ -52,7 +54,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: sched_reprioritize + * Name: nxsched_reprioritize * * Description: * This function sets the priority of a specified task. @@ -66,26 +68,24 @@ * sched_priority - The new task priority * * Return Value: - * On success, sched_setparam() returns 0 (OK). On error, -1 - * (ERROR) is returned, and errno is set appropriately. + * On success, sched_reporioritize() returns 0 (OK). On error, a negated + * errno value is returned. * * EINVAL The parameter 'param' is invalid or does not make sense for the * current scheduling policy. * EPERM The calling task does not have appropriate privileges. * ESRCH The task whose ID is pid could not be found. * - * Assumptions: - * ****************************************************************************/ -int sched_reprioritize(FAR struct tcb_s *tcb, int sched_priority) +int nxsched_reprioritize(FAR struct tcb_s *tcb, int sched_priority) { - /* This function is equivalent to sched_setpriority() BUT it also has the + /* This function is equivalent to nxsched_setpriority() BUT it also has the * side effect of discarding all priority inheritance history. This is * done only on explicit, user-initiated reprioritization. */ - int ret = sched_setpriority(tcb, sched_priority); + int ret = nxsched_setpriority(tcb, sched_priority); if (ret == 0) { /* Reset the base_priority -- the priority that the thread would return diff --git a/sched/sched/sched_setaffinity.c b/sched/sched/sched_setaffinity.c index f7fb592812..150d5019af 100644 --- a/sched/sched/sched_setaffinity.c +++ b/sched/sched/sched_setaffinity.c @@ -1,7 +1,7 @@ /**************************************************************************** * sched/sched/sched_setaffinity.c * - * Copyright (C) 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -53,7 +53,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: sched_getscheduler + * Name: nxsched_setaffinity * * Description: * sched_setaffinity() sets the CPU affinity mask of the thread whose ID @@ -62,14 +62,20 @@ * bytes) of the data pointed to by mask. Normally this argument would * be specified as sizeof(cpu_set_t). * - * If the thread specified by pid is not currently running on one of the - * CPUs specified in mask, then that thread is migrated to one of the + * If the thread specified by pid is not currently running on one of the + * CPUs specified in mask, then that thread is migrated to one of the * CPUs specified in mask. * + * nxsched_setaffinity() is identical to the function sched_setparam(), + * differing only in its return value: This function does not modify + * the errno variable. This is a non-standard, internal OS function and + * is not intended for use by application logic. Applications should + * use the standard sched_setparam(). + * * Inputs: * pid - The ID of thread whose affinity set will be modified. * cpusetsize - Size of cpuset. MUST be sizeofcpu_set_t(). - * cpuset - The location to return the thread's new affinity set. + * mask - The location to return the thread's new affinity set. * * Return Value: * 0 if successful. Otherwise, ERROR (-1) is returned, and errno is @@ -79,12 +85,12 @@ * ****************************************************************************/ -int sched_setaffinity(pid_t pid, size_t cpusetsize, FAR const cpu_set_t *mask) +int nxsched_setaffinity(pid_t pid, size_t cpusetsize, + FAR const cpu_set_t *mask) { FAR struct tcb_s *tcb; irqstate_t flags; - int errcode = 0; - int ret; + int ret = OK; DEBUGASSERT(cpusetsize == sizeof(cpu_set_t) && mask != NULL); @@ -102,7 +108,7 @@ int sched_setaffinity(pid_t pid, size_t cpusetsize, FAR const cpu_set_t *mask) if (tcb == NULL) { - errcode = ESRCH; + ret = -ESRCH; goto errout_with_lock; } @@ -113,7 +119,7 @@ int sched_setaffinity(pid_t pid, size_t cpusetsize, FAR const cpu_set_t *mask) flags = enter_critical_section(); if ((tcb->flags & TCB_FLAG_CPU_LOCKED) != 0) { - errcode = EINVAL; + ret = -EINVAL; goto errout_with_csection; } @@ -140,17 +146,13 @@ int sched_setaffinity(pid_t pid, size_t cpusetsize, FAR const cpu_set_t *mask) /* No.. then we will need to move the task from the assigned * task list to some other ready to run list. * - * sched_setpriority() will do just what we want... it will remove + * nxsched_setpriority() will do just what we want... it will remove * the task from its current position in the some assigned task list * and then simply put it back in the right place. This works even * if the task is this task. */ - ret = sched_setpriority(tcb, tcb->sched_priority); - if (ret < 0) - { - errcode = get_errno(); - } + ret = nxsched_setpriority(tcb, tcb->sched_priority); } } @@ -159,11 +161,47 @@ errout_with_csection: errout_with_lock: sched_unlock(); - if (errcode != 0) + return ret; +} + +/**************************************************************************** + * Name: sched_setaffinity + * + * Description: + * sched_setaffinity() sets the CPU affinity mask of the thread whose ID + * is pid to the value specified by mask. If pid is zero, then the + * calling thread is used. The argument cpusetsize is the length (i + * bytes) of the data pointed to by mask. Normally this argument would + * be specified as sizeof(cpu_set_t). + * + * If the thread specified by pid is not currently running on one of the + * CPUs specified in mask, then that thread is migrated to one of the + * CPUs specified in mask. + * + * This function is a simply wrapper around nxsched_setaffinity() that sets + * the errno value in the event of an error. + * + * Inputs: + * pid - The ID of thread whose affinity set will be modified. + * cpusetsize - Size of cpuset. MUST be sizeofcpu_set_t(). + * mask - The location to return the thread's new affinity set. + * + * Return Value: + * 0 if successful. Otherwise, ERROR (-1) is returned, and errno is + * set appropriately: + * + * ESRCH The task whose ID is pid could not be found. + * + ****************************************************************************/ + +int sched_setaffinity(pid_t pid, size_t cpusetsize, FAR const cpu_set_t *mask) +{ + int ret = nxsched_setaffinity(pid, cpusetsize, mask); + if (ret < 0) { - set_errno(errcode); - return ERROR; + set_errno(-ret); + ret = ERROR; } - return OK; + return ret; } diff --git a/sched/sched/sched_setparam.c b/sched/sched/sched_setparam.c index 93bfccfe43..33307f1575 100644 --- a/sched/sched/sched_setparam.c +++ b/sched/sched/sched_setparam.c @@ -1,7 +1,8 @@ /**************************************************************************** * sched/sched/sched_setparam.c * - * Copyright (C) 2007, 2009, 2013, 2015-2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2009, 2013, 2015-2016, 2018 Gregory Nutt. All + * rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -44,6 +45,7 @@ #include #include +#include #include #include @@ -55,15 +57,21 @@ ****************************************************************************/ /**************************************************************************** - * Name: sched_setparam + * Name: nxsched_setparam * * Description: - * This function sets the priority of a specified task. + * This function sets the priority of a specified task. It is identical + * to the function sched_setparam(), differing only in its return value: + * This function does not modify the errno variable. * * NOTE: Setting a task's priority to the same value has a similar effect * to sched_yield() -- The task will be moved to after all other tasks * with the same priority. * + * This is a non-standard, internal OS function and is not intended for + * use by application logic. Applications should use the standard + * sched_setparam(). + * * Inputs: * pid - the task ID of the task to reprioritize. If pid is zero, the * priority of the calling task is changed. @@ -72,31 +80,27 @@ * through SCHED_PRIORITY_MAX. * * Return Value: - * On success, sched_setparam() returns 0 (OK). On error, -1 (ERROR) is - * returned, and errno is set appropriately. + * 0 (OK) if successful, otherwise a negated errno value is returned to + * indicate the nature of the failure.. * - * EINVAL The parameter 'param' is invalid or does not make sense for the - * current scheduling policy. - * EPERM The calling task does not have appropriate privileges. - * ESRCH The task whose ID is pid could not be found. - * - * Assumptions: + * EINVAL The parameter 'param' is invalid or does not make sense for the + * current scheduling policy. + * EPERM The calling task does not have appropriate privileges. + * ESRCH The task whose ID is pid could not be found. * ****************************************************************************/ -int sched_setparam(pid_t pid, FAR const struct sched_param *param) +int nxsched_setparam(pid_t pid, FAR const struct sched_param *param) { FAR struct tcb_s *rtcb; FAR struct tcb_s *tcb; - int errcode; int ret; /* Verify that the requested priority is in the valid range */ - if (!param) + if (param == NULL) { - errcode = EINVAL; - goto errout_with_errcode; + return -EINVAL; } /* Prohibit modifications to the head of the ready-to-run task @@ -122,7 +126,7 @@ int sched_setparam(pid_t pid, FAR const struct sched_param *param) { /* No task with this PID was found */ - errcode = ESRCH; + ret = -ESRCH; goto errout_with_lock; } } @@ -140,7 +144,7 @@ int sched_setparam(pid_t pid, FAR const struct sched_param *param) if (param->sched_ss_max_repl < 1 || param->sched_ss_max_repl > CONFIG_SCHED_SPORADIC_MAXREPL) { - errcode = EINVAL; + ret = -EINVAL; goto errout_with_lock; } @@ -174,7 +178,7 @@ int sched_setparam(pid_t pid, FAR const struct sched_param *param) if (repl_ticks < budget_ticks) #endif { - errcode = EINVAL; + ret = -EINVAL; goto errout_with_lock; } @@ -209,7 +213,6 @@ int sched_setparam(pid_t pid, FAR const struct sched_param *param) leave_critical_section(flags); if (ret < 0) { - errcode = -ret; goto errout_with_lock; } } @@ -217,16 +220,53 @@ int sched_setparam(pid_t pid, FAR const struct sched_param *param) /* Then perform the reprioritization */ - ret = sched_reprioritize(tcb, param->sched_priority); - sched_unlock(); - return ret; + ret = nxsched_reprioritize(tcb, param->sched_priority); errout_with_lock: - set_errno(errcode); sched_unlock(); - return ERROR; + return ret; +} + +/**************************************************************************** + * Name: sched_setparam + * + * Description: + * This function sets the priority of a specified task. This function is + * a simply wrapper around nxsched_setparam() that sets the errno value in + * the event of an error. + * + * NOTE: Setting a task's priority to the same value has a similar effect + * to sched_yield() -- The task will be moved to after all other tasks + * with the same priority. + * + * Inputs: + * pid - the task ID of the task to reprioritize. If pid is zero, the + * priority of the calling task is changed. + * param - A structure whose member sched_priority is the integer priority. + * The range of valid priority numbers is from SCHED_PRIORITY_MIN + * through SCHED_PRIORITY_MAX. + * + * Return Value: + * On success, sched_setparam() returns 0 (OK). On error, -1 (ERROR) is + * returned, and errno is set appropriately. + * + * EINVAL The parameter 'param' is invalid or does not make sense for the + * current scheduling policy. + * EPERM The calling task does not have appropriate privileges. + * ESRCH The task whose ID is pid could not be found. + * + * Assumptions: + * + ****************************************************************************/ -errout_with_errcode: - set_errno(errcode); - return ERROR; +int sched_setparam(pid_t pid, FAR const struct sched_param *param) +{ + int ret = nxsched_setparam(pid, param); + if (ret < 0) + { + set_errno(-ret); + ret = ERROR; + } + + return ret; } diff --git a/sched/sched/sched_setpriority.c b/sched/sched/sched_setpriority.c index abad51b801..1e8cbd41bf 100644 --- a/sched/sched/sched_setpriority.c +++ b/sched/sched/sched_setpriority.c @@ -1,7 +1,7 @@ /**************************************************************************** * sched/sched/sched_setpriority.c * - * Copyright (C) 2009, 2013, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2009, 2013, 2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -315,7 +315,7 @@ static inline void sched_blocked_setpriority(FAR struct tcb_s *tcb, ****************************************************************************/ /**************************************************************************** - * Name: sched_setpriority + * Name: nxsched_setpriority * * Description: * This function sets the priority of a specified task. @@ -329,19 +329,17 @@ static inline void sched_blocked_setpriority(FAR struct tcb_s *tcb, * sched_priority - The new task priority * * Return Value: - * On success, sched_setparam() returns 0 (OK). On error, -1 (ERROR) is - * returned, and errno is set appropriately. + * On success, nxsched_setpriority() returns 0 (OK). On error, a negated + * errno value is returned. * * EINVAL The parameter 'param' is invalid or does not make sense for the * current scheduling policy. * EPERM The calling task does not have appropriate privileges. * ESRCH The task whose ID is pid could not be found. * - * Assumptions: - * ****************************************************************************/ -int sched_setpriority(FAR struct tcb_s *tcb, int sched_priority) +int nxsched_setpriority(FAR struct tcb_s *tcb, int sched_priority) { irqstate_t flags; @@ -350,8 +348,7 @@ int sched_setpriority(FAR struct tcb_s *tcb, int sched_priority) if (sched_priority < SCHED_PRIORITY_MIN || sched_priority > SCHED_PRIORITY_MAX) { - set_errno(EINVAL); - return ERROR; + return -EINVAL; } /* We need to assure that there there is no interrupt activity while @@ -383,7 +380,6 @@ int sched_setpriority(FAR struct tcb_s *tcb, int sched_priority) sched_readytorun_setpriority(tcb, sched_priority); break; - /* CASE 3. The task is not in the ready to run list. Changing its * Priority cannot effect the currently executing task. */ diff --git a/sched/sched/sched_setscheduler.c b/sched/sched/sched_setscheduler.c index fecd1cf426..6bee58f97e 100644 --- a/sched/sched/sched_setscheduler.c +++ b/sched/sched/sched_setscheduler.c @@ -1,7 +1,8 @@ /**************************************************************************** * sched/sched/sched_setscheduler.c * - * Copyright (C) 2007, 2009, 2012, 2015-2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2009, 2012, 2015-2016, 2018 Gregory Nutt. All + * rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -56,7 +57,7 @@ ****************************************************************************/ /**************************************************************************** - * Name:sched_setscheduler + * Name: sched_setscheduler * * Description: * sched_setscheduler() sets both the scheduling policy and the priority @@ -88,9 +89,7 @@ int sched_setscheduler(pid_t pid, int policy, { FAR struct tcb_s *tcb; irqstate_t flags; -#ifdef CONFIG_SCHED_SPORADIC int errcode; -#endif int ret; /* Check for supported scheduling policy */ @@ -278,15 +277,23 @@ int sched_setscheduler(pid_t pid, int policy, /* Set the new priority */ - ret = sched_reprioritize(tcb, param->sched_priority); + ret = nxsched_reprioritize(tcb, param->sched_priority); + if (ret < 0) + { + errcode = -ret; + goto errout_with_lock; + } + sched_unlock(); - return (ret >= 0) ? OK : ERROR; + return OK; #ifdef CONFIG_SCHED_SPORADIC errout_with_irq: - set_errno(errcode); leave_critical_section(flags); +#endif + +errout_with_lock: + set_errno(errcode); sched_unlock(); return ERROR; -#endif } diff --git a/sched/sched/sched_sporadic.c b/sched/sched/sched_sporadic.c index 90206c486e..83349097ed 100644 --- a/sched/sched/sched_sporadic.c +++ b/sched/sched/sched_sporadic.c @@ -1,7 +1,7 @@ /**************************************************************************** * sched/sched/sched_sporadic.c * - * Copyright (C) 2015-2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2015-2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -159,12 +159,11 @@ static int sporadic_set_lowpriority(FAR struct tcb_s *tcb) * switch. */ - ret = sched_reprioritize(tcb, sporadic->low_priority); + ret = nxsched_reprioritize(tcb, sporadic->low_priority); if (ret < 0) { - int errcode = get_errno(); - serr("ERROR: sched_reprioritize failed: %d\n", errcode); - return -errcode; + serr("ERROR: nxsched_reprioritize failed: %d\n", ret); + return ret; } } @@ -239,12 +238,11 @@ static int sporadic_set_hipriority(FAR struct tcb_s *tcb) /* Then reprioritize to the higher priority */ - ret = sched_reprioritize(tcb, sporadic->hi_priority); + ret = nxsched_reprioritize(tcb, sporadic->hi_priority); if (ret < 0) { - int errcode = get_errno(); - serr("ERROR: sched_reprioritize failed: %d\n", errcode); - return -errcode; + serr("ERROR: nxsched_reprioritize failed: %d\n", ret); + return ret; } return OK; diff --git a/sched/sched/sched_yield.c b/sched/sched/sched_yield.c index c55a925dac..e9e62920f9 100644 --- a/sched/sched/sched_yield.c +++ b/sched/sched/sched_yield.c @@ -1,7 +1,7 @@ /**************************************************************************** * sched/sched/sched_yield.c * - * Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2009, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -67,11 +67,14 @@ int sched_yield(void) { FAR struct tcb_s *rtcb = this_task(); + int ret; /* This equivalent to just resetting the task priority to its current value * since this will cause the task to be rescheduled behind any other tasks * at the same priority. */ - return sched_setpriority(rtcb, rtcb->sched_priority); + ret = nxsched_setpriority(rtcb, rtcb->sched_priority); + return ret < 0 ? ERROR : OK; } + diff --git a/sched/semaphore/sem_holder.c b/sched/semaphore/sem_holder.c index 860032fb17..3080c3080f 100644 --- a/sched/semaphore/sem_holder.c +++ b/sched/semaphore/sem_holder.c @@ -1,7 +1,8 @@ /**************************************************************************** * sched/semaphore/sem_holder.c * - * Copyright (C) 2009-2011, 2013, 2016-2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2009-2011, 2013, 2016-2018 Gregory Nutt. All rights + * reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -387,7 +388,7 @@ static int nxsem_boostholderprio(FAR struct semholder_s *pholder, * switch may occur during up_block_task() processing. */ - (void)sched_setpriority(htcb, rtcb->sched_priority); + (void)nxsched_setpriority(htcb, rtcb->sched_priority); } else { @@ -425,7 +426,7 @@ static int nxsem_boostholderprio(FAR struct semholder_s *pholder, * will occur during up_block_task() processing. */ - (void)sched_setpriority(htcb, rtcb->sched_priority); + (void)nxsched_setpriority(htcb, rtcb->sched_priority); } #endif @@ -535,7 +536,7 @@ static int nxsem_restoreholderprio(FAR struct tcb_s *htcb, /* Reset the holder's priority back to the base priority. */ - sched_reprioritize(htcb, htcb->base_priority); + (void)nxsched_reprioritize(htcb, htcb->base_priority); } /* There are multiple pending priority levels. The holder thread's @@ -577,7 +578,7 @@ static int nxsem_restoreholderprio(FAR struct tcb_s *htcb, * base_priority) */ - sched_setpriority(htcb, rpriority); + nxsched_setpriority(htcb, rpriority); } else { @@ -617,7 +618,7 @@ static int nxsem_restoreholderprio(FAR struct tcb_s *htcb, * priority. */ - sched_reprioritize(htcb, htcb->base_priority); + (void)nxsched_reprioritize(htcb, htcb->base_priority); #endif } diff --git a/sched/task/task_posixspawn.c b/sched/task/task_posixspawn.c index 0792101884..050b800a2a 100644 --- a/sched/task/task_posixspawn.c +++ b/sched/task/task_posixspawn.c @@ -1,7 +1,7 @@ /**************************************************************************** * sched/task/task_posixspawn.c * - * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2013, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -43,6 +43,7 @@ #include #include +#include #include #include #include @@ -391,14 +392,12 @@ int posix_spawn(FAR pid_t *pid, FAR const char *path, /* Get the priority of this (parent) task */ - ret = sched_getparam(0, ¶m); + ret = nxsched_getparam(0, ¶m); if (ret < 0) { - int errcode = get_errno(); - - serr("ERROR: sched_getparam failed: %d\n", errcode); + serr("ERROR: nxsched_getparam failed: %d\n", ret); spawn_semgive(&g_spawn_parmsem); - return errcode; + return -ret; } /* Disable pre-emption so that the proxy does not run until waitpid diff --git a/sched/task/task_spawn.c b/sched/task/task_spawn.c index 852585d8c8..e22193c537 100644 --- a/sched/task/task_spawn.c +++ b/sched/task/task_spawn.c @@ -1,7 +1,7 @@ /**************************************************************************** * sched/task/task_spawn.c * - * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2013, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -44,6 +44,8 @@ #include #include +#include + #include "sched/sched.h" #include "group/group.h" #include "task/spawn.h" @@ -123,9 +125,10 @@ static int task_spawn_exec(FAR pid_t *pidp, FAR const char *name, /* Set the default priority to the same priority as this task */ - ret = sched_getparam(0, ¶m); + ret = nxsched_getparam(0, ¶m); if (ret < 0) { + ret = -ret; goto errout; } @@ -378,14 +381,12 @@ int task_spawn(FAR pid_t *pid, FAR const char *name, main_t entry, /* Get the priority of this (parent) task */ - ret = sched_getparam(0, ¶m); + ret = nxsched_getparam(0, ¶m); if (ret < 0) { - int errcode = get_errno(); - - serr("ERROR: sched_getparam failed: %d\n", errcode); + serr("ERROR: nxsched_getparam failed: %d\n", ret); spawn_semgive(&g_spawn_parmsem); - return errcode; + return -ret; } /* Disable pre-emption so that the proxy does not run until waitpid diff --git a/sched/task/task_spawnparms.c b/sched/task/task_spawnparms.c index 1a9e5f79fc..53c9877747 100644 --- a/sched/task/task_spawnparms.c +++ b/sched/task/task_spawnparms.c @@ -1,7 +1,7 @@ /**************************************************************************** * sched/task/task_spawnparms.c * - * Copyright (C) 2013, 2015, 2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2013, 2015, 2017-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -194,7 +194,7 @@ void spawn_semtake(FAR sem_t *sem) * attr - The attributes to use * * Returned Value: - * Errors are not reported by this function. This is because errors + * Errors are not reported by this function. This is not because errors * cannot occur, but rather that the new task has already been started * so there is no graceful way to handle errors detected in this context * (unless we delete the new task and recover). @@ -208,6 +208,7 @@ void spawn_semtake(FAR sem_t *sem) int spawn_execattrs(pid_t pid, FAR const posix_spawnattr_t *attr) { struct sched_param param; + int ret; DEBUGASSERT(attr); @@ -223,17 +224,14 @@ int spawn_execattrs(pid_t pid, FAR const posix_spawnattr_t *attr) if ((attr->flags & POSIX_SPAWN_SETSCHEDPARAM) != 0) { #ifdef CONFIG_SCHED_SPORADIC - int ret; - /* Get the current sporadic scheduling parameters. Those will not be * modified. */ - ret = sched_getparam(pid, ¶m); + ret = nxsched_getparam(pid, ¶m); if (ret < 0) { - int errcode = get_errno(); - return -errcode; + return ret; } #endif @@ -250,7 +248,11 @@ int spawn_execattrs(pid_t pid, FAR const posix_spawnattr_t *attr) sinfo("Setting priority=%d for pid=%d\n", param.sched_priority, pid); - (void)sched_setparam(pid, ¶m); + ret = nxsched_setparam(pid, ¶m); + if (ret < 0) + { + return ret; + } } } @@ -261,7 +263,11 @@ int spawn_execattrs(pid_t pid, FAR const posix_spawnattr_t *attr) else if ((attr->flags & POSIX_SPAWN_SETSCHEDULER) != 0) { - (void)sched_getparam(0, ¶m); + ret = nxsched_getparam(0, ¶m); + if (ret < 0) + { + return ret; + } } /* Are we setting the scheduling policy? If so, use the priority diff --git a/sched/wqueue/kwork_inherit.c b/sched/wqueue/kwork_inherit.c index 31c23b258b..c648c4b4ed 100644 --- a/sched/wqueue/kwork_inherit.c +++ b/sched/wqueue/kwork_inherit.c @@ -1,7 +1,7 @@ /**************************************************************************** * sched/work/work_inherit.c * - * Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2014, 2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -123,7 +123,7 @@ static void lpwork_boostworker(pid_t wpid, uint8_t reqprio) * sched_unblock() processing. */ - (void)sched_setpriority(wtcb, reqprio); + (void)nxsched_setpriority(wtcb, reqprio); } else { @@ -160,7 +160,7 @@ static void lpwork_boostworker(pid_t wpid, uint8_t reqprio) * sched_unlock() processing. */ - (void)sched_setpriority(wtcb, reqprio); + (void)nxsched_setpriority(wtcb, reqprio); } #endif } @@ -223,7 +223,7 @@ static void lpwork_restoreworker(pid_t wpid, uint8_t reqprio) /* Reset the worker's priority back to the base priority. */ - sched_reprioritize(wtcb, wtcb->base_priority); + (void)nxsched_reprioritize(wtcb, wtcb->base_priority); } /* There are multiple pending priority levels. The worker thread's @@ -264,7 +264,7 @@ static void lpwork_restoreworker(pid_t wpid, uint8_t reqprio) * base_priority) */ - sched_setpriority(wtcb, wpriority); + nxsched_setpriority(wtcb, wpriority); } else { @@ -304,7 +304,7 @@ static void lpwork_restoreworker(pid_t wpid, uint8_t reqprio) * priority. */ - sched_reprioritize(wtcb, wtcb->base_priority); + (void)nxsched_reprioritize(wtcb, wtcb->base_priority); #endif } } -- GitLab From 82982f797249d4f081c4798abcde732c46f0525f Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 30 Jan 2018 16:16:41 -0600 Subject: [PATCH 137/228] sched/: Fix several inappropriate accesses to get_errno() that were missed in previous changes (some going back to nuttx-.23). Add new nxsched_setscheduler() and nxsched_getaffinity() which are equivalent to their counterparts without the nx on front. These versions do not modify the errno value. Changed all calls within the OS to use these newer versions of the functions. --- TODO | 14 ++-- arch/arm/src/lc823450/lc823450_i2s.c | 2 +- include/nuttx/sched.h | 107 ++++++++++++++++++++---- sched/pthread/pthread_create.c | 2 +- sched/pthread/pthread_getaffinity.c | 13 +-- sched/pthread/pthread_initialize.c | 13 ++- sched/pthread/pthread_mutexconsistent.c | 9 +- sched/pthread/pthread_mutexinit.c | 8 +- sched/pthread/pthread_setschedparam.c | 16 ++-- sched/sched/sched.h | 4 +- sched/sched/sched_getaffinity.c | 78 +++++++++++++---- sched/sched/sched_getparam.c | 1 - sched/sched/sched_setaffinity.c | 15 ++-- sched/sched/sched_setscheduler.c | 95 ++++++++++++++------- sched/task/task_spawnparms.c | 6 +- 15 files changed, 276 insertions(+), 107 deletions(-) diff --git a/TODO b/TODO index 05108babcc..320e8c69b4 100644 --- a/TODO +++ b/TODO @@ -170,6 +170,9 @@ o Task/Scheduler (sched/) to make this change: Just move the pterrno field from struct tcb_s to struct task_group_s. However, I am still not sure if this should be done or not. + NOTE: glibc behaves this way unless __thread is defined then, + in that case, it behaves like NuttX (using TLS to save the + thread local errno). Status: Closed. The existing solution is better (although its incompatibilities could show up in porting some code). Priority: Low @@ -255,13 +258,14 @@ o Task/Scheduler (sched/) message queue used in the OS. I am keeping this issue open because (1) there are some known remaining calls that that will modify the errno (such as dup(), dup2(), - task_activate(), mq_open(), mq_close(), and others) and - (2) there may still be calls that create cancellation - points. Need to check things like open(), close(), read(), - write(), and possibly others. + task_create(), task_activate(), kthread_create(), exec(), mq_open(), + mq_close(), and others) and (2) there may still be calls that + create cancellation points. Need to check things like open(), + close(), read(), write(), and possibly others. 2018-01-30: This change has been completed for the case of scheduler functions used within the OS: sched_getparam(), - sched_setparam(), sched_getscheduler(), and sched_setaffinity(), + sched_setparam(), sched_getscheduler(), sched_setschedule(), + and sched_setaffinity(), Status: Open Priority: Low. Things are working OK the way they are. But the design diff --git a/arch/arm/src/lc823450/lc823450_i2s.c b/arch/arm/src/lc823450/lc823450_i2s.c index e3ed25364d..2b993d6a1c 100644 --- a/arch/arm/src/lc823450/lc823450_i2s.c +++ b/arch/arm/src/lc823450/lc823450_i2s.c @@ -474,7 +474,7 @@ FAR struct i2s_dev_s *lc823450_i2sdev_initialize(void) /* Backup the current affinity */ - sched_getaffinity(getpid(), sizeof(cpuset0), &cpuset0); + (void)nxsched_getaffinity(getpid(), sizeof(cpuset0), &cpuset0); /* Set the new affinity which assigns to CPU0 */ diff --git a/include/nuttx/sched.h b/include/nuttx/sched.h index c251059a8b..10cbcbefc8 100644 --- a/include/nuttx/sched.h +++ b/include/nuttx/sched.h @@ -191,19 +191,23 @@ */ #if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__) -# define _SCHED_GETPARAM(t,p) nxsched_getparam(t,p) -# define _SCHED_SETPARAM(t,p) nxsched_setparam(t,p) -# define _SCHED_GETSCHEDULER(t) nxsched_getscheduler(t) -# define _SCHED_SETAFFINITY(t,c,m) nxsched_setaffinity(t,c,m) -# define _SCHED_ERRNO(r) (-(r)) -# define _SCHED_ERRVAL(r) (r) +# define _SCHED_GETPARAM(t,p) nxsched_getparam(t,p) +# define _SCHED_SETPARAM(t,p) nxsched_setparam(t,p) +# define _SCHED_GETSCHEDULER(t) nxsched_getscheduler(t) +# define _SCHED_SETSCHEDULER(t,s,p) nxsched_setscheduler(t,s,p) +# define _SCHED_GETAFFINITY(t,c,m) nxsched_getaffinity(t,c,m) +# define _SCHED_SETAFFINITY(t,c,m) nxsched_setaffinity(t,c,m) +# define _SCHED_ERRNO(r) (-(r)) +# define _SCHED_ERRVAL(r) (r) #else -# define _SCHED_GETPARAM(t,p) sched_getparam(t,p) -# define _SCHED_SETPARAM(t,p) sched_setparam(t,p) -# define _SCHED_GETSCHEDULER(t) sched_getscheduler(t) -# define _SCHED_SETAFFINITY(t,c,m) sched_setaffinity(t,c,m) -# define _SCHED_ERRNO(r) errno -# define _SCHED_ERRVAL(r) (-errno) +# define _SCHED_GETPARAM(t,p) sched_getparam(t,p) +# define _SCHED_SETPARAM(t,p) sched_setparam(t,p) +# define _SCHED_GETSCHEDULER(t) sched_getscheduler(t) +# define _SCHED_SETSCHEDULER(t,s,p) sched_setscheduler(t,s,p) +# define _SCHED_GETAFFINITY(t,c,m) sched_getaffinity(t,c,m) +# define _SCHED_SETAFFINITY(t,c,m) sched_setaffinity(t,c,m) +# define _SCHED_ERRNO(r) errno +# define _SCHED_ERRVAL(r) (-errno) #endif /******************************************************************************** @@ -1006,6 +1010,76 @@ int nxsched_setparam(pid_t pid, FAR const struct sched_param *param); int nxsched_getscheduler(pid_t pid); +/**************************************************************************** + * Name: nxsched_setscheduler + * + * Description: + * nxsched_setscheduler() sets both the scheduling policy and the priority + * for the task identified by pid. If pid equals zero, the scheduler of + * the calling task will be set. The parameter 'param' holds the priority + * of the thread under the new policy. + * + * nxsched_setscheduler() is identical to the function sched_getparam(), + * differing only in its return value: This function does not modify the + * errno variable. + * + * This is a non-standard, internal OS function and is not intended for + * use by application logic. Applications should use the standard + * sched_getparam(). + * + * Input Parameters: + * pid - the task ID of the task to modify. If pid is zero, the calling + * task is modified. + * policy - Scheduling policy requested (either SCHED_FIFO or SCHED_RR) + * param - A structure whose member sched_priority is the new priority. + * The range of valid priority numbers is from SCHED_PRIORITY_MIN + * through SCHED_PRIORITY_MAX. + * + * Returned Value: + * On success, nxsched_setscheduler() returns OK (zero). On error, a + * negated errno value is returned: + * + * EINVAL The scheduling policy is not one of the recognized policies. + * ESRCH The task whose ID is pid could not be found. + * + ****************************************************************************/ + +int nxsched_setscheduler(pid_t pid, int policy, + FAR const struct sched_param *param); + +/**************************************************************************** + * Name: nxsched_getaffinity + * + * Description: + * nxsched_getaffinity() writes the affinity mask of the thread whose ID + * is pid into the cpu_set_t pointed to by mask. The cpusetsize + * argument specifies the size (in bytes) of mask. If pid is zero, then + * the mask of the calling thread is returned. + * + * nxsched_getaffinity() is identical to the function sched_getaffinity(), + * differing only in its return value: This function does not modify the + * errno variable. + * + * This is a non-standard, internal OS function and is not intended for + * use by application logic. Applications should use the standard + * sched_getparam(). + * + * Input Parameters: + * pid - The ID of thread whose affinity set will be retrieved. + * cpusetsize - Size of mask. MUST be sizeofcpu_set_t(). + * mask - The location to return the thread's new affinity set. + * + * Returned Value: + * Zero (OK) if successful. Otherwise, a negated errno value is returned: + * + * ESRCH The task whose ID is pid could not be found. + * + ****************************************************************************/ + +#ifdef CONFIG_SMP +int nxsched_getaffinity(pid_t pid, size_t cpusetsize, FAR cpu_set_t *mask); +#endif + /**************************************************************************** * Name: nxsched_setaffinity * @@ -1027,15 +1101,14 @@ int nxsched_getscheduler(pid_t pid); * use the standard sched_setparam(). * * Inputs: - * pid - The ID of thread whose affinity set will be modified. - * cpusetsize - Size of cpuset. MUST be sizeofcpu_set_t(). + * pid - The ID of thread whose affinity set will be modified. + * cpusetsize - Size of mask. MUST be sizeofcpu_set_t(). * mask - The location to return the thread's new affinity set. * * Return Value: - * 0 if successful. Otherwise, ERROR (-1) is returned, and errno is - * set appropriately: + * Zero (OK) if successful. Otherwise, a negated errno value is returned: * - * ESRCH The task whose ID is pid could not be found. + * ESRCH The task whose ID is pid could not be found. * ****************************************************************************/ diff --git a/sched/pthread/pthread_create.c b/sched/pthread/pthread_create.c index da612bb1a7..4900574e16 100644 --- a/sched/pthread/pthread_create.c +++ b/sched/pthread/pthread_create.c @@ -529,7 +529,7 @@ int pthread_create(FAR pthread_t *thread, FAR const pthread_attr_t *attr, if (ret < 0) { - ret = get_errno(); + ret = -ret; } } diff --git a/sched/pthread/pthread_getaffinity.c b/sched/pthread/pthread_getaffinity.c index f4d46f1976..868fe7003d 100644 --- a/sched/pthread/pthread_getaffinity.c +++ b/sched/pthread/pthread_getaffinity.c @@ -1,7 +1,7 @@ /**************************************************************************** * sched/pthread/pthread_getaffinity.c * - * Copyright (C) 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -45,6 +45,8 @@ #include #include +#include + #include "pthread/pthread.h" #ifdef CONFIG_SMP @@ -86,15 +88,14 @@ int pthread_getaffinity_np(pthread_t thread, size_t cpusetsize, DEBUGASSERT(thread > 0 && cpusetsize == sizeof(cpu_set_t) && cpuset != NULL); - /* Let sched_getaffinity do all of the work */ + /* Let nxsched_getaffinity do all of the work */ - ret = sched_getaffinity((pid_t)thread, cpusetsize, cpuset); + ret = nxsched_getaffinity((pid_t)thread, cpusetsize, cpuset); if (ret < 0) { - /* If sched_getaffinity() fails, return the errno */ + /* If nxsched_getaffinity() fails, return the positive errno */ - ret = get_errno(); - DEBUGASSERT(ret > 0); + ret = -ret; } return ret; diff --git a/sched/pthread/pthread_initialize.c b/sched/pthread/pthread_initialize.c index 3887ab7e8f..be0cb85ae4 100644 --- a/sched/pthread/pthread_initialize.c +++ b/sched/pthread/pthread_initialize.c @@ -164,6 +164,8 @@ int pthread_sem_trytake(sem_t *sem) int pthread_sem_give(sem_t *sem) { + int ret; + /* Verify input parameters */ @@ -172,16 +174,13 @@ int pthread_sem_give(sem_t *sem) { /* Give the semaphore */ - if (nxsem_post(sem) == OK) + ret = nxsem_post(sem); + if (ret < 0) { - return OK; + return -ret; } - else - { - /* nxsem_post() reported an error */ - return get_errno(); - } + return OK; } else { diff --git a/sched/pthread/pthread_mutexconsistent.c b/sched/pthread/pthread_mutexconsistent.c index c00331d1f9..eb37d1fb6d 100644 --- a/sched/pthread/pthread_mutexconsistent.c +++ b/sched/pthread/pthread_mutexconsistent.c @@ -129,7 +129,14 @@ int pthread_mutex_consistent(FAR pthread_mutex_t *mutex) */ status = nxsem_reset((FAR sem_t *)&mutex->sem, 1); - ret = (status != OK) ? get_errno() : OK; + if (status < 0) + { + ret = -status; + } + else + { + ret = OK; + } } /* Otherwise the mutex is held by some active thread. Let's not diff --git a/sched/pthread/pthread_mutexinit.c b/sched/pthread/pthread_mutexinit.c index 6624c47349..9885869bbe 100644 --- a/sched/pthread/pthread_mutexinit.c +++ b/sched/pthread/pthread_mutexinit.c @@ -119,18 +119,18 @@ int pthread_mutex_init(FAR pthread_mutex_t *mutex, /* Initialize the mutex like a semaphore with initial count = 1 */ status = nxsem_init((FAR sem_t *)&mutex->sem, pshared, 1); - if (status != OK) + if (status < 0) { - ret = get_errno(); + ret = -ret; } #ifdef CONFIG_PRIORITY_INHERITANCE /* Initialize the semaphore protocol */ status = nxsem_setprotocol((FAR sem_t *)&mutex->sem, proto); - if (status != OK) + if (status < 0) { - ret = get_errno(); + ret = -status; } #endif diff --git a/sched/pthread/pthread_setschedparam.c b/sched/pthread/pthread_setschedparam.c index f5ce5c5391..2ba1e85116 100644 --- a/sched/pthread/pthread_setschedparam.c +++ b/sched/pthread/pthread_setschedparam.c @@ -38,12 +38,16 @@ * Included Files ****************************************************************************/ +#include + #include #include #include #include #include +#include + #include "pthread/pthread.h" /**************************************************************************** @@ -95,8 +99,6 @@ * specified. * ESRCH The value specified by thread does not refer to a existing thread. * - * Assumptions: - * ****************************************************************************/ int pthread_setschedparam(pthread_t thread, int policy, @@ -106,14 +108,14 @@ int pthread_setschedparam(pthread_t thread, int policy, sinfo("thread ID=%d policy=%d param=0x%p\n", thread, policy, param); - /* Let sched_setscheduler do all of the work */ + /* Let nxsched_setscheduler do all of the work */ - ret = sched_setscheduler((pid_t)thread, policy, param); - if (ret != OK) + ret = nxsched_setscheduler((pid_t)thread, policy, param); + if (ret < 0) { - /* If sched_setscheduler() fails, return the errno */ + /* If nxsched_setscheduler() fails, return the positive errno value */ - ret = get_errno(); + ret = -ret; } return ret; diff --git a/sched/sched/sched.h b/sched/sched/sched.h index 3dbbeeac6a..e05b88692c 100644 --- a/sched/sched/sched.h +++ b/sched/sched/sched.h @@ -171,7 +171,7 @@ extern volatile dq_queue_t g_readytorun; * and * - Tasks/threads that have not been assigned to a CPU. * - * Otherwise, the TCB will be reatined in an assigned task list, + * Otherwise, the TCB will be retained in an assigned task list, * g_assignedtasks. As its name suggests, on 'g_assignedtasks queue for CPU * 'n' would contain only tasks/threads that are assigned to CPU 'n'. Tasks/ * threads would be assigned a particular CPU by one of two mechanisms: @@ -285,7 +285,7 @@ extern struct pidhash_s g_pidhash[CONFIG_MAX_TASKS]; /* This is a table of task lists. This table is indexed by the task stat * enumeration type (tstate_t) and provides a pointer to the associated * static task list (if there is one) as well as a a set of attribute flags - * indicating properities of the list, for example, if the list is an + * indicating properties of the list, for example, if the list is an * ordered list or not. */ diff --git a/sched/sched/sched_getaffinity.c b/sched/sched/sched_getaffinity.c index fb0814027c..7a15bc7d57 100644 --- a/sched/sched/sched_getaffinity.c +++ b/sched/sched/sched_getaffinity.c @@ -53,37 +53,45 @@ ****************************************************************************/ /**************************************************************************** - * Name: sched_getaffinity + * Name: nxsched_getaffinity * * Description: - * sched_getaffinity() writes the affinity mask of the thread whose ID + * nxsched_getaffinity() writes the affinity mask of the thread whose ID * is pid into the cpu_set_t pointed to by mask. The cpusetsize * argument specifies the size (in bytes) of mask. If pid is zero, then * the mask of the calling thread is returned. * - * Inputs: + * nxsched_getaffinity() is identical to the function sched_getaffinity(), + * differing only in its return value: This function does not modify the + * errno variable. + * + * This is a non-standard, internal OS function and is not intended for + * use by application logic. Applications should use the standard + * sched_getparam(). + * + * Input Parameters: * pid - The ID of thread whose affinity set will be retrieved. - * cpusetsize - Size of cpuset. MUST be sizeofcpu_set_t(). - * cpuset - The location to return the thread's new affinity set. + * cpusetsize - Size of mask. MUST be sizeofcpu_set_t(). + * mask - The location to return the thread's new affinity set. * - * Return Value: - * 0 if successful. Otherwise, ERROR (-1) is returned, and errno is - * set appropriately: + * Returned Value: + * Zero (OK) if successful. Otherwise, a negated errno value is returned: * * ESRCH The task whose ID is pid could not be found. * ****************************************************************************/ -int sched_getaffinity(pid_t pid, size_t cpusetsize, FAR cpu_set_t *mask) +int nxsched_getaffinity(pid_t pid, size_t cpusetsize, FAR cpu_set_t *mask) { FAR struct tcb_s *tcb; + int ret; DEBUGASSERT(cpusetsize == sizeof(cpu_set_t) && mask != NULL); /* Verify that the PID corresponds to a real task */ sched_lock(); - if (!pid) + if (pid == 0) { tcb = this_task(); } @@ -94,13 +102,53 @@ int sched_getaffinity(pid_t pid, size_t cpusetsize, FAR cpu_set_t *mask) if (tcb == NULL) { - set_errno(ESRCH); - return ERROR; + ret = -ESRCH; } + else + { + /* Return the affinity mask from the TCB. */ - /* Return the affinity mask from the TCB. */ + *mask = tcb->affinity; + ret = OK; + } - *mask = tcb->affinity; sched_unlock(); - return OK; + return ret; +} + +/**************************************************************************** + * Name: sched_getaffinity + * + * Description: + * sched_getaffinity() writes the affinity mask of the thread whose ID + * is pid into the cpu_set_t pointed to by mask. The cpusetsize + * argument specifies the size (in bytes) of mask. If pid is zero, then + * the mask of the calling thread is returned. + * + * This function is a simply wrapper around nxsched_getaffinity() that + * sets the errno value in the event of an error. + * + * Input Parameters: + * pid - The ID of thread whose affinity set will be retrieved. + * cpusetsize - Size of mask. MUST be sizeofcpu_set_t(). + * mask - The location to return the thread's new affinity set. + * + * Returned Value: + * 0 if successful. Otherwise, ERROR (-1) is returned, and errno is + * set appropriately: + * + * ESRCH The task whose ID is pid could not be found. + * + ****************************************************************************/ + +int sched_getaffinity(pid_t pid, size_t cpusetsize, FAR cpu_set_t *mask) +{ + int ret = nxsched_getaffinity(pid, cpusetsize, mask); + if (ret < 0) + { + set_errno(-ret); + ret = ERROR; + } + + return ret; } diff --git a/sched/sched/sched_getparam.c b/sched/sched/sched_getparam.c index e96c445164..9c164e374d 100644 --- a/sched/sched/sched_getparam.c +++ b/sched/sched/sched_getparam.c @@ -192,4 +192,3 @@ int sched_getparam (pid_t pid, FAR struct sched_param *param) return ret; } - diff --git a/sched/sched/sched_setaffinity.c b/sched/sched/sched_setaffinity.c index 150d5019af..06ab16f865 100644 --- a/sched/sched/sched_setaffinity.c +++ b/sched/sched/sched_setaffinity.c @@ -73,15 +73,14 @@ * use the standard sched_setparam(). * * Inputs: - * pid - The ID of thread whose affinity set will be modified. - * cpusetsize - Size of cpuset. MUST be sizeofcpu_set_t(). + * pid - The ID of thread whose affinity set will be modified. + * cpusetsize - Size of mask. MUST be sizeofcpu_set_t(). * mask - The location to return the thread's new affinity set. * * Return Value: - * 0 if successful. Otherwise, ERROR (-1) is returned, and errno is - * set appropriately: + * Zero (OK) if successful. Otherwise, a negated errno value is returned: * - * ESRCH The task whose ID is pid could not be found. + * ESRCH The task whose ID is pid could not be found. * ****************************************************************************/ @@ -182,15 +181,15 @@ errout_with_lock: * the errno value in the event of an error. * * Inputs: - * pid - The ID of thread whose affinity set will be modified. - * cpusetsize - Size of cpuset. MUST be sizeofcpu_set_t(). + * pid - The ID of thread whose affinity set will be modified. + * cpusetsize - Size of mask. MUST be sizeofcpu_set_t(). * mask - The location to return the thread's new affinity set. * * Return Value: * 0 if successful. Otherwise, ERROR (-1) is returned, and errno is * set appropriately: * - * ESRCH The task whose ID is pid could not be found. + * ESRCH The task whose ID is pid could not be found. * ****************************************************************************/ diff --git a/sched/sched/sched_setscheduler.c b/sched/sched/sched_setscheduler.c index 6bee58f97e..e2f733cfd6 100644 --- a/sched/sched/sched_setscheduler.c +++ b/sched/sched/sched_setscheduler.c @@ -46,6 +46,7 @@ #include #include +#include #include #include @@ -57,15 +58,23 @@ ****************************************************************************/ /**************************************************************************** - * Name: sched_setscheduler + * Name: nxsched_setscheduler * * Description: - * sched_setscheduler() sets both the scheduling policy and the priority + * nxsched_setscheduler() sets both the scheduling policy and the priority * for the task identified by pid. If pid equals zero, the scheduler of * the calling task will be set. The parameter 'param' holds the priority * of the thread under the new policy. * - * Inputs: + * nxsched_setscheduler() is identical to the function sched_getparam(), + * differing only in its return value: This function does not modify the + * errno variable. + * + * This is a non-standard, internal OS function and is not intended for + * use by application logic. Applications should use the standard + * sched_getparam(). + * + * Input Parameters: * pid - the task ID of the task to modify. If pid is zero, the calling * task is modified. * policy - Scheduling policy requested (either SCHED_FIFO or SCHED_RR) @@ -73,23 +82,20 @@ * The range of valid priority numbers is from SCHED_PRIORITY_MIN * through SCHED_PRIORITY_MAX. * - * Return Value: - * On success, sched_setscheduler() returns OK (zero). On error, ERROR - * (-1) is returned, and errno is set appropriately: + * Returned Value: + * On success, nxsched_setscheduler() returns OK (zero). On error, a + * negated errno value is returned: * * EINVAL The scheduling policy is not one of the recognized policies. * ESRCH The task whose ID is pid could not be found. * - * Assumptions: - * ****************************************************************************/ -int sched_setscheduler(pid_t pid, int policy, - FAR const struct sched_param *param) +int nxsched_setscheduler(pid_t pid, int policy, + FAR const struct sched_param *param) { FAR struct tcb_s *tcb; irqstate_t flags; - int errcode; int ret; /* Check for supported scheduling policy */ @@ -103,8 +109,7 @@ int sched_setscheduler(pid_t pid, int policy, #endif ) { - set_errno(EINVAL); - return ERROR; + return -EINVAL; } /* Check if the task to modify the calling task */ @@ -119,8 +124,7 @@ int sched_setscheduler(pid_t pid, int policy, tcb = sched_gettcb(pid); if (!tcb) { - set_errno(ESRCH); - return ERROR; + return -ESRCH; } /* Prohibit any context switches while we muck with priority and scheduler @@ -137,6 +141,7 @@ int sched_setscheduler(pid_t pid, int policy, { default: DEBUGPANIC(); + case SCHED_FIFO: { #ifdef CONFIG_SCHED_SPORADIC @@ -185,7 +190,7 @@ int sched_setscheduler(pid_t pid, int policy, if (param->sched_ss_max_repl < 1 || param->sched_ss_max_repl > CONFIG_SCHED_SPORADIC_MAXREPL) { - errcode = EINVAL; + ret = -EINVAL; goto errout_with_irq; } @@ -219,7 +224,7 @@ int sched_setscheduler(pid_t pid, int policy, if (repl_ticks < budget_ticks) #endif { - errcode = EINVAL; + ret = -EINVAL; goto errout_with_irq; } @@ -259,7 +264,6 @@ int sched_setscheduler(pid_t pid, int policy, if (ret < 0) { - errcode = -ret; goto errout_with_irq; } } @@ -278,22 +282,55 @@ int sched_setscheduler(pid_t pid, int policy, /* Set the new priority */ ret = nxsched_reprioritize(tcb, param->sched_priority); - if (ret < 0) - { - errcode = -ret; - goto errout_with_lock; - } - sched_unlock(); - return OK; + return ret; #ifdef CONFIG_SCHED_SPORADIC errout_with_irq: leave_critical_section(flags); + sched_unlock(); + return ret; #endif +} -errout_with_lock: - set_errno(errcode); - sched_unlock(); - return ERROR; +/**************************************************************************** + * Name: sched_setscheduler + * + * Description: + * sched_setscheduler() sets both the scheduling policy and the priority + * for the task identified by pid. If pid equals zero, the scheduler of + * the calling task will be set. The parameter 'param' holds the priority + * of the thread under the new policy. + * + * This function is a simply wrapper around nxsched_getparam() that + * sets the errno value in the event of an error. + * + * Input Parameters: + * pid - the task ID of the task to modify. If pid is zero, the calling + * task is modified. + * policy - Scheduling policy requested (either SCHED_FIFO or SCHED_RR) + * param - A structure whose member sched_priority is the new priority. + * The range of valid priority numbers is from SCHED_PRIORITY_MIN + * through SCHED_PRIORITY_MAX. + * + * Returned Value: + * On success, sched_setscheduler() returns OK (zero). On error, ERROR + * (-1) is returned, and errno is set appropriately: + * + * EINVAL The scheduling policy is not one of the recognized policies. + * ESRCH The task whose ID is pid could not be found. + * + ****************************************************************************/ + +int sched_setscheduler(pid_t pid, int policy, + FAR const struct sched_param *param) +{ + int ret = nxsched_setscheduler(pid, policy, param); + if (ret < 0) + { + set_errno(-ret); + ret = ERROR; + } + + return ret; } diff --git a/sched/task/task_spawnparms.c b/sched/task/task_spawnparms.c index 53c9877747..20dd13de3a 100644 --- a/sched/task/task_spawnparms.c +++ b/sched/task/task_spawnparms.c @@ -240,7 +240,7 @@ int spawn_execattrs(pid_t pid, FAR const posix_spawnattr_t *attr) param.sched_priority = attr->priority; /* If we are setting *both* the priority and the scheduler, - * then we will call sched_setscheduler() below. + * then we will call nxsched_setscheduler() below. */ if ((attr->flags & POSIX_SPAWN_SETSCHEDULER) == 0) @@ -258,7 +258,7 @@ int spawn_execattrs(pid_t pid, FAR const posix_spawnattr_t *attr) /* If we are only changing the scheduling policy, then reset * the priority to the default value (the same as this thread) in - * preparation for the sched_setscheduler() call below. + * preparation for the nxsched_setscheduler() call below. */ else if ((attr->flags & POSIX_SPAWN_SETSCHEDULER) != 0) @@ -289,7 +289,7 @@ int spawn_execattrs(pid_t pid, FAR const posix_spawnattr_t *attr) param.sched_ss_init_budget.tv_sec = attr->budget.tv_sec; param.sched_ss_init_budget.tv_nsec = attr->budget.tv_nsec; #endif - (void)sched_setscheduler(pid, attr->policy, ¶m); + (void)nxsched_setscheduler(pid, attr->policy, ¶m); } return OK; -- GitLab From 30f292710117ff4eacccf5583e02c1ab1ef0f323 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 30 Jan 2018 17:23:10 -0600 Subject: [PATCH 138/228] binfmt/, drivers/, graphics/: Fix several inappropriate accesses to get_errno() that were missed in previous changes (some going back to nuttx-.23). --- binfmt/binfmt_schedunload.c | 8 ------- drivers/audio/wm8776.c | 4 ++-- drivers/loop/losetup.c | 14 ++++++------- drivers/syslog/syslog_stream.c | 8 +++---- drivers/usbmonitor/usbmonitor.c | 2 +- drivers/wireless/cc3000/socket.c | 6 +++--- drivers/wireless/cc3000/socket_imp.c | 13 ++++++------ graphics/nxmu/nxmu_requestbkgd.c | 28 ++----------------------- graphics/nxmu/nxmu_server.c | 31 ++++------------------------ graphics/vnc/server/vnc_negotiate.c | 30 +++++++++------------------ graphics/vnc/server/vnc_receiver.c | 18 ++++++---------- 11 files changed, 44 insertions(+), 118 deletions(-) diff --git a/binfmt/binfmt_schedunload.c b/binfmt/binfmt_schedunload.c index f742b49396..e7b981d2fe 100644 --- a/binfmt/binfmt_schedunload.c +++ b/binfmt/binfmt_schedunload.c @@ -52,14 +52,6 @@ #if !defined(CONFIG_BINFMT_DISABLE) && defined(CONFIG_SCHED_HAVE_PARENT) -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - /**************************************************************************** * Private Data ****************************************************************************/ diff --git a/drivers/audio/wm8776.c b/drivers/audio/wm8776.c index c9a9ebebcc..81c77fac0a 100644 --- a/drivers/audio/wm8776.c +++ b/drivers/audio/wm8776.c @@ -566,7 +566,7 @@ static void wm8776_senddone(FAR struct i2s_dev_s *i2s, CONFIG_WM8776_MSG_PRIO); if (ret < 0) { - auderr("ERROR: mq_send failed: %d\n", errno); + auderr("ERROR: mq_send failed: %d\n", get_errno()); } } @@ -913,7 +913,7 @@ static int wm8776_enqueuebuffer(FAR struct audio_lowerhalf_s *dev, CONFIG_WM8776_MSG_PRIO); if (ret < 0) { - int errcode = errno; + int errcode = get_errno(); DEBUGASSERT(errcode > 0); auderr("ERROR: mq_send failed: %d\n", errcode); diff --git a/drivers/loop/losetup.c b/drivers/loop/losetup.c index 0690776e23..0a18eaff92 100644 --- a/drivers/loop/losetup.c +++ b/drivers/loop/losetup.c @@ -234,7 +234,7 @@ static ssize_t loop_read(FAR struct inode *inode, FAR unsigned char *buffer, FAR struct loop_struct_s *dev; ssize_t nbytesread; off_t offset; - int ret; + off_t ret; DEBUGASSERT(inode && inode->i_private); dev = (FAR struct loop_struct_s *)inode->i_private; @@ -249,10 +249,9 @@ static ssize_t loop_read(FAR struct inode *inode, FAR unsigned char *buffer, offset = start_sector * dev->sectsize + dev->offset; ret = file_seek(&dev->devfile, offset, SEEK_SET); - if (ret == (off_t)-1) + if (ret < 0) { - ferr("ERROR: Seek failed for offset=%d: %d\n", - (int)offset, get_errno()); + ferr("ERROR: Seek failed for offset=%d: %d\n", (int)offset, (int)ret); return -EIO; } @@ -290,7 +289,7 @@ static ssize_t loop_write(FAR struct inode *inode, FAR struct loop_struct_s *dev; ssize_t nbyteswritten; off_t offset; - int ret; + off_t ret; DEBUGASSERT(inode && inode->i_private); dev = (FAR struct loop_struct_s *)inode->i_private; @@ -299,10 +298,9 @@ static ssize_t loop_write(FAR struct inode *inode, offset = start_sector * dev->sectsize + dev->offset; ret = file_seek(&dev->devfile, offset, SEEK_SET); - if (ret == (off_t)-1) + if (ret < 0) { - ferr("ERROR: Seek failed for offset=%d: %d\n", - (int)offset, get_errno()); + ferr("ERROR: Seek failed for offset=%d: %d\n", (int)offset, (int)ret); } /* Then write the requested number of sectors to that position */ diff --git a/drivers/syslog/syslog_stream.c b/drivers/syslog/syslog_stream.c index a14a5d4f12..a71bd933d7 100644 --- a/drivers/syslog/syslog_stream.c +++ b/drivers/syslog/syslog_stream.c @@ -79,7 +79,7 @@ static int syslogstream_flush(FAR struct lib_syslogstream_s *stream) (size_t)iob->io_len); if (nbytes < 0) { - ret = -get_errno(); + ret = (int)nbytes; } else { @@ -172,18 +172,18 @@ static void syslogstream_putc(FAR struct lib_outstream_s *this, int ch) */ ret = syslog_putc(ch); - if (ret != EOF) + if (ret >= 0) { this->nput++; return; } - /* The special errno value -EINTR means that syslog_putc() was + /* The special return value -EINTR means that syslog_putc() was * awakened by a signal. This is not a real error and must be * ignored in this context. */ } - while (get_errno() == -EINTR); + while (ret == -EINTR); } } } diff --git a/drivers/usbmonitor/usbmonitor.c b/drivers/usbmonitor/usbmonitor.c index 6d350f23db..3f20dbb119 100644 --- a/drivers/usbmonitor/usbmonitor.c +++ b/drivers/usbmonitor/usbmonitor.c @@ -231,7 +231,7 @@ int usbmonitor_start(void) (FAR char * const *)NULL); if (ret < 0) { - int errcode = errno; + int errcode = get_errno(); uerr("ERROR: Failed to start the USB monitor: %d\n", errcode); UNUSED(errcode); diff --git a/drivers/wireless/cc3000/socket.c b/drivers/wireless/cc3000/socket.c index 10699a7089..b1da05d0c9 100644 --- a/drivers/wireless/cc3000/socket.c +++ b/drivers/wireless/cc3000/socket.c @@ -130,7 +130,7 @@ int cc3000_socket(int domain, int type, int protocol) if (type < SOCK_STREAM || type >= ARRAY_SIZE(bsd2ti_types)) { - errno = EPROTOTYPE; + set_errno(EPROTOTYPE); return -1; } @@ -145,7 +145,7 @@ int cc3000_socket(int domain, int type, int protocol) break; default: - errno = EAFNOSUPPORT; + set_errno(EAFNOSUPPORT); return -1; } @@ -163,7 +163,7 @@ int cc3000_socket(int domain, int type, int protocol) break; default: - errno = EPROTONOSUPPORT; + set_errno(EPROTONOSUPPORT); return -1; } diff --git a/drivers/wireless/cc3000/socket_imp.c b/drivers/wireless/cc3000/socket_imp.c index a9a830e6ef..832e696a02 100644 --- a/drivers/wireless/cc3000/socket_imp.c +++ b/drivers/wireless/cc3000/socket_imp.c @@ -512,15 +512,16 @@ int cc3000_gethostbyname_impl(char *hostname, uint16_t usNameLen, unsigned long *out_ip_addr) { tBsdGethostbynameParams ret; - uint8_t *ptr, *args; - - set_errno(EFAIL); + uint8_t *ptr; + uint8_t *args; if (usNameLen > CC3000_HOSTNAME_MAX_LENGTH) { - return get_errno(); + return -EINVAL; } + ret.retVal = OK; + ptr = tSLInformation.pucTxCommandBuffer; args = (ptr + SIMPLE_LINK_HCI_CMND_TRANSPORT_HEADER_SIZE); @@ -539,11 +540,9 @@ int cc3000_gethostbyname_impl(char *hostname, uint16_t usNameLen, SimpleLinkWaitEvent(HCI_EVNT_BSD_GETHOSTBYNAME, &ret); - set_errno(ret.retVal); - (*((FAR long *)out_ip_addr)) = ret.outputAddress; - return ret.retVal; + return (int)ret.retVal; } #endif diff --git a/graphics/nxmu/nxmu_requestbkgd.c b/graphics/nxmu/nxmu_requestbkgd.c index 23f7748fc3..72485b6aaa 100644 --- a/graphics/nxmu/nxmu_requestbkgd.c +++ b/graphics/nxmu/nxmu_requestbkgd.c @@ -39,32 +39,13 @@ #include +#include #include #include #include #include "nxfe.h" -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -92,12 +73,7 @@ void nxmu_requestbkgd(FAR struct nxfe_conn_s *conn, FAR const struct nx_callback_s *cb, FAR void *arg) { -#ifdef CONFIG_DEBUG_FEATURES - if (!conn || !be || !cb) - { - errno = EINVAL; - } -#endif + DEBUGASSERT(conn != NULL || be != NULL || cb != NULL); /* Set the client's callback vtable and and replace the server * connection with the clients connection. diff --git a/graphics/nxmu/nxmu_server.c b/graphics/nxmu/nxmu_server.c index 79cb140a3e..a2a2999abd 100644 --- a/graphics/nxmu/nxmu_server.c +++ b/graphics/nxmu/nxmu_server.c @@ -45,6 +45,7 @@ #include #include #include +#include #include #include @@ -53,22 +54,6 @@ #include "nxfe.h" -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - /**************************************************************************** * Private Functions ****************************************************************************/ @@ -190,7 +175,7 @@ static inline int nxmu_setup(FAR const char *mqname, FAR NX_DRIVERTYPE *dev, if (ret < 0) { gerr("ERROR: nxbe_configure failed: %d\n", -ret); - errno = -ret; + set_errno(-ret); return ERROR; } @@ -199,7 +184,7 @@ static inline int nxmu_setup(FAR const char *mqname, FAR NX_DRIVERTYPE *dev, if (ret < 0) { gerr("ERROR: nxbe_colormap failed: %d\n", -ret); - errno = -ret; + set_errno(-ret); return ERROR; } #endif /* CONFIG_FB_CMAP */ @@ -301,15 +286,7 @@ int nx_runinstance(FAR const char *mqname, FAR NX_DRIVERTYPE *dev) /* Initialization *********************************************************/ - /* Sanity checking */ - -#ifdef CONFIG_DEBUG_FEATURES - if (!mqname || !dev) - { - errno = EINVAL; - return ERROR; - } -#endif + DEBUGASSERT(mqname != NULL || dev != NULL); /* Initialize and configure the server */ diff --git a/graphics/vnc/server/vnc_negotiate.c b/graphics/vnc/server/vnc_negotiate.c index 31ee14322f..f685acb438 100644 --- a/graphics/vnc/server/vnc_negotiate.c +++ b/graphics/vnc/server/vnc_negotiate.c @@ -158,10 +158,8 @@ int vnc_negotiate(FAR struct vnc_session_s *session) nrecvd = psock_recv(&session->connect, session->inbuf, len, 0); if (nrecvd < 0) { - errcode = get_errno(); - gerr("ERROR: Receive protocol confirmation failed: %d\n", errcode); - DEBUGASSERT(errcode > 0); - return -errcode; + gerr("ERROR: Receive protocol confirmation failed: %d\n", (int)nrecvd); + return (int)nrecvd; } else if (nrecvd == 0) { @@ -226,10 +224,8 @@ int vnc_negotiate(FAR struct vnc_session_s *session) sizeof(struct rfb_selected_sectype_s), 0); if (nrecvd < 0) { - errcode = get_errno(); - gerr("ERROR: Receive SecurityType failed: %d\n", errcode); - DEBUGASSERT(errcode > 0); - return -errcode; + gerr("ERROR: Receive SecurityType failed: %d\n", (int)nrecvd); + return (int)nrecvd; } else if (nrecvd == 0) { @@ -309,10 +305,8 @@ int vnc_negotiate(FAR struct vnc_session_s *session) sizeof(struct rfb_clientinit_s), 0); if (nrecvd < 0) { - errcode = get_errno(); - gerr("ERROR: Receive ClientInit failed: %d\n", errcode); - DEBUGASSERT(errcode > 0); - return -errcode; + gerr("ERROR: Receive ClientInit failed: %d\n", (int)nrecvd); + return (int)nrecvd; } else if (nrecvd == 0) { @@ -383,10 +377,8 @@ int vnc_negotiate(FAR struct vnc_session_s *session) sizeof(struct rfb_setpixelformat_s), 0); if (nrecvd < 0) { - errcode = get_errno(); - gerr("ERROR: Receive SetPixelFormat failed: %d\n", errcode); - DEBUGASSERT(errcode > 0); - return -errcode; + gerr("ERROR: Receive SetPixelFormat failed: %d\n", (int)nrecvd); + return (int)nrecvd; } else if (nrecvd == 0) { @@ -430,10 +422,8 @@ int vnc_negotiate(FAR struct vnc_session_s *session) CONFIG_VNCSERVER_INBUFFER_SIZE, 0); if (nrecvd < 0) { - errcode = get_errno(); - gerr("ERROR: Receive SetEncodings failed: %d\n", errcode); - DEBUGASSERT(errcode > 0); - return -errcode; + gerr("ERROR: Receive SetEncodings failed: %d\n", (int)nrecvd); + return (int)nrecvd; } else if (nrecvd == 0) { diff --git a/graphics/vnc/server/vnc_receiver.c b/graphics/vnc/server/vnc_receiver.c index 36d04428ab..82a7fbb421 100644 --- a/graphics/vnc/server/vnc_receiver.c +++ b/graphics/vnc/server/vnc_receiver.c @@ -104,10 +104,8 @@ int vnc_read_remainder(FAR struct vnc_session_s *session, size_t msglen, msglen - ntotal, 0); if (nrecvd < 0) { - errcode = get_errno(); - gerr("ERROR: Receive message failed: %d\n", errcode); - DEBUGASSERT(errcode > 0); - return -errcode; + gerr("ERROR: Receive message failed: %d\n", (int)nrecvd); + return (int)recvd; } } @@ -155,10 +153,8 @@ int vnc_receiver(FAR struct vnc_session_s *session) &tv, sizeof(struct timeval)); if (ret < 0) { - errcode = get_errno(); - gerr("ERROR: Failed to disable receive timeout: %d\n", errcode); - DEBUGASSERT(errcode > 0); - return -errcode; + gerr("ERROR: Failed to disable receive timeout: %d\n", ret); + return ret; } #endif @@ -174,10 +170,8 @@ int vnc_receiver(FAR struct vnc_session_s *session) nrecvd = psock_recv(&session->connect, session->inbuf, 1, 0); if (nrecvd < 0) { - errcode = get_errno(); - gerr("ERROR: Receive byte failed: %d\n", errcode); - DEBUGASSERT(errcode > 0); - return -errcode; + gerr("ERROR: Receive byte failed: %d\n", (int)nrecvd); + return (int)nrecvd; } /* A return value of zero means that the connection was gracefully -- GitLab From 3521aaf94433b50e6e4b50f79dd3981188271cea Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 30 Jan 2018 17:57:36 -0600 Subject: [PATCH 139/228] Squashed commit of the following: binfmt/, configs/, grahics/, libc/, mm/, net/, sched/: OS references to the errno variable should always use the set_errno(), get_errno() macros arch/arm/src/stm32 and stm32f7: Architecture-specific code is not permitted to modify the errno variable. drivers/ and libc/: OS references to the errno variable should always use the set_errno(), get_errno() macros --- arch/arm/src/stm32/stm32_comp.c | 1 - arch/arm/src/stm32/stm32_hrtim.c | 1 - arch/arm/src/stm32/stm32_opamp.c | 1 - arch/arm/src/stm32f7/stm32_dma2d.c | 1 - binfmt/libelf/libelf_init.c | 4 ++-- binfmt/libelf/libelf_read.c | 2 +- binfmt/libnxflat/libnxflat_init.c | 2 +- binfmt/libnxflat/libnxflat_read.c | 2 +- configs/sama5d4-ek/src/at25_main.c | 8 ++++---- drivers/net/telnet.c | 2 +- graphics/nxmu/nx_start.c | 2 +- libc/modlib/modlib_init.c | 4 ++-- libc/modlib/modlib_read.c | 2 +- libc/netdb/lib_dnsaddserver.c | 2 +- libc/netdb/lib_dnsforeach.c | 2 +- libc/netdb/lib_gethostbyaddrr.c | 2 +- libc/netdb/lib_gethostbynamer.c | 2 +- libc/pthread/pthread_setcancelstate.c | 2 +- libc/pthread/pthread_setcanceltype.c | 2 +- libc/stdio/lib_fclose.c | 4 ++-- libc/stdlib/lib_wctomb.c | 2 +- libc/time/lib_localtime.c | 2 +- libc/wqueue/work_signal.c | 2 +- libc/wqueue/work_usrthread.c | 2 +- mm/mm_heap/mm_sem.c | 2 +- net/route/net_fileroute.c | 2 +- sched/wqueue/kwork_hpthread.c | 2 +- sched/wqueue/kwork_lpthread.c | 2 +- 28 files changed, 30 insertions(+), 34 deletions(-) diff --git a/arch/arm/src/stm32/stm32_comp.c b/arch/arm/src/stm32/stm32_comp.c index ada2600421..b46b678f94 100644 --- a/arch/arm/src/stm32/stm32_comp.c +++ b/arch/arm/src/stm32/stm32_comp.c @@ -1069,7 +1069,6 @@ FAR struct comp_dev_s* stm32_compinitialize(int intf) if (ret < 0) { aerr("ERROR: Failed to initialize COMP%d: %d\n", intf, ret); - errno = -ret; return NULL; } diff --git a/arch/arm/src/stm32/stm32_hrtim.c b/arch/arm/src/stm32/stm32_hrtim.c index af1c032c38..09da49edf9 100644 --- a/arch/arm/src/stm32/stm32_hrtim.c +++ b/arch/arm/src/stm32/stm32_hrtim.c @@ -5313,7 +5313,6 @@ FAR struct hrtim_dev_s* stm32_hrtiminitialize(void) if (ret < 0) { tmrerr("ERROR: Failed to initialize HRTIM1: %d\n", ret); - errno = -ret; return NULL; } diff --git a/arch/arm/src/stm32/stm32_opamp.c b/arch/arm/src/stm32/stm32_opamp.c index e79e8ed806..e839bba863 100644 --- a/arch/arm/src/stm32/stm32_opamp.c +++ b/arch/arm/src/stm32/stm32_opamp.c @@ -1402,7 +1402,6 @@ FAR struct opamp_dev_s* stm32_opampinitialize(int intf) if (ret < 0) { aerr("ERROR: Failed to initialize OPAMP%d: %d\n", intf, ret); - errno = -ret; return NULL; } diff --git a/arch/arm/src/stm32f7/stm32_dma2d.c b/arch/arm/src/stm32f7/stm32_dma2d.c index f0ec212339..8e6276484e 100644 --- a/arch/arm/src/stm32f7/stm32_dma2d.c +++ b/arch/arm/src/stm32f7/stm32_dma2d.c @@ -2261,7 +2261,6 @@ FAR struct dma2d_layer_s *stm32_dma2dinitltdc(FAR struct stm32_ltdc_s *layer) { lcderr("ERROR: Returning -EINVAL, unsupported pixel format: %d\n", layer->vinfo.fmt); - errno = -EINVAL; return NULL; } diff --git a/binfmt/libelf/libelf_init.c b/binfmt/libelf/libelf_init.c index 7307261df6..3e09a6676a 100644 --- a/binfmt/libelf/libelf_init.c +++ b/binfmt/libelf/libelf_init.c @@ -101,7 +101,7 @@ static inline int elf_filelen(FAR struct elf_loadinfo_s *loadinfo, ret = stat(filename, &buf); if (ret < 0) { - int errval = errno; + int errval = get_errno(); berr("Failed to stat file: %d\n", errval); return -errval; } @@ -165,7 +165,7 @@ int elf_init(FAR const char *filename, FAR struct elf_loadinfo_s *loadinfo) loadinfo->filfd = open(filename, O_RDONLY); if (loadinfo->filfd < 0) { - int errval = errno; + int errval = get_errno(); berr("Failed to open ELF binary %s: %d\n", filename, errval); return -errval; } diff --git a/binfmt/libelf/libelf_read.c b/binfmt/libelf/libelf_read.c index 490ba1fdd9..a240e107fb 100644 --- a/binfmt/libelf/libelf_read.c +++ b/binfmt/libelf/libelf_read.c @@ -127,7 +127,7 @@ int elf_read(FAR struct elf_loadinfo_s *loadinfo, FAR uint8_t *buffer, rpos = lseek(loadinfo->filfd, offset, SEEK_SET); if (rpos != offset) { - int errval = errno; + int errval = get_errno(); berr("Failed to seek to position %lu: %d\n", (unsigned long)offset, errval); return -errval; diff --git a/binfmt/libnxflat/libnxflat_init.c b/binfmt/libnxflat/libnxflat_init.c index eff6cd8b29..d3f48c0073 100644 --- a/binfmt/libnxflat/libnxflat_init.c +++ b/binfmt/libnxflat/libnxflat_init.c @@ -111,7 +111,7 @@ int nxflat_init(const char *filename, struct nxflat_loadinfo_s *loadinfo) loadinfo->filfd = open(filename, O_RDONLY); if (loadinfo->filfd < 0) { - int errval = errno; + int errval = get_errno(); berr("Failed to open NXFLAT binary %s: %d\n", filename, errval); return -errval; } diff --git a/binfmt/libnxflat/libnxflat_read.c b/binfmt/libnxflat/libnxflat_read.c index 720f725679..09016f5d3d 100644 --- a/binfmt/libnxflat/libnxflat_read.c +++ b/binfmt/libnxflat/libnxflat_read.c @@ -131,7 +131,7 @@ int nxflat_read(struct nxflat_loadinfo_s *loadinfo, char *buffer, rpos = lseek(loadinfo->filfd, offset, SEEK_SET); if (rpos != offset) { - int errval = errno; + int errval = get_errno(); berr("Failed to seek to position %d: %d\n", offset, errval); return -errval; } diff --git a/configs/sama5d4-ek/src/at25_main.c b/configs/sama5d4-ek/src/at25_main.c index 699f613b10..2d07927ee3 100644 --- a/configs/sama5d4-ek/src/at25_main.c +++ b/configs/sama5d4-ek/src/at25_main.c @@ -144,7 +144,7 @@ int at25_main(int argc, char *argv) fd = open(g_at25dev, O_WRONLY); if (fd < 0) { - int errcode = errno; + int errcode = get_errno(); fprintf(stderr, "ERROR: Failed to open %s: %d\n", g_at25dev, errcode); return EXIT_FAILURE; } @@ -205,7 +205,7 @@ int at25_main(int argc, char *argv) nwritten = write(fd, src, memoutstream.public.nput); if (nwritten <= 0) { - int errcode = errno; + int errcode = get_errno(); if (errno != EINTR) { fprintf(stderr, "ERROR: Write failed: %d\n", errcode); @@ -235,7 +235,7 @@ int at25_main(int argc, char *argv) fd = open(g_at25dev, O_RDONLY); if (fd < 0) { - int errcode = errno; + int errcode = get_errno(); fprintf(stderr, "ERROR: Failed to open %s: %d\n", g_at25dev, errcode); return EXIT_FAILURE; } @@ -254,7 +254,7 @@ int at25_main(int argc, char *argv) nread = read(fd, g_iobuffer, rdsize); if (nread <= 0) { - int errcode = errno; + int errcode = get_errno(); if (errno != EINTR) { fprintf(stderr, "ERROR: Read failed: %d\n", errcode); diff --git a/drivers/net/telnet.c b/drivers/net/telnet.c index 9dbded1e1e..6c849826ef 100644 --- a/drivers/net/telnet.c +++ b/drivers/net/telnet.c @@ -863,7 +863,7 @@ static int telnet_session(FAR struct telnet_session_s *session) priv->td_minor); ret = stat(session->ts_devpath, &statbuf); - DEBUGASSERT(ret >= 0 || errno == ENOENT); + DEBUGASSERT(ret >= 0 || get_errno() == ENOENT); } while (ret >= 0 && start != g_telnet_common.tc_minor); diff --git a/graphics/nxmu/nx_start.c b/graphics/nxmu/nx_start.c index cfa39cc523..348e8c09d7 100644 --- a/graphics/nxmu/nx_start.c +++ b/graphics/nxmu/nx_start.c @@ -190,7 +190,7 @@ int nx_start(void) CONFIG_NXSTART_SERVERSTACK, nx_server, NULL); if (server < 0) { - int errcode = errno; + int errcode = get_errno(); DEBUGASSERT(errcode > 0); gerr("ERROR: Failed to create nx_server kernel thread: %d\n", errcode); diff --git a/libc/modlib/modlib_init.c b/libc/modlib/modlib_init.c index 964272ca0a..a8f10118e0 100644 --- a/libc/modlib/modlib_init.c +++ b/libc/modlib/modlib_init.c @@ -98,7 +98,7 @@ static inline int modlib_filelen(FAR struct mod_loadinfo_s *loadinfo, ret = stat(filename, &buf); if (ret < 0) { - int errval = errno; + int errval = get_errno(); serr("ERROR: Failed to stat file: %d\n", errval); return -errval; } @@ -163,7 +163,7 @@ int modlib_initialize(FAR const char *filename, loadinfo->filfd = open(filename, O_RDONLY); if (loadinfo->filfd < 0) { - int errval = errno; + int errval = get_errno(); serr("ERROR: Failed to open ELF binary %s: %d\n", filename, errval); return -errval; } diff --git a/libc/modlib/modlib_read.c b/libc/modlib/modlib_read.c index 169d581429..00402ffcae 100644 --- a/libc/modlib/modlib_read.c +++ b/libc/modlib/modlib_read.c @@ -121,7 +121,7 @@ int modlib_read(FAR struct mod_loadinfo_s *loadinfo, FAR uint8_t *buffer, rpos = lseek(loadinfo->filfd, offset, SEEK_SET); if (rpos != offset) { - int errval = errno; + int errval = get_errno(); serr("ERROR: Failed to seek to position %lu: %d\n", (unsigned long)offset, errval); return -errval; diff --git a/libc/netdb/lib_dnsaddserver.c b/libc/netdb/lib_dnsaddserver.c index 3efbeb9ca0..21de6bcbaa 100644 --- a/libc/netdb/lib_dnsaddserver.c +++ b/libc/netdb/lib_dnsaddserver.c @@ -90,7 +90,7 @@ int dns_add_nameserver(FAR const struct sockaddr *addr, socklen_t addrlen) stream = fopen(CONFIG_NETDB_RESOLVCONF_PATH, "at"); if (stream == NULL) { - int errcode = errno; + int errcode = get_errno(); nerr("ERROR: Failed to open %s: %d\n", CONFIG_NETDB_RESOLVCONF_PATH, errcode); DEBUGASSERT(errcode > 0); diff --git a/libc/netdb/lib_dnsforeach.c b/libc/netdb/lib_dnsforeach.c index cc34b1658f..ab02f85a0b 100644 --- a/libc/netdb/lib_dnsforeach.c +++ b/libc/netdb/lib_dnsforeach.c @@ -104,7 +104,7 @@ int dns_foreach_nameserver(dns_callback_t callback, FAR void *arg) stream = fopen(CONFIG_NETDB_RESOLVCONF_PATH, "rb"); if (stream == NULL) { - int errcode = errno; + int errcode = get_errno(); nerr("ERROR: Failed to open %s: %d\n", CONFIG_NETDB_RESOLVCONF_PATH, errcode); DEBUGASSERT(errcode > 0); diff --git a/libc/netdb/lib_gethostbyaddrr.c b/libc/netdb/lib_gethostbyaddrr.c index 53e91fda34..8366425b16 100644 --- a/libc/netdb/lib_gethostbyaddrr.c +++ b/libc/netdb/lib_gethostbyaddrr.c @@ -263,7 +263,7 @@ int lib_hostfile_lookup(FAR const void *addr, socklen_t len, int type, stream = fopen(CONFIG_NETDB_HOSTCONF_PATH, "r"); if (stream == NULL) { - int errcode = errno; + int errcode = get_errno(); nerr("ERROR: Failed to open the hosts file %s: %d\n", CONFIG_NETDB_HOSTCONF_PATH, errcode); diff --git a/libc/netdb/lib_gethostbynamer.c b/libc/netdb/lib_gethostbynamer.c index 8ad93ac6f3..d1a2e5fb2d 100644 --- a/libc/netdb/lib_gethostbynamer.c +++ b/libc/netdb/lib_gethostbynamer.c @@ -597,7 +597,7 @@ static int lib_hostfile_lookup(FAR const char *name, FAR struct hostent *host, stream = fopen(CONFIG_NETDB_HOSTCONF_PATH, "r"); if (stream == NULL) { - int errcode = errno; + int errcode = get_errno(); nerr("ERROR: Failed to open the hosts file %s: %d\n", CONFIG_NETDB_HOSTCONF_PATH, errcode); diff --git a/libc/pthread/pthread_setcancelstate.c b/libc/pthread/pthread_setcancelstate.c index e81a4440f7..457d26f1ab 100644 --- a/libc/pthread/pthread_setcancelstate.c +++ b/libc/pthread/pthread_setcancelstate.c @@ -85,7 +85,7 @@ int pthread_setcancelstate(int state, FAR int *oldstate) ret = task_setcancelstate(state, oldstate); if (ret < 0) { - ret = errno; + ret = get_errno(); } return ret; diff --git a/libc/pthread/pthread_setcanceltype.c b/libc/pthread/pthread_setcanceltype.c index 583376dfcc..590fa03b8c 100644 --- a/libc/pthread/pthread_setcanceltype.c +++ b/libc/pthread/pthread_setcanceltype.c @@ -85,7 +85,7 @@ int pthread_setcanceltype(int type, FAR int *oldtype) ret = task_setcanceltype(type, oldtype); if (ret < 0) { - ret = errno; + ret = get_errno(); } return ret; diff --git a/libc/stdio/lib_fclose.c b/libc/stdio/lib_fclose.c index 022d7bde8e..374e9f4e53 100644 --- a/libc/stdio/lib_fclose.c +++ b/libc/stdio/lib_fclose.c @@ -89,7 +89,7 @@ int fclose(FAR FILE *stream) if ((stream->fs_oflags & O_WROK) != 0) { ret = lib_fflush(stream, true); - errcode = errno; + errcode = get_errno(); } /* Close the underlying file descriptor and save the return status */ @@ -103,7 +103,7 @@ int fclose(FAR FILE *stream) if (ret == OK) { ret = status; - errcode = errno; + errcode = get_errno(); } } diff --git a/libc/stdlib/lib_wctomb.c b/libc/stdlib/lib_wctomb.c index cef60ad149..f60f347829 100644 --- a/libc/stdlib/lib_wctomb.c +++ b/libc/stdlib/lib_wctomb.c @@ -66,7 +66,7 @@ int wctomb(FAR char *s, wchar_t wc) if ((size_t) wc >= 0x100) { - errno = EILSEQ; + set_errno(EILSEQ); return -1; } diff --git a/libc/time/lib_localtime.c b/libc/time/lib_localtime.c index ac5cd64f64..f1fc6ae083 100644 --- a/libc/time/lib_localtime.c +++ b/libc/time/lib_localtime.c @@ -2374,7 +2374,7 @@ static time_t time1(FAR struct tm *const tmp, if (tmp == NULL) { - errno = EINVAL; + set_errno(EINVAL); return -1; } diff --git a/libc/wqueue/work_signal.c b/libc/wqueue/work_signal.c index da8b174cd5..53fc8f829d 100644 --- a/libc/wqueue/work_signal.c +++ b/libc/wqueue/work_signal.c @@ -98,7 +98,7 @@ int work_signal(int qid) ret = kill(g_usrwork.pid, SIGWORK); if (ret < 0) { - int errcode = errno; + int errcode = get_errno(); ret = -errcode; } } diff --git a/libc/wqueue/work_usrthread.c b/libc/wqueue/work_usrthread.c index 17d3b10f25..5e919d8e0a 100644 --- a/libc/wqueue/work_usrthread.c +++ b/libc/wqueue/work_usrthread.c @@ -360,7 +360,7 @@ int work_usrstart(void) DEBUGASSERT(g_usrwork.pid > 0); if (g_usrwork.pid < 0) { - int errcode = errno; + int errcode = get_errno(); DEBUGASSERT(errcode > 0); return -errcode; } diff --git a/mm/mm_heap/mm_sem.c b/mm/mm_heap/mm_sem.c index fae3b27867..51eda272a5 100644 --- a/mm/mm_heap/mm_sem.c +++ b/mm/mm_heap/mm_sem.c @@ -200,7 +200,7 @@ void mm_takesemaphore(FAR struct mm_heap_s *heap) #if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__) DEBUGASSERT(ret == -EINTR); #else - int errcode = errno; + int errcode = get_errno(); DEBUGASSERT(errcode == EINTR); ret = -errcode; #endif diff --git a/net/route/net_fileroute.c b/net/route/net_fileroute.c index 32074efd85..8cbdd517ce 100644 --- a/net/route/net_fileroute.c +++ b/net/route/net_fileroute.c @@ -170,7 +170,7 @@ int net_routesize(FAR const char *path, size_t entrysize) * created yet? */ - errcode = errno; + errcode = get_errno(); if (errcode == ENOENT) { /* The routing table file has not been created. Return size zero. */ diff --git a/sched/wqueue/kwork_hpthread.c b/sched/wqueue/kwork_hpthread.c index 8a3d3f0e88..59aa0391be 100644 --- a/sched/wqueue/kwork_hpthread.c +++ b/sched/wqueue/kwork_hpthread.c @@ -162,7 +162,7 @@ int work_hpstart(void) DEBUGASSERT(pid > 0); if (pid < 0) { - int errcode = errno; + int errcode = get_errno(); DEBUGASSERT(errcode > 0); serr("ERROR: kthread_create failed: %d\n", errcode); diff --git a/sched/wqueue/kwork_lpthread.c b/sched/wqueue/kwork_lpthread.c index 4b6b3ee997..daebd137ad 100644 --- a/sched/wqueue/kwork_lpthread.c +++ b/sched/wqueue/kwork_lpthread.c @@ -209,7 +209,7 @@ int work_lpstart(void) DEBUGASSERT(pid > 0); if (pid < 0) { - int errcode = errno; + int errcode = get_errno(); DEBUGASSERT(errcode > 0); serr("ERROR: kthread_create %d failed: %d\n", wndx, errcode); -- GitLab From d295f11a3a2ce9e1299ff454c1f630598a9f473c Mon Sep 17 00:00:00 2001 From: Masayuki Ishikawa Date: Wed, 31 Jan 2018 11:23:22 +0900 Subject: [PATCH 140/228] SMP: Introduce a new global IRQ clearing logic and tasklist protection. The previous implementation of clearing global IRQ in sched_addreadytorun() and sched_removereadytorun() was done too early. As a result, nxsem_post() would have a chance to enter the critical section even nxsem_wait() is still not in blocked state. This patch moves clearing global IRQ controls from sched_addreadytorun() and sched_removereadytorun() to sched_resumescheduler() to ensure that nxsem_post() can enter the critical section correctly. For this change, sched_resumescheduler.c is always necessary for SMP configuration. In addition, by this change, task_exit() had to be modified so that it calls sched_resumescheduler() because it calls sched_removescheduler() inside the function, otherwise it will cause a deadlock. However, I encountered another DEBUGASSERT() in sched_cpu_select() during HTTP streaming aging test on lc823450-xgevk. Actually sched_cpu_select() accesses the g_assignedtasks which might be changed by another CPU. Similarly, other tasklists might be modified simultaneously if both CPUs are executing scheduling logic. To avoid this, I introduced tasklist protetion APIs. With these changes, SMP kernel stability has been much improved. Signed-off-by: Masayuki Ishikawa --- include/nuttx/sched.h | 2 +- sched/sched/Make.defs | 6 ++ sched/sched/sched.h | 8 ++ sched/sched/sched_addblocked.c | 12 +++ sched/sched/sched_addreadytorun.c | 14 ++- sched/sched/sched_mergepending.c | 15 ++- sched/sched/sched_mergeprioritized.c | 19 +++- sched/sched/sched_removereadytorun.c | 16 +++- sched/sched/sched_resumescheduler.c | 42 ++++++++- sched/sched/sched_tasklistlock.c | 133 +++++++++++++++++++++++++++ sched/task/task_exit.c | 8 ++ 11 files changed, 259 insertions(+), 16 deletions(-) create mode 100644 sched/sched/sched_tasklistlock.c diff --git a/include/nuttx/sched.h b/include/nuttx/sched.h index 10cbcbefc8..3810962c8b 100644 --- a/include/nuttx/sched.h +++ b/include/nuttx/sched.h @@ -883,7 +883,7 @@ void task_vforkabort(FAR struct task_tcb_s *child, int errcode); ********************************************************************************/ #if CONFIG_RR_INTERVAL > 0 || defined(CONFIG_SCHED_SPORADIC) || \ - defined(CONFIG_SCHED_INSTRUMENTATION) + defined(CONFIG_SCHED_INSTRUMENTATION) || defined(CONFIG_SMP) void sched_resume_scheduler(FAR struct tcb_s *tcb); #else # define sched_resume_scheduler(tcb) diff --git a/sched/sched/Make.defs b/sched/sched/Make.defs index 0626d9e39b..c9088453c0 100644 --- a/sched/sched/Make.defs +++ b/sched/sched/Make.defs @@ -77,6 +77,8 @@ else ifeq ($(CONFIG_SCHED_SPORADIC),y) CSRCS += sched_resumescheduler.c else ifeq ($(CONFIG_SCHED_INSTRUMENTATION),y) CSRCS += sched_resumescheduler.c +else ifeq ($(CONFIG_SMP),y) +CSRCS += sched_resumescheduler.c endif ifeq ($(CONFIG_SCHED_CPULOAD),y) @@ -96,6 +98,10 @@ ifeq ($(CONFIG_SCHED_INSTRUMENTATION_BUFFER),y) CSRCS += sched_note.c endif +ifeq ($(CONFIG_SMP),y) +CSRCS += sched_tasklistlock.c +endif + # Include sched build support DEPPATH += --dep-path sched diff --git a/sched/sched/sched.h b/sched/sched/sched.h index e05b88692c..63c081de85 100644 --- a/sched/sched/sched.h +++ b/sched/sched/sched.h @@ -364,6 +364,10 @@ extern volatile spinlock_t g_cpu_schedlock SP_SECTION; extern volatile spinlock_t g_cpu_locksetlock SP_SECTION; extern volatile cpu_set_t g_cpu_lockset SP_SECTION; +/* Used to lock tasklist to prevent from concurrent access */ + +extern volatile spinlock_t g_cpu_tasklistlock SP_SECTION; + #endif /* CONFIG_SMP */ /**************************************************************************** @@ -425,6 +429,10 @@ void sched_sporadic_lowpriority(FAR struct tcb_s *tcb); #ifdef CONFIG_SMP int sched_cpu_select(cpu_set_t affinity); int sched_cpu_pause(FAR struct tcb_s *tcb); + +irqstate_t sched_tasklist_lock(void); +void sched_tasklist_unlock(irqstate_t lock); + # define sched_islocked(tcb) spin_islocked(&g_cpu_schedlock) #else # define sched_cpu_select(a) (0) diff --git a/sched/sched/sched_addblocked.c b/sched/sched/sched_addblocked.c index 34303681c5..151faedb69 100644 --- a/sched/sched/sched_addblocked.c +++ b/sched/sched/sched_addblocked.c @@ -77,6 +77,12 @@ void sched_addblocked(FAR struct tcb_s *btcb, tstate_t task_state) DEBUGASSERT(task_state >= FIRST_BLOCKED_STATE && task_state <= LAST_BLOCKED_STATE); +#ifdef CONFIG_SMP + /* Lock the tasklists before accessing */ + + irqstate_t lock = sched_tasklist_lock(); +#endif + /* Add the TCB to the blocked task list associated with this state. */ tasklist = TLIST_BLOCKED(task_state); @@ -96,6 +102,12 @@ void sched_addblocked(FAR struct tcb_s *btcb, tstate_t task_state) dq_addlast((FAR dq_entry_t *)btcb, tasklist); } +#ifdef CONFIG_SMP + /* Unlock the tasklists */ + + sched_tasklist_unlock(lock); +#endif + /* Make sure the TCB's state corresponds to the list */ btcb->task_state = task_state; diff --git a/sched/sched/sched_addreadytorun.c b/sched/sched/sched_addreadytorun.c index dcd07ac9a6..880f4b85bb 100644 --- a/sched/sched/sched_addreadytorun.c +++ b/sched/sched/sched_addreadytorun.c @@ -173,6 +173,10 @@ bool sched_addreadytorun(FAR struct tcb_s *btcb) int cpu; int me; + /* Lock the tasklists before accessing */ + + irqstate_t lock = sched_tasklist_lock(); + /* Check if the blocked TCB is locked to this CPU */ if ((btcb->flags & TCB_FLAG_CPU_LOCKED) != 0) @@ -339,10 +343,9 @@ bool sched_addreadytorun(FAR struct tcb_s *btcb) else if (g_cpu_nestcount[me] <= 0) { - /* Release our hold on the IRQ lock. */ - - spin_clrbit(&g_cpu_irqset, cpu, &g_cpu_irqsetlock, - &g_cpu_irqlock); + /* Do nothing here + * NOTE: spin_clrbit() will be done in sched_resumescheduler() + */ } /* Sanity check. g_cpu_netcount should be greater than zero @@ -426,6 +429,9 @@ bool sched_addreadytorun(FAR struct tcb_s *btcb) } } + /* Unlock the tasklists */ + + sched_tasklist_unlock(lock); return doswitch; } diff --git a/sched/sched/sched_mergepending.c b/sched/sched/sched_mergepending.c index 39968e6e11..6e258c7554 100644 --- a/sched/sched/sched_mergepending.c +++ b/sched/sched/sched_mergepending.c @@ -199,6 +199,10 @@ bool sched_mergepending(void) int cpu; int me; + /* Lock the tasklist before accessing */ + + irqstate_t lock = sched_tasklist_lock(); + /* Remove and process every TCB in the g_pendingtasks list. * * Do nothing if (1) pre-emption is still disabled (by any CPU), or (2) if @@ -215,7 +219,7 @@ bool sched_mergepending(void) { /* The pending task list is empty */ - return ret; + goto errout_with_lock; } cpu = sched_cpu_select(ALL_CPUS /* ptcb->affinity */); @@ -259,7 +263,7 @@ bool sched_mergepending(void) * pending task list. */ - return ret; + goto errout_with_lock; } /* Set up for the next time through the loop */ @@ -269,7 +273,7 @@ bool sched_mergepending(void) { /* The pending task list is empty */ - return ret; + goto errout_with_lock; } cpu = sched_cpu_select(ALL_CPUS /* ptcb->affinity */); @@ -285,6 +289,11 @@ bool sched_mergepending(void) TSTATE_TASK_READYTORUN); } +errout_with_lock: + + /* Unlock the tasklist */ + + sched_tasklist_unlock(lock); return ret; } #endif /* CONFIG_SMP */ diff --git a/sched/sched/sched_mergeprioritized.c b/sched/sched/sched_mergeprioritized.c index 90ef9dfbad..7ff70b14df 100644 --- a/sched/sched/sched_mergeprioritized.c +++ b/sched/sched/sched_mergeprioritized.c @@ -83,6 +83,12 @@ void sched_mergeprioritized(FAR dq_queue_t *list1, FAR dq_queue_t *list2, FAR struct tcb_s *tcb2; FAR struct tcb_s *tmp; +#ifdef CONFIG_SMP + /* Lock the tasklists before accessing */ + + irqstate_t lock = sched_tasklist_lock(); +#endif + DEBUGASSERT(list1 != NULL && list2 != NULL); /* Get a private copy of list1, clearing list1. We do this early so that @@ -99,7 +105,7 @@ void sched_mergeprioritized(FAR dq_queue_t *list1, FAR dq_queue_t *list2, { /* Special case.. list1 is empty. There is nothing to be done. */ - return; + goto ret_with_lock; } /* Now the TCBs are no longer accessible and we can change the state on @@ -122,7 +128,7 @@ void sched_mergeprioritized(FAR dq_queue_t *list1, FAR dq_queue_t *list2, /* Special case.. list2 is empty. Move list1 to list2. */ dq_move(&clone, list2); - return; + goto ret_with_lock; } /* Now loop until all entries from list1 have been merged into list2. tcb1 @@ -171,4 +177,13 @@ void sched_mergeprioritized(FAR dq_queue_t *list1, FAR dq_queue_t *list2, } } while (tcb1 != NULL); + +ret_with_lock: + +#ifdef CONFIG_SMP + /* Unlock the tasklists */ + + sched_tasklist_unlock(lock); +#endif + return; } diff --git a/sched/sched/sched_removereadytorun.c b/sched/sched/sched_removereadytorun.c index 231310f62d..f5e93b881c 100644 --- a/sched/sched/sched_removereadytorun.c +++ b/sched/sched/sched_removereadytorun.c @@ -42,6 +42,7 @@ #include #include #include +#include #include "irq/irq.h" #include "sched/sched.h" @@ -138,6 +139,10 @@ bool sched_removereadytorun(FAR struct tcb_s *rtcb) bool doswitch = false; int cpu; + /* Lock the tasklists before accessing */ + + irqstate_t lock = sched_tasklist_lock(); + /* Which CPU (if any) is the task running on? Which task list holds the * TCB? */ @@ -283,10 +288,9 @@ bool sched_removereadytorun(FAR struct tcb_s *rtcb) else if (g_cpu_nestcount[me] <= 0) { - /* Release our hold on the IRQ lock. */ - - spin_clrbit(&g_cpu_irqset, cpu, &g_cpu_irqsetlock, - &g_cpu_irqlock); + /* Do nothing here + * NOTE: spin_clrbit() will be done in sched_resumescheduler() + */ } /* Sanity check. g_cpu_netcount should be greater than zero @@ -330,6 +334,10 @@ bool sched_removereadytorun(FAR struct tcb_s *rtcb) /* Since the TCB is no longer in any list, it is now invalid */ rtcb->task_state = TSTATE_TASK_INVALID; + + /* Unlock the tasklists */ + + sched_tasklist_unlock(lock); return doswitch; } #endif /* CONFIG_SMP */ diff --git a/sched/sched/sched_resumescheduler.c b/sched/sched/sched_resumescheduler.c index 96097d4fcd..08f104a5d8 100644 --- a/sched/sched/sched_resumescheduler.c +++ b/sched/sched/sched_resumescheduler.c @@ -45,10 +45,11 @@ #include #include +#include "irq/irq.h" #include "sched/sched.h" #if CONFIG_RR_INTERVAL > 0 || defined(CONFIG_SCHED_SPORADIC) || \ - defined(CONFIG_SCHED_INSTRUMENTATION) + defined(CONFIG_SCHED_INSTRUMENTATION) || defined(CONFIG_SMP) /**************************************************************************** * Public Functions @@ -101,7 +102,44 @@ void sched_resume_scheduler(FAR struct tcb_s *tcb) sched_note_resume(tcb); #endif +#ifdef CONFIG_SMP + /* NOTE: The following logic for adjusting global IRQ controls were + * derived from sched_addreadytorun() and sched_removedreadytorun() + * Here, we only handles clearing logic to defer unlocking IRQ lock + * followed by context switching. + */ + + int me = this_cpu(); + + /* Adjust global IRQ controls. If irqcount is greater than zero, + * then this task/this CPU holds the IRQ lock + */ + + if (tcb->irqcount > 0) + { + /* Do notihing here + * NOTE: spin_setbit() is done in sched_addreadytorun() + * and sched_removereadytorun() + */ + } + + /* No.. This CPU will be relinquishing the lock. But this works + * differently if we are performing a context switch from an + * interrupt handler and the interrupt handler has established + * a critical section. We can detect this case when + * g_cpu_nestcount[me] > 0. + */ + + else if (g_cpu_nestcount[me] <= 0) + { + /* Release our hold on the IRQ lock. */ + + spin_clrbit(&g_cpu_irqset, me, &g_cpu_irqsetlock, + &g_cpu_irqlock); + } +#endif /* CONFIG_SMP */ + } #endif /* CONFIG_RR_INTERVAL > 0 || CONFIG_SCHED_SPORADIC || \ - * CONFIG_SCHED_INSTRUMENTATION */ + * CONFIG_SCHED_INSTRUMENTATION || CONFIG_SMP */ diff --git a/sched/sched/sched_tasklistlock.c b/sched/sched/sched_tasklistlock.c new file mode 100644 index 0000000000..d8946d4b74 --- /dev/null +++ b/sched/sched/sched_tasklistlock.c @@ -0,0 +1,133 @@ +/**************************************************************************** + * sched/sched/sched_tasklistlock.c + * + * Copyright (C) 2018 Sony Corporation. All rights reserved. + * Author: Masayuki Ishikawa + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +#include +#include + +#include "sched/sched.h" + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/* Splinlock to protect the tasklists */ + +static volatile spinlock_t g_tasklist_lock SP_SECTION = SP_UNLOCKED; + +/* Handles nested calls */ + +static volatile uint8_t g_tasklist_lock_count[CONFIG_SMP_NCPUS]; + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: sched_tasklist_lock() + * + * Description: + * Disable local interrupts and take the global spinlock (g_tasklist_lock) + * if the call counter (g_tasklist_lock_count[cpu]) equals to 0. Then the + * counter on the CPU is incremented to allow nested call. + * + * NOTE: This API is used to protect tasklists in the scheduler. So do not + * use this API for other purposes. + * + * Returned Value: + * An opaque, architecture-specific value that represents the state of + * the interrupts prior to the call to sched_tasklist_lock(); + ****************************************************************************/ + +irqstate_t sched_tasklist_lock(void) +{ + int me; + irqstate_t ret; + + ret = up_irq_save(); + me = this_cpu(); + + if (0 == g_tasklist_lock_count[me]) + { + spin_lock(&g_tasklist_lock); + } + + g_tasklist_lock_count[me]++; + ASSERT(0 != g_tasklist_lock_count[me]); + return ret; +} + +/**************************************************************************** + * Name: sched_tasklist_unlock() + * + * Description: + * Decrement the call counter (g_tasklist_lock_count[cpu]) and if it + * decrements to zero then release the spinlock (g_tasklist_lock) and + * restore the interrupt state as it was prior to the previous call to + * sched_tasklist_lock(). + * + * NOTE: This API is used to protect tasklists in the scheduler. So do not + * use this API for other purposes. + * + * Input Parameters: + * lock - The architecture-specific value that represents the state of + * the interrupts prior to the call to sched_tasklist_lock(). + * + * Returned Value: + * None + ****************************************************************************/ + +void sched_tasklist_unlock(irqstate_t lock) +{ + int me; + + me = this_cpu(); + + ASSERT(0 < g_tasklist_lock_count[me]); + g_tasklist_lock_count[me]--; + + if (0 == g_tasklist_lock_count[me]) + { + spin_unlock(&g_tasklist_lock); + } + + up_irq_restore(lock); +} diff --git a/sched/task/task_exit.c b/sched/task/task_exit.c index 6a04073f29..f42ef1421e 100644 --- a/sched/task/task_exit.c +++ b/sched/task/task_exit.c @@ -97,6 +97,14 @@ int task_exit(void) (void)sched_removereadytorun(dtcb); rtcb = this_task(); +#ifdef CONFIG_SMP + /* Because clearing the global IRQ control in sched_removereadytorun() + * was moved to sched_resume_scheduler(). So call the API here. + */ + + sched_resume_scheduler(rtcb); +#endif + /* We are now in a bad state -- the head of the ready to run task list * does not correspond to the thread that is running. Disabling pre- * emption on this TCB and marking the new ready-to-run task as not -- GitLab From 1f10a9c576c0aa6d50242331c73c97936f9d1596 Mon Sep 17 00:00:00 2001 From: Matt Thompson Date: Wed, 31 Jan 2018 13:29:23 +0000 Subject: [PATCH 141/228] Merged in extent3d/nuttx/i2c (pull request #588) SAMDL: Added I2S register definitions Approved-by: Gregory Nutt --- arch/arm/src/samdl/chip/samd_gclk.h | 4 +- arch/arm/src/samdl/chip/samd_i2s.h | 203 +++++++++++++++++++++++++++ arch/arm/src/samdl/chip/samd_pm.h | 2 +- arch/arm/src/samdl/samd_periphclks.h | 6 +- 4 files changed, 209 insertions(+), 6 deletions(-) create mode 100644 arch/arm/src/samdl/chip/samd_i2s.h diff --git a/arch/arm/src/samdl/chip/samd_gclk.h b/arch/arm/src/samdl/chip/samd_gclk.h index 5426dc394d..56ec14f2f6 100644 --- a/arch/arm/src/samdl/chip/samd_gclk.h +++ b/arch/arm/src/samdl/chip/samd_gclk.h @@ -158,8 +158,8 @@ # define GCLK_CLKCTRL_ID_ACANA (32 << GCLK_CLKCTRL_ID_SHIFT) /* AC_ANA */ # define GCLK_CLKCTRL_ID_DAC (33 << GCLK_CLKCTRL_ID_SHIFT) /* DAC */ # define GCLK_CLKCTRL_ID_PTC (34 << GCLK_CLKCTRL_ID_SHIFT) /* PTC */ -# define GCLK_CLKCTRL_I2S0_PTC (35 << GCLK_CLKCTRL_ID_SHIFT) /* I2S0 */ -# define GCLK_CLKCTRL_I2S1_PTC (36 << GCLK_CLKCTRL_ID_SHIFT) /* I2S1 */ +# define GCLK_CLKCTRL_ID_I2S0 (35 << GCLK_CLKCTRL_ID_SHIFT) /* I2S0 */ +# define GCLK_CLKCTRL_ID_I2S1 (36 << GCLK_CLKCTRL_ID_SHIFT) /* I2S1 */ #endif #define GCLK_CLKCTRL_GEN_SHIFT (8) /* Bits 8-11: Generic Clock Generator */ diff --git a/arch/arm/src/samdl/chip/samd_i2s.h b/arch/arm/src/samdl/chip/samd_i2s.h new file mode 100644 index 0000000000..87a4cf7daf --- /dev/null +++ b/arch/arm/src/samdl/chip/samd_i2s.h @@ -0,0 +1,203 @@ +/******************************************************************************************** + * arch/arm/src/samdl/chip/samd_i2s.h + * + * Copyright (C) 2018 Gregory Nutt. All rights reserved. + * Author: Matt Thompson + * + * References: + * "Microchip SAMD21 datasheet" + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ********************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_SAMDL_CHIP_SAMD_I2S_H +#define __ARCH_ARM_SRC_SAMDL_CHIP_SAMD_I2S_H + +/******************************************************************************************** + * Included Files + ********************************************************************************************/ + +#include + +#include "chip.h" + +#ifdef CONFIG_ARCH_FAMILY_SAMD21 + +/******************************************************************************************** + * Pre-processor Definitions + ********************************************************************************************/ +/* I2S register offsets *********************************************************************/ + +#define SAM_I2S_CTRLA_OFFSET 0x0000 /* Control A register */ +#define SAM_I2S_CLKCTRL0_OFFSET 0x0004 /* Clock Control 0 register */ +#define SAM_I2S_CLKCTRL1_OFFSET 0x0008 /* Clock Control 1 register */ +#define SAM_I2S_INTENCLR_OFFSET 0x000C /* Interrupt enable clear register */ +#define SAM_I2S_INTENSET_OFFSET 0x0010 /* Interrupt enable set register */ +#define SAM_I2S_INTFLAG_OFFSET 0x0014 /* Interrupt flag register */ +#define SAM_I2S_SYNCBUSY_OFFSET 0x0018 /* Sync Busy register */ +#define SAM_I2S_SERCTRL0_OFFSET 0x0020 /* Serializer 0 Control register */ +#define SAM_I2S_SERCTRL1_OFFSET 0x0024 /* Serializer 1 Control register */ +#define SAM_I2S_DATA0_OFFSET 0x0030 /* Data 0 register */ +#define SAM_I2S_DATA1_OFFSET 0x0034 /* Data 1 register */ + +/* I2S register addresses ******************************************************************/ + +#define SAM_I2S_CTRLA (SAM_I2S_BASE+SAM_I2S_CTRLA_OFFSET) +#define SAM_I2S_CLKCTRL0 (SAM_I2S_BASE+SAM_I2S_CLKCTRL0_OFFSET) +#define SAM_I2S_CLKCTRL1 (SAM_I2S_BASE+SAM_I2S_CLKCTRL1_OFFSET) +#define SAM_I2S_INTENCLR (SAM_I2S_BASE+SAM_I2S_INTENCLR_OFFSET) +#define SAM_I2S_INTENSET (SAM_I2S_BASE+SAM_I2S_INTENSET_OFFSET) +#define SAM_I2S_INTFLAG (SAM_I2S_BASE+SAM_I2S_INTFLAG_OFFSET) +#define SAM_I2S_SYNCBUSY (SAM_I2S_BASE+SAM_I2S_SYNCBUSY_OFFSET) +#define SAM_I2S_SERCTRL0 (SAM_I2S_BASE+SAM_I2S_SERCTRL0_OFFSET) +#define SAM_I2S_SERCTRL1 (SAM_I2S_BASE+SAM_I2S_SERCTRL1_OFFSET) +#define SAM_I2S_DATA0 (SAM_I2S_BASE+SAM_I2S_DATA0_OFFSET) +#define SAM_I2S_DATA1 (SAM_I2S_BASE+SAM_I2S_DATA1_OFFSET) + +/* I2S register bit definitions ************************************************************/ + +/* Control A register */ + +#define I2S_CTRLA_SWRST (1 << 0) /* Bit 0: Software Reset */ +#define I2S_CTRLA_ENABLE (1 << 1) /* Bit 1: Enable */ +#define I2S_CTRLA_CKEN0 (1 << 2) /* Bit 2: Clock Unit 0 Enable */ +#define I2S_CTRLA_CKEN1 (1 << 3) /* Bit 3: Clock Unit 1 Enable */ +#define I2S_CTRLA_SEREN0 (1 << 4) /* Bit 4: Serializer 0 Enable */ +#define I2S_CTRLA_SEREN1 (1 << 5) /* Bit 5: Seriailier 1 Enable */ + +/* Clock Unit Control Register */ + +#define I2S_CLKCTRL_SLOTSIZE_SHIFT (0) /* Bits [1:0]: Slot Size */ +#define I2S_CLKCTRL_SLOTSIZE_MASK (3 << I2S_CLKCTRL_SLOTSIZE_SHIFT) +# define I2S_CLKCTRL_SLOTSIZE_8 (0 << I2S_CLKCTRL_SLOTSIZE_SHIFT) +# define I2S_CLKCTRL_SLOTSIZE_16 (1 << I2S_CLKCTRL_SLOTSIZE_SHIFT) +# define I2S_CLKCTRL_SLOTSIZE_24 (2 << I2S_CLKCTRL_SLOTSIZE_SHIFT) +# define I2S_CLKCTRL_SLOTSIZE_32 (3 << I2S_CLKCTRL_SLOTSIZE_SHIFT) +#define I2S_CLKCTRL_NBSLOTS_SHIFT (2) /* Bit 2: Number of Slots in Frame */ +#define I2S_CLKCTRL_NBSLOTS_MASK (7 << I2S_CLKCTRL_NBSLOTS_SHIFT) +#define I2S_CLKCTRL_NBSLOTS(n) (((n) & 0x7) << I2S_CLKCTRL_NBSLOTS_SHIFT) +#define I2S_CLKCTRL_FSWIDTH_SHIFT (5) /* Bits [6:5]: Frame Sync Width */ +#define I2S_CLKCTRL_FSWIDTH_MASK (3 << I2S_CLKCTRL_FSWIDTH_SHIFT) +# define I2S_CLKCTRL_FSWIDTH_SLOT (0 << I2S_CLKCTRL_FSWIDTH_SHIFT) +# define I2S_CLKCTRL_FSWIDTH_HALF (1 << I2S_CLKCTRL_FSWIDTH_SHIFT) +# define I2S_CLKCTRL_FSWIDTH_BIT (2 << I2S_CLKCTRL_FSWIDTH_SHIFT) +# define I2S_CLKCTRL_FSWIDTH_BURST (3 << I2S_CLKCTRL_FSWIDTH_SHIFT) +#define I2S_CLKCTRL_BITDELAY (1 << 7) /* Bit 7: Data Delay from Frame Sync */ +#define I2S_CLKCTRL_FSSEL (1 << 8) /* Bit 8: Frame Sync Select */ +#define I2S_CLKCTRL_FSINV (1 << 11) /* Bit 11: Frame Sync Invert */ +#define I2S_CLKCTRL_SCKSEL (1 << 12) /* Bit 12: Serial Clock Select. 0: Divided Master clock, 1: SCKn input pin */ +#define I2S_CLKCTRL_MCKSEL (1 << 16) /* Bit 16: Master Clock Select. 0: GCLK, 1: MCKn input pin */ +#define I2S_CLKCTRL_MCKEN (1 << 18) /* Bit 18: Master Clock Enable */ +#define I2S_CLKCTRL_MCKDIV_SHIFT (19) /* Bits [23:19]: Master Clock Division Factor */ +#define I2S_CLKCTRL_MCKDIV_MASK (0x1f << I2S_CLKCTRL_MCKDIV_SHIFT) +#define I2S_CLKCTRL_MCKDIV(n) (((n) & 0x1f) << I2S_CLKCTRL_MCKDIV_SHIFT) +#define I2S_CLKCTRL_MCKOUTDIV_SHIFT (24) /* Bits [28:24]: Master Clock Output Division Factor */ +#define I2S_CLKCTRL_MCKOUTDIV_MASK (0x1f << I2S_CLKCTRL_MCKOUTDIV_SHIFT) +#define I2S_CLKCTRL_MCKOUTDIV(n) (((n) & 0x1f) << I2S_CLKCTRL_MCKOUTDIV_SHIFT) +#define I2S_CLKCTRL_FSOUTINV (1 << 29) /* Bit 29: Frame Sync Output Invert */ +#define I2S_CLKCTRL_SCKOUTINV (1 << 30) /* Bit 30: Serial Clock Output Invert */ +#define I2S_CLKCTRL_MCKOUTINV (1 << 31) /* Bit 31: Master Clock Output Invert */ + +/* Interrupt register bits */ + +#define I2S_INT_RXRDY0 (1 << 0) /* Bit 0: Receive Ready 0 */ +#define I2S_INT_RXRDY1 (1 << 1) /* Bit 1: Receive Ready 1 */ +#define I2S_INT_RXOR0 (1 << 4) /* Bit 4: Receive Overrun 0 */ +#define I2S_INT_RXOR1 (1 << 5) /* Bit 5: Receive Overrun 1 */ +#define I2S_INT_TXRDY0 (1 << 8) /* Bit 8: Transmit Ready 0 */ +#define I2S_INT_TXRDY1 (1 << 9) /* Bit 9: Transmit Ready 1 */ +#define I2S_INT_TXUR0 (1 << 12) /* Bit 12: Transmit Underrun 0 */ +#define I2S_INT_TXUR1 (1 << 13) /* Bit 13: Transmit Underrun 1 */ +#define I2S_INT_ALL (0x3333) + +/* Sync Busy register bits */ + +#define I2S_SYNCBUSY_SWRST (1 << 0) /* Bit 0: Software Reset Sync Status */ +#define I2S_SYNCBUSY_ENABLE (1 << 1) /* Bit 1: Enable Sync Status */ +#define I2S_SYNCBUSY_CKEN0 (1 << 2) /* Bit 2: Clock Unit 0 Sync Status */ +#define I2S_SYNCBUSY_CKEN1 (1 << 3) /* Bit 3: Clock Unit 1 Sync Status */ +#define I2S_SYNCBUSY_SEREN0 (1 << 4) /* Bit 4: Serializer 0 Enable Sync Status */ +#define I2S_SYNCBUSY_SEREN1 (1 << 5) /* Bit 5: Seriaiizer 1 Enable Sync Status */ +#define I2S_SYNCBUSY_DATA0 (1 << 8) /* Bit 8: Data 0 Sync Status */ +#define I2S_SYNCBUSY_DATA1 (1 << 9) /* Bit 9: Data 1 Sync Status */ + +/* Serializer Control register bits */ + +#define I2S_SERCTRL_SERMODE_SHIFT (0) /* Bits [1:0]: Seriailizer Mode */ +#define I2S_SERCTRL_SERMODE_MASK (3 << I2S_SERCTRL_SERMODE_SHIFT) +# define I2S_SERCTRL_SERMODE_RX (0 << I2S_SERCTRL_SERMODE_SHIFT) +# define I2S_SERCTRL_SERMODE_TX (1 << I2S_SERCTRL_SERMODE_SHIFT) +# define I2S_SERCTRL_SERMODE_PDM2 (2 << I2S_SERCTRL_SERMODE_SHIFT) +#define I2S_SERCTRL_TXDEFAULT_SHIFT (2) /* Bits [3:2]: Line Default when Slot Disabled */ +#define I2S_SERCTRL_TXDEFAULT_MASK (3 << I2S_SERCTRL_TXDEFAULT_SHIFT) +# define I2S_SERCTRL_TXDEFAULT_ZERO (0 << I2S_SERCTRL_TXDEFAULT_SHIFT) +# define I2S_SERCTRL_TXDEFAULT_ONE (1 << I2S_SERCTRL_TXDEFAULT_SHIFT) +# define I2S_SERCTRL_TXDEFAULT_HIZ (3 << I2S_SERCTRL_TXDEFAULT_SHIFT) +#define I2S_SERCTRL_TXSAME (1 << 4) /* Bit 4: Transmit last data when Underrun */ +#define I2S_SERCTRL_CLKSEL (1 << 5) /* Bit 5: Clock Unit Selection. 0: Use Clock 0, 1: Use Clock 1 */ +#define I2S_SERCTRL_SLOTADJ (1 << 7) /* Bit 7: Data slot formatting. 0: Right justified, 1: Left justified */ +#define I2S_SERCTRL_DATASIZE_SHIFT (8) /* Bits [10:8]: Data Word Size */ +#define I2S_SERCTRL_DATASIZE_MASK (7 << I2S_SERCTRL_DATASIZE_SHIFT) +# define I2S_SERCTRL_DATASIZE_32 (0 << I2S_SERCTRL_DATASIZE_SHIFT) +# define I2S_SERCTRL_DATASIZE_24 (1 << I2S_SERCTRL_DATASIZE_SHIFT) +# define I2S_SERCTRL_DATASIZE_20 (2 << I2S_SERCTRL_DATASIZE_SHIFT) +# define I2S_SERCTRL_DATASIZE_18 (3 << I2S_SERCTRL_DATASIZE_SHIFT) +# define I2S_SERCTRL_DATASIZE_16 (4 << I2S_SERCTRL_DATASIZE_SHIFT) +# define I2S_SERCTRL_DATASIZE_16C (5 << I2S_SERCTRL_DATASIZE_SHIFT) +# define I2S_SERCTRL_DATASIZE_8 (6 << I2S_SERCTRL_DATASIZE_SHIFT) +# define I2S_SERCTRL_DATASIZE_8C (7 << I2S_SERCTRL_DATASIZE_SHIFT) +#define I2S_SERCTRL_WORDADJ (1 << 12) /* Bit 12: Data word formatting. 0: Right justified, 1: Left justified */ +#define I2S_SERCTRL_EXTEND_SHIFT (13) /* Bits [14:13]: Data formatting bit extension */ +#define I2S_SERCTRL_EXTEND_MASK (3 << I2S_SERCTRL_EXTEND_SHIFT) +# define I2S_SERCTRL_EXTEND_ZERO (0 << I2S_SERCTRL_EXTEND_SHIFT) +# define I2S_SERCTRL_EXTEND_ONE (1 << I2S_SERCTRL_EXTEND_SHIFT) +# define I2S_SERCTRL_EXTEND_MSBIT (2 << I2S_SERCTRL_EXTEND_SHIFT) +# define I2S_SERCTRL_EXTEND_LSBIT (3 << I2S_SERCTRL_EXTEND_SHIFT) +#define I2S_SERCTRL_BITREV (1 << 15) /* Bit 15: Data formatting bit reverse */ +#define I2S_SERCTRL_SLOTDIS_SHIFT (16) /* Bits [23:16]: Slot x Disabled */ +#define I2S_SERCTRL_SLOTDIS_MASK (0xff << I2S_SERCTRL_SLOTDIS_SHIFT) +#define I2S_SERCTRL_SLOTDIS(n) (((n) & 0xff) << I2C_SERCTRL_SLOTDIS_SHIFT) +#define I2S_SERCTRL_MONO (1 << 24) /* Bit 24: Mono Mode */ +#define I2S_SERCTRL_DMA (1 << 25) /* Bit 25: Single or Multiple DMA channels */ +#define I2S_SERCTRL_RXLOOP (1 << 26) /* Bit 26: RX Loopback Test Mode */ + +/******************************************************************************************** + * Public Types + ********************************************************************************************/ + +/******************************************************************************************** + * Public Data + ********************************************************************************************/ + +/******************************************************************************************** + * Public Functions + ********************************************************************************************/ + +#endif /* CONFIG_ARCH_FAMILY_SAMD21 */ +#endif /* __ARCH_ARM_SRC_SAMDL_CHIP_SAMD_I2S_H */ diff --git a/arch/arm/src/samdl/chip/samd_pm.h b/arch/arm/src/samdl/chip/samd_pm.h index 7c3e7f0872..50f8551d31 100644 --- a/arch/arm/src/samdl/chip/samd_pm.h +++ b/arch/arm/src/samdl/chip/samd_pm.h @@ -228,7 +228,7 @@ #define PM_APBCMASK_PTC (1 << 19) /* Bit 19: PTC */ #ifdef CONFIG_ARCH_FAMILY_SAMD21 -# define PM_APBBMASK_I2S (1 << 20) /* Bit 20: Inter IC Sound */ +# define PM_APBCMASK_I2S (1 << 20) /* Bit 20: Inter IC Sound */ #endif /* Interrupt enable clear, Interrupt enable set, and Interrupt flag status and clear registers */ diff --git a/arch/arm/src/samdl/samd_periphclks.h b/arch/arm/src/samdl/samd_periphclks.h index e5de81f754..0130cb6372 100644 --- a/arch/arm/src/samdl/samd_periphclks.h +++ b/arch/arm/src/samdl/samd_periphclks.h @@ -107,7 +107,7 @@ #define sam_ptc_enableperiph() sam_apbc_enableperiph(PM_APBCMASK_PTC) #ifdef CONFIG_ARCH_FAMILY_SAMD21 -# define sam_i2s_enableperiph() sam_apbc_enableperiph(PM_APBBMASK_I2S) +# define sam_i2s_enableperiph() sam_apbc_enableperiph(PM_APBCMASK_I2S) #endif #define sam_apba_disableperiph(s) modifyreg32(SAM_PM_APBAMASK,s,0) @@ -167,7 +167,7 @@ #define sam_ptc_disableperiph() sam_apbc_disableperiph(PM_APBCMASK_PTC) #ifdef CONFIG_ARCH_FAMILY_SAMD21 -# define sam_i2s_disableperiph() sam_apbc_disableperiph(PM_APBBMASK_I2S) +# define sam_i2s_disableperiph() sam_apbc_disableperiph(PM_APBCMASK_I2S) #endif #define sam_apba_isenabled(s) (getreg32(SAM_PM_APBAMASK) & (s)) != 0) @@ -227,7 +227,7 @@ #define sam_ptc_isenabled() sam_apbc_isenabled(PM_APBCMASK_PTC) #ifdef CONFIG_ARCH_FAMILY_SAMD21 -# define sam_i2s_isenabled() sam_apbc_isenabled(PM_APBBMASK_I2S) +# define sam_i2s_isenabled() sam_apbc_isenabled(PM_APBCMASK_I2S) #endif /**************************************************************************** -- GitLab From a5cb1129f952127befd50b750c0096a37d639b8c Mon Sep 17 00:00:00 2001 From: Juha Niskanen Date: Wed, 31 Jan 2018 07:41:39 -0600 Subject: [PATCH 142/228] drivers/sensors/lis2dh: use realtime clock if monotonic is not available --- drivers/sensors/lis2dh.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/sensors/lis2dh.c b/drivers/sensors/lis2dh.c index 502246ee52..8efe51f133 100644 --- a/drivers/sensors/lis2dh.c +++ b/drivers/sensors/lis2dh.c @@ -1664,7 +1664,13 @@ static int lis2dh_reboot(FAR struct lis2dh_dev_s *dev) int32_t diff_msec; uint8_t value; + /* Prefer monotonic for timeout calculation when enabled. */ + +#ifdef CONFIG_CLOCK_MONOTONIC (void)clock_gettime(CLOCK_MONOTONIC, &start); +#else + (void)clock_gettime(CLOCK_REALTIME, &start); +#endif /* Reboot to reset chip. */ @@ -1689,7 +1695,11 @@ static int lis2dh_reboot(FAR struct lis2dh_dev_s *dev) break; } +#ifdef CONFIG_CLOCK_MONOTONIC (void)clock_gettime(CLOCK_MONOTONIC, &curr); +#else + (void)clock_gettime(CLOCK_REALTIME, &curr); +#endif diff_msec = (curr.tv_sec - start.tv_sec) * 1000; diff_msec += (curr.tv_nsec - start.tv_nsec) / (1000 * 1000); -- GitLab From a959d7fefad05608ac190e6f910919f4255519ef Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 31 Jan 2018 09:19:19 -0600 Subject: [PATCH 143/228] fs/aio: Fix one additional place where the errno variable is being accessed inappropriately. --- fs/aio/aio_read.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/fs/aio/aio_read.c b/fs/aio/aio_read.c index 462c5ddd26..6cb446fe3f 100644 --- a/fs/aio/aio_read.c +++ b/fs/aio/aio_read.c @@ -128,19 +128,16 @@ static void aio_read_worker(FAR void *arg) } #endif - /* Set the result of the read */ + /* Set the result of the read operation. */ +#ifdef CONFIG_DEBUG_FS_ERROR if (nread < 0) { - int errcode = get_errno(); - ferr("ERROR: pread failed: %d\n", errcode); - DEBUGASSERT(errcode > 0); - aiocbp->aio_result = -errcode; - } - else - { - aiocbp->aio_result = nread; + ferr("ERROR: read failed: %d\n", (int)nread); } +#endif + + aiocbp->aio_result = nread; /* Signal the client */ -- GitLab From da50646bcfe0f0c3564f71a540a4975f666ab3d2 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 31 Jan 2018 10:09:14 -0600 Subject: [PATCH 144/228] sched/wdog: wd_start() is an internal OS function and should not set the errno value. Reviewed and updated every call to wd_start() to verify if return value is used and if so if the errno value is accessed. --- Documentation/NuttxPortingGuide.html | 6 +++--- arch/arm/src/efm32/efm32_spi.c | 2 +- arch/arm/src/kinetis/kinetis_i2c.c | 4 ++-- arch/arm/src/kinetis/kinetis_sdhc.c | 2 +- arch/arm/src/kinetis/kinetis_usbdev.c | 3 ++- arch/arm/src/lpc11xx/lpc11_i2c.c | 3 ++- arch/arm/src/lpc17xx/lpc17_i2c.c | 3 ++- arch/arm/src/lpc17xx/lpc17_sdcard.c | 2 +- arch/arm/src/lpc2378/lpc23xx_i2c.c | 3 ++- arch/arm/src/lpc31xx/lpc31_i2c.c | 2 +- arch/arm/src/lpc43xx/lpc43_i2c.c | 3 ++- arch/arm/src/lpc43xx/lpc43_sdmmc.c | 2 +- arch/arm/src/lpc54xx/lpc54_i2c_master.c | 5 ++--- arch/arm/src/lpc54xx/lpc54_sdmmc.c | 2 +- arch/arm/src/sam34/sam_hsmci.c | 2 +- arch/arm/src/sam34/sam_spi.c | 2 +- arch/arm/src/sam34/sam_twi.c | 2 +- arch/arm/src/sama5/sam_hsmci.c | 2 +- arch/arm/src/sama5/sam_spi.c | 2 +- arch/arm/src/sama5/sam_tsd.c | 6 ++++-- arch/arm/src/sama5/sam_twi.c | 2 +- arch/arm/src/samv7/sam_hsmci.c | 2 +- arch/arm/src/samv7/sam_qspi.c | 2 +- arch/arm/src/samv7/sam_spi.c | 2 +- arch/arm/src/samv7/sam_twihs.c | 3 ++- arch/arm/src/stm32/stm32_sdio.c | 2 +- arch/arm/src/stm32f7/stm32_sdmmc.c | 2 +- arch/arm/src/stm32l4/stm32l4_qspi.c | 2 +- arch/arm/src/stm32l4/stm32l4_sdmmc.c | 2 +- arch/mips/src/pic32mx/pic32mx-usbdev.c | 3 ++- drivers/input/ads7843e.c | 3 ++- drivers/input/max11802.c | 8 ++++---- drivers/wireless/ieee80211/bcmf_driver.c | 4 ++-- drivers/wireless/ieee80211/bcmf_sdio.c | 8 ++++---- fs/mount/fs_automount.c | 7 ++----- include/nuttx/wdog.h | 9 ++++++--- sched/mqueue/mq_timedreceive.c | 4 ++-- sched/mqueue/mq_timedsend.c | 3 ++- sched/pthread/pthread_condtimedwait.c | 6 ++++-- sched/signal/sig_timedwait.c | 4 ++-- sched/timer/timer_settime.c | 12 +++++++++++- sched/wdog/wd_delete.c | 3 ++- sched/wdog/wd_start.c | 15 +++++++-------- 43 files changed, 94 insertions(+), 72 deletions(-) diff --git a/Documentation/NuttxPortingGuide.html b/Documentation/NuttxPortingGuide.html index 808152c91a..04b746b598 100644 --- a/Documentation/NuttxPortingGuide.html +++ b/Documentation/NuttxPortingGuide.html @@ -12,7 +12,7 @@

    NuttX RTOS Porting Guide

    -

    Last Updated: October 12, 2017

    +

    Last Updated: January 31, 2018

    @@ -2605,7 +2605,7 @@ pointer to a watchdog structure.

    Returned Value:

      -
    • OK or ERROR +
    • Zero (OK) is returned on success; a negated errno value is return to indicate the nature of any failure.

    @@ -2662,7 +2662,7 @@ wd_start() on a given watchdog ID has any effect.

    Returned Value:

      -
    • OK or ERROR +
    • Zero (OK) is returned on success; a negated errno value is return to indicate the nature of any failure.

    diff --git a/arch/arm/src/efm32/efm32_spi.c b/arch/arm/src/efm32/efm32_spi.c index f16d196e64..d7821a553e 100644 --- a/arch/arm/src/efm32/efm32_spi.c +++ b/arch/arm/src/efm32/efm32_spi.c @@ -1493,7 +1493,7 @@ static void spi_exchange(struct spi_dev_s *dev, const void *txbuffer, ret = wd_start(priv->wdog, (int)ticks, spi_dma_timeout, 1, (uint32_t)priv); if (ret < 0) { - spierr("ERROR: Failed to start timeout\n"); + spierr("ERROR: Failed to start timeout: %d\n", ret); } /* Then wait for each to complete. TX should complete first */ diff --git a/arch/arm/src/kinetis/kinetis_i2c.c b/arch/arm/src/kinetis/kinetis_i2c.c index 3e40998650..1a7af792a8 100644 --- a/arch/arm/src/kinetis/kinetis_i2c.c +++ b/arch/arm/src/kinetis/kinetis_i2c.c @@ -1183,8 +1183,8 @@ static int kinetis_i2c_transfer(struct i2c_master_s *dev, /* Wait for transfer complete */ - wd_start(priv->timeout, I2C_TIMEOUT, kinetis_i2c_timeout, 1, - (uint32_t) priv); + (void)wd_start(priv->timeout, I2C_TIMEOUT, kinetis_i2c_timeout, 1, + (uint32_t)priv); kinetis_i2c_wait(priv); wd_cancel(priv->timeout); diff --git a/arch/arm/src/kinetis/kinetis_sdhc.c b/arch/arm/src/kinetis/kinetis_sdhc.c index 1a3a0b53b7..ef59c16fe0 100644 --- a/arch/arm/src/kinetis/kinetis_sdhc.c +++ b/arch/arm/src/kinetis/kinetis_sdhc.c @@ -2465,7 +2465,7 @@ static sdio_eventset_t kinetis_eventwait(FAR struct sdio_dev_s *dev, delay = MSEC2TICK(timeout); ret = wd_start(priv->waitwdog, delay, (wdentry_t)kinetis_eventtimeout, 1, (uint32_t)priv); - if (ret != OK) + if (ret < 0) { mcerr("ERROR: wd_start failed: %d\n", ret); } diff --git a/arch/arm/src/kinetis/kinetis_usbdev.c b/arch/arm/src/kinetis/kinetis_usbdev.c index 4d10d422fd..9fd71b3e78 100644 --- a/arch/arm/src/kinetis/kinetis_usbdev.c +++ b/arch/arm/src/kinetis/kinetis_usbdev.c @@ -1112,7 +1112,8 @@ static void khci_delayedrestart(struct khci_usbdev_s *priv, uint8_t epno) /* And start (or re-start) the watchdog timer */ - wd_start(priv->wdog, RESTART_DELAY, khci_rqrestart, 1, (uint32_t)priv); + (void)wd_start(priv->wdog, RESTART_DELAY, khci_rqrestart, 1, + (uint32_t)priv); } /**************************************************************************** diff --git a/arch/arm/src/lpc11xx/lpc11_i2c.c b/arch/arm/src/lpc11xx/lpc11_i2c.c index 1c94939da9..5873a18ff3 100644 --- a/arch/arm/src/lpc11xx/lpc11_i2c.c +++ b/arch/arm/src/lpc11xx/lpc11_i2c.c @@ -215,7 +215,8 @@ static int lpc11_i2c_start(struct lpc11_i2cdev_s *priv) priv->base + LPC11_I2C_CONCLR_OFFSET); putreg32(I2C_CONSET_STA, priv->base + LPC11_I2C_CONSET_OFFSET); - wd_start(priv->timeout, I2C_TIMEOUT, lpc11_i2c_timeout, 1, (uint32_t)priv); + (void)wd_start(priv->timeout, I2C_TIMEOUT, lpc11_i2c_timeout, 1, + (uint32_t)priv); nxsem_wait(&priv->wait); wd_cancel(priv->timeout); diff --git a/arch/arm/src/lpc17xx/lpc17_i2c.c b/arch/arm/src/lpc17xx/lpc17_i2c.c index 579e943336..522afae683 100644 --- a/arch/arm/src/lpc17xx/lpc17_i2c.c +++ b/arch/arm/src/lpc17xx/lpc17_i2c.c @@ -215,7 +215,8 @@ static int lpc17_i2c_start(struct lpc17_i2cdev_s *priv) priv->base + LPC17_I2C_CONCLR_OFFSET); putreg32(I2C_CONSET_STA, priv->base + LPC17_I2C_CONSET_OFFSET); - wd_start(priv->timeout, I2C_TIMEOUT, lpc17_i2c_timeout, 1, (uint32_t)priv); + (void)wd_start(priv->timeout, I2C_TIMEOUT, lpc17_i2c_timeout, 1, + (uint32_t)priv); nxsem_wait(&priv->wait); wd_cancel(priv->timeout); diff --git a/arch/arm/src/lpc17xx/lpc17_sdcard.c b/arch/arm/src/lpc17xx/lpc17_sdcard.c index 3d7fdffe70..96cdb510f9 100644 --- a/arch/arm/src/lpc17xx/lpc17_sdcard.c +++ b/arch/arm/src/lpc17xx/lpc17_sdcard.c @@ -2307,7 +2307,7 @@ static sdio_eventset_t lpc17_eventwait(FAR struct sdio_dev_s *dev, delay = MSEC2TICK(timeout); ret = wd_start(priv->waitwdog, delay, (wdentry_t)lpc17_eventtimeout, 1, (uint32_t)priv); - if (ret != OK) + if (ret < 0) { mcerr("ERROR: wd_start failed: %d\n", ret); } diff --git a/arch/arm/src/lpc2378/lpc23xx_i2c.c b/arch/arm/src/lpc2378/lpc23xx_i2c.c index 00d44687ea..2a99c2a084 100644 --- a/arch/arm/src/lpc2378/lpc23xx_i2c.c +++ b/arch/arm/src/lpc2378/lpc23xx_i2c.c @@ -220,7 +220,8 @@ static int lpc2378_i2c_start(struct lpc2378_i2cdev_s *priv) priv->base + I2C_CONCLR_OFFSET); putreg32(I2C_CONSET_STA, priv->base + I2C_CONSET_OFFSET); - wd_start(priv->timeout, I2C_TIMEOUT, lpc2378_i2c_timeout, 1, (uint32_t)priv); + (void)wd_start(priv->timeout, I2C_TIMEOUT, lpc2378_i2c_timeout, 1, + (uint32_t)priv); nxsem_wait(&priv->wait); wd_cancel(priv->timeout); diff --git a/arch/arm/src/lpc31xx/lpc31_i2c.c b/arch/arm/src/lpc31xx/lpc31_i2c.c index c65d55c471..b4ff05cd9d 100644 --- a/arch/arm/src/lpc31xx/lpc31_i2c.c +++ b/arch/arm/src/lpc31xx/lpc31_i2c.c @@ -490,7 +490,7 @@ static int i2c_transfer(FAR struct i2c_master_s *dev, FAR struct i2c_msg_s *msgs /* Start a watchdog to timeout the transfer if the bus is locked up... */ - wd_start(priv->timeout, I2C_TIMEOUT, i2c_timeout, 1, (uint32_t)priv); + (void)wd_start(priv->timeout, I2C_TIMEOUT, i2c_timeout, 1, (uint32_t)priv); /* Wait for the transfer to complete */ diff --git a/arch/arm/src/lpc43xx/lpc43_i2c.c b/arch/arm/src/lpc43xx/lpc43_i2c.c index f613470a8f..64acf4f987 100644 --- a/arch/arm/src/lpc43xx/lpc43_i2c.c +++ b/arch/arm/src/lpc43xx/lpc43_i2c.c @@ -202,7 +202,8 @@ static int lpc43_i2c_start(struct lpc43_i2cdev_s *priv) priv->base + LPC43_I2C_CONCLR_OFFSET); putreg32(I2C_CONSET_STA, priv->base + LPC43_I2C_CONSET_OFFSET); - wd_start(priv->timeout, I2C_TIMEOUT, lpc43_i2c_timeout, 1, (uint32_t)priv); + (void)wd_start(priv->timeout, I2C_TIMEOUT, lpc43_i2c_timeout, 1,i + (uint32_t)priv); nxsem_wait(&priv->wait); wd_cancel(priv->timeout); diff --git a/arch/arm/src/lpc43xx/lpc43_sdmmc.c b/arch/arm/src/lpc43xx/lpc43_sdmmc.c index 5d4df400b3..c3504e7a15 100644 --- a/arch/arm/src/lpc43xx/lpc43_sdmmc.c +++ b/arch/arm/src/lpc43xx/lpc43_sdmmc.c @@ -2262,7 +2262,7 @@ static sdio_eventset_t lpc43_eventwait(FAR struct sdio_dev_s *dev, delay = MSEC2TICK(timeout); ret = wd_start(priv->waitwdog, delay, (wdentry_t)lpc43_eventtimeout, 1, (uint32_t)priv); - if (ret != OK) + if (ret < 0) { mcerr("ERROR: wd_start failed: %d\n", ret); } diff --git a/arch/arm/src/lpc54xx/lpc54_i2c_master.c b/arch/arm/src/lpc54xx/lpc54_i2c_master.c index cf4981676f..05d171a597 100644 --- a/arch/arm/src/lpc54xx/lpc54_i2c_master.c +++ b/arch/arm/src/lpc54xx/lpc54_i2c_master.c @@ -765,10 +765,9 @@ static int lpc54_i2c_transfer(FAR struct i2c_master_s *dev, priv->result = OK; /* Set up the transfer timeout */ - /* wd_start(priv->timeout ...); */ - wd_start(priv->timeout, priv->nmsgs * I2C_WDOG_TIMEOUT, lpc54_i2c_timeout, - 1, (uint32_t)priv); + (void)wd_start(priv->timeout, priv->nmsgs * I2C_WDOG_TIMEOUT, + lpc54_i2c_timeout, 1, (uint32_t)priv); /* Initiate the transfer */ diff --git a/arch/arm/src/lpc54xx/lpc54_sdmmc.c b/arch/arm/src/lpc54xx/lpc54_sdmmc.c index 09cb425267..626db2654f 100644 --- a/arch/arm/src/lpc54xx/lpc54_sdmmc.c +++ b/arch/arm/src/lpc54xx/lpc54_sdmmc.c @@ -2262,7 +2262,7 @@ static sdio_eventset_t lpc54_eventwait(FAR struct sdio_dev_s *dev, delay = MSEC2TICK(timeout); ret = wd_start(priv->waitwdog, delay, (wdentry_t)lpc54_eventtimeout, 1, (uint32_t)priv); - if (ret != OK) + if (ret < 0) { mcerr("ERROR: wd_start failed: %d\n", ret); } diff --git a/arch/arm/src/sam34/sam_hsmci.c b/arch/arm/src/sam34/sam_hsmci.c index 0ac187982b..25006b7f19 100644 --- a/arch/arm/src/sam34/sam_hsmci.c +++ b/arch/arm/src/sam34/sam_hsmci.c @@ -2317,7 +2317,7 @@ static sdio_eventset_t sam_eventwait(FAR struct sdio_dev_s *dev, delay = MSEC2TICK(timeout); ret = wd_start(priv->waitwdog, delay, (wdentry_t)sam_eventtimeout, 1, (uint32_t)priv); - if (ret != OK) + if (ret < 0) { mcerr("ERROR: wd_start failed: %d\n", ret); } diff --git a/arch/arm/src/sam34/sam_spi.c b/arch/arm/src/sam34/sam_spi.c index 0dc57e7a6c..79bc6ca9ea 100644 --- a/arch/arm/src/sam34/sam_spi.c +++ b/arch/arm/src/sam34/sam_spi.c @@ -1590,7 +1590,7 @@ static void spi_exchange(struct spi_dev_s *dev, const void *txbuffer, ret = wd_start(spics->dmadog, DMA_TIMEOUT_TICKS, (wdentry_t)spi_dmatimeout, 1, (uint32_t)spics); - if (ret != OK) + if (ret < 0) { spierr("ERROR: wd_start failed: %d\n", ret); } diff --git a/arch/arm/src/sam34/sam_twi.c b/arch/arm/src/sam34/sam_twi.c index 18b510cbcb..7f733790f7 100644 --- a/arch/arm/src/sam34/sam_twi.c +++ b/arch/arm/src/sam34/sam_twi.c @@ -386,7 +386,7 @@ static int twi_wait(struct twi_dev_s *priv) { /* Start a timeout to avoid hangs */ - wd_start(priv->timeout, TWI_TIMEOUT, twi_timeout, 1, (uint32_t)priv); + (void)wd_start(priv->timeout, TWI_TIMEOUT, twi_timeout, 1, (uint32_t)priv); /* Wait for either the TWI transfer or the timeout to complete */ diff --git a/arch/arm/src/sama5/sam_hsmci.c b/arch/arm/src/sama5/sam_hsmci.c index b5093d36b0..e47248e2eb 100644 --- a/arch/arm/src/sama5/sam_hsmci.c +++ b/arch/arm/src/sama5/sam_hsmci.c @@ -2745,7 +2745,7 @@ static sdio_eventset_t sam_eventwait(FAR struct sdio_dev_s *dev, delay = MSEC2TICK(timeout); ret = wd_start(priv->waitwdog, delay, (wdentry_t)sam_eventtimeout, 1, (uint32_t)priv); - if (ret != OK) + if (ret < 0) { lcderr("ERROR: wd_start failed: %d\n", ret); } diff --git a/arch/arm/src/sama5/sam_spi.c b/arch/arm/src/sama5/sam_spi.c index ce398400f4..457aa04f19 100644 --- a/arch/arm/src/sama5/sam_spi.c +++ b/arch/arm/src/sama5/sam_spi.c @@ -1520,7 +1520,7 @@ static void spi_exchange(struct spi_dev_s *dev, const void *txbuffer, ret = wd_start(spics->dmadog, DMA_TIMEOUT_TICKS, (wdentry_t)spi_dmatimeout, 1, (uint32_t)spics); - if (ret != OK) + if (ret < 0) { spierr("ERROR: wd_start failed: %d\n", ret); } diff --git a/arch/arm/src/sama5/sam_tsd.c b/arch/arm/src/sama5/sam_tsd.c index 4ec8d1bf04..36fc9e6d00 100644 --- a/arch/arm/src/sama5/sam_tsd.c +++ b/arch/arm/src/sama5/sam_tsd.c @@ -597,7 +597,8 @@ static void sam_tsd_bottomhalf(void *arg) * this case; we rely on the timer expiry to get us going again. */ - wd_start(priv->wdog, TSD_WDOG_DELAY, sam_tsd_expiry, 1, (uint32_t)priv); + (void)wd_start(priv->wdog, TSD_WDOG_DELAY, sam_tsd_expiry, 1, + (uint32_t)priv); ier = 0; goto ignored; } @@ -675,7 +676,8 @@ static void sam_tsd_bottomhalf(void *arg) /* Continue to sample the position while the pen is down */ - wd_start(priv->wdog, TSD_WDOG_DELAY, sam_tsd_expiry, 1, (uint32_t)priv); + (void)wd_start(priv->wdog, TSD_WDOG_DELAY, sam_tsd_expiry, 1, + (uint32_t)priv); /* Check the thresholds. Bail if (1) this is not the first * measurement and (2) there is no significant difference from diff --git a/arch/arm/src/sama5/sam_twi.c b/arch/arm/src/sama5/sam_twi.c index 7e32dd7720..11f9cf8801 100644 --- a/arch/arm/src/sama5/sam_twi.c +++ b/arch/arm/src/sama5/sam_twi.c @@ -487,7 +487,7 @@ static int twi_wait(struct twi_dev_s *priv, unsigned int size) * TWI transfer stalls. */ - wd_start(priv->timeout, timeout, twi_timeout, 1, (uint32_t)priv); + (void)wd_start(priv->timeout, timeout, twi_timeout, 1, (uint32_t)priv); /* Wait for either the TWI transfer or the timeout to complete */ diff --git a/arch/arm/src/samv7/sam_hsmci.c b/arch/arm/src/samv7/sam_hsmci.c index b6df58bc18..4f5e0d87d9 100644 --- a/arch/arm/src/samv7/sam_hsmci.c +++ b/arch/arm/src/samv7/sam_hsmci.c @@ -2791,7 +2791,7 @@ static sdio_eventset_t sam_eventwait(FAR struct sdio_dev_s *dev, delay = MSEC2TICK(timeout); ret = wd_start(priv->waitwdog, delay, (wdentry_t)sam_eventtimeout, 1, (uint32_t)priv); - if (ret != OK) + if (ret < 0) { mcerr("ERROR: wd_start failed: %d\n", ret); } diff --git a/arch/arm/src/samv7/sam_qspi.c b/arch/arm/src/samv7/sam_qspi.c index 80ce719c80..7e47c6caf9 100644 --- a/arch/arm/src/samv7/sam_qspi.c +++ b/arch/arm/src/samv7/sam_qspi.c @@ -885,7 +885,7 @@ static int qspi_memory_dma(struct sam_qspidev_s *priv, ret = wd_start(priv->dmadog, DMA_TIMEOUT_TICKS, (wdentry_t)qspi_dma_timeout, 1, (uint32_t)priv); - if (ret != OK) + if (ret < 0) { spierr("ERROR: wd_start failed: %d\n", ret); } diff --git a/arch/arm/src/samv7/sam_spi.c b/arch/arm/src/samv7/sam_spi.c index e45fac7d00..0ae37af28b 100644 --- a/arch/arm/src/samv7/sam_spi.c +++ b/arch/arm/src/samv7/sam_spi.c @@ -1864,7 +1864,7 @@ static void spi_exchange(struct spi_dev_s *dev, const void *txbuffer, ret = wd_start(spics->dmadog, DMA_TIMEOUT_TICKS, (wdentry_t)spi_dmatimeout, 1, (uint32_t)spics); - if (ret != OK) + if (ret < 0) { spierr("ERROR: wd_start failed: %d\n", ret); } diff --git a/arch/arm/src/samv7/sam_twihs.c b/arch/arm/src/samv7/sam_twihs.c index 261357c618..6c2d36b291 100644 --- a/arch/arm/src/samv7/sam_twihs.c +++ b/arch/arm/src/samv7/sam_twihs.c @@ -491,7 +491,8 @@ static int twi_wait(struct twi_dev_s *priv, unsigned int size) * TWIHS transfer stalls. */ - wd_start(priv->timeout, (timeout * size), twi_timeout, 1, (uint32_t)priv); + (void)wd_start(priv->timeout, (timeout * size), twi_timeout, 1, + (uint32_t)priv); /* Wait for either the TWIHS transfer or the timeout to complete */ diff --git a/arch/arm/src/stm32/stm32_sdio.c b/arch/arm/src/stm32/stm32_sdio.c index 31ecd08604..1413334419 100644 --- a/arch/arm/src/stm32/stm32_sdio.c +++ b/arch/arm/src/stm32/stm32_sdio.c @@ -2500,7 +2500,7 @@ static sdio_eventset_t stm32_eventwait(FAR struct sdio_dev_s *dev, delay = MSEC2TICK(timeout); ret = wd_start(priv->waitwdog, delay, (wdentry_t)stm32_eventtimeout, 1, (uint32_t)priv); - if (ret != OK) + if (ret < 0) { mcerr("ERROR: wd_start failed: %d\n", ret); } diff --git a/arch/arm/src/stm32f7/stm32_sdmmc.c b/arch/arm/src/stm32f7/stm32_sdmmc.c index e5ac6632df..c3530fc3fe 100644 --- a/arch/arm/src/stm32f7/stm32_sdmmc.c +++ b/arch/arm/src/stm32f7/stm32_sdmmc.c @@ -2691,7 +2691,7 @@ static sdio_eventset_t stm32_eventwait(FAR struct sdio_dev_s *dev, delay = MSEC2TICK(timeout); ret = wd_start(priv->waitwdog, delay, (wdentry_t)stm32_eventtimeout, 1, (uint32_t)priv); - if (ret != OK) + if (ret < 0) { mcerr("ERROR: wd_start failed: %d\n", ret); } diff --git a/arch/arm/src/stm32l4/stm32l4_qspi.c b/arch/arm/src/stm32l4/stm32l4_qspi.c index 793fbb7ffa..025e71f6d1 100644 --- a/arch/arm/src/stm32l4/stm32l4_qspi.c +++ b/arch/arm/src/stm32l4/stm32l4_qspi.c @@ -1447,7 +1447,7 @@ static int qspi_memory_dma(struct stm32l4_qspidev_s *priv, ret = wd_start(priv->dmadog, DMA_TIMEOUT_TICKS, (wdentry_t)qspi_dma_timeout, 1, (uint32_t)priv); - if (ret != OK) + if (ret < 0) { spierr("ERROR: wd_start failed: %d\n", ret); } diff --git a/arch/arm/src/stm32l4/stm32l4_sdmmc.c b/arch/arm/src/stm32l4/stm32l4_sdmmc.c index 6da267d2d0..2078c16258 100644 --- a/arch/arm/src/stm32l4/stm32l4_sdmmc.c +++ b/arch/arm/src/stm32l4/stm32l4_sdmmc.c @@ -2637,7 +2637,7 @@ static sdio_eventset_t stm32_eventwait(FAR struct sdio_dev_s *dev, delay = MSEC2TICK(timeout); ret = wd_start(priv->waitwdog, delay, (wdentry_t)stm32_eventtimeout, 1, (uint32_t)priv); - if (ret != OK) + if (ret < 0) { mcerr("ERROR: wd_start failed: %d\n", ret); } diff --git a/arch/mips/src/pic32mx/pic32mx-usbdev.c b/arch/mips/src/pic32mx/pic32mx-usbdev.c index b184ff41ec..82b3185181 100644 --- a/arch/mips/src/pic32mx/pic32mx-usbdev.c +++ b/arch/mips/src/pic32mx/pic32mx-usbdev.c @@ -1031,7 +1031,8 @@ static void pic32mx_delayedrestart(struct pic32mx_usbdev_s *priv, uint8_t epno) /* And start (or re-start) the watchdog timer */ - wd_start(priv->wdog, RESTART_DELAY, pic32mx_rqrestart, 1, (uint32_t)priv); + (void)wd_start(priv->wdog, RESTART_DELAY, pic32mx_rqrestart, 1, + (uint32_t)priv); } /**************************************************************************** diff --git a/drivers/input/ads7843e.c b/drivers/input/ads7843e.c index 195aaa0260..e62d2c2de3 100644 --- a/drivers/input/ads7843e.c +++ b/drivers/input/ads7843e.c @@ -607,7 +607,8 @@ static void ads7843e_worker(FAR void *arg) * later. */ - wd_start(priv->wdog, ADS7843E_WDOG_DELAY, ads7843e_wdog, 1, (uint32_t)priv); + (void)wd_start(priv->wdog, ADS7843E_WDOG_DELAY, ads7843e_wdog, 1, + (uint32_t)priv); goto ignored; } else diff --git a/drivers/input/max11802.c b/drivers/input/max11802.c index 1e40178df0..52ba527ed8 100644 --- a/drivers/input/max11802.c +++ b/drivers/input/max11802.c @@ -592,8 +592,8 @@ static void max11802_worker(FAR void *arg) iinfo("Previous pen up event still in buffer\n"); max11802_notify(priv); - wd_start(priv->wdog, MAX11802_WDOG_DELAY, max11802_wdog, 1, - (uint32_t)priv); + (void)wd_start(priv->wdog, MAX11802_WDOG_DELAY, max11802_wdog, 1, + (uint32_t)priv); goto ignored; } else @@ -632,8 +632,8 @@ static void max11802_worker(FAR void *arg) /* Continue to sample the position while the pen is down */ - wd_start(priv->wdog, MAX11802_WDOG_DELAY, max11802_wdog, 1, - (uint32_t)priv); + (void)wd_start(priv->wdog, MAX11802_WDOG_DELAY, max11802_wdog, 1, +i (uint32_t)priv); /* Check if data is valid */ diff --git a/drivers/wireless/ieee80211/bcmf_driver.c b/drivers/wireless/ieee80211/bcmf_driver.c index 1a3ae7f76e..6c17b2b7a9 100644 --- a/drivers/wireless/ieee80211/bcmf_driver.c +++ b/drivers/wireless/ieee80211/bcmf_driver.c @@ -886,8 +886,8 @@ int bcmf_wl_start_scan(FAR struct bcmf_dev_s *priv, struct iwreq *iwr) /* Start scan_timeout timer */ - wd_start(priv->scan_timeout, BCMF_SCAN_TIMEOUT_TICK, - bcmf_wl_scan_timeout, (wdparm_t)priv); + (void)wd_start(priv->scan_timeout, BCMF_SCAN_TIMEOUT_TICK, + bcmf_wl_scan_timeout, (wdparm_t)priv); return OK; diff --git a/drivers/wireless/ieee80211/bcmf_sdio.c b/drivers/wireless/ieee80211/bcmf_sdio.c index 25f94ab303..d13276c263 100644 --- a/drivers/wireless/ieee80211/bcmf_sdio.c +++ b/drivers/wireless/ieee80211/bcmf_sdio.c @@ -665,8 +665,8 @@ int bcmf_bus_sdio_initialize(FAR struct bcmf_dev_s *priv, /* Start the waitdog timer */ - wd_start(sbus->waitdog, BCMF_WAITDOG_TIMEOUT_TICK, bcmf_sdio_waitdog_timeout, - (wdparm_t)priv); + (void)wd_start(sbus->waitdog, BCMF_WAITDOG_TIMEOUT_TICK, + bcmf_sdio_waitdog_timeout, (wdparm_t)priv); /* Spawn bcmf daemon thread */ @@ -760,8 +760,8 @@ int bcmf_sdio_thread(int argc, char **argv) /* Restart the waitdog timer */ - wd_start(sbus->waitdog, BCMF_WAITDOG_TIMEOUT_TICK, - bcmf_sdio_waitdog_timeout, (wdparm_t)priv); + (void)wd_start(sbus->waitdog, BCMF_WAITDOG_TIMEOUT_TICK, + bcmf_sdio_waitdog_timeout, (wdparm_t)priv); /* Wake up device */ diff --git a/fs/mount/fs_automount.c b/fs/mount/fs_automount.c index e73ce50e24..41de262749 100644 --- a/fs/mount/fs_automount.c +++ b/fs/mount/fs_automount.c @@ -303,11 +303,8 @@ static int automount_unmount(FAR struct automounter_state_s *priv) (uint32_t)((uintptr_t)priv)); if (ret < 0) { - errcode = get_errno(); - DEBUGASSERT(errcode > 0); - - ferr("ERROR: wd_start failed: %d\n", errcode); - return -ret; + ferr("ERROR: wd_start failed: %d\n", ret); + return ret; } } diff --git a/include/nuttx/wdog.h b/include/nuttx/wdog.h index 7aacca711c..720d2b961c 100644 --- a/include/nuttx/wdog.h +++ b/include/nuttx/wdog.h @@ -1,7 +1,8 @@ /**************************************************************************** * include/nuttx/wdog.h * - * Copyright (C) 2007-2009, 2014-2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2014-2015, 2018 Gregory Nutt. All rights + * reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -196,7 +197,8 @@ WDOG_ID wd_create(void); * watchdog structure. * * Return Value: - * Returns OK or ERROR + * Zero (OK) is returned on success; a negated errno value is return to + * indicate the nature of any failure. * * Assumptions: * The caller has assured that the watchdog is no longer in use. @@ -230,7 +232,8 @@ int wd_delete(WDOG_ID wdog); * parm1..4 - parameters to pass to wdentry * * Return Value: - * OK or ERROR + * Zero (OK) is returned on success; a negated errno value is return to + * indicate the nature of any failure. * * Assumptions: * The watchdog routine runs in the context of the timer interrupt handler diff --git a/sched/mqueue/mq_timedreceive.c b/sched/mqueue/mq_timedreceive.c index 9194a79da7..af95097e89 100644 --- a/sched/mqueue/mq_timedreceive.c +++ b/sched/mqueue/mq_timedreceive.c @@ -239,8 +239,8 @@ ssize_t nxmq_timedreceive(mqd_t mqdes, FAR char *msg, size_t msglen, /* Start the watchdog */ - wd_start(rtcb->waitdog, ticks, (wdentry_t)nxmq_rcvtimeout, - 1, getpid()); + (void)wd_start(rtcb->waitdog, ticks, (wdentry_t)nxmq_rcvtimeout, + 1, getpid()); } /* Get the message from the message queue */ diff --git a/sched/mqueue/mq_timedsend.c b/sched/mqueue/mq_timedsend.c index 43924d4901..66682e68f7 100644 --- a/sched/mqueue/mq_timedsend.c +++ b/sched/mqueue/mq_timedsend.c @@ -271,7 +271,8 @@ int nxmq_timedsend(mqd_t mqdes, FAR const char *msg, size_t msglen, int prio, /* Start the watchdog and begin the wait for MQ not full */ - wd_start(rtcb->waitdog, ticks, (wdentry_t)nxmq_sndtimeout, 1, getpid()); + (void)wd_start(rtcb->waitdog, ticks, (wdentry_t)nxmq_sndtimeout, + 1, getpid()); /* And wait for the message queue to be non-empty */ diff --git a/sched/pthread/pthread_condtimedwait.c b/sched/pthread/pthread_condtimedwait.c index b27c279397..66410faebd 100644 --- a/sched/pthread/pthread_condtimedwait.c +++ b/sched/pthread/pthread_condtimedwait.c @@ -274,8 +274,10 @@ int pthread_cond_timedwait(FAR pthread_cond_t *cond, FAR pthread_mutex_t *mutex, { /* Start the watchdog */ - wd_start(rtcb->waitdog, ticks, (wdentry_t)pthread_condtimedout, - 2, (uint32_t)mypid, (uint32_t)SIGCONDTIMEDOUT); + (void)wd_start(rtcb->waitdog, ticks, + (wdentry_t)pthread_condtimedout, + 2, (uint32_t)mypid, + (uint32_t)SIGCONDTIMEDOUT); /* Take the condition semaphore. Do not restore interrupts * until we return from the wait. This is necessary to diff --git a/sched/signal/sig_timedwait.c b/sched/signal/sig_timedwait.c index 948c91723d..01b735ffec 100644 --- a/sched/signal/sig_timedwait.c +++ b/sched/signal/sig_timedwait.c @@ -356,8 +356,8 @@ int nxsig_timedwait(FAR const sigset_t *set, FAR struct siginfo *info, /* Start the watchdog */ - wd_start(rtcb->waitdog, waitticks, (wdentry_t)nxsig_timeout, - 1, wdparm.pvarg); + (void)wd_start(rtcb->waitdog, waitticks, + (wdentry_t)nxsig_timeout, 1, wdparm.pvarg); /* Now wait for either the signal or the watchdog */ diff --git a/sched/timer/timer_settime.c b/sched/timer/timer_settime.c index 9be2104c35..3724ed5ebd 100644 --- a/sched/timer/timer_settime.c +++ b/sched/timer/timer_settime.c @@ -1,7 +1,8 @@ /**************************************************************************** * sched/timer/timer_settime.c * - * Copyright (C) 2007-2010, 2013-2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2010, 2013-2016, 2018 Gregory Nutt. All rights + * reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -390,6 +391,15 @@ int timer_settime(timer_t timerid, int flags, timer->pt_last = delay; ret = wd_start(timer->pt_wdog, delay, (wdentry_t)timer_timeout, 1, (uint32_t)((wdparm_t)timer)); + if (ret < 0) + { + set_errno(-ret); + ret = ERROR; + } + else + { + ret = OK; + } } leave_critical_section(intflags); diff --git a/sched/wdog/wd_delete.c b/sched/wdog/wd_delete.c index 7b56bede46..785d4ec87c 100644 --- a/sched/wdog/wd_delete.c +++ b/sched/wdog/wd_delete.c @@ -68,7 +68,8 @@ * watchdog structure. * * Return Value: - * Returns OK or ERROR + * Zero (OK) is returned on success; a negated errno value is return to + * indicate the nature of any failure. * * Assumptions: * The caller has assured that the watchdog is no longer in use. diff --git a/sched/wdog/wd_start.c b/sched/wdog/wd_start.c index f94f9c2320..f861cbfab7 100644 --- a/sched/wdog/wd_start.c +++ b/sched/wdog/wd_start.c @@ -1,7 +1,8 @@ /**************************************************************************** * sched/wdog/wd_start.c * - * Copyright (C) 2007-2009, 2012, 2014, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2012, 2014, 2016, 2018 Gregory Nutt. All + * rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -103,8 +104,6 @@ typedef void (*wdentry4_t)(int argc, wdparm_t arg1, wdparm_t arg2, * Return Value: * None * - * Assumptions: - * ****************************************************************************/ static inline void wd_expiration(void) @@ -211,7 +210,8 @@ static inline void wd_expiration(void) * parm1..4 - parameters to pass to wdentry * * Return Value: - * OK or ERROR + * Zero (OK) is returned on success; a negated errno value is return to + * indicate the nature of any failure. * * Assumptions: * The watchdog routine runs in the context of the timer interrupt handler @@ -229,12 +229,11 @@ int wd_start(WDOG_ID wdog, int32_t delay, wdentry_t wdentry, int argc, ...) irqstate_t flags; int i; - /* Verify the wdog */ + /* Verify the wdog and setup parameters */ - if (!wdog || argc > CONFIG_MAX_WDOGPARMS || delay < 0) + if (wdog == NULL || argc > CONFIG_MAX_WDOGPARMS || delay < 0) { - set_errno(EINVAL); - return ERROR; + return -EINVAL; } /* Check if the watchdog has been started. If so, stop it. -- GitLab From 770a83bc7d7f02028c6908c391c33cb5398087bd Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 31 Jan 2018 11:31:12 -0600 Subject: [PATCH 145/228] graphics/vnc: Correct a typo introduced in last large set of changes --- graphics/vnc/server/vnc_receiver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphics/vnc/server/vnc_receiver.c b/graphics/vnc/server/vnc_receiver.c index 82a7fbb421..35633f9d14 100644 --- a/graphics/vnc/server/vnc_receiver.c +++ b/graphics/vnc/server/vnc_receiver.c @@ -105,7 +105,7 @@ int vnc_read_remainder(FAR struct vnc_session_s *session, size_t msglen, if (nrecvd < 0) { gerr("ERROR: Receive message failed: %d\n", (int)nrecvd); - return (int)recvd; + return (int)nrecvd; } } -- GitLab From 1550ef2f54414beb169adf0ef1323f58d5b85581 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 31 Jan 2018 11:32:43 -0600 Subject: [PATCH 146/228] arch/arm/src/lpc43xx: Correct a typo introduced in last large set of changes --- arch/arm/src/lpc43xx/lpc43_i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/src/lpc43xx/lpc43_i2c.c b/arch/arm/src/lpc43xx/lpc43_i2c.c index 64acf4f987..137a34f1f7 100644 --- a/arch/arm/src/lpc43xx/lpc43_i2c.c +++ b/arch/arm/src/lpc43xx/lpc43_i2c.c @@ -202,7 +202,7 @@ static int lpc43_i2c_start(struct lpc43_i2cdev_s *priv) priv->base + LPC43_I2C_CONCLR_OFFSET); putreg32(I2C_CONSET_STA, priv->base + LPC43_I2C_CONSET_OFFSET); - (void)wd_start(priv->timeout, I2C_TIMEOUT, lpc43_i2c_timeout, 1,i + (void)wd_start(priv->timeout, I2C_TIMEOUT, lpc43_i2c_timeout, 1, (uint32_t)priv); nxsem_wait(&priv->wait); -- GitLab From 50ca32e2548c7930f15667f7cba10c0e54201e33 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 31 Jan 2018 16:11:54 -0600 Subject: [PATCH 147/228] Squashed commit of the following: sched/: Convert legitimate uses of task_create() to nxtask_create(). Review handling of returned values from all uses of kthread_create() (as well as nxtask_create()). graphics/: Review return values for all calls to kthread_start() because it no longer returns an errno. drivers/: threads started by drivers should be kernel threads, not user tasks. Review return values for all calls to kthread_start() because it no longer returns an errno. configs/: threads started by board bringup logic should be kernel threads, not user tasksi (part 2 of 2). sched/task: Add nxtask_create(). Kthread_create() and nxtask_create() are internal OS functions and should not modify the errno variable. configs/: threads started by board bringup logic should be kernel threads, not user tasks. --- TODO | 2 +- configs/cloudctrl/src/stm32_usb.c | 7 +- configs/ea3131/src/lpc31_usbhost.c | 6 +- configs/indium-f7/src/stm32_usb.c | 7 +- configs/mcb1700/src/lpc17_bringup.c | 7 +- configs/mikroe-stm32f4/src/stm32_usb.c | 7 +- configs/nucleo-144/src/stm32_usb.c | 7 +- configs/nucleo-l496zg/src/stm32_usb.c | 7 +- configs/olimex-lpc-h3131/src/lpc31_usbhost.c | 6 +- configs/olimex-lpc1766stk/src/lpc17_appinit.c | 7 +- configs/olimex-stm32-e407/src/stm32_usb.c | 7 +- configs/olimex-stm32-h407/src/stm32_usb.c | 7 +- configs/olimex-stm32-p207/src/stm32_usb.c | 7 +- configs/olimex-stm32-p407/src/stm32_usb.c | 7 +- configs/open1788/src/lpc17_bringup.c | 7 +- .../pic32mx-starterkit/src/pic32mx_appinit.c | 7 +- configs/pic32mx7mmb/src/pic32_bringup.c | 7 +- configs/sama5d3-xplained/src/sam_usb.c | 13 +-- configs/sama5d3x-ek/src/sam_usb.c | 13 +-- configs/sama5d4-ek/src/sam_usb.c | 13 +-- configs/shenzhou/src/stm32_usb.c | 7 +- configs/stm3220g-eval/src/stm32_usb.c | 7 +- configs/stm3240g-eval/src/stm32_usb.c | 3 +- configs/stm32f411e-disco/src/stm32_usb.c | 7 +- configs/stm32f429i-disco/src/stm32_usb.c | 7 +- configs/stm32f4discovery/src/stm32_usb.c | 3 +- configs/stm32f746-ws/src/stm32_usb.c | 3 +- configs/stm32l476vg-disco/src/stm32_usb.c | 7 +- configs/sure-pic32mx/src/pic32mx_appinit.c | 7 +- drivers/net/slip.c | 17 +-- drivers/usbhost/usbhost_hidkbd.c | 4 +- drivers/usbhost/usbhost_hidmouse.c | 4 +- drivers/usbhost/usbhost_xboxcontroller.c | 4 +- drivers/usbmonitor/usbmonitor.c | 9 +- graphics/nxmu/nx_start.c | 7 +- include/nuttx/kthread.h | 57 +++++++++- sched/init/os_bringup.c | 18 ++-- sched/task/task_create.c | 100 ++++++++++++++---- sched/task/task_posixspawn.c | 3 +- sched/task/task_spawn.c | 18 ++-- sched/wqueue/kwork_hpthread.c | 7 +- sched/wqueue/kwork_lpthread.c | 7 +- 42 files changed, 293 insertions(+), 164 deletions(-) diff --git a/TODO b/TODO index 320e8c69b4..583177e4a7 100644 --- a/TODO +++ b/TODO @@ -258,7 +258,7 @@ o Task/Scheduler (sched/) message queue used in the OS. I am keeping this issue open because (1) there are some known remaining calls that that will modify the errno (such as dup(), dup2(), - task_create(), task_activate(), kthread_create(), exec(), mq_open(), + task_activate(), kthread_create(), exec(), mq_open(), mq_close(), and others) and (2) there may still be calls that create cancellation points. Need to check things like open(), close(), read(), write(), and possibly others. diff --git a/configs/cloudctrl/src/stm32_usb.c b/configs/cloudctrl/src/stm32_usb.c index 955377a5dd..7d7ea1732f 100644 --- a/configs/cloudctrl/src/stm32_usb.c +++ b/configs/cloudctrl/src/stm32_usb.c @@ -48,6 +48,7 @@ #include #include +#include #include #include #include @@ -209,9 +210,9 @@ int stm32_usbhost_initialize(void) uinfo("Start usbhost_waiter\n"); - pid = task_create("usbhost", CONFIG_USBHOST_DEFPRIO, - CONFIG_USBHOST_STACKSIZE, - (main_t)usbhost_waiter, (FAR char * const *)NULL); + pid = kthread_create("usbhost", CONFIG_USBHOST_DEFPRIO, + CONFIG_USBHOST_STACKSIZE, + (main_t)usbhost_waiter, (FAR char * const *)NULL); return pid < 0 ? -ENOEXEC : OK; } diff --git a/configs/ea3131/src/lpc31_usbhost.c b/configs/ea3131/src/lpc31_usbhost.c index fe16aa1637..81c8cfa866 100644 --- a/configs/ea3131/src/lpc31_usbhost.c +++ b/configs/ea3131/src/lpc31_usbhost.c @@ -48,6 +48,7 @@ #include #include +#include #include #include #include @@ -225,8 +226,9 @@ int lpc31_usbhost_initialize(void) /* Start a thread to handle device connection. */ - pid = task_create("EHCI Monitor", CONFIG_USBHOST_DEFPRIO, CONFIG_USBHOST_STACKSIZE, - (main_t)ehci_waiter, (FAR char * const *)NULL); + pid = kthread_create("EHCI Monitor", CONFIG_USBHOST_DEFPRIO, + CONFIG_USBHOST_STACKSIZE, + (main_t)ehci_waiter, (FAR char * const *)NULL); if (pid < 0) { uerr("ERROR: Failed to create ehci_waiter task: %d\n", ret); diff --git a/configs/indium-f7/src/stm32_usb.c b/configs/indium-f7/src/stm32_usb.c index 794975f51c..63d3d5530b 100644 --- a/configs/indium-f7/src/stm32_usb.c +++ b/configs/indium-f7/src/stm32_usb.c @@ -49,6 +49,7 @@ #include #include +#include #include #include #include @@ -240,9 +241,9 @@ int stm32_usbhost_initialize(void) uinfo("Start usbhost_waiter\n"); - pid = task_create("usbhost", CONFIG_STM32F4DISCO_USBHOST_PRIO, - CONFIG_STM32F4DISCO_USBHOST_STACKSIZE, - (main_t)usbhost_waiter, (FAR char * const *)NULL); + pid = kthread_create("usbhost", CONFIG_STM32F4DISCO_USBHOST_PRIO, + CONFIG_STM32F4DISCO_USBHOST_STACKSIZE, + (main_t)usbhost_waiter, (FAR char * const *)NULL); return pid < 0 ? -ENOEXEC : OK; } diff --git a/configs/mcb1700/src/lpc17_bringup.c b/configs/mcb1700/src/lpc17_bringup.c index 6b5da0d75e..8e87b85927 100644 --- a/configs/mcb1700/src/lpc17_bringup.c +++ b/configs/mcb1700/src/lpc17_bringup.c @@ -45,6 +45,7 @@ #include #include +#include #include #include #include @@ -301,9 +302,9 @@ static int nsh_usbhostinitialize(void) syslog(LOG_ERR, "ERROR: Start nsh_waiter\n"); - pid = task_create("usbhost", CONFIG_MCB1700_USBHOST_PRIO, - CONFIG_MCB1700_USBHOST_STACKSIZE, - (main_t)nsh_waiter, (FAR char * const *)NULL); + pid = kthread_create("usbhost", CONFIG_MCB1700_USBHOST_PRIO, + CONFIG_MCB1700_USBHOST_STACKSIZE, + (main_t)nsh_waiter, (FAR char * const *)NULL); return pid < 0 ? -ENOEXEC : OK; } diff --git a/configs/mikroe-stm32f4/src/stm32_usb.c b/configs/mikroe-stm32f4/src/stm32_usb.c index 8047a631fd..f6114e62b7 100644 --- a/configs/mikroe-stm32f4/src/stm32_usb.c +++ b/configs/mikroe-stm32f4/src/stm32_usb.c @@ -47,6 +47,7 @@ #include #include +#include #include #include #include @@ -208,9 +209,9 @@ int stm32_usbhost_initialize(void) uinfo("Start usbhost_waiter\n"); - pid = task_create("usbhost", CONFIG_USBHOST_DEFPRIO, - CONFIG_USBHOST_STACKSIZE, - (main_t)usbhost_waiter, (FAR char * const *)NULL); + pid = kthread_create("usbhost", CONFIG_USBHOST_DEFPRIO, + CONFIG_USBHOST_STACKSIZE, + (main_t)usbhost_waiter, (FAR char * const *)NULL); return pid < 0 ? -ENOEXEC : OK; } diff --git a/configs/nucleo-144/src/stm32_usb.c b/configs/nucleo-144/src/stm32_usb.c index 597570ae18..00fdaa9415 100644 --- a/configs/nucleo-144/src/stm32_usb.c +++ b/configs/nucleo-144/src/stm32_usb.c @@ -48,6 +48,7 @@ #include #include +#include #include #include #include @@ -239,9 +240,9 @@ int stm32_usbhost_initialize(void) uinfo("Start usbhost_waiter\n"); - pid = task_create("usbhost", CONFIG_STM32F4DISCO_USBHOST_PRIO, - CONFIG_STM32F4DISCO_USBHOST_STACKSIZE, - (main_t)usbhost_waiter, (FAR char * const *)NULL); + pid = kthread_create("usbhost", CONFIG_STM32F4DISCO_USBHOST_PRIO, + CONFIG_STM32F4DISCO_USBHOST_STACKSIZE, + (main_t)usbhost_waiter, (FAR char * const *)NULL); return pid < 0 ? -ENOEXEC : OK; } diff --git a/configs/nucleo-l496zg/src/stm32_usb.c b/configs/nucleo-l496zg/src/stm32_usb.c index 505d78445a..50ecd74de4 100644 --- a/configs/nucleo-l496zg/src/stm32_usb.c +++ b/configs/nucleo-l496zg/src/stm32_usb.c @@ -48,6 +48,7 @@ #include #include +#include #include #include #include @@ -239,9 +240,9 @@ int stm32_usbhost_initialize(void) uinfo("Start usbhost_waiter\n"); - pid = task_create("usbhost", CONFIG_STM32F4DISCO_USBHOST_PRIO, - CONFIG_STM32F4DISCO_USBHOST_STACKSIZE, - (main_t)usbhost_waiter, (FAR char * const *)NULL); + pid = kthread_create("usbhost", CONFIG_STM32F4DISCO_USBHOST_PRIO, + CONFIG_STM32F4DISCO_USBHOST_STACKSIZE, + (main_t)usbhost_waiter, (FAR char * const *)NULL); return pid < 0 ? -ENOEXEC : OK; } diff --git a/configs/olimex-lpc-h3131/src/lpc31_usbhost.c b/configs/olimex-lpc-h3131/src/lpc31_usbhost.c index 18b865b7db..37c08d5c43 100644 --- a/configs/olimex-lpc-h3131/src/lpc31_usbhost.c +++ b/configs/olimex-lpc-h3131/src/lpc31_usbhost.c @@ -48,6 +48,7 @@ #include #include +#include #include #include #include @@ -230,8 +231,9 @@ int lpc31_usbhost_initialize(void) /* Start a thread to handle device connection. */ - pid = task_create("EHCI Monitor", CONFIG_USBHOST_DEFPRIO, CONFIG_USBHOST_STACKSIZE, - (main_t)ehci_waiter, (FAR char * const *)NULL); + pid = kthread_create("EHCI Monitor", CONFIG_USBHOST_DEFPRIO,i + CONFIG_USBHOST_STACKSIZE, + (main_t)ehci_waiter, (FAR char * const *)NULL); if (pid < 0) { uerr("ERROR: Failed to create ehci_waiter task: %d\n", ret); diff --git a/configs/olimex-lpc1766stk/src/lpc17_appinit.c b/configs/olimex-lpc1766stk/src/lpc17_appinit.c index 8c3d455e9a..8a5d9a2fd4 100644 --- a/configs/olimex-lpc1766stk/src/lpc17_appinit.c +++ b/configs/olimex-lpc1766stk/src/lpc17_appinit.c @@ -45,6 +45,7 @@ #include #include +#include #include #include #include @@ -301,9 +302,9 @@ static int nsh_usbhostinitialize(void) syslog(LOG_ERR, "ERROR: Start nsh_waiter\n"); - pid = task_create("usbhost", CONFIG_LPC1766STK_USBHOST_PRIO, - CONFIG_LPC1766STK_USBHOST_STACKSIZE, - (main_t)nsh_waiter, (FAR char * const *)NULL); + pid = kthread_create("usbhost", CONFIG_LPC1766STK_USBHOST_PRIO, + CONFIG_LPC1766STK_USBHOST_STACKSIZE, + (main_t)nsh_waiter, (FAR char * const *)NULL); return pid < 0 ? -ENOEXEC : OK; } diff --git a/configs/olimex-stm32-e407/src/stm32_usb.c b/configs/olimex-stm32-e407/src/stm32_usb.c index f59dc54486..fc0b45a4db 100644 --- a/configs/olimex-stm32-e407/src/stm32_usb.c +++ b/configs/olimex-stm32-e407/src/stm32_usb.c @@ -47,6 +47,7 @@ #include #include +#include #include #include #include @@ -237,9 +238,9 @@ int stm32_usbhost_initialize(void) uinfo("Start usbhost_waiter\n"); - pid = task_create("usbhost", CONFIG_STM32F4DISCO_USBHOST_PRIO, - CONFIG_STM32F4DISCO_USBHOST_STACKSIZE, - (main_t)usbhost_waiter, (FAR char * const *)NULL); + pid = kthread_create("usbhost", CONFIG_STM32F4DISCO_USBHOST_PRIO, + CONFIG_STM32F4DISCO_USBHOST_STACKSIZE, + (main_t)usbhost_waiter, (FAR char * const *)NULL); return pid < 0 ? -ENOEXEC : OK; } diff --git a/configs/olimex-stm32-h407/src/stm32_usb.c b/configs/olimex-stm32-h407/src/stm32_usb.c index a5148f1e57..6c2cf52e5d 100644 --- a/configs/olimex-stm32-h407/src/stm32_usb.c +++ b/configs/olimex-stm32-h407/src/stm32_usb.c @@ -47,6 +47,7 @@ #include #include +#include #include #include #include @@ -215,9 +216,9 @@ int stm32_usbhost_initialize(void) uinfo("Start usbhost_waiter\n"); - pid = task_create("usbhost", CONFIG_STM32H407_USBHOST_PRIO, - CONFIG_STM32H407_USBHOST_STACKSIZE, - (main_t)usbhost_waiter, (FAR char * const *)NULL); + pid = kthread_create("usbhost", CONFIG_STM32H407_USBHOST_PRIO, + CONFIG_STM32H407_USBHOST_STACKSIZE, + (main_t)usbhost_waiter, (FAR char * const *)NULL); return pid < 0 ? -ENOEXEC : OK; } diff --git a/configs/olimex-stm32-p207/src/stm32_usb.c b/configs/olimex-stm32-p207/src/stm32_usb.c index fdef1532dc..da898fd74d 100644 --- a/configs/olimex-stm32-p207/src/stm32_usb.c +++ b/configs/olimex-stm32-p207/src/stm32_usb.c @@ -47,6 +47,7 @@ #include #include +#include #include #include #include @@ -219,9 +220,9 @@ int stm32_usbhost_initialize(void) uinfo("Start usbhost_waiter\n"); - pid = task_create("usbhost", CONFIG_USBHOST_DEFPRIO, - CONFIG_USBHOST_STACKSIZE, - (main_t)usbhost_waiter, (FAR char * const *)NULL); + pid = kthread_create("usbhost", CONFIG_USBHOST_DEFPRIO, + CONFIG_USBHOST_STACKSIZE, + (main_t)usbhost_waiter, (FAR char * const *)NULL); return pid < 0 ? -ENOEXEC : OK; } diff --git a/configs/olimex-stm32-p407/src/stm32_usb.c b/configs/olimex-stm32-p407/src/stm32_usb.c index 2456beecf6..2f0c652f0a 100644 --- a/configs/olimex-stm32-p407/src/stm32_usb.c +++ b/configs/olimex-stm32-p407/src/stm32_usb.c @@ -47,6 +47,7 @@ #include #include +#include #include #include #include @@ -236,9 +237,9 @@ int stm32_usbhost_setup(void) uinfo("Start usbhost_waiter\n"); - pid = task_create("usbhost", CONFIG_OLIMEXP407_USBHOST_PRIO, - CONFIG_OLIMEXP407_USBHOST_STACKSIZE, - (main_t)usbhost_waiter, (FAR char * const *)NULL); + pid = kthread_create("usbhost", CONFIG_OLIMEXP407_USBHOST_PRIO, + CONFIG_OLIMEXP407_USBHOST_STACKSIZE, + (main_t)usbhost_waiter, (FAR char * const *)NULL); return pid < 0 ? -ENOEXEC : OK; } diff --git a/configs/open1788/src/lpc17_bringup.c b/configs/open1788/src/lpc17_bringup.c index 047c31df84..44d9228f24 100644 --- a/configs/open1788/src/lpc17_bringup.c +++ b/configs/open1788/src/lpc17_bringup.c @@ -46,6 +46,7 @@ #include #include +#include #include #include #include @@ -343,9 +344,9 @@ static int nsh_usbhostinitialize(void) syslog(LOG_INFO, "Start nsh_waiter\n"); - pid = task_create("usbhost", CONFIG_USBHOST_DEFPRIO, - CONFIG_USBHOST_STACKSIZE, - (main_t)nsh_waiter, (FAR char * const *)NULL); + pid = kthread_create("usbhost", CONFIG_USBHOST_DEFPRIO, + CONFIG_USBHOST_STACKSIZE, + (main_t)nsh_waiter, (FAR char * const *)NULL); return pid < 0 ? -ENOEXEC : OK; } diff --git a/configs/pic32mx-starterkit/src/pic32mx_appinit.c b/configs/pic32mx-starterkit/src/pic32mx_appinit.c index 68aadbcce2..12ad25b4b9 100644 --- a/configs/pic32mx-starterkit/src/pic32mx_appinit.c +++ b/configs/pic32mx-starterkit/src/pic32mx_appinit.c @@ -45,6 +45,7 @@ #include #include +#include #include #include #include @@ -309,9 +310,9 @@ static int nsh_usbhostinitialize(void) syslog(LOG_INFO, "Start nsh_waiter\n"); - pid = task_create("usbhost", CONFIG_USBHOST_DEFPRIO, - CONFIG_USBHOST_STACKSIZE, - (main_t)nsh_waiter, (FAR char * const *)NULL); + pid = kthread_create("usbhost", CONFIG_USBHOST_DEFPRIO, + CONFIG_USBHOST_STACKSIZE, + (main_t)nsh_waiter, (FAR char * const *)NULL); return pid < 0 ? -ENOEXEC : OK; } diff --git a/configs/pic32mx7mmb/src/pic32_bringup.c b/configs/pic32mx7mmb/src/pic32_bringup.c index 81fc7e98e7..bdc6b7bec1 100644 --- a/configs/pic32mx7mmb/src/pic32_bringup.c +++ b/configs/pic32mx7mmb/src/pic32_bringup.c @@ -46,6 +46,7 @@ #include #include +#include #include #include #include @@ -320,9 +321,9 @@ static int nsh_usbhostinitialize(void) syslog(LOG_INFO, "Start nsh_waiter\n"); - pid = task_create("usbhost", CONFIG_USBHOST_DEFPRIO, - CONFIG_USBHOST_STACKSIZE, - (main_t)nsh_waiter, (FAR char * const *)NULL); + pid = kthread_create("usbhost", CONFIG_USBHOST_DEFPRIO, + CONFIG_USBHOST_STACKSIZE, + (main_t)nsh_waiter, (FAR char * const *)NULL); return pid < 0 ? -ENOEXEC : OK; } return -ENODEV; diff --git a/configs/sama5d3-xplained/src/sam_usb.c b/configs/sama5d3-xplained/src/sam_usb.c index cad7cf0150..3189e94774 100644 --- a/configs/sama5d3-xplained/src/sam_usb.c +++ b/configs/sama5d3-xplained/src/sam_usb.c @@ -48,6 +48,7 @@ #include #include +#include #include #include #include @@ -357,9 +358,9 @@ int sam_usbhost_initialize(void) /* Start a thread to handle device connection. */ - pid = task_create("OHCI Monitor", CONFIG_SAMA5D3XPLAINED_USBHOST_PRIO, - CONFIG_SAMA5D3XPLAINED_USBHOST_STACKSIZE, - (main_t)ohci_waiter, (FAR char * const *)NULL); + pid = kthread_create("OHCI Monitor", CONFIG_SAMA5D3XPLAINED_USBHOST_PRIO, + CONFIG_SAMA5D3XPLAINED_USBHOST_STACKSIZE, + (main_t)ohci_waiter, (FAR char * const *)NULL); if (pid < 0) { uerr("ERROR: Failed to create ohci_waiter task: %d\n", ret); @@ -379,9 +380,9 @@ int sam_usbhost_initialize(void) /* Start a thread to handle device connection. */ - pid = task_create("EHCI Monitor", CONFIG_SAMA5D3XPLAINED_USBHOST_PRIO, - CONFIG_SAMA5D3XPLAINED_USBHOST_STACKSIZE, - (main_t)ehci_waiter, (FAR char * const *)NULL); + pid = kthread_create("EHCI Monitor", CONFIG_SAMA5D3XPLAINED_USBHOST_PRIO, + CONFIG_SAMA5D3XPLAINED_USBHOST_STACKSIZE, + (main_t)ehci_waiter, (FAR char * const *)NULL); if (pid < 0) { uerr("ERROR: Failed to create ehci_waiter task: %d\n", ret); diff --git a/configs/sama5d3x-ek/src/sam_usb.c b/configs/sama5d3x-ek/src/sam_usb.c index 5b365f422d..4607f641fe 100644 --- a/configs/sama5d3x-ek/src/sam_usb.c +++ b/configs/sama5d3x-ek/src/sam_usb.c @@ -48,6 +48,7 @@ #include #include +#include #include #include #include @@ -355,9 +356,9 @@ int sam_usbhost_initialize(void) /* Start a thread to handle device connection. */ - pid = task_create("OHCI Monitor", CONFIG_SAMA5D3xEK_USBHOST_PRIO, - CONFIG_SAMA5D3xEK_USBHOST_STACKSIZE, - (main_t)ohci_waiter, (FAR char * const *)NULL); + pid = kthread_create("OHCI Monitor", CONFIG_SAMA5D3xEK_USBHOST_PRIO, + CONFIG_SAMA5D3xEK_USBHOST_STACKSIZE, + (main_t)ohci_waiter, (FAR char * const *)NULL); if (pid < 0) { uerr("ERROR: Failed to create ohci_waiter task: %d\n", ret); @@ -377,9 +378,9 @@ int sam_usbhost_initialize(void) /* Start a thread to handle device connection. */ - pid = task_create("EHCI Monitor", CONFIG_SAMA5D3xEK_USBHOST_PRIO, - CONFIG_SAMA5D3xEK_USBHOST_STACKSIZE, - (main_t)ehci_waiter, (FAR char * const *)NULL); + pid = kthread_create("EHCI Monitor", CONFIG_SAMA5D3xEK_USBHOST_PRIO, + CONFIG_SAMA5D3xEK_USBHOST_STACKSIZE, + (main_t)ehci_waiter, (FAR char * const *)NULL); if (pid < 0) { uerr("ERROR: Failed to create ehci_waiter task: %d\n", ret); diff --git a/configs/sama5d4-ek/src/sam_usb.c b/configs/sama5d4-ek/src/sam_usb.c index a73c4b384f..d6923ea70a 100644 --- a/configs/sama5d4-ek/src/sam_usb.c +++ b/configs/sama5d4-ek/src/sam_usb.c @@ -48,6 +48,7 @@ #include #include +#include #include #include #include @@ -356,9 +357,9 @@ int sam_usbhost_initialize(void) /* Start a thread to handle device connection. */ - pid = task_create("OHCI Monitor", CONFIG_SAMA5D4EK_USBHOST_PRIO, - CONFIG_SAMA5D4EK_USBHOST_STACKSIZE, - (main_t)ohci_waiter, (FAR char * const *)NULL); + pid = kthread_create("OHCI Monitor", CONFIG_SAMA5D4EK_USBHOST_PRIO, + CONFIG_SAMA5D4EK_USBHOST_STACKSIZE, + (main_t)ohci_waiter, (FAR char * const *)NULL); if (pid < 0) { uerr("ERROR: Failed to create ohci_waiter task: %d\n", ret); @@ -378,9 +379,9 @@ int sam_usbhost_initialize(void) /* Start a thread to handle device connection. */ - pid = task_create("EHCI Monitor", CONFIG_SAMA5D4EK_USBHOST_PRIO, - CONFIG_SAMA5D4EK_USBHOST_STACKSIZE, - (main_t)ehci_waiter, (FAR char * const *)NULL); + pid = kthread_create("EHCI Monitor", CONFIG_SAMA5D4EK_USBHOST_PRIO, + CONFIG_SAMA5D4EK_USBHOST_STACKSIZE, + (main_t)ehci_waiter, (FAR char * const *)NULL); if (pid < 0) { uerr("ERROR: Failed to create ehci_waiter task: %d\n", ret); diff --git a/configs/shenzhou/src/stm32_usb.c b/configs/shenzhou/src/stm32_usb.c index 5baddf4d01..91bbe8d846 100644 --- a/configs/shenzhou/src/stm32_usb.c +++ b/configs/shenzhou/src/stm32_usb.c @@ -47,6 +47,7 @@ #include #include +#include #include #include #include @@ -208,9 +209,9 @@ int stm32_usbhost_initialize(void) uinfo("Start usbhost_waiter\n"); - pid = task_create("usbhost", CONFIG_USBHOST_DEFPRIO, - CONFIG_USBHOST_STACKSIZE, - (main_t)usbhost_waiter, (FAR char * const *)NULL); + pid = kthread_create("usbhost", CONFIG_USBHOST_DEFPRIO, + CONFIG_USBHOST_STACKSIZE, + (main_t)usbhost_waiter, (FAR char * const *)NULL); return pid < 0 ? -ENOEXEC : OK; } diff --git a/configs/stm3220g-eval/src/stm32_usb.c b/configs/stm3220g-eval/src/stm32_usb.c index 33809073c8..328aad2471 100644 --- a/configs/stm3220g-eval/src/stm32_usb.c +++ b/configs/stm3220g-eval/src/stm32_usb.c @@ -47,6 +47,7 @@ #include #include +#include #include #include #include @@ -208,9 +209,9 @@ int stm32_usbhost_initialize(void) uinfo("Start usbhost_waiter\n"); - pid = task_create("usbhost", CONFIG_USBHOST_DEFPRIO, - CONFIG_USBHOST_STACKSIZE, - (main_t)usbhost_waiter, (FAR char * const *)NULL); + pid = kthread_create("usbhost", CONFIG_USBHOST_DEFPRIO, + CONFIG_USBHOST_STACKSIZE, + (main_t)usbhost_waiter, (FAR char * const *)NULL); return pid < 0 ? -ENOEXEC : OK; } diff --git a/configs/stm3240g-eval/src/stm32_usb.c b/configs/stm3240g-eval/src/stm32_usb.c index 27846d9cf6..e89cf8116f 100644 --- a/configs/stm3240g-eval/src/stm32_usb.c +++ b/configs/stm3240g-eval/src/stm32_usb.c @@ -47,6 +47,7 @@ #include #include +#include #include #include #include @@ -208,7 +209,7 @@ int stm32_usbhost_initialize(void) uinfo("Start usbhost_waiter\n"); - pid = task_create("usbhost", CONFIG_USBHOST_DEFPRIO, + pid = kthread_create("usbhost", CONFIG_USBHOST_DEFPRIO, CONFIG_USBHOST_STACKSIZE, (main_t)usbhost_waiter, (FAR char * const *)NULL); return pid < 0 ? -ENOEXEC : OK; diff --git a/configs/stm32f411e-disco/src/stm32_usb.c b/configs/stm32f411e-disco/src/stm32_usb.c index 95cc3da81d..223fb94932 100644 --- a/configs/stm32f411e-disco/src/stm32_usb.c +++ b/configs/stm32f411e-disco/src/stm32_usb.c @@ -50,6 +50,7 @@ #include #include +#include #include #include #include @@ -248,9 +249,9 @@ int stm32_usbhost_initialize(void) uinfo("Start usbhost_waiter\n"); - pid = task_create("usbhost", CONFIG_STM32F411DISCO_USBHOST_PRIO, - CONFIG_STM32F411DISCO_USBHOST_STACKSIZE, - (main_t)usbhost_waiter, (FAR char * const *)NULL); + pid = kthread_create("usbhost", CONFIG_STM32F411DISCO_USBHOST_PRIO, + CONFIG_STM32F411DISCO_USBHOST_STACKSIZE, + (main_t)usbhost_waiter, (FAR char * const *)NULL); return pid < 0 ? -ENOEXEC : OK; } diff --git a/configs/stm32f429i-disco/src/stm32_usb.c b/configs/stm32f429i-disco/src/stm32_usb.c index 33718f1534..3d597eff7c 100644 --- a/configs/stm32f429i-disco/src/stm32_usb.c +++ b/configs/stm32f429i-disco/src/stm32_usb.c @@ -47,6 +47,7 @@ #include #include +#include #include #include #include @@ -214,9 +215,9 @@ int stm32_usbhost_initialize(void) uinfo("Start usbhost_waiter\n"); - pid = task_create("usbhost", CONFIG_STM32F429IDISCO_USBHOST_PRIO, - CONFIG_STM32F429IDISCO_USBHOST_STACKSIZE, - (main_t)usbhost_waiter, (FAR char * const *)NULL); + pid = kthread_create("usbhost", CONFIG_STM32F429IDISCO_USBHOST_PRIO, + CONFIG_STM32F429IDISCO_USBHOST_STACKSIZE, + (main_t)usbhost_waiter, (FAR char * const *)NULL); return pid < 0 ? -ENOEXEC : OK; } diff --git a/configs/stm32f4discovery/src/stm32_usb.c b/configs/stm32f4discovery/src/stm32_usb.c index f0d2e16170..6386b566ac 100644 --- a/configs/stm32f4discovery/src/stm32_usb.c +++ b/configs/stm32f4discovery/src/stm32_usb.c @@ -47,6 +47,7 @@ #include #include +#include #include #include #include @@ -248,7 +249,7 @@ int stm32_usbhost_initialize(void) uinfo("Start usbhost_waiter\n"); - pid = task_create("usbhost", CONFIG_STM32F4DISCO_USBHOST_PRIO, + pid = kthread_create("usbhost", CONFIG_STM32F4DISCO_USBHOST_PRIO, CONFIG_STM32F4DISCO_USBHOST_STACKSIZE, (main_t)usbhost_waiter, (FAR char * const *)NULL); return pid < 0 ? -ENOEXEC : OK; diff --git a/configs/stm32f746-ws/src/stm32_usb.c b/configs/stm32f746-ws/src/stm32_usb.c index a2985140b3..8fa3f1e827 100644 --- a/configs/stm32f746-ws/src/stm32_usb.c +++ b/configs/stm32f746-ws/src/stm32_usb.c @@ -47,6 +47,7 @@ #include #include +#include #include #include #include @@ -240,7 +241,7 @@ int stm32_usbhost_initialize(void) uinfo("Start usbhost_waiter\n"); - pid = task_create("usbhost", CONFIG_STM32F7F4DISCO_USBHOST_PRIO, + pid = kthread_create("usbhost", CONFIG_STM32F7F4DISCO_USBHOST_PRIO, CONFIG_STM32F7F4DISCO_USBHOST_STACKSIZE, (main_t)usbhost_waiter, (FAR char * const *)NULL); return pid < 0 ? -ENOEXEC : OK; diff --git a/configs/stm32l476vg-disco/src/stm32_usb.c b/configs/stm32l476vg-disco/src/stm32_usb.c index 0f51871e1a..a2c7ddadfa 100644 --- a/configs/stm32l476vg-disco/src/stm32_usb.c +++ b/configs/stm32l476vg-disco/src/stm32_usb.c @@ -47,6 +47,7 @@ #include #include +#include #include #include #include @@ -237,9 +238,9 @@ int stm32l4_usbhost_initialize(void) uvdbg("Start usbhost_waiter\n"); - pid = task_create("usbhost", CONFIG_STM32L4DISCO_USBHOST_PRIO, - CONFIG_STM32L4DISCO_USBHOST_STACKSIZE, - (main_t)usbhost_waiter, (FAR char * const *)NULL); + pid = kthread_create("usbhost", CONFIG_STM32L4DISCO_USBHOST_PRIO, + CONFIG_STM32L4DISCO_USBHOST_STACKSIZE, + (main_t)usbhost_waiter, (FAR char * const *)NULL); return pid < 0 ? -ENOEXEC : OK; } diff --git a/configs/sure-pic32mx/src/pic32mx_appinit.c b/configs/sure-pic32mx/src/pic32mx_appinit.c index b668e512cb..3bb9398a92 100644 --- a/configs/sure-pic32mx/src/pic32mx_appinit.c +++ b/configs/sure-pic32mx/src/pic32mx_appinit.c @@ -45,6 +45,7 @@ #include #include +#include #include #include #include @@ -318,9 +319,9 @@ static int nsh_usbhostinitialize(void) syslog(LOG_INFO, "Start nsh_waiter\n"); - pid = task_create("usbhost", CONFIG_USBHOST_DEFPRIO, - CONFIG_USBHOST_STACKSIZE, - (main_t)nsh_waiter, (FAR char * const *)NULL); + pid = kthread_create("usbhost", CONFIG_USBHOST_DEFPRIO, + CONFIG_USBHOST_STACKSIZE, + (main_t)nsh_waiter, (FAR char * const *)NULL); return pid < 0 ? -ENOEXEC : OK; } return -ENODEV; diff --git a/drivers/net/slip.c b/drivers/net/slip.c index f9a30b64ea..6d882a416e 100644 --- a/drivers/net/slip.c +++ b/drivers/net/slip.c @@ -57,6 +57,7 @@ #include #include #include +#include #include #include #include @@ -971,15 +972,15 @@ int slip_initialize(int intf, FAR const char *devname) slip_ifdown(&priv->dev); - /* Start the SLIP receiver task */ + /* Start the SLIP receiver kernel thread */ snprintf(buffer, 8, "%d", intf); argv[0] = buffer; argv[1] = NULL; - priv->rxpid = task_create("rxslip", CONFIG_NET_SLIP_DEFPRIO, - CONFIG_NET_SLIP_STACKSIZE, (main_t)slip_rxtask, - (FAR char * const *)argv); + priv->rxpid = kthread_create("rxslip", CONFIG_NET_SLIP_DEFPRIO, + CONFIG_NET_SLIP_STACKSIZE, (main_t)slip_rxtask, + (FAR char * const *)argv); if (priv->rxpid < 0) { nerr("ERROR: Failed to start receiver task\n"); @@ -990,11 +991,11 @@ int slip_initialize(int intf, FAR const char *devname) slip_semtake(priv); - /* Start the SLIP transmitter task */ + /* Start the SLIP transmitter kernel thread */ - priv->txpid = task_create("txslip", CONFIG_NET_SLIP_DEFPRIO, - CONFIG_NET_SLIP_STACKSIZE, (main_t)slip_txtask, - (FAR char * const *)argv); + priv->txpid = kthread_create("txslip", CONFIG_NET_SLIP_DEFPRIO, + CONFIG_NET_SLIP_STACKSIZE, (main_t)slip_txtask, + (FAR char * const *)argv); if (priv->txpid < 0) { nerr("ERROR: Failed to start receiver task\n"); diff --git a/drivers/usbhost/usbhost_hidkbd.c b/drivers/usbhost/usbhost_hidkbd.c index 39cbdadfb3..e3a9f19207 100644 --- a/drivers/usbhost/usbhost_hidkbd.c +++ b/drivers/usbhost/usbhost_hidkbd.c @@ -1629,12 +1629,12 @@ static inline int usbhost_devinit(FAR struct usbhost_state_s *priv) CONFIG_HIDKBD_STACKSIZE, (main_t)usbhost_kbdpoll, (FAR char * const *)NULL); - if (priv->pollpid == ERROR) + if (priv->pollpid < 0) { /* Failed to started the poll thread... probably due to memory resources */ usbhost_givesem(&g_exclsem); - ret = -ENOMEM; + ret = (int)priv->pollpid; goto errout; } diff --git a/drivers/usbhost/usbhost_hidmouse.c b/drivers/usbhost/usbhost_hidmouse.c index 043adb3183..944b939f89 100644 --- a/drivers/usbhost/usbhost_hidmouse.c +++ b/drivers/usbhost/usbhost_hidmouse.c @@ -1699,12 +1699,12 @@ static inline int usbhost_devinit(FAR struct usbhost_state_s *priv) CONFIG_HIDMOUSE_STACKSIZE, (main_t)usbhost_mouse_poll, (FAR char * const *)NULL); - if (priv->pollpid == ERROR) + if (priv->pollpid < 0) { /* Failed to started the poll thread... probably due to memory resources */ usbhost_givesem(&g_exclsem); - ret = -ENOMEM; + ret = priv->pollpid; goto errout; } diff --git a/drivers/usbhost/usbhost_xboxcontroller.c b/drivers/usbhost/usbhost_xboxcontroller.c index d64ab3353f..3ba40c204f 100644 --- a/drivers/usbhost/usbhost_xboxcontroller.c +++ b/drivers/usbhost/usbhost_xboxcontroller.c @@ -1341,12 +1341,12 @@ static inline int usbhost_devinit(FAR struct usbhost_state_s *priv) CONFIG_XBOXCONTROLLER_STACKSIZE, (main_t)usbhost_xboxcontroller_poll, (FAR char * const *)NULL); - if (priv->pollpid == ERROR) + if (priv->pollpid < 0) { /* Failed to started the poll thread... probably due to memory resources */ usbhost_givesem(&g_exclsem); - ret = -ENOMEM; + ret = priv->pollpid; goto errout; } diff --git a/drivers/usbmonitor/usbmonitor.c b/drivers/usbmonitor/usbmonitor.c index 3f20dbb119..e3ccb1e821 100644 --- a/drivers/usbmonitor/usbmonitor.c +++ b/drivers/usbmonitor/usbmonitor.c @@ -231,25 +231,24 @@ int usbmonitor_start(void) (FAR char * const *)NULL); if (ret < 0) { - int errcode = get_errno(); uerr("ERROR: Failed to start the USB monitor: %d\n", - errcode); - UNUSED(errcode); + ret); } else { g_usbmonitor.pid = ret; uinfo("Started: %d\n", g_usbmonitor.pid); + ret = OK; } sched_unlock(); - return 0; + return ret; } sched_unlock(); uinfo("%s: %d\n", g_usbmonitor.stop ? "Stopping" : "Running", g_usbmonitor.pid); - return 0; + return OK; } /**************************************************************************** diff --git a/graphics/nxmu/nx_start.c b/graphics/nxmu/nx_start.c index 348e8c09d7..5c7435880e 100644 --- a/graphics/nxmu/nx_start.c +++ b/graphics/nxmu/nx_start.c @@ -190,11 +190,8 @@ int nx_start(void) CONFIG_NXSTART_SERVERSTACK, nx_server, NULL); if (server < 0) { - int errcode = get_errno(); - DEBUGASSERT(errcode > 0); - - gerr("ERROR: Failed to create nx_server kernel thread: %d\n", errcode); - return -errcode; + gerr("ERROR: Failed to create nx_server kernel thread: %d\n", ret); + return ret; } g_nxserver_started = true; diff --git a/include/nuttx/kthread.h b/include/nuttx/kthread.h index f345a0e914..254ce87098 100644 --- a/include/nuttx/kthread.h +++ b/include/nuttx/kthread.h @@ -64,6 +64,49 @@ extern "C" * Public Function Prototypes ****************************************************************************/ +/**************************************************************************** + * Name: nxtask_create + * + * Description: + * This function creates and activates a new user task with a specified + * priority and returns its system-assigned ID. + * + * The entry address entry is the address of the "main" function of the + * task. This function will be called once the C environment has been + * set up. The specified function will be called with four arguments. + * Should the specified routine return, a call to exit() will + * automatically be made. + * + * Note that four (and only four) arguments must be passed for the spawned + * functions. + * + * nxtask_create() is identical to the function task_create(), differing + * only in its return value: This function does not modify the errno + * variable. This is a non-standard, internal OS function and is not + * intended for use by application logic. Applications should use + * task_create(). + * + * Input Parameters: + * name - Name of the new task + * priority - Priority of the new task + * stack_size - size (in bytes) of the stack needed + * entry - Entry point of a new task + * arg - A pointer to an array of input parameters. Up to + * CONFIG_MAX_TASK_ARG parameters may be provided. If fewer + * than CONFIG_MAX_TASK_ARG parameters are passed, the list + * should be terminated with a NULL argv[] value. If no + * parameters are required, argv may be NULL. + * + * Return Value: + * Returns the positive, non-zero process ID of the new task or a negated + * errno value to indicate the nature of any failure. If memory is + * insufficient or the task cannot be created -ENOMEM will be returned. + * + ****************************************************************************/ + +int nxtask_create(FAR const char *name, int priority, + int stack_size, main_t entry, FAR char * const argv[]); + /******************************************************************************** * Name: kthread_create * @@ -73,10 +116,20 @@ extern "C" * newly started thread to run in kernel model. * * Input Parameters: - * (same as task_create()) + * name - Name of the new task + * priority - Priority of the new task + * stack_size - size (in bytes) of the stack needed + * entry - Entry point of a new task + * arg - A pointer to an array of input parameters. Up to + * CONFIG_MAX_TASK_ARG parameters may be provided. If fewer + * than CONFIG_MAX_TASK_ARG parameters are passed, the list + * should be terminated with a NULL argv[] value. If no + * parameters are required, argv may be NULL. * * Return Value: - * (same as task_create()) + * Returns the positive, non-zero process ID of the new task or a negated + * errno value to indicate the nature of any failure. If memory is + * insufficient or the task cannot be created -ENOMEM will be returned. * ********************************************************************************/ diff --git a/sched/init/os_bringup.c b/sched/init/os_bringup.c index f2028fc45f..62d5d78661 100644 --- a/sched/init/os_bringup.c +++ b/sched/init/os_bringup.c @@ -257,16 +257,16 @@ static inline void os_do_appstart(void) #ifdef CONFIG_BUILD_PROTECTED DEBUGASSERT(USERSPACE->us_entrypoint != NULL); - pid = task_create("init", SCHED_PRIORITY_DEFAULT, - CONFIG_USERMAIN_STACKSIZE, USERSPACE->us_entrypoint, - (FAR char * const *)NULL); + pid = nxtask_create("init", SCHED_PRIORITY_DEFAULT, + CONFIG_USERMAIN_STACKSIZE, USERSPACE->us_entrypoint, + (FAR char * const *)NULL); #else - pid = task_create("init", SCHED_PRIORITY_DEFAULT, - CONFIG_USERMAIN_STACKSIZE, - (main_t)CONFIG_USER_ENTRYPOINT, - (FAR char * const *)NULL); + pid = nxtask_create("init", SCHED_PRIORITY_DEFAULT, + CONFIG_USERMAIN_STACKSIZE, + (main_t)CONFIG_USER_ENTRYPOINT, + (FAR char * const *)NULL); #endif - ASSERT(pid > 0); + DEBUGASSERT(pid > 0); } #elif defined(CONFIG_INIT_FILEPATH) @@ -357,7 +357,7 @@ static inline void os_start_application(void) pid = kthread_create("AppBringUp", CONFIG_BOARD_INITTHREAD_PRIORITY, CONFIG_BOARD_INITTHREAD_STACKSIZE, (main_t)os_start_task, (FAR char * const *)NULL); - ASSERT(pid > 0); + DEBUGASSERT(pid > 0); #else /* Do the board/application initialization on this thread of execution. */ diff --git a/sched/task/task_create.c b/sched/task/task_create.c index 2cc8c1a911..16bb154926 100644 --- a/sched/task/task_create.c +++ b/sched/task/task_create.c @@ -1,7 +1,8 @@ /**************************************************************************** * sched/task/task_create.c * - * Copyright (C) 2007-2010, 2013-2014, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2010, 2013-2014, 2016, 2018 Gregory Nutt. All rights + * reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -78,9 +79,9 @@ * parameters are required, argv may be NULL. * * Return Value: - * Returns the non-zero process ID of the new task or ERROR if memory is - * insufficient or the task cannot be created. The errno will be set to - * indicate the nature of the error (always ENOMEM). + * Returns the positive, non-zero process ID of the new task or a negated + * errno value to indicate the nature of any failure. If memory is + * insufficient or the task cannot be created -ENOMEM will be returned. * ****************************************************************************/ @@ -90,7 +91,6 @@ static int thread_create(FAR const char *name, uint8_t ttype, int priority, { FAR struct task_tcb_s *tcb; pid_t pid; - int errcode; int ret; /* Allocate a TCB for the new task. */ @@ -99,7 +99,7 @@ static int thread_create(FAR const char *name, uint8_t ttype, int priority, if (!tcb) { serr("ERROR: Failed to allocate TCB\n"); - errcode = ENOMEM; + return -ENOMEM; goto errout; } @@ -111,7 +111,6 @@ static int thread_create(FAR const char *name, uint8_t ttype, int priority, ret = group_allocate(tcb, ttype); if (ret < 0) { - errcode = -ret; goto errout_with_tcb; } #endif @@ -129,7 +128,6 @@ static int thread_create(FAR const char *name, uint8_t ttype, int priority, ret = group_setuptaskfiles(tcb); if (ret < OK) { - errcode = -ret; goto errout_with_tcb; } } @@ -140,7 +138,6 @@ static int thread_create(FAR const char *name, uint8_t ttype, int priority, ret = up_create_stack((FAR struct tcb_s *)tcb, stack_size, ttype); if (ret < OK) { - errcode = -ret; goto errout_with_tcb; } @@ -149,7 +146,6 @@ static int thread_create(FAR const char *name, uint8_t ttype, int priority, ret = task_schedsetup(tcb, priority, task_start, entry, ttype); if (ret < OK) { - errcode = -ret; goto errout_with_tcb; } @@ -163,7 +159,6 @@ static int thread_create(FAR const char *name, uint8_t ttype, int priority, ret = group_initialize(tcb); if (ret < 0) { - errcode = -ret; goto errout_with_tcb; } #endif @@ -177,7 +172,8 @@ static int thread_create(FAR const char *name, uint8_t ttype, int priority, ret = task_activate((FAR struct tcb_s *)tcb); if (ret < OK) { - errcode = get_errno(); + ret = -get_errno(); + DEBUGASSERT(ret < 0); /* The TCB was added to the active task list by task_schedsetup() */ @@ -189,16 +185,60 @@ static int thread_create(FAR const char *name, uint8_t ttype, int priority, errout_with_tcb: sched_releasetcb((FAR struct tcb_s *)tcb, ttype); - -errout: - set_errno(errcode); - return ERROR; + return ret; } /**************************************************************************** * Public Functions ****************************************************************************/ +/**************************************************************************** + * Name: nxtask_create + * + * Description: + * This function creates and activates a new task with a specified + * priority and returns its system-assigned ID. + * + * The entry address entry is the address of the "main" function of the + * task. This function will be called once the C environment has been + * set up. The specified function will be called with four arguments. + * Should the specified routine return, a call to exit() will + * automatically be made. + * + * Note that four (and only four) arguments must be passed for the spawned + * functions. + * + * nxtask_create() is identical to the function task_create(), differing + * only in its return value: This function does not modify the errno + * variable. This is a non-standard, internal OS function and is not + * intended for use by application logic. Applications should use + * task_create(). + * + * Input Parameters: + * name - Name of the new task + * priority - Priority of the new task + * stack_size - size (in bytes) of the stack needed + * entry - Entry point of a new task + * arg - A pointer to an array of input parameters. Up to + * CONFIG_MAX_TASK_ARG parameters may be provided. If fewer + * than CONFIG_MAX_TASK_ARG parameters are passed, the list + * should be terminated with a NULL argv[] value. If no + * parameters are required, argv may be NULL. + * + * Return Value: + * Returns the positive, non-zero process ID of the new task or a negated + * errno value to indicate the nature of any failure. If memory is + * insufficient or the task cannot be created -ENOMEM will be returned. + * + ****************************************************************************/ + +int nxtask_create(FAR const char *name, int priority, + int stack_size, main_t entry, FAR char * const argv[]) +{ + return thread_create(name, TCB_FLAG_TTYPE_TASK, priority, stack_size, + entry, argv); +} + /**************************************************************************** * Name: task_create * @@ -228,8 +268,8 @@ errout: * * Return Value: * Returns the non-zero process ID of the new task or ERROR if memory is - * insufficient or the task cannot be created. The errno will be set to - * indicate the nature of the error (always ENOMEM). + * insufficient or the task cannot be created. The errno will be set in + * the failure case to indicate the nature of the error. * ****************************************************************************/ @@ -237,8 +277,14 @@ errout: int task_create(FAR const char *name, int priority, int stack_size, main_t entry, FAR char * const argv[]) { - return thread_create(name, TCB_FLAG_TTYPE_TASK, priority, stack_size, - entry, argv); + int ret = nxtask_create(name, priority, stack_size, entry, argv); + if (ret < 0) + { + set_errno(-ret); + ret = ERROR; + } + + return ret; } #endif @@ -251,10 +297,20 @@ int task_create(FAR const char *name, int priority, * configures the newly started thread to run in kernel model. * * Input Parameters: - * (same as task_create()) + * name - Name of the new task + * priority - Priority of the new task + * stack_size - size (in bytes) of the stack needed + * entry - Entry point of a new task + * arg - A pointer to an array of input parameters. Up to + * CONFIG_MAX_TASK_ARG parameters may be provided. If fewer + * than CONFIG_MAX_TASK_ARG parameters are passed, the list + * should be terminated with a NULL argv[] value. If no + * parameters are required, argv may be NULL. * * Return Value: - * (same as task_create()) + * Returns the positive, non-zero process ID of the new task or a negated + * errno value to indicate the nature of any failure. If memory is + * insufficient or the task cannot be created -ENOMEM will be returned. * ****************************************************************************/ diff --git a/sched/task/task_posixspawn.c b/sched/task/task_posixspawn.c index 050b800a2a..e3f11a8b99 100644 --- a/sched/task/task_posixspawn.c +++ b/sched/task/task_posixspawn.c @@ -420,9 +420,8 @@ int posix_spawn(FAR pid_t *pid, FAR const char *path, (FAR char * const *)NULL); if (proxy < 0) { - ret = get_errno(); + ret = -proxy; serr("ERROR: Failed to start posix_spawn_proxy: %d\n", ret); - goto errout_with_lock; } diff --git a/sched/task/task_spawn.c b/sched/task/task_spawn.c index e22193c537..4e6120a63a 100644 --- a/sched/task/task_spawn.c +++ b/sched/task/task_spawn.c @@ -45,6 +45,7 @@ #include #include +#include #include "sched/sched.h" #include "group/group.h" @@ -138,11 +139,11 @@ static int task_spawn_exec(FAR pid_t *pidp, FAR const char *name, /* Start the task */ - pid = task_create(name, priority, stacksize, entry, argv); + pid = nxtask_create(name, priority, stacksize, entry, argv); if (pid < 0) { - ret = get_errno(); - serr("ERROR: task_create failed: %d\n", ret); + ret = -pid; + serr("ERROR: nxtask_create failed: %d\n", ret); goto errout; } @@ -403,15 +404,14 @@ int task_spawn(FAR pid_t *pid, FAR const char *name, main_t entry, * task. */ - proxy = task_create("task_spawn_proxy", param.sched_priority, - CONFIG_POSIX_SPAWN_PROXY_STACKSIZE, - (main_t)task_spawn_proxy, - (FAR char * const *)NULL); + proxy = nxtask_create("task_spawn_proxy", param.sched_priority, + CONFIG_POSIX_SPAWN_PROXY_STACKSIZE, + (main_t)task_spawn_proxy, + (FAR char * const *)NULL); if (proxy < 0) { - ret = get_errno(); + ret = -proxy; serr("ERROR: Failed to start task_spawn_proxy: %d\n", ret); - goto errout_with_lock; } diff --git a/sched/wqueue/kwork_hpthread.c b/sched/wqueue/kwork_hpthread.c index 59aa0391be..7389220452 100644 --- a/sched/wqueue/kwork_hpthread.c +++ b/sched/wqueue/kwork_hpthread.c @@ -162,11 +162,8 @@ int work_hpstart(void) DEBUGASSERT(pid > 0); if (pid < 0) { - int errcode = get_errno(); - DEBUGASSERT(errcode > 0); - - serr("ERROR: kthread_create failed: %d\n", errcode); - return -errcode; + serr("ERROR: kthread_create failed: %d\n", (int)pid); + return (int)pid; } g_hpwork.worker[0].pid = pid; diff --git a/sched/wqueue/kwork_lpthread.c b/sched/wqueue/kwork_lpthread.c index daebd137ad..dcb0726efe 100644 --- a/sched/wqueue/kwork_lpthread.c +++ b/sched/wqueue/kwork_lpthread.c @@ -209,12 +209,9 @@ int work_lpstart(void) DEBUGASSERT(pid > 0); if (pid < 0) { - int errcode = get_errno(); - DEBUGASSERT(errcode > 0); - - serr("ERROR: kthread_create %d failed: %d\n", wndx, errcode); + serr("ERROR: kthread_create %d failed: %d\n", wndx, (int)pid); sched_unlock(); - return -errcode; + return (int)pid; } g_lpwork.worker[wndx].pid = pid; -- GitLab From 8191640320f207343b8c5166ea57bfb3d3f29026 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 31 Jan 2018 16:17:23 -0600 Subject: [PATCH 148/228] sched/task: Correct a compile error introduced with last big set of changes. --- sched/task/task_create.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sched/task/task_create.c b/sched/task/task_create.c index 16bb154926..c1cdedba29 100644 --- a/sched/task/task_create.c +++ b/sched/task/task_create.c @@ -100,7 +100,6 @@ static int thread_create(FAR const char *name, uint8_t ttype, int priority, { serr("ERROR: Failed to allocate TCB\n"); return -ENOMEM; - goto errout; } #ifdef HAVE_TASK_GROUP -- GitLab From 84b00e54d381d68f98bb65e4e1007c22ac51092c Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 31 Jan 2018 16:26:41 -0600 Subject: [PATCH 149/228] graphics/nxmu: Correct a compile error introduced with last big set of changes. --- graphics/nxmu/nx_start.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/graphics/nxmu/nx_start.c b/graphics/nxmu/nx_start.c index 5c7435880e..757b418d7e 100644 --- a/graphics/nxmu/nx_start.c +++ b/graphics/nxmu/nx_start.c @@ -190,8 +190,9 @@ int nx_start(void) CONFIG_NXSTART_SERVERSTACK, nx_server, NULL); if (server < 0) { - gerr("ERROR: Failed to create nx_server kernel thread: %d\n", ret); - return ret; + gerr("ERROR: Failed to create nx_server kernel thread: %d\n", + (int)server); + return (int)server; } g_nxserver_started = true; -- GitLab From d87b54099a64bb896a16c1cb1063ccf43612f502 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 31 Jan 2018 17:54:20 -0600 Subject: [PATCH 150/228] Eliminate a warning. --- sched/init/os_bringup.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sched/init/os_bringup.c b/sched/init/os_bringup.c index 62d5d78661..e5dfddbafa 100644 --- a/sched/init/os_bringup.c +++ b/sched/init/os_bringup.c @@ -267,6 +267,7 @@ static inline void os_do_appstart(void) (FAR char * const *)NULL); #endif DEBUGASSERT(pid > 0); + UNUSED(pid); } #elif defined(CONFIG_INIT_FILEPATH) -- GitLab From be81893b553512ccaf4e4cd628582f5992346c30 Mon Sep 17 00:00:00 2001 From: Stewart Date: Thu, 1 Feb 2018 07:24:36 -0600 Subject: [PATCH 151/228] arm/src/kinetis: Correct some Ethernet PHY register bit tests for the KSZ8081 PHY. --- arch/arm/src/kinetis/kinetis_enet.c | 12 +++++++----- include/nuttx/net/mii.h | 2 ++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/arch/arm/src/kinetis/kinetis_enet.c b/arch/arm/src/kinetis/kinetis_enet.c index 4a7e1ba7ca..73d2f76892 100644 --- a/arch/arm/src/kinetis/kinetis_enet.c +++ b/arch/arm/src/kinetis/kinetis_enet.c @@ -158,19 +158,21 @@ # define BOARD_PHYID1 MII_PHYID1_KSZ8041 # define BOARD_PHYID2 MII_PHYID2_KSZ8041 # define BOARD_PHY_STATUS MII_KSZ8041_PHYCTRL2 +# define BOARD_PHY_10BASET(s) (((s) & MII_PHYCTRL2_MODE_10HDX) != 0) +# define BOARD_PHY_100BASET(s) (((s) & MII_PHYCTRL2_MODE_100HDX) != 0) +# define BOARD_PHY_ISDUPLEX(s) (((s) & MII_PHYCTRL2_MODE_DUPLEX) != 0) #elif defined(CONFIG_ETH0_PHY_KSZ8081) # define BOARD_PHY_NAME "KSZ8081" # define BOARD_PHYID1 MII_PHYID1_KSZ8081 # define BOARD_PHYID2 MII_PHYID2_KSZ8081 -# define BOARD_PHY_STATUS MII_KSZ8081_PHYCTRL2 +# define BOARD_PHY_STATUS MII_KSZ8081_PHYCTRL1 +# define BOARD_PHY_10BASET(s) (((s) & MII_PHYCTRL1_MODE_10HDX) != 0) +# define BOARD_PHY_100BASET(s) (((s) & MII_PHYCTRL1_MODE_100HDX) != 0) +# define BOARD_PHY_ISDUPLEX(s) (((s) & MII_PHYCTRL1_MODE_DUPLEX) != 0) #else # error "Unrecognized or missing PHY selection" #endif -#define BOARD_PHY_10BASET(s) (((s) & (1 << MII_PHYCTRL2_MODE_SHIFT)) != 0) -#define BOARD_PHY_100BASET(s) (((s) & (2 << MII_PHYCTRL2_MODE_SHIFT)) != 0) -#define BOARD_PHY_ISDUPLEX(s) (((s) & (4 << MII_PHYCTRL2_MODE_SHIFT)) != 0) - /* Estimate the MII_SPEED in order to get an MDC close to 2.5MHz, based on the internal module (ENET) clock: * diff --git a/include/nuttx/net/mii.h b/include/nuttx/net/mii.h index facd4c2f9d..e4e915e70c 100644 --- a/include/nuttx/net/mii.h +++ b/include/nuttx/net/mii.h @@ -583,6 +583,7 @@ # define MII_PHYCTRL2_MODE_BUSY (0 << MII_PHYCTRL2_MODE_SHIFT) /* Still in autonegotiation */ # define MII_PHYCTRL2_MODE_10HDX (1 << MII_PHYCTRL2_MODE_SHIFT) /* 10Base-T half-duplex */ # define MII_PHYCTRL2_MODE_100HDX (2 << MII_PHYCTRL2_MODE_SHIFT) /* 100Base-T half-duplex */ +# define MII_PHYCTRL2_MODE_DUPLEX (4 << MII_PHYCTRL2_MODE_SHIFT) /* Full duplex */ # define MII_PHYCTRL2_MODE_10FDX (5 << MII_PHYCTRL2_MODE_SHIFT) /* 10Base-T full-duplex */ # define MII_PHYCTRL2_MODE_100FDX (6 << MII_PHYCTRL2_MODE_SHIFT) /* 100Base-T full-duplex */ #define MII_PHYCTRL2_SEQTEST (1 << 1) /* Bit 1: Enable SQE test */ @@ -602,6 +603,7 @@ # define MII_PHYCTRL1_MODE_BUSY (0 << MII_PHYCTRL1_MODE_SHIFT) /* Still in autonegotiation */ # define MII_PHYCTRL1_MODE_10HDX (1 << MII_PHYCTRL1_MODE_SHIFT) /* 10Base-T half-duplex */ # define MII_PHYCTRL1_MODE_100HDX (2 << MII_PHYCTRL1_MODE_SHIFT) /* 100Base-T half-duplex */ +# define MII_PHYCTRL1_MODE_DUPLEX (4 << MII_PHYCTRL1_MODE_SHIFT) /* Full duplex */ # define MII_PHYCTRL1_MODE_10FDX (5 << MII_PHYCTRL1_MODE_SHIFT) /* 10Base-T full-duplex */ # define MII_PHYCTRL1_MODE_100FDX (6 << MII_PHYCTRL1_MODE_SHIFT) /* 100Base-T full-duplex */ -- GitLab From e93cb86903d54f463aed2a5e7f6fb3dbf1636b77 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 1 Feb 2018 07:37:16 -0600 Subject: [PATCH 152/228] libc/stdio: in dtoa(), up_interrupt_context() is used in a debug assertion. up_interrupt_context() is not available in the user-mode phase of the PROTECTED or KERNEL build configurations. In those configurations, enabling libc floating point support and debug assertions will result in an undefined reference to up_interrupt_context(). --- libc/stdio/lib_libdtoa.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libc/stdio/lib_libdtoa.c b/libc/stdio/lib_libdtoa.c index 6dff3bc0e9..80c9723d15 100644 --- a/libc/stdio/lib_libdtoa.c +++ b/libc/stdio/lib_libdtoa.c @@ -138,6 +138,7 @@ static void lib_dtoa(FAR struct lib_outstream_s *obj, int fmt, int prec, int dsgn; /* Unused sign indicator */ int i; +#if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__) /* This function may *NOT* be called within interrupt level logic. That is * because the logic in __dtoa may attempt to allocate memory. That will * lead to cryptic failures down the road within the memory manager. @@ -146,6 +147,7 @@ static void lib_dtoa(FAR struct lib_outstream_s *obj, int fmt, int prec, */ DEBUGASSERT(up_interrupt_context() == false); +#endif /* Special handling for NaN and Infinity */ -- GitLab From a096bc1266e5169b4dc0ffd63495f8752fa44c2a Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 1 Feb 2018 08:33:04 -0600 Subject: [PATCH 153/228] binfmt/: Fix one more inappropriate access to the errno variable. --- binfmt/binfmt_unregister.c | 16 ---------------- binfmt/builtin.c | 2 +- binfmt/elf.c | 2 +- binfmt/nxflat.c | 2 +- binfmt/pcode.c | 6 +----- 5 files changed, 4 insertions(+), 24 deletions(-) diff --git a/binfmt/binfmt_unregister.c b/binfmt/binfmt_unregister.c index f97b06ff2d..e0a6fe80e6 100644 --- a/binfmt/binfmt_unregister.c +++ b/binfmt/binfmt_unregister.c @@ -50,22 +50,6 @@ #ifndef CONFIG_BINFMT_DISABLE -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/binfmt/builtin.c b/binfmt/builtin.c index 88ad846c7f..fda996429f 100644 --- a/binfmt/builtin.c +++ b/binfmt/builtin.c @@ -195,7 +195,7 @@ int builtin_initialize(void) void builtin_uninitialize(void) { - unregister_binfmt(&g_builtin_binfmt); + (void)unregister_binfmt(&g_builtin_binfmt); } #endif /* CONFIG_BUILTIN */ diff --git a/binfmt/elf.c b/binfmt/elf.c index 37b1e117cd..d4e227c26c 100644 --- a/binfmt/elf.c +++ b/binfmt/elf.c @@ -362,7 +362,7 @@ int elf_initialize(void) void elf_uninitialize(void) { - unregister_binfmt(&g_elfbinfmt); + (void)unregister_binfmt(&g_elfbinfmt); } #endif /* CONFIG_ELF */ diff --git a/binfmt/nxflat.c b/binfmt/nxflat.c index c2f1c06f78..16fdc17e18 100644 --- a/binfmt/nxflat.c +++ b/binfmt/nxflat.c @@ -274,7 +274,7 @@ int nxflat_initialize(void) void nxflat_uninitialize(void) { - unregister_binfmt(&g_nxflatbinfmt); + (void)unregister_binfmt(&g_nxflatbinfmt); } #endif /* CONFIG_NXFLAT */ diff --git a/binfmt/pcode.c b/binfmt/pcode.c index 7e38c14e9b..b8fc5aaf09 100644 --- a/binfmt/pcode.c +++ b/binfmt/pcode.c @@ -583,11 +583,7 @@ void pcode_uninitialize(void) ret = unregister_binfmt(&g_pcode_binfmt); if (ret < 0) { - int errval = get_errno(); - DEBUGASSERT(errval > 0); - - berr("ERROR: unregister_binfmt() failed: %d\n", errval); - UNUSED(errval); + berr("ERROR: unregister_binfmt() failed: %d\n", ret); } #ifdef CONFIG_BINFMT_PCODE_TEST_FS -- GitLab From 7cf88d7dbdc8277f0c9ffb282bcc7a890a04c697 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 1 Feb 2018 10:00:02 -0600 Subject: [PATCH 154/228] Make sure that labeling is used consistently in all function headers. --- arch/arm/src/arm/pg_macros.h | 6 +- arch/arm/src/arm/up_blocktask.c | 2 +- arch/arm/src/arm/up_dataabort.c | 2 +- arch/arm/src/arm/up_reprioritizertr.c | 2 +- arch/arm/src/arm/up_unblocktask.c | 2 +- arch/arm/src/arm/vfork.S | 4 +- arch/arm/src/armv6-m/up_blocktask.c | 2 +- arch/arm/src/armv6-m/up_fullcontextrestore.S | 2 +- arch/arm/src/armv6-m/up_reprioritizertr.c | 2 +- arch/arm/src/armv6-m/up_saveusercontext.S | 2 +- arch/arm/src/armv6-m/up_signal_dispatch.c | 4 +- arch/arm/src/armv6-m/up_signal_handler.S | 4 +- arch/arm/src/armv6-m/up_switchcontext.S | 2 +- arch/arm/src/armv6-m/up_unblocktask.c | 2 +- arch/arm/src/armv6-m/vfork.S | 4 +- arch/arm/src/armv7-a/arm_blocktask.c | 2 +- arch/arm/src/armv7-a/arm_cpuhead.S | 2 +- arch/arm/src/armv7-a/arm_cpuidlestack.c | 2 +- arch/arm/src/armv7-a/arm_dataabort.c | 2 +- arch/arm/src/armv7-a/arm_fullcontextrestore.S | 2 +- arch/arm/src/armv7-a/arm_gicv2.c | 4 +- arch/arm/src/armv7-a/arm_reprioritizertr.c | 2 +- arch/arm/src/armv7-a/arm_signal_dispatch.c | 4 +- arch/arm/src/armv7-a/arm_unblocktask.c | 2 +- arch/arm/src/armv7-a/arm_vfork.S | 4 +- arch/arm/src/armv7-a/crt0.c | 4 +- arch/arm/src/armv7-a/gic.h | 6 +- arch/arm/src/armv7-a/mmu.h | 26 ++-- arch/arm/src/armv7-a/smp.h | 4 +- .../src/armv7-m/gnu/up_fullcontextrestore.S | 2 +- arch/arm/src/armv7-m/gnu/up_saveusercontext.S | 2 +- arch/arm/src/armv7-m/gnu/up_signal_handler.S | 4 +- arch/arm/src/armv7-m/gnu/up_switchcontext.S | 2 +- arch/arm/src/armv7-m/gnu/vfork.S | 4 +- .../src/armv7-m/iar/up_fullcontextrestore.S | 2 +- arch/arm/src/armv7-m/iar/up_saveusercontext.S | 2 +- arch/arm/src/armv7-m/iar/up_switchcontext.S | 2 +- arch/arm/src/armv7-m/iar/vfork.S | 4 +- arch/arm/src/armv7-m/up_blocktask.c | 2 +- arch/arm/src/armv7-m/up_reprioritizertr.c | 2 +- arch/arm/src/armv7-m/up_signal_dispatch.c | 4 +- arch/arm/src/armv7-m/up_unblocktask.c | 2 +- arch/arm/src/armv7-r/arm_blocktask.c | 2 +- arch/arm/src/armv7-r/arm_dataabort.c | 2 +- arch/arm/src/armv7-r/arm_fullcontextrestore.S | 2 +- arch/arm/src/armv7-r/arm_reprioritizertr.c | 2 +- arch/arm/src/armv7-r/arm_signal_dispatch.c | 4 +- arch/arm/src/armv7-r/arm_signal_handler.S | 4 +- arch/arm/src/armv7-r/arm_unblocktask.c | 2 +- arch/arm/src/armv7-r/arm_vfork.S | 4 +- arch/arm/src/bcm2708/bcm_miniuart.c | 2 +- arch/arm/src/common/up_checkstack.c | 4 +- arch/arm/src/common/up_createstack.c | 2 +- arch/arm/src/common/up_releasestack.c | 2 +- arch/arm/src/common/up_stackframe.c | 2 +- arch/arm/src/common/up_usestack.c | 2 +- arch/arm/src/common/up_vfork.c | 2 +- arch/arm/src/dm320/dm320_framebuffer.c | 4 +- arch/arm/src/efm32/efm32_adc.c | 2 +- arch/arm/src/efm32/efm32_bitband.c | 8 +- arch/arm/src/efm32/efm32_dma.c | 2 +- arch/arm/src/efm32/efm32_dma.h | 2 +- arch/arm/src/efm32/efm32_i2c.h | 4 +- arch/arm/src/efm32/efm32_pm.h | 2 +- arch/arm/src/efm32/efm32_pwm.c | 18 +-- arch/arm/src/efm32/efm32_rmu.c | 2 +- arch/arm/src/efm32/efm32_rmu.h | 2 +- arch/arm/src/efm32/efm32_spi.c | 4 +- arch/arm/src/efm32/efm32_spi.h | 2 +- arch/arm/src/efm32/efm32_timer.c | 6 +- arch/arm/src/efm32/efm32_usbhost.c | 34 ++--- arch/arm/src/imx1/imx_cspi.h | 2 +- arch/arm/src/imx1/imx_spi.c | 2 +- arch/arm/src/imx6/imx_cpuboot.c | 2 +- arch/arm/src/imx6/imx_ecspi.c | 2 +- arch/arm/src/imx6/imx_ecspi.h | 2 +- arch/arm/src/kinetis/kinetis.h | 14 +- arch/arm/src/kinetis/kinetis_i2c.h | 4 +- arch/arm/src/kinetis/kinetis_lpserial.c | 4 +- arch/arm/src/kinetis/kinetis_pin.c | 2 +- arch/arm/src/kinetis/kinetis_pinirq.c | 2 +- arch/arm/src/kinetis/kinetis_pwm.c | 14 +- arch/arm/src/kinetis/kinetis_sdhc.c | 6 +- arch/arm/src/kinetis/kinetis_serial.c | 4 +- arch/arm/src/kinetis/kinetis_spi.c | 2 +- arch/arm/src/kinetis/kinetis_spi.h | 2 +- arch/arm/src/kl/kl_gpio.h | 2 +- arch/arm/src/kl/kl_gpioirq.c | 4 +- arch/arm/src/kl/kl_pwm.c | 14 +- arch/arm/src/kl/kl_spi.c | 2 +- arch/arm/src/kl/kl_spi.h | 2 +- arch/arm/src/lc823450/lc823450_cpuidlestack.c | 2 +- arch/arm/src/lc823450/lc823450_sdc.c | 4 +- arch/arm/src/lc823450/lc823450_spi.c | 2 +- arch/arm/src/lc823450/lc823450_syscontrol.c | 2 +- arch/arm/src/lc823450/lc823450_wdt.c | 18 +-- arch/arm/src/lpc11xx/lpc11_i2c.h | 4 +- arch/arm/src/lpc11xx/lpc11_spi.c | 2 +- arch/arm/src/lpc11xx/lpc11_spi.h | 2 +- arch/arm/src/lpc11xx/lpc11_ssp.c | 8 +- arch/arm/src/lpc11xx/lpc11_ssp.h | 2 +- arch/arm/src/lpc11xx/lpc11_timer.c | 18 +-- arch/arm/src/lpc17xx/lpc17_can.c | 4 +- arch/arm/src/lpc17xx/lpc17_can.h | 2 +- arch/arm/src/lpc17xx/lpc17_i2c.h | 4 +- arch/arm/src/lpc17xx/lpc17_lcd.c | 4 +- arch/arm/src/lpc17xx/lpc17_mcpwm.c | 20 +-- arch/arm/src/lpc17xx/lpc17_pwm.c | 20 +-- arch/arm/src/lpc17xx/lpc17_sdcard.c | 6 +- arch/arm/src/lpc17xx/lpc17_sdcard.h | 6 +- arch/arm/src/lpc17xx/lpc17_spi.c | 2 +- arch/arm/src/lpc17xx/lpc17_spi.h | 2 +- arch/arm/src/lpc17xx/lpc17_ssp.c | 8 +- arch/arm/src/lpc17xx/lpc17_ssp.h | 2 +- arch/arm/src/lpc17xx/lpc17_timer.c | 18 +-- arch/arm/src/lpc17xx/lpc17_usbhost.c | 40 +++--- arch/arm/src/lpc214x/lpc214x_spi.h | 2 +- arch/arm/src/lpc2378/lpc23xx_i2c.h | 4 +- arch/arm/src/lpc2378/lpc23xx_spi.c | 2 +- arch/arm/src/lpc2378/lpc23xx_spi.h | 2 +- arch/arm/src/lpc31xx/lpc31.h | 8 +- arch/arm/src/lpc31xx/lpc31_ehci.c | 40 +++--- arch/arm/src/lpc31xx/lpc31_i2c.h | 4 +- arch/arm/src/lpc31xx/lpc31_spi.c | 2 +- arch/arm/src/lpc43xx/lpc43_can.c | 4 +- arch/arm/src/lpc43xx/lpc43_can.h | 2 +- arch/arm/src/lpc43xx/lpc43_ehci.c | 40 +++--- arch/arm/src/lpc43xx/lpc43_i2c.h | 4 +- arch/arm/src/lpc43xx/lpc43_pinconfig.c | 2 +- arch/arm/src/lpc43xx/lpc43_pinconfig.h | 2 +- arch/arm/src/lpc43xx/lpc43_sdmmc.c | 2 +- arch/arm/src/lpc43xx/lpc43_sdmmc.h | 2 +- arch/arm/src/lpc43xx/lpc43_spi.c | 4 +- arch/arm/src/lpc43xx/lpc43_spi.h | 2 +- arch/arm/src/lpc43xx/lpc43_spifi.c | 4 +- arch/arm/src/lpc43xx/lpc43_spifi.h | 2 +- arch/arm/src/lpc43xx/lpc43_ssp.c | 6 +- arch/arm/src/lpc43xx/lpc43_ssp.h | 2 +- arch/arm/src/lpc43xx/lpc43_timer.c | 16 +-- arch/arm/src/lpc43xx/lpc43_timer.h | 2 +- arch/arm/src/lpc43xx/lpc43_wdt.h | 2 +- arch/arm/src/lpc43xx/lpc43_wwdt.c | 18 +-- arch/arm/src/lpc54xx/lpc54_i2c_master.h | 4 +- arch/arm/src/lpc54xx/lpc54_lcd.c | 4 +- arch/arm/src/lpc54xx/lpc54_sdmmc.c | 2 +- arch/arm/src/lpc54xx/lpc54_sdmmc.h | 2 +- arch/arm/src/lpc54xx/lpc54_serial.c | 2 +- arch/arm/src/lpc54xx/lpc54_spi_master.c | 2 +- arch/arm/src/lpc54xx/lpc54_spi_master.h | 2 +- arch/arm/src/lpc54xx/lpc54_wwdt.c | 18 +-- arch/arm/src/lpc54xx/lpc54_wwdt.h | 2 +- arch/arm/src/nuc1xx/nuc_gpio.c | 2 +- arch/arm/src/nuc1xx/nuc_gpio.h | 2 +- arch/arm/src/sam34/sam4cm_cpuidlestack.c | 2 +- arch/arm/src/sam34/sam_hsmci.c | 6 +- arch/arm/src/sam34/sam_hsmci.h | 6 +- arch/arm/src/sam34/sam_rtt.c | 16 +-- arch/arm/src/sam34/sam_rtt.h | 2 +- arch/arm/src/sam34/sam_spi.c | 2 +- arch/arm/src/sam34/sam_spi.h | 8 +- arch/arm/src/sam34/sam_tc.c | 16 +-- arch/arm/src/sam34/sam_tc.h | 2 +- arch/arm/src/sam34/sam_twi.h | 4 +- arch/arm/src/sam34/sam_wdt.c | 18 +-- arch/arm/src/sam34/sam_wdt.h | 2 +- arch/arm/src/sama5/sam_adc.c | 4 +- arch/arm/src/sama5/sam_can.c | 14 +- arch/arm/src/sama5/sam_can.h | 2 +- arch/arm/src/sama5/sam_ehci.c | 40 +++--- arch/arm/src/sama5/sam_hsmci.c | 6 +- arch/arm/src/sama5/sam_hsmci.h | 8 +- arch/arm/src/sama5/sam_hsmci_clkdiv.c | 2 +- arch/arm/src/sama5/sam_irq.c | 4 +- arch/arm/src/sama5/sam_lcd.c | 4 +- arch/arm/src/sama5/sam_nand.c | 124 +++++++++--------- arch/arm/src/sama5/sam_nand.h | 10 +- arch/arm/src/sama5/sam_ohci.c | 38 +++--- arch/arm/src/sama5/sam_pwm.c | 22 ++-- arch/arm/src/sama5/sam_spi.c | 2 +- arch/arm/src/sama5/sam_spi.h | 8 +- arch/arm/src/sama5/sam_ssc.c | 6 +- arch/arm/src/sama5/sam_ssc.h | 2 +- arch/arm/src/sama5/sam_tsd.c | 6 +- arch/arm/src/sama5/sam_tsd.h | 2 +- arch/arm/src/sama5/sam_twi.h | 4 +- arch/arm/src/sama5/sam_wdt.c | 18 +-- arch/arm/src/sama5/sam_wdt.h | 2 +- arch/arm/src/samdl/sam_port.h | 2 +- arch/arm/src/samdl/sam_spi.c | 2 +- arch/arm/src/samdl/sam_spi.h | 8 +- arch/arm/src/samv7/sam_hsmci.c | 6 +- arch/arm/src/samv7/sam_hsmci.h | 8 +- arch/arm/src/samv7/sam_hsmci_clkdiv.c | 2 +- arch/arm/src/samv7/sam_mcan.c | 8 +- arch/arm/src/samv7/sam_mcan.h | 2 +- arch/arm/src/samv7/sam_qspi.c | 2 +- arch/arm/src/samv7/sam_qspi.h | 2 +- arch/arm/src/samv7/sam_rswdt.c | 18 +-- arch/arm/src/samv7/sam_spi.c | 2 +- arch/arm/src/samv7/sam_spi.h | 10 +- arch/arm/src/samv7/sam_spi_slave.c | 2 +- arch/arm/src/samv7/sam_ssc.c | 6 +- arch/arm/src/samv7/sam_ssc.h | 2 +- arch/arm/src/samv7/sam_twihs.h | 4 +- arch/arm/src/samv7/sam_wdt.c | 18 +-- arch/arm/src/samv7/sam_wdt.h | 4 +- arch/arm/src/stm32/stm32_1wire.c | 6 +- arch/arm/src/stm32/stm32_1wire.h | 4 +- arch/arm/src/stm32/stm32_adc.c | 2 +- arch/arm/src/stm32/stm32_can.c | 26 ++-- arch/arm/src/stm32/stm32_can.h | 2 +- arch/arm/src/stm32/stm32_dma.h | 4 +- arch/arm/src/stm32/stm32_dma2d.c | 54 ++++---- arch/arm/src/stm32/stm32_dma2d.h | 34 ++--- arch/arm/src/stm32/stm32_exti.h | 2 +- arch/arm/src/stm32/stm32_exti_alarm.c | 2 +- arch/arm/src/stm32/stm32_exti_pwr.c | 2 +- arch/arm/src/stm32/stm32_exti_pwr.h | 2 +- arch/arm/src/stm32/stm32_exti_wakeup.c | 2 +- arch/arm/src/stm32/stm32_flash.h | 8 +- arch/arm/src/stm32/stm32_gpio.c | 4 +- arch/arm/src/stm32/stm32_hrtim.c | 20 +-- arch/arm/src/stm32/stm32_i2c.h | 4 +- arch/arm/src/stm32/stm32_i2s.c | 4 +- arch/arm/src/stm32/stm32_i2s.h | 2 +- arch/arm/src/stm32/stm32_iwdg.c | 12 +- arch/arm/src/stm32/stm32_ltdc.c | 62 ++++----- arch/arm/src/stm32/stm32_ltdc.h | 42 +++--- arch/arm/src/stm32/stm32_otgfshost.c | 34 ++--- arch/arm/src/stm32/stm32_otghshost.c | 34 ++--- arch/arm/src/stm32/stm32_pm.h | 2 +- arch/arm/src/stm32/stm32_pminitialize.c | 4 +- arch/arm/src/stm32/stm32_pmstandby.c | 2 +- arch/arm/src/stm32/stm32_pwm.c | 24 ++-- arch/arm/src/stm32/stm32_pwr.c | 8 +- arch/arm/src/stm32/stm32_pwr.h | 8 +- arch/arm/src/stm32/stm32_qencoder.c | 4 +- arch/arm/src/stm32/stm32_qencoder.h | 2 +- arch/arm/src/stm32/stm32_sdadc.c | 2 +- arch/arm/src/stm32/stm32_sdio.c | 6 +- arch/arm/src/stm32/stm32_sdio.h | 6 +- arch/arm/src/stm32/stm32_serial.c | 4 +- arch/arm/src/stm32/stm32_spi.c | 4 +- arch/arm/src/stm32/stm32_spi.h | 2 +- arch/arm/src/stm32/stm32_tim.h | 2 +- arch/arm/src/stm32/stm32_tim_lowerhalf.c | 12 +- arch/arm/src/stm32/stm32_wdg.h | 4 +- arch/arm/src/stm32/stm32_wwdg.c | 18 +-- arch/arm/src/stm32/stm32f10xxx_dma.c | 4 +- arch/arm/src/stm32/stm32f20xxx_dma.c | 4 +- arch/arm/src/stm32/stm32f33xxx_adc.c | 2 +- arch/arm/src/stm32/stm32f33xxx_dma.c | 4 +- arch/arm/src/stm32/stm32f40xxx_dma.c | 4 +- arch/arm/src/stm32f0/stm32f0_gpio.c | 4 +- arch/arm/src/stm32f0/stm32f0_gpio.h | 4 +- arch/arm/src/stm32f0/stm32f0_i2c.h | 4 +- arch/arm/src/stm32f0/stm32f0_serial.c | 4 +- arch/arm/src/stm32f7/stm32_adc.c | 2 +- arch/arm/src/stm32f7/stm32_dma.c | 4 +- arch/arm/src/stm32f7/stm32_dma.h | 4 +- arch/arm/src/stm32f7/stm32_dma2d.c | 54 ++++---- arch/arm/src/stm32f7/stm32_dma2d.h | 34 ++--- arch/arm/src/stm32f7/stm32_exti_alarm.c | 2 +- arch/arm/src/stm32f7/stm32_exti_pwr.c | 2 +- arch/arm/src/stm32f7/stm32_exti_pwr.h | 2 +- arch/arm/src/stm32f7/stm32_gpio.c | 4 +- arch/arm/src/stm32f7/stm32_i2c.h | 4 +- arch/arm/src/stm32f7/stm32_ltdc.c | 62 ++++----- arch/arm/src/stm32f7/stm32_ltdc.h | 42 +++--- arch/arm/src/stm32f7/stm32_otghost.c | 34 ++--- arch/arm/src/stm32f7/stm32_pwr.c | 6 +- arch/arm/src/stm32f7/stm32_pwr.h | 2 +- arch/arm/src/stm32f7/stm32_sdmmc.c | 6 +- arch/arm/src/stm32f7/stm32_sdmmc.h | 6 +- arch/arm/src/stm32f7/stm32_serial.c | 4 +- arch/arm/src/stm32f7/stm32_spi.c | 4 +- arch/arm/src/stm32f7/stm32_spi.h | 2 +- arch/arm/src/stm32f7/stm32_tim.h | 2 +- arch/arm/src/stm32l4/stm32l4_adc.c | 2 +- arch/arm/src/stm32l4/stm32l4_can.c | 20 +-- arch/arm/src/stm32l4/stm32l4_can.h | 2 +- arch/arm/src/stm32l4/stm32l4_comp.c | 2 +- arch/arm/src/stm32l4/stm32l4_dfsdm.c | 2 +- arch/arm/src/stm32l4/stm32l4_dma.h | 4 +- arch/arm/src/stm32l4/stm32l4_exti.h | 6 +- arch/arm/src/stm32l4/stm32l4_exti_alarm.c | 2 +- arch/arm/src/stm32l4/stm32l4_exti_comp.c | 2 +- arch/arm/src/stm32l4/stm32l4_exti_pwr.c | 2 +- arch/arm/src/stm32l4/stm32l4_exti_pwr.h | 2 +- arch/arm/src/stm32l4/stm32l4_exti_wakeup.c | 2 +- arch/arm/src/stm32l4/stm32l4_gpio.c | 4 +- arch/arm/src/stm32l4/stm32l4_gpio.h | 4 +- arch/arm/src/stm32l4/stm32l4_i2c.h | 4 +- arch/arm/src/stm32l4/stm32l4_iwdg.c | 12 +- arch/arm/src/stm32l4/stm32l4_otgfshost.c | 34 ++--- arch/arm/src/stm32l4/stm32l4_pm.h | 2 +- arch/arm/src/stm32l4/stm32l4_pminitialize.c | 4 +- arch/arm/src/stm32l4/stm32l4_pmstandby.c | 2 +- arch/arm/src/stm32l4/stm32l4_pwm.c | 24 ++-- arch/arm/src/stm32l4/stm32l4_qencoder.c | 4 +- arch/arm/src/stm32l4/stm32l4_qencoder.h | 2 +- arch/arm/src/stm32l4/stm32l4_qspi.c | 6 +- arch/arm/src/stm32l4/stm32l4_qspi.h | 6 +- arch/arm/src/stm32l4/stm32l4_sai.c | 6 +- arch/arm/src/stm32l4/stm32l4_sdmmc.c | 6 +- arch/arm/src/stm32l4/stm32l4_sdmmc.h | 6 +- arch/arm/src/stm32l4/stm32l4_serial.c | 4 +- arch/arm/src/stm32l4/stm32l4_spi.c | 4 +- arch/arm/src/stm32l4/stm32l4_spi.h | 2 +- arch/arm/src/stm32l4/stm32l4_tim.h | 2 +- arch/arm/src/stm32l4/stm32l4_tim_lowerhalf.c | 12 +- arch/arm/src/stm32l4/stm32l4_wdg.h | 4 +- arch/arm/src/stm32l4/stm32l4x6xx_dma.c | 4 +- arch/arm/src/str71x/str71x.h | 2 +- arch/arm/src/tiva/tiva_adc.h | 34 ++--- arch/arm/src/tiva/tiva_adclib.c | 34 ++--- arch/arm/src/tiva/tiva_adclow.c | 2 +- arch/arm/src/tiva/tiva_gpioirq.c | 2 +- arch/arm/src/tiva/tiva_i2c.h | 4 +- arch/arm/src/tiva/tiva_pwm.c | 12 +- arch/arm/src/tiva/tiva_qencoder.c | 16 +-- arch/arm/src/tiva/tiva_ssi.c | 2 +- arch/arm/src/tiva/tiva_ssi.h | 2 +- arch/arm/src/tiva/tiva_timer.h | 2 +- arch/arm/src/tiva/tiva_timerlow32.c | 22 ++-- arch/arm/src/tms570/tms570_irq.c | 4 +- arch/arm/src/tms570/tms570_selftest.h | 2 +- arch/arm/src/xmc4/xmc4_i2c.h | 4 +- arch/arm/src/xmc4/xmc4_serial.c | 2 +- arch/arm/src/xmc4/xmc4_spi.h | 2 +- arch/avr/src/at32uc3/at32uc3_gpioirq.c | 4 +- arch/avr/src/avr/avr.h | 2 +- arch/avr/src/avr/up_blocktask.c | 2 +- arch/avr/src/avr/up_checkstack.c | 4 +- arch/avr/src/avr/up_createstack.c | 2 +- arch/avr/src/avr/up_reprioritizertr.c | 2 +- arch/avr/src/avr/up_spi.c | 2 +- arch/avr/src/avr/up_stackframe.c | 2 +- arch/avr/src/avr/up_switchcontext.S | 2 +- arch/avr/src/avr/up_unblocktask.c | 2 +- arch/avr/src/avr/up_usestack.c | 2 +- arch/avr/src/avr32/up_blocktask.c | 2 +- arch/avr/src/avr32/up_createstack.c | 2 +- arch/avr/src/avr32/up_reprioritizertr.c | 2 +- arch/avr/src/avr32/up_stackframe.c | 2 +- arch/avr/src/avr32/up_switchcontext.S | 2 +- arch/avr/src/avr32/up_unblocktask.c | 2 +- arch/avr/src/avr32/up_usestack.c | 2 +- arch/avr/src/common/up_releasestack.c | 2 +- arch/hc/src/common/up_blocktask.c | 2 +- arch/hc/src/common/up_createstack.c | 2 +- arch/hc/src/common/up_releasestack.c | 2 +- arch/hc/src/common/up_reprioritizertr.c | 2 +- arch/hc/src/common/up_stackframe.c | 2 +- arch/hc/src/common/up_unblocktask.c | 2 +- arch/hc/src/common/up_usestack.c | 2 +- arch/hc/src/m9s12/m9s12.h | 2 +- arch/mips/src/common/up_createstack.c | 2 +- arch/mips/src/common/up_releasestack.c | 2 +- arch/mips/src/common/up_stackframe.c | 2 +- arch/mips/src/common/up_usestack.c | 2 +- arch/mips/src/mips32/up_blocktask.c | 2 +- arch/mips/src/mips32/up_reprioritizertr.c | 2 +- arch/mips/src/mips32/up_unblocktask.c | 2 +- arch/mips/src/mips32/up_vfork.c | 4 +- arch/mips/src/mips32/vfork.S | 4 +- arch/mips/src/pic32mx/pic32mx-spi.c | 2 +- arch/mips/src/pic32mx/pic32mx.h | 2 +- arch/mips/src/pic32mz/pic32mz-spi.c | 2 +- arch/mips/src/pic32mz/pic32mz-spi.h | 2 +- arch/misoc/src/lm32/lm32_blocktask.c | 2 +- arch/misoc/src/lm32/lm32_createstack.c | 2 +- arch/misoc/src/lm32/lm32_releasestack.c | 2 +- arch/misoc/src/lm32/lm32_reprioritizertr.c | 2 +- arch/misoc/src/lm32/lm32_stackframe.c | 2 +- arch/misoc/src/lm32/lm32_unblocktask.c | 2 +- arch/renesas/src/common/up_blocktask.c | 2 +- arch/renesas/src/common/up_createstack.c | 2 +- arch/renesas/src/common/up_releasestack.c | 2 +- arch/renesas/src/common/up_reprioritizertr.c | 2 +- arch/renesas/src/common/up_stackframe.c | 2 +- arch/renesas/src/common/up_unblocktask.c | 2 +- arch/renesas/src/common/up_usestack.c | 2 +- arch/risc-v/src/common/up_createstack.c | 2 +- arch/risc-v/src/common/up_releasestack.c | 2 +- arch/risc-v/src/common/up_stackframe.c | 2 +- arch/risc-v/src/common/up_usestack.c | 2 +- arch/risc-v/src/nr5m100/nr5_timer.h | 2 +- arch/risc-v/src/rv32im/up_blocktask.c | 2 +- arch/risc-v/src/rv32im/up_reprioritizertr.c | 2 +- arch/risc-v/src/rv32im/up_unblocktask.c | 2 +- arch/risc-v/src/rv32im/up_vfork.c | 4 +- arch/sim/src/up_blocktask.c | 2 +- arch/sim/src/up_cpuidlestack.c | 2 +- arch/sim/src/up_createstack.c | 2 +- arch/sim/src/up_framebuffer.c | 4 +- arch/sim/src/up_qspiflash.c | 2 +- arch/sim/src/up_releasestack.c | 2 +- arch/sim/src/up_reprioritizertr.c | 2 +- arch/sim/src/up_spiflash.c | 2 +- arch/sim/src/up_stackframe.c | 2 +- arch/sim/src/up_unblocktask.c | 2 +- arch/sim/src/up_usestack.c | 2 +- arch/x86/src/common/up_blocktask.c | 2 +- arch/x86/src/common/up_reprioritizertr.c | 2 +- arch/x86/src/common/up_unblocktask.c | 2 +- arch/x86/src/i486/up_createstack.c | 2 +- arch/x86/src/i486/up_releasestack.c | 2 +- arch/x86/src/i486/up_stackframe.c | 2 +- arch/x86/src/i486/up_usestack.c | 2 +- arch/x86/src/qemu/qemu.h | 2 +- arch/x86/src/qemu/qemu_vga.c | 3 +- arch/xtensa/src/common/xtensa_assert.c | 4 +- arch/xtensa/src/common/xtensa_blocktask.c | 2 +- arch/xtensa/src/common/xtensa_checkstack.c | 4 +- arch/xtensa/src/common/xtensa_createstack.c | 2 +- arch/xtensa/src/common/xtensa_releasestack.c | 2 +- .../src/common/xtensa_reprioritizertr.c | 2 +- arch/xtensa/src/common/xtensa_stackframe.c | 2 +- arch/xtensa/src/common/xtensa_unblocktask.c | 2 +- arch/xtensa/src/common/xtensa_usestack.c | 2 +- arch/xtensa/src/esp32/esp32_cpuidlestack.c | 2 +- arch/z16/src/common/up_blocktask.c | 2 +- arch/z16/src/common/up_createstack.c | 2 +- arch/z16/src/common/up_releasestack.c | 2 +- arch/z16/src/common/up_reprioritizertr.c | 2 +- arch/z16/src/common/up_stackframe.c | 2 +- arch/z16/src/common/up_unblocktask.c | 2 +- arch/z16/src/common/up_usestack.c | 2 +- arch/z16/src/z16f/z16f_espi.c | 2 +- arch/z16/src/z16f/z16f_lowuart.S | 4 +- arch/z80/src/common/up_blocktask.c | 2 +- arch/z80/src/common/up_createstack.c | 2 +- arch/z80/src/common/up_releasestack.c | 2 +- arch/z80/src/common/up_reprioritizertr.c | 2 +- arch/z80/src/common/up_stackframe.c | 2 +- arch/z80/src/common/up_unblocktask.c | 2 +- arch/z80/src/common/up_usestack.c | 2 +- arch/z80/src/ez80/ez80_i2c.c | 2 +- arch/z80/src/ez80/ez80_spi.c | 2 +- arch/z80/src/ez80/ez80f91_i2c.h | 4 +- arch/z80/src/ez80/ez80f91_spi.h | 2 +- arch/z80/src/z8/z8_i2c.c | 2 +- audio/audio.c | 6 +- binfmt/binfmt.h | 6 +- binfmt/binfmt_copyargv.c | 4 +- binfmt/binfmt_schedunload.c | 8 +- configs/cloudctrl/src/stm32_usb.c | 4 +- configs/dk-tm4c129x/include/board.h | 2 +- configs/dk-tm4c129x/src/tm4c_tmp100.c | 2 +- configs/ea3131/src/lpc31_usbhost.c | 4 +- configs/freedom-kl25z/src/kl_cc3000.c | 2 +- configs/freedom-kl25z/src/kl_spi.c | 6 +- configs/freedom-kl26z/src/kl_spi.c | 6 +- configs/indium-f7/src/stm32_usb.c | 4 +- configs/mcu123-lpc214x/src/lpc2148_spi1.c | 2 +- configs/mikroe-stm32f4/src/stm32_pm.c | 4 +- configs/mikroe-stm32f4/src/stm32_usb.c | 4 +- configs/nucleo-144/src/stm32_usb.c | 4 +- configs/nucleo-f303re/src/nucleo-f303re.h | 2 +- configs/nucleo-f303re/src/stm32_timer.c | 2 +- configs/nucleo-f334r8/src/nucleo-f334r8.h | 2 +- configs/nucleo-l432kc/src/stm32_timer.c | 2 +- configs/nucleo-l476rg/src/stm32_timer.c | 2 +- configs/nucleo-l496zg/src/stm32_usb.c | 4 +- configs/olimex-lpc-h3131/include/board.h | 4 +- configs/olimex-lpc-h3131/src/lpc31_usbhost.c | 4 +- configs/olimex-stm32-e407/src/stm32_usb.c | 4 +- configs/olimex-stm32-h407/src/stm32_usb.c | 2 +- configs/olimex-stm32-p207/src/stm32_usb.c | 4 +- configs/olimex-stm32-p407/src/stm32_usb.c | 4 +- configs/olimex-strp711/src/str71_spi.c | 2 +- configs/olimexino-stm32/src/olimexino-stm32.h | 2 +- configs/olimexino-stm32/src/stm32_usbdev.c | 2 +- configs/photon/src/photon.h | 4 +- configs/sam3u-ek/src/sam_spi.c | 4 +- configs/sam4e-ek/src/sam_spi.c | 4 +- configs/sam4l-xplained/src/sam_spi.c | 6 +- .../src/sam4s-xplained-pro.h | 2 +- configs/sama5d3-xplained/src/sam_nandflash.c | 2 +- configs/sama5d3-xplained/src/sam_spi.c | 4 +- configs/sama5d3-xplained/src/sam_usb.c | 4 +- configs/sama5d3x-ek/src/sam_nandflash.c | 2 +- configs/sama5d3x-ek/src/sam_spi.c | 4 +- configs/sama5d3x-ek/src/sam_usb.c | 4 +- configs/sama5d4-ek/src/sam_nandflash.c | 2 +- configs/sama5d4-ek/src/sam_spi.c | 4 +- configs/sama5d4-ek/src/sam_usb.c | 2 +- configs/samd20-xplained/src/sam_spi.c | 6 +- configs/samd21-xplained/src/sam_spi.c | 6 +- configs/same70-xplained/src/sam_spi.c | 4 +- configs/saml21-xplained/src/sam_spi.c | 6 +- configs/samv71-xult/src/sam_spi.c | 4 +- configs/shenzhou/src/stm32_usb.c | 4 +- configs/spark/src/stm32_cc3000.c | 2 +- configs/stm3210e-eval/include/board.h | 4 +- configs/stm3210e-eval/src/stm32_lm75.c | 4 +- configs/stm3210e-eval/src/stm32_pm.c | 4 +- configs/stm3220g-eval/src/stm32_usb.c | 4 +- configs/stm3240g-eval/src/stm32_usb.c | 4 +- configs/stm32butterfly2/src/stm32_boot.c | 2 +- configs/stm32butterfly2/src/stm32_leds.c | 8 +- configs/stm32f103-minimum/src/stm32_apa102.c | 2 +- .../stm32f103-minimum/src/stm32_apds9960.c | 2 +- configs/stm32f103-minimum/src/stm32_lm75.c | 4 +- configs/stm32f103-minimum/src/stm32_mcp2515.c | 2 +- configs/stm32f103-minimum/src/stm32_mfrc522.c | 2 +- .../stm32f103-minimum/src/stm32_nrf24l01.c | 2 +- .../stm32f103-minimum/src/stm32_veml6070.c | 2 +- .../stm32f103-minimum/src/stm32f103_minimum.h | 2 +- configs/stm32f334-disco/src/stm32f334-disco.h | 2 +- configs/stm32f411e-disco/src/stm32_usb.c | 4 +- configs/stm32f429i-disco/src/stm32_l3gd20.c | 2 +- configs/stm32f429i-disco/src/stm32_lcd.c | 10 +- configs/stm32f429i-disco/src/stm32_spi.c | 2 +- configs/stm32f429i-disco/src/stm32_usb.c | 2 +- .../stm32f429i-disco/src/stm32f429i-disco.h | 4 +- .../stm32f4discovery/src/stm32_bh1750fvi.c | 2 +- configs/stm32f4discovery/src/stm32_bmp180.c | 2 +- configs/stm32f4discovery/src/stm32_lis3dsh.c | 4 +- configs/stm32f4discovery/src/stm32_max31855.c | 2 +- configs/stm32f4discovery/src/stm32_max6675.c | 2 +- configs/stm32f4discovery/src/stm32_pm.c | 4 +- configs/stm32f4discovery/src/stm32_timer.c | 2 +- configs/stm32f4discovery/src/stm32_usb.c | 4 +- .../stm32f4discovery/src/stm32f4discovery.h | 2 +- configs/stm32f746-ws/src/stm32_usb.c | 4 +- configs/stm32l476vg-disco/src/stm32_usb.c | 4 +- configs/teensy-lc/src/kl_spi.c | 6 +- configs/u-blox-c027/src/lpc17_ubxmdm.c | 2 +- .../viewtool-stm32f107/src/stm32_mpl115a.c | 2 +- .../src/viewtool_stm32f107.h | 2 +- configs/zp214xpa/src/lpc2148_spi1.c | 2 +- crypto/aes.c | 4 +- drivers/analog/ad5410.c | 2 +- drivers/analog/ads1255.c | 2 +- drivers/analog/dac.c | 2 +- drivers/audio/tone.c | 2 +- drivers/can/can.c | 4 +- drivers/can/mcp2515.c | 6 +- drivers/contactless/pn532.c | 4 +- drivers/input/ajoystick.c | 2 +- drivers/input/button_upper.c | 2 +- drivers/input/djoystick.c | 2 +- drivers/input/nunchuck.c | 2 +- drivers/lcd/ili9341.c | 4 +- drivers/lcd/lcd_framebuffer.c | 4 +- drivers/leds/rgbled.c | 2 +- drivers/leds/userled_upper.c | 2 +- drivers/mtd/hamming.c | 12 +- drivers/mtd/mtd_config.c | 8 +- drivers/mtd/mtd_nand.c | 14 +- drivers/mtd/mtd_nandecc.c | 8 +- drivers/mtd/mtd_nandmodel.c | 6 +- drivers/mtd/mtd_nandscheme.c | 14 +- drivers/mtd/mtd_partition.c | 2 +- drivers/net/telnet.c | 6 +- drivers/pipes/fifo.c | 4 +- drivers/pipes/pipe.c | 4 +- drivers/power/battery_charger.c | 4 +- drivers/power/battery_gauge.c | 4 +- drivers/power/pm_initialize.c | 4 +- drivers/power/pm_register.c | 4 +- drivers/pwm.c | 4 +- drivers/ramdisk.c | 4 +- drivers/syslog/syslog_emergstream.c | 2 +- drivers/syslog/syslog_stream.c | 4 +- drivers/timers/rtc.c | 2 +- drivers/timers/timer.c | 6 +- drivers/timers/watchdog.c | 4 +- drivers/usbdev/cdcacm.c | 6 +- drivers/usbdev/composite.c | 2 +- drivers/usbdev/rndis.c | 2 +- drivers/usbdev/usbmsc.c | 2 +- drivers/usbdev/usbmsc.h | 2 +- drivers/usbdev/usbmsc_scsi.c | 12 +- drivers/usbhost/hid_parser.c | 4 +- drivers/usbhost/usbhost_cdcacm.c | 2 +- drivers/usbhost/usbhost_enumerate.c | 2 +- drivers/usbhost/usbhost_findclass.c | 4 +- drivers/usbhost/usbhost_hidkbd.c | 40 +++--- drivers/usbhost/usbhost_hidmouse.c | 34 ++--- drivers/usbhost/usbhost_hub.c | 28 ++-- drivers/usbhost/usbhost_registerclass.c | 2 +- drivers/usbhost/usbhost_skeleton.c | 30 ++--- drivers/usbhost/usbhost_storage.c | 46 +++---- drivers/usbhost/usbhost_xboxcontroller.c | 34 ++--- drivers/usbmonitor/usbmonitor.c | 4 +- drivers/wireless/cc1101.c | 2 +- drivers/wireless/cc3000/wlan.c | 4 +- drivers/wireless/ieee802154/xbee/xbee.c | 4 +- .../wireless/ieee802154/xbee/xbee_netdev.c | 12 +- .../wireless/spirit/drivers/spirit_netdev.c | 6 +- .../wireless/spirit/include/spirit_general.h | 2 +- drivers/wireless/spirit/include/spirit_spi.h | 12 +- drivers/wireless/spirit/lib/spirit_spi.c | 12 +- fs/dirent/fs_closedir.c | 4 +- fs/dirent/fs_opendir.c | 16 +-- fs/dirent/fs_readdir.c | 4 +- fs/dirent/fs_rewinddir.c | 4 +- fs/dirent/fs_seekdir.c | 4 +- fs/driver/driver.h | 6 +- fs/driver/fs_blockproxy.c | 4 +- fs/driver/fs_closeblockdriver.c | 4 +- fs/driver/fs_findblockdriver.c | 4 +- fs/driver/fs_openblockdriver.c | 4 +- fs/driver/fs_registerblockdriver.c | 2 +- fs/driver/fs_registerdriver.c | 2 +- fs/fat/fs_fat32dirent.c | 10 +- fs/fat/fs_fat32util.c | 5 +- fs/inode/fs_inodereserve.c | 2 +- fs/inode/inode.h | 2 +- fs/mount/fs_mount.c | 2 +- fs/mount/fs_umount2.c | 2 +- fs/mqueue/mq_close.c | 6 +- fs/mqueue/mq_open.c | 2 +- fs/mqueue/mq_unlink.c | 2 +- fs/mqueue/mqueue.h | 2 +- fs/nfs/nfs_util.c | 8 +- fs/nxffs/nxffs.h | 20 +-- fs/nxffs/nxffs_block.c | 2 +- fs/nxffs/nxffs_inode.c | 2 +- fs/nxffs/nxffs_open.c | 6 +- fs/nxffs/nxffs_pack.c | 26 ++-- fs/nxffs/nxffs_util.c | 2 +- fs/nxffs/nxffs_write.c | 2 +- fs/semaphore/sem_close.c | 2 +- fs/semaphore/sem_open.c | 2 +- fs/semaphore/sem_unlink.c | 2 +- fs/unionfs/fs_unionfs.c | 2 +- fs/vfs/fs_fstatfs.c | 3 +- fs/vfs/fs_ioctl.c | 4 +- fs/vfs/fs_lseek.c | 4 +- fs/vfs/fs_poll.c | 4 +- fs/vfs/fs_pread.c | 2 +- fs/vfs/fs_pwrite.c | 2 +- fs/vfs/fs_select.c | 4 +- fs/vfs/fs_sendfile.c | 2 +- fs/vfs/fs_statfs.c | 3 +- graphics/nxbe/nxbe.h | 14 +- graphics/nxbe/nxbe_bitmap.c | 2 +- graphics/nxbe/nxbe_closewindow.c | 2 +- graphics/nxbe/nxbe_fill.c | 2 +- graphics/nxbe/nxbe_filltrapezoid.c | 2 +- graphics/nxbe/nxbe_getrectangle.c | 2 +- graphics/nxbe/nxbe_move.c | 2 +- graphics/nxbe/nxbe_setpixel.c | 2 +- graphics/nxmu/nxfe.h | 10 +- graphics/nxmu/nxmu_openwindow.c | 2 +- graphics/nxmu/nxmu_releasebkgd.c | 2 +- graphics/nxmu/nxmu_requestbkgd.c | 2 +- graphics/nxmu/nxmu_sendclient.c | 2 +- graphics/nxmu/nxmu_sendclientwindow.c | 2 +- graphics/nxmu/nxmu_server.c | 2 +- graphics/nxterm/nx_register.c | 8 +- graphics/nxterm/nxtk_register.c | 8 +- graphics/nxterm/nxtool_register.c | 8 +- graphics/vnc/server/vnc_fbdev.c | 10 +- include/hex2bin.h | 10 +- include/nuttx/analog/adc.h | 2 +- include/nuttx/analog/dac.h | 2 +- include/nuttx/arch.h | 30 ++--- include/nuttx/audio/audio.h | 4 +- include/nuttx/audio/tone.h | 2 +- include/nuttx/binfmt/binfmt.h | 2 +- include/nuttx/binfmt/builtin.h | 6 +- include/nuttx/cancelpt.h | 6 +- include/nuttx/clock.h | 10 +- include/nuttx/crypto/aes.h | 4 +- include/nuttx/drivers/drivers.h | 8 +- include/nuttx/drivers/pwm.h | 4 +- include/nuttx/drivers/ramdisk.h | 4 +- include/nuttx/fs/fs.h | 6 +- include/nuttx/fs/unionfs.h | 2 +- include/nuttx/fs/userfs.h | 4 +- include/nuttx/input/ajoystick.h | 2 +- include/nuttx/input/buttons.h | 2 +- include/nuttx/input/djoystick.h | 2 +- include/nuttx/input/nunchuck.h | 2 +- include/nuttx/kthread.h | 4 +- include/nuttx/leds/rgbled.h | 2 +- include/nuttx/leds/userled.h | 2 +- include/nuttx/mqueue.h | 2 +- include/nuttx/mtd/configdata.h | 2 +- include/nuttx/mtd/hamming.h | 4 +- include/nuttx/mtd/mtd.h | 2 +- include/nuttx/mtd/nand.h | 4 +- include/nuttx/mtd/nand_ecc.h | 8 +- include/nuttx/mtd/nand_model.h | 30 ++--- include/nuttx/mtd/nand_raw.h | 20 +-- include/nuttx/mtd/nand_scheme.h | 22 ++-- include/nuttx/net/ieee802154.h | 2 +- include/nuttx/net/net.h | 12 +- include/nuttx/net/pkt.h | 2 +- include/nuttx/net/radiodev.h | 6 +- include/nuttx/net/telnet.h | 2 +- include/nuttx/nx/nx.h | 56 ++++---- include/nuttx/nx/nxfonts.h | 6 +- include/nuttx/nx/nxglib.h | 12 +- include/nuttx/nx/nxmu.h | 8 +- include/nuttx/nx/nxterm.h | 6 +- include/nuttx/nx/nxtk.h | 58 ++++---- include/nuttx/power/battery_charger.h | 4 +- include/nuttx/power/battery_gauge.h | 4 +- include/nuttx/power/pm.h | 8 +- include/nuttx/sched.h | 20 +-- include/nuttx/semaphore.h | 26 ++-- include/nuttx/signal.h | 8 +- include/nuttx/streams.h | 20 +-- include/nuttx/syslog/syslog.h | 2 +- include/nuttx/time.h | 2 +- include/nuttx/timers/timer.h | 6 +- include/nuttx/timers/watchdog.h | 4 +- include/nuttx/usb/cdcacm.h | 4 +- include/nuttx/usb/composite.h | 2 +- include/nuttx/usb/hid_parser.h | 6 +- include/nuttx/usb/usbhost.h | 56 ++++---- include/nuttx/usb/usbmonitor.h | 2 +- include/nuttx/userspace.h | 8 +- include/nuttx/video/fb.h | 4 +- include/nuttx/wdog.h | 10 +- include/nuttx/wireless/cc3000/evnt_handler.h | 6 +- include/nuttx/wireless/cc3000/wlan.h | 4 +- .../wireless/ieee802154/ieee802154_mac.h | 16 +-- include/nuttx/wireless/nrf24l01.h | 38 +++--- include/nuttx/wireless/pktradio.h | 12 +- include/nuttx/wqueue.h | 14 +- include/sys/ioctl.h | 2 +- include/sys/sendfile.h | 2 +- include/sys/time.h | 4 +- libc/dirent/lib_readdirr.c | 4 +- libc/dirent/lib_telldir.c | 4 +- libc/hex2bin/lib_fhex2mem.c | 2 +- libc/hex2bin/lib_hex2bin.c | 2 +- libc/hex2bin/lib_hex2mem.c | 2 +- libc/inttypes/lib_strtoimax.c | 2 +- libc/inttypes/lib_strtoumax.c | 2 +- libc/libgen/lib_basename.c | 2 +- libc/libgen/lib_dirname.c | 2 +- libc/misc/lib_ioctl.c | 2 +- libc/misc/lib_mkfifo.c | 4 +- libc/misc/lib_sendfile.c | 2 +- libc/net/lib_shutdown.c | 6 +- libc/pthread/pthread_attr_destroy.c | 2 +- libc/pthread/pthread_attr_getaffinity.c | 2 +- libc/pthread/pthread_attr_getinheritsched.c | 2 +- libc/pthread/pthread_attr_getschedparam.c | 2 +- libc/pthread/pthread_attr_getschedpolicy.c | 2 +- libc/pthread/pthread_attr_getstacksize.c | 2 +- libc/pthread/pthread_attr_init.c | 2 +- libc/pthread/pthread_attr_setaffinity.c | 2 +- libc/pthread/pthread_attr_setinheritsched.c | 2 +- libc/pthread/pthread_attr_setschedparam.c | 2 +- libc/pthread/pthread_attr_setschedpolicy.c | 2 +- libc/pthread/pthread_attr_setstacksize.c | 2 +- libc/pthread/pthread_barrierattr_destroy.c | 2 +- libc/pthread/pthread_barrierattr_getpshared.c | 2 +- libc/pthread/pthread_barrierattr_init.c | 2 +- libc/pthread/pthread_barrierattr_setpshared.c | 2 +- libc/pthread/pthread_barrierdestroy.c | 2 +- libc/pthread/pthread_barrierinit.c | 2 +- libc/pthread/pthread_barrierwait.c | 2 +- libc/pthread/pthread_condattr_destroy.c | 2 +- libc/pthread/pthread_condattr_init.c | 2 +- libc/pthread/pthread_conddestroy.c | 2 +- libc/pthread/pthread_condinit.c | 2 +- libc/pthread/pthread_mutexattr_destroy.c | 2 +- libc/pthread/pthread_mutexattr_getprotocol.c | 2 +- libc/pthread/pthread_mutexattr_getpshared.c | 2 +- libc/pthread/pthread_mutexattr_getrobust.c | 2 +- libc/pthread/pthread_mutexattr_gettype.c | 2 +- libc/pthread/pthread_mutexattr_init.c | 2 +- libc/pthread/pthread_mutexattr_setprotocol.c | 2 +- libc/pthread/pthread_mutexattr_setpshared.c | 2 +- libc/pthread/pthread_mutexattr_setrobust.c | 2 +- libc/pthread/pthread_mutexattr_settype.c | 2 +- libc/pthread/pthread_once.c | 2 +- libc/pthread/pthread_rwlock_rdlock.c | 2 +- libc/pthread/pthread_rwlock_wrlock.c | 2 +- libc/pthread/pthread_startup.c | 4 +- libc/pthread/pthread_yield.c | 2 +- libc/sched/sched_cpucount.c | 4 +- libc/sched/sched_getprioritymax.c | 4 +- libc/sched/sched_getprioritymin.c | 4 +- libc/sched/task_startup.c | 4 +- libc/semaphore/sem_getprotocol.c | 2 +- libc/semaphore/sem_getvalue.c | 2 +- libc/semaphore/sem_init.c | 4 +- libc/semaphore/sem_setprotocol.c | 4 +- libc/signal/sig_addset.c | 2 +- libc/signal/sig_delset.c | 2 +- libc/signal/sig_emptyset.c | 2 +- libc/signal/sig_fillset.c | 2 +- libc/signal/sig_ismember.c | 2 +- libc/stdio/lib_ferror.c | 2 +- libc/stdio/lib_fflush.c | 2 +- libc/stdio/lib_freopen.c | 2 +- libc/stdio/lib_libfflush.c | 2 +- libc/stdio/lib_libnoflush.c | 2 +- libc/stdio/lib_libsnoflush.c | 2 +- libc/stdio/lib_lowoutstream.c | 2 +- libc/stdio/lib_meminstream.c | 2 +- libc/stdio/lib_memoutstream.c | 2 +- libc/stdio/lib_memsistream.c | 2 +- libc/stdio/lib_memsostream.c | 2 +- libc/stdio/lib_nullinstream.c | 2 +- libc/stdio/lib_nulloutstream.c | 2 +- libc/stdio/lib_rawinstream.c | 2 +- libc/stdio/lib_rawoutstream.c | 2 +- libc/stdio/lib_rawsistream.c | 2 +- libc/stdio/lib_rawsostream.c | 2 +- libc/stdio/lib_remove.c | 2 +- libc/stdio/lib_stdinstream.c | 2 +- libc/stdio/lib_stdoutstream.c | 2 +- libc/stdio/lib_stdsistream.c | 2 +- libc/stdio/lib_stdsostream.c | 2 +- libc/stdio/lib_zeroinstream.c | 2 +- libc/stdlib/lib_abort.c | 2 +- libc/stdlib/lib_checkbase.c | 2 +- libc/stdlib/lib_ptsname.c | 2 +- libc/stdlib/lib_ptsnamer.c | 2 +- libc/stdlib/lib_strtol.c | 2 +- libc/stdlib/lib_strtoll.c | 2 +- libc/stdlib/lib_strtoul.c | 2 +- libc/stdlib/lib_strtoull.c | 2 +- libc/stdlib/lib_unlockpt.c | 2 +- libc/string/lib_stpcpy.c | 2 +- libc/string/lib_strcpy.c | 2 +- libc/string/lib_strtok.c | 2 +- libc/string/lib_strtokr.c | 2 +- libc/time/lib_asctime.c | 2 +- libc/time/lib_asctimer.c | 2 +- libc/time/lib_ctime.c | 2 +- libc/time/lib_ctimer.c | 2 +- libc/time/lib_dayofweek.c | 2 +- libc/time/lib_gettimeofday.c | 2 +- libc/time/lib_settimeofday.c | 2 +- libc/time/lib_time.c | 2 +- libc/unistd/lib_chdir.c | 2 +- libc/unistd/lib_getcwd.c | 2 +- libc/unistd/lib_getopt.c | 15 ++- libc/unistd/lib_pipe.c | 4 +- libc/userfs/lib_userfs.c | 2 +- libc/wqueue/work_cancel.c | 4 +- libc/wqueue/work_lock.c | 4 +- libc/wqueue/work_queue.c | 4 +- libc/wqueue/work_signal.c | 2 +- libc/wqueue/work_usrthread.c | 6 +- libc/wqueue/wqueue.h | 4 +- libnx/nx/nx_drawcircle.c | 2 +- libnx/nx/nx_drawline.c | 2 +- libnx/nx/nx_fillcircle.c | 2 +- libnx/nxfonts/nxfonts_cache.c | 6 +- libnx/nxglib/nxglib_circlepts.c | 4 +- libnx/nxglib/nxglib_circletraps.c | 4 +- libnx/nxglib/nxglib_splitline.c | 4 +- libnx/nxmu/nx_bitmap.c | 2 +- libnx/nxmu/nx_block.c | 2 +- libnx/nxmu/nx_closewindow.c | 2 +- libnx/nxmu/nx_connect.c | 2 +- libnx/nxmu/nx_constructwindow.c | 2 +- libnx/nxmu/nx_disconnect.c | 2 +- libnx/nxmu/nx_eventhandler.c | 2 +- libnx/nxmu/nx_eventnotify.c | 2 +- libnx/nxmu/nx_fill.c | 2 +- libnx/nxmu/nx_filltrapezoid.c | 2 +- libnx/nxmu/nx_getposition.c | 2 +- libnx/nxmu/nx_getrectangle.c | 2 +- libnx/nxmu/nx_lower.c | 4 +- libnx/nxmu/nx_move.c | 2 +- libnx/nxmu/nx_openwindow.c | 2 +- libnx/nxmu/nx_raise.c | 4 +- libnx/nxmu/nx_releasebkgd.c | 2 +- libnx/nxmu/nx_requestbkgd.c | 2 +- libnx/nxmu/nx_setbgcolor.c | 2 +- libnx/nxmu/nx_setpixel.c | 2 +- libnx/nxmu/nx_setposition.c | 2 +- libnx/nxmu/nx_setsize.c | 2 +- libnx/nxmu/nxmu_sendserver.c | 2 +- libnx/nxmu/nxmu_sendwindow.c | 2 +- libnx/nxtk/nxtk.h | 14 +- libnx/nxtk/nxtk_bitmaptoolbar.c | 2 +- libnx/nxtk/nxtk_bitmapwindow.c | 2 +- libnx/nxtk/nxtk_block.c | 2 +- libnx/nxtk/nxtk_closetoolbar.c | 2 +- libnx/nxtk/nxtk_closewindow.c | 2 +- libnx/nxtk/nxtk_containerclip.c | 4 +- libnx/nxtk/nxtk_drawcircletoolbar.c | 2 +- libnx/nxtk/nxtk_drawcirclewindow.c | 2 +- libnx/nxtk/nxtk_drawframe.c | 4 +- libnx/nxtk/nxtk_drawlinetoolbar.c | 2 +- libnx/nxtk/nxtk_drawlinewindow.c | 2 +- libnx/nxtk/nxtk_fillcircletoolbar.c | 2 +- libnx/nxtk/nxtk_fillcirclewindow.c | 2 +- libnx/nxtk/nxtk_filltoolbar.c | 2 +- libnx/nxtk/nxtk_filltraptoolbar.c | 2 +- libnx/nxtk/nxtk_filltrapwindow.c | 2 +- libnx/nxtk/nxtk_fillwindow.c | 2 +- libnx/nxtk/nxtk_getposition.c | 2 +- libnx/nxtk/nxtk_gettoolbar.c | 2 +- libnx/nxtk/nxtk_getwindow.c | 2 +- libnx/nxtk/nxtk_lower.c | 4 +- libnx/nxtk/nxtk_movetoolbar.c | 2 +- libnx/nxtk/nxtk_movewindow.c | 2 +- libnx/nxtk/nxtk_opentoolbar.c | 2 +- libnx/nxtk/nxtk_openwindow.c | 2 +- libnx/nxtk/nxtk_raise.c | 4 +- libnx/nxtk/nxtk_setposition.c | 2 +- libnx/nxtk/nxtk_setsize.c | 2 +- libnx/nxtk/nxtk_subwindowclip.c | 4 +- libnx/nxtk/nxtk_subwindowmove.c | 2 +- libnx/nxtk/nxtk_toolbarbounds.c | 2 +- mm/kmm_heap/kmm_addregion.c | 2 +- mm/kmm_heap/kmm_free.c | 2 +- mm/kmm_heap/kmm_heapmember.c | 2 +- mm/kmm_heap/kmm_initialize.c | 2 +- mm/kmm_heap/kmm_kernel.c | 2 +- mm/kmm_heap/kmm_malloc.c | 2 +- mm/kmm_heap/kmm_memalign.c | 2 +- mm/kmm_heap/kmm_realloc.c | 2 +- mm/kmm_heap/kmm_sem.c | 4 +- mm/kmm_heap/kmm_zalloc.c | 2 +- mm/mm_heap/mm_initialize.c | 4 +- mm/shm/shmget.c | 16 +-- mm/umm_heap/umm_addregion.c | 2 +- mm/umm_heap/umm_initialize.c | 2 +- mm/umm_heap/umm_malloc.c | 2 +- mm/umm_heap/umm_realloc.c | 2 +- mm/umm_heap/umm_sem.c | 4 +- mm/umm_heap/umm_zalloc.c | 2 +- net/arp/arp.h | 8 +- net/arp/arp_table.c | 6 +- net/devif/devif.h | 10 +- net/devif/devif_callback.c | 10 +- net/devif/devif_initialize.c | 2 +- net/icmp/icmp.h | 4 +- net/icmp/icmp_input.c | 4 +- net/icmp/icmp_poll.c | 2 +- net/icmp/icmp_sendto.c | 2 +- net/icmpv6/icmpv6.h | 14 +- net/icmpv6/icmpv6_advertise.c | 2 +- net/icmpv6/icmpv6_autoconfig.c | 2 +- net/icmpv6/icmpv6_input.c | 4 +- net/icmpv6/icmpv6_poll.c | 2 +- net/icmpv6/icmpv6_rsolicit.c | 2 +- net/icmpv6/icmpv6_sendto.c | 2 +- net/icmpv6/icmpv6_solicit.c | 2 +- net/ieee802154/ieee802154.h | 16 +-- net/ieee802154/ieee802154_container.c | 12 +- net/ieee802154/ieee802154_input.c | 6 +- net/ieee802154/ieee802154_poll.c | 2 +- net/ieee802154/ieee802154_recvfrom.c | 6 +- net/ieee802154/ieee802154_sendto.c | 6 +- net/igmp/igmp.h | 2 +- net/igmp/igmp_send.c | 2 +- net/ipforward/ipv6_forward.c | 2 +- net/local/local.h | 10 +- net/local/local_connect.c | 4 +- net/local/local_recvutils.c | 6 +- net/local/local_send.c | 2 +- net/local/local_sendpacket.c | 4 +- net/netdev/netdev_ioctl.c | 22 ++-- net/pkt/pkt.h | 4 +- net/pkt/pkt_input.c | 2 +- net/pkt/pkt_poll.c | 2 +- net/pkt/pkt_recvfrom.c | 4 +- net/sixlowpan/sixlowpan.h | 12 +- net/sixlowpan/sixlowpan_framelist.c | 4 +- net/sixlowpan/sixlowpan_framer.c | 10 +- net/sixlowpan/sixlowpan_hc06.c | 2 +- net/sixlowpan/sixlowpan_hc1.c | 2 +- net/sixlowpan/sixlowpan_icmpv6send.c | 2 +- net/sixlowpan/sixlowpan_input.c | 2 +- net/sixlowpan/sixlowpan_internal.h | 32 ++--- net/sixlowpan/sixlowpan_reassbuf.c | 24 ++-- net/sixlowpan/sixlowpan_send.c | 2 +- net/sixlowpan/sixlowpan_tcpsend.c | 8 +- net/sixlowpan/sixlowpan_udpsend.c | 6 +- net/sixlowpan/sixlowpan_utils.c | 8 +- net/tcp/tcp.h | 24 ++-- net/tcp/tcp_appsend.c | 4 +- net/tcp/tcp_callback.c | 2 +- net/tcp/tcp_conn.c | 8 +- net/tcp/tcp_devpoll.c | 2 +- net/tcp/tcp_input.c | 6 +- net/tcp/tcp_send.c | 16 +-- net/tcp/tcp_timer.c | 2 +- net/tcp/tcp_wrbuffer.c | 2 +- net/udp/udp.h | 10 +- net/udp/udp_conn.c | 2 +- net/udp/udp_devpoll.c | 2 +- net/udp/udp_input.c | 6 +- net/udp/udp_send.c | 2 +- net/udp/udp_wrbuffer.c | 2 +- net/utils/net_ipv6_mask2pref.c | 2 +- net/utils/net_lock.c | 8 +- net/utils/utils.h | 2 +- sched/clock/clock_abstime2ticks.c | 2 +- sched/clock/clock_dow.c | 2 +- sched/clock/clock_initialize.c | 4 +- sched/clock/clock_systimer.c | 2 +- sched/clock/clock_systimespec.c | 2 +- sched/clock/clock_ticks2time.c | 2 +- sched/clock/clock_time2ticks.c | 2 +- sched/clock/clock_timespec_add.c | 4 +- sched/clock/clock_timespec_subtract.c | 4 +- sched/environ/env_clearenv.c | 2 +- sched/environ/env_dup.c | 2 +- sched/environ/env_findvar.c | 2 +- sched/environ/env_getenv.c | 2 +- sched/environ/env_getenvironptr.c | 2 +- sched/environ/env_putenv.c | 2 +- sched/environ/env_release.c | 2 +- sched/environ/env_removevar.c | 2 +- sched/environ/env_setenv.c | 2 +- sched/environ/env_unsetenv.c | 2 +- sched/errno/errno_get.c | 2 +- sched/errno/errno_getptr.c | 2 +- sched/errno/errno_set.c | 2 +- sched/group/group_addrenv.c | 2 +- sched/group/group_childstatus.c | 18 +-- sched/group/group_create.c | 6 +- sched/group/group_find.c | 4 +- sched/group/group_foreachchild.c | 2 +- sched/group/group_join.c | 6 +- sched/group/group_killchildren.c | 4 +- sched/group/group_leave.c | 8 +- sched/group/group_setupidlefiles.c | 2 +- sched/group/group_setuptaskfiles.c | 6 +- sched/group/group_signal.c | 4 +- sched/init/init.h | 2 +- sched/init/os_start.c | 2 +- sched/irq/irq.h | 4 +- sched/irq/irq_csection.c | 4 +- sched/mqueue/mq_desclose.c | 4 +- sched/mqueue/mq_descreate.c | 8 +- sched/mqueue/mq_getattr.c | 2 +- sched/mqueue/mq_initialize.c | 10 +- sched/mqueue/mq_msgfree.c | 4 +- sched/mqueue/mq_msgqalloc.c | 2 +- sched/mqueue/mq_msgqfree.c | 4 +- sched/mqueue/mq_notify.c | 2 +- sched/mqueue/mq_recover.c | 4 +- sched/mqueue/mq_release.c | 4 +- sched/mqueue/mq_setattr.c | 2 +- sched/mqueue/mq_sndinternal.c | 2 +- sched/mqueue/mq_waitirq.c | 2 +- sched/paging/paging.h | 2 +- sched/paging/pg_worker.c | 12 +- sched/pthread/pthread_cleanup.c | 2 +- sched/pthread/pthread_completejoin.c | 2 +- sched/pthread/pthread_condbroadcast.c | 2 +- sched/pthread/pthread_condsignal.c | 2 +- sched/pthread/pthread_condtimedwait.c | 4 +- sched/pthread/pthread_condwait.c | 2 +- sched/pthread/pthread_create.c | 6 +- sched/pthread/pthread_detach.c | 2 +- sched/pthread/pthread_findjoininfo.c | 2 +- sched/pthread/pthread_getaffinity.c | 2 +- sched/pthread/pthread_getschedparam.c | 2 +- sched/pthread/pthread_getspecific.c | 2 +- sched/pthread/pthread_initialize.c | 4 +- sched/pthread/pthread_join.c | 2 +- sched/pthread/pthread_keycreate.c | 2 +- sched/pthread/pthread_keydelete.c | 2 +- sched/pthread/pthread_kill.c | 2 +- sched/pthread/pthread_mutex.c | 10 +- sched/pthread/pthread_mutexdestroy.c | 2 +- sched/pthread/pthread_mutexinit.c | 2 +- sched/pthread/pthread_mutexlock.c | 2 +- sched/pthread/pthread_mutextrylock.c | 2 +- sched/pthread/pthread_mutexunlock.c | 4 +- sched/pthread/pthread_release.c | 2 +- sched/pthread/pthread_setaffinity.c | 2 +- sched/pthread/pthread_setschedparam.c | 2 +- sched/pthread/pthread_setschedprio.c | 4 +- sched/pthread/pthread_setspecific.c | 2 +- sched/pthread/pthread_sigmask.c | 2 +- sched/sched/sched_addblocked.c | 4 +- sched/sched/sched_addprioritized.c | 4 +- sched/sched/sched_addreadytorun.c | 8 +- sched/sched/sched_cpuload.c | 10 +- sched/sched/sched_cpuselect.c | 4 +- sched/sched/sched_foreach.c | 2 +- sched/sched/sched_garbage.c | 12 +- sched/sched/sched_getfiles.c | 2 +- sched/sched/sched_getparam.c | 8 +- sched/sched/sched_getscheduler.c | 8 +- sched/sched/sched_getsockets.c | 2 +- sched/sched/sched_getstreams.c | 2 +- sched/sched/sched_lock.c | 4 +- sched/sched/sched_lockcount.c | 4 +- sched/sched/sched_mergepending.c | 8 +- sched/sched/sched_mergeprioritized.c | 4 +- sched/sched/sched_releasetcb.c | 2 +- sched/sched/sched_removeblocked.c | 4 +- sched/sched/sched_removereadytorun.c | 8 +- sched/sched/sched_reprioritize.c | 4 +- sched/sched/sched_roundrobin.c | 4 +- sched/sched/sched_rrgetinterval.c | 4 +- sched/sched/sched_setaffinity.c | 8 +- sched/sched/sched_setparam.c | 8 +- sched/sched/sched_setpriority.c | 20 +-- sched/sched/sched_timerexpiration.c | 8 +- sched/sched/sched_waitpid.c | 2 +- sched/sched/sched_yield.c | 4 +- sched/semaphore/sem_destroy.c | 4 +- sched/semaphore/sem_holder.c | 24 ++-- sched/semaphore/sem_initialize.c | 2 +- sched/semaphore/sem_post.c | 4 +- sched/semaphore/sem_recover.c | 4 +- sched/semaphore/sem_reset.c | 2 +- sched/semaphore/sem_setprotocol.c | 4 +- sched/semaphore/sem_tickwait.c | 2 +- sched/semaphore/sem_timedwait.c | 4 +- sched/semaphore/sem_timeout.c | 2 +- sched/semaphore/sem_trywait.c | 4 +- sched/semaphore/sem_wait.c | 4 +- sched/semaphore/sem_waitirq.c | 2 +- sched/signal/sig_action.c | 2 +- sched/signal/sig_pending.c | 2 +- sched/signal/sig_procmask.c | 4 +- sched/signal/sig_queue.c | 4 +- sched/signal/sig_suspend.c | 2 +- sched/signal/sig_timedwait.c | 4 +- sched/signal/sig_waitinfo.c | 2 +- sched/task/task_activate.c | 2 +- sched/task/task_atexit.c | 2 +- sched/task/task_cancelpt.c | 6 +- sched/task/task_create.c | 8 +- sched/task/task_exit.c | 4 +- sched/task/task_getgroup.c | 2 +- sched/task/task_init.c | 2 +- sched/task/task_onexit.c | 2 +- sched/task/task_recover.c | 4 +- sched/task/task_reparent.c | 2 +- sched/task/task_restart.c | 4 +- sched/task/task_setup.c | 16 +-- sched/task/task_start.c | 4 +- sched/task/task_starthook.c | 4 +- sched/task/task_terminate.c | 4 +- sched/task/task_vfork.c | 6 +- sched/timer/timer_create.c | 2 +- sched/timer/timer_delete.c | 2 +- sched/timer/timer_getoverrun.c | 2 +- sched/timer/timer_gettime.c | 2 +- sched/timer/timer_initialize.c | 4 +- sched/timer/timer_release.c | 2 +- sched/timer/timer_settime.c | 8 +- sched/wdog/wd_cancel.c | 2 +- sched/wdog/wd_create.c | 2 +- sched/wdog/wd_delete.c | 2 +- sched/wdog/wd_gettime.c | 2 +- sched/wdog/wd_initialize.c | 2 +- sched/wdog/wd_recover.c | 4 +- sched/wdog/wd_start.c | 6 +- sched/wdog/wdog.h | 8 +- sched/wqueue/kwork_cancel.c | 4 +- sched/wqueue/kwork_hpthread.c | 4 +- sched/wqueue/kwork_inherit.c | 8 +- sched/wqueue/kwork_lpthread.c | 4 +- sched/wqueue/kwork_process.c | 2 +- sched/wqueue/kwork_queue.c | 4 +- sched/wqueue/kwork_signal.c | 2 +- sched/wqueue/wqueue.h | 6 +- wireless/ieee802154/ieee802154_primitive.c | 12 +- wireless/ieee802154/mac802154_device.c | 2 +- wireless/ieee802154/mac802154_loopback.c | 6 +- wireless/ieee802154/mac802154_netdev.c | 12 +- wireless/pktradio/pktradio_loopback.c | 6 +- wireless/pktradio/pktradio_metadata.c | 12 +- 1171 files changed, 3042 insertions(+), 3039 deletions(-) diff --git a/arch/arm/src/arm/pg_macros.h b/arch/arm/src/arm/pg_macros.h index 47616b426a..94263c7eb5 100644 --- a/arch/arm/src/arm/pg_macros.h +++ b/arch/arm/src/arm/pg_macros.h @@ -377,7 +377,7 @@ * ldr r3, =MMUFLAGS <-- L2 MMU flags * pg_l2map r0, r1, r2, r3, r4 * - * Inputs: + * Input Parameters: * l2 - Physical or virtual start address in the L2 page table, depending * upon the context. (modified) * ppage - The physical address of the start of the region to span. Must @@ -448,7 +448,7 @@ * ldr r4, =MMU_L1_PGTABFLAGS <-- L1 MMU flags * pg_l1span r0, r1, r2, r3, r4, r4 * - * Inputs (unmodified unless noted): + * Input Parameters (unmodified unless noted): * l1 - Physical or virtual address in the L1 table to begin writing (modified) * l2 - Physical start address in the L2 page table (modified) * npages - Number of pages to required to span that memory region (modified) @@ -462,7 +462,7 @@ * ppage - After the first page, this will be the full number of pages. * tmp - scratch * - * Return: + * Returned Value: * Nothing of interest. * * Assumptions: diff --git a/arch/arm/src/arm/up_blocktask.c b/arch/arm/src/arm/up_blocktask.c index 7169667145..97d1838d8a 100644 --- a/arch/arm/src/arm/up_blocktask.c +++ b/arch/arm/src/arm/up_blocktask.c @@ -62,7 +62,7 @@ * the ready to run list must be stopped. Save its context * and move it to the inactive list specified by task_state. * - * Inputs: + * Input Parameters: * tcb: Refers to a task in the ready-to-run list (normally * the task at the head of the list). It most be * stopped, its context saved and moved into one of the diff --git a/arch/arm/src/arm/up_dataabort.c b/arch/arm/src/arm/up_dataabort.c index 318c59232c..2a348b401e 100644 --- a/arch/arm/src/arm/up_dataabort.c +++ b/arch/arm/src/arm/up_dataabort.c @@ -59,7 +59,7 @@ /**************************************************************************** * Name: up_dataabort * - * Input parameters: + * Input Parameters: * regs - The standard, ARM register save array. * * If CONFIG_PAGING is selected in the NuttX configuration file, then these diff --git a/arch/arm/src/arm/up_reprioritizertr.c b/arch/arm/src/arm/up_reprioritizertr.c index 95679e31dd..10175b0df5 100644 --- a/arch/arm/src/arm/up_reprioritizertr.c +++ b/arch/arm/src/arm/up_reprioritizertr.c @@ -68,7 +68,7 @@ * the priority of the current, running task and it now has the * priority. * - * Inputs: + * Input Parameters: * tcb: The TCB of the task that has been reprioritized * priority: The new task priority * diff --git a/arch/arm/src/arm/up_unblocktask.c b/arch/arm/src/arm/up_unblocktask.c index 12cb984d83..e94c81de0c 100644 --- a/arch/arm/src/arm/up_unblocktask.c +++ b/arch/arm/src/arm/up_unblocktask.c @@ -61,7 +61,7 @@ * but has been prepped to execute. Move the TCB to the * ready-to-run list, restore its context, and start execution. * - * Inputs: + * Input Parameters: * tcb: Refers to the tcb to be unblocked. This tcb is * in one of the waiting tasks lists. It must be moved to * the ready-to-run list and, if it is the highest priority diff --git a/arch/arm/src/arm/vfork.S b/arch/arm/src/arm/vfork.S index 161315466f..661546daab 100644 --- a/arch/arm/src/arm/vfork.S +++ b/arch/arm/src/arm/vfork.S @@ -86,10 +86,10 @@ * 5) up_vfork() then calls task_vforkstart() * 6) task_vforkstart() then executes the child thread. * - * Input Paremeters: + * Input Parameters: * None * - * Return: + * Returned Value: * Upon successful completion, vfork() returns 0 to the child process and returns * the process ID of the child process to the parent process. Otherwise, -1 is * returned to the parent, no child process is created, and errno is set to diff --git a/arch/arm/src/armv6-m/up_blocktask.c b/arch/arm/src/armv6-m/up_blocktask.c index 2a95163cca..c01894715a 100644 --- a/arch/arm/src/armv6-m/up_blocktask.c +++ b/arch/arm/src/armv6-m/up_blocktask.c @@ -61,7 +61,7 @@ * be stopped. Save its context and move it to the inactive list specified * by task_state. * - * Inputs: + * Input Parameters: * tcb: Refers to a task in the ready-to-run list (normally the task at * the head of the list). It most be stopped, its context saved and * moved into one of the waiting task lists. It it was the task at the diff --git a/arch/arm/src/armv6-m/up_fullcontextrestore.S b/arch/arm/src/armv6-m/up_fullcontextrestore.S index 048c468749..4ec6a32a7e 100644 --- a/arch/arm/src/armv6-m/up_fullcontextrestore.S +++ b/arch/arm/src/armv6-m/up_fullcontextrestore.S @@ -70,7 +70,7 @@ * * void up_fullcontextrestore(uint32_t *restoreregs) noreturn_function; * - * Return: + * Returned Value: * None * ************************************************************************************/ diff --git a/arch/arm/src/armv6-m/up_reprioritizertr.c b/arch/arm/src/armv6-m/up_reprioritizertr.c index 41f0c8700d..0f99b91740 100644 --- a/arch/arm/src/armv6-m/up_reprioritizertr.c +++ b/arch/arm/src/armv6-m/up_reprioritizertr.c @@ -67,7 +67,7 @@ * the priority of the current, running task and it now has the * priority. * - * Inputs: + * Input Parameters: * tcb: The TCB of the task that has been reprioritized * priority: The new task priority * diff --git a/arch/arm/src/armv6-m/up_saveusercontext.S b/arch/arm/src/armv6-m/up_saveusercontext.S index bfc9a70ea8..55e6461b2b 100644 --- a/arch/arm/src/armv6-m/up_saveusercontext.S +++ b/arch/arm/src/armv6-m/up_saveusercontext.S @@ -70,7 +70,7 @@ * * int up_saveusercontext(uint32_t *saveregs); * - * Return: + * Returned Value: * 0: Normal return * 1: Context switch return * diff --git a/arch/arm/src/armv6-m/up_signal_dispatch.c b/arch/arm/src/armv6-m/up_signal_dispatch.c index fa3cea6222..45446a2b5e 100644 --- a/arch/arm/src/armv6-m/up_signal_dispatch.c +++ b/arch/arm/src/armv6-m/up_signal_dispatch.c @@ -78,12 +78,12 @@ * user-space, signal handler trampoline function. It is called from * up_signal_dispatch() in user-mode. * - * Inputs: + * Input Parameters: * sighand - The address user-space signal handling function * signo, info, and ucontext - Standard arguments to be passed to the * signal handling function. * - * Return: + * Returned Value: * None. This function does not return in the normal sense. It returns * via an architecture specific system call made by up_signal_handler(). * However, this will look like a normal return by the caller of diff --git a/arch/arm/src/armv6-m/up_signal_handler.S b/arch/arm/src/armv6-m/up_signal_handler.S index f294db9fc8..9ad7ec8133 100644 --- a/arch/arm/src/armv6-m/up_signal_handler.S +++ b/arch/arm/src/armv6-m/up_signal_handler.S @@ -65,13 +65,13 @@ * This function is the user-space, signal handler trampoline function. It * is called from up_signal_dispatch() in user-mode. * - * Inputs: + * Input Parameters: * R0 = sighand * The address user-space signal handling function * R1-R3 = signo, info, and ucontext * Standard arguments to be passed to the signal handling function. * - * Return: + * Returned Value: * None. This function does not return in the normal sense. It returns * via the SYS_signal_handler_return (see svcall.h) * diff --git a/arch/arm/src/armv6-m/up_switchcontext.S b/arch/arm/src/armv6-m/up_switchcontext.S index c24f501fc2..dc5aca9169 100644 --- a/arch/arm/src/armv6-m/up_switchcontext.S +++ b/arch/arm/src/armv6-m/up_switchcontext.S @@ -71,7 +71,7 @@ * * void up_switchcontext(uint32_t *saveregs, uint32_t *restoreregs); * - * Return: + * Returned Value: * None * ************************************************************************************/ diff --git a/arch/arm/src/armv6-m/up_unblocktask.c b/arch/arm/src/armv6-m/up_unblocktask.c index 62ec07d90a..1fbae12950 100644 --- a/arch/arm/src/armv6-m/up_unblocktask.c +++ b/arch/arm/src/armv6-m/up_unblocktask.c @@ -60,7 +60,7 @@ * execute. Move the TCB to the ready-to-run list, restore its context, * and start execution. * - * Inputs: + * Input Parameters: * tcb: Refers to the tcb to be unblocked. This tcb is in one of the * waiting tasks lists. It must be moved to the ready-to-run list and, * if it is the highest priority ready to run taks, executed. diff --git a/arch/arm/src/armv6-m/vfork.S b/arch/arm/src/armv6-m/vfork.S index 20c003d3ea..c64e96e22c 100644 --- a/arch/arm/src/armv6-m/vfork.S +++ b/arch/arm/src/armv6-m/vfork.S @@ -87,10 +87,10 @@ * 5) up_vfork() then calls task_vforkstart() * 6) task_vforkstart() then executes the child thread. * - * Input Paremeters: + * Input Parameters: * None * - * Return: + * Returned Value: * Upon successful completion, vfork() returns 0 to the child process and returns * the process ID of the child process to the parent process. Otherwise, -1 is * returned to the parent, no child process is created, and errno is set to diff --git a/arch/arm/src/armv7-a/arm_blocktask.c b/arch/arm/src/armv7-a/arm_blocktask.c index 3f02e46b36..61cce48de2 100644 --- a/arch/arm/src/armv7-a/arm_blocktask.c +++ b/arch/arm/src/armv7-a/arm_blocktask.c @@ -62,7 +62,7 @@ * the ready to run list must be stopped. Save its context * and move it to the inactive list specified by task_state. * - * Inputs: + * Input Parameters: * tcb: Refers to a task in the ready-to-run list (normally * the task at the head of the list). It most be * stopped, its context saved and moved into one of the diff --git a/arch/arm/src/armv7-a/arm_cpuhead.S b/arch/arm/src/armv7-a/arm_cpuhead.S index 02735e36d5..3ed001656d 100644 --- a/arch/arm/src/armv7-a/arm_cpuhead.S +++ b/arch/arm/src/armv7-a/arm_cpuhead.S @@ -93,7 +93,7 @@ * * These functions are provided by the common ARMv7-A logic. * - * Input parameters: + * Input Parameters: * None * * Returned Value: diff --git a/arch/arm/src/armv7-a/arm_cpuidlestack.c b/arch/arm/src/armv7-a/arm_cpuidlestack.c index dd264d25c1..1648de2fdb 100644 --- a/arch/arm/src/armv7-a/arm_cpuidlestack.c +++ b/arch/arm/src/armv7-a/arm_cpuidlestack.c @@ -112,7 +112,7 @@ static FAR const uint32_t *g_cpu_stackalloc[CONFIG_SMP_NCPUS] = * - adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The initial value of * the stack pointer. * - * Inputs: + * Input Parameters: * - cpu: CPU index that indicates which CPU the IDLE task is * being created for. * - tcb: The TCB of new CPU IDLE task diff --git a/arch/arm/src/armv7-a/arm_dataabort.c b/arch/arm/src/armv7-a/arm_dataabort.c index 50c95a2018..17073a925e 100644 --- a/arch/arm/src/armv7-a/arm_dataabort.c +++ b/arch/arm/src/armv7-a/arm_dataabort.c @@ -59,7 +59,7 @@ /**************************************************************************** * Name: arm_dataabort * - * Input parameters: + * Input Parameters: * regs - The standard, ARM register save array. * * If CONFIG_PAGING is selected in the NuttX configuration file, then these diff --git a/arch/arm/src/armv7-a/arm_fullcontextrestore.S b/arch/arm/src/armv7-a/arm_fullcontextrestore.S index 64f74c8a98..f65adbfadb 100644 --- a/arch/arm/src/armv7-a/arm_fullcontextrestore.S +++ b/arch/arm/src/armv7-a/arm_fullcontextrestore.S @@ -62,7 +62,7 @@ * * void up_fullcontextrestore(uint32_t *restoreregs) noreturn_function; * - * Return: + * Returned Value: * None * ****************************************************************************/ diff --git a/arch/arm/src/armv7-a/arm_gicv2.c b/arch/arm/src/armv7-a/arm_gicv2.c index 0232685dc8..8c6eee1509 100644 --- a/arch/arm/src/armv7-a/arm_gicv2.c +++ b/arch/arm/src/armv7-a/arm_gicv2.c @@ -372,7 +372,7 @@ void arm_gic_initialize(void) * the irq number of the interrupt and then to call arm_doirq to dispatch * the interrupt. * - * Input parameters: + * Input Parameters: * regs - A pointer to the register save area on the stack. * ****************************************************************************/ @@ -532,7 +532,7 @@ int up_prioritize_irq(int irq, int priority) * Since this API is not supported on all architectures, it should be * avoided in common implementations where possible. * - * Input Paramters: + * Input Parameters: * irq - The interrupt request to modify. * edge - False: Active HIGH level sensitive, True: Rising edge sensitive * diff --git a/arch/arm/src/armv7-a/arm_reprioritizertr.c b/arch/arm/src/armv7-a/arm_reprioritizertr.c index 4381178e05..eb1a4d2e6a 100644 --- a/arch/arm/src/armv7-a/arm_reprioritizertr.c +++ b/arch/arm/src/armv7-a/arm_reprioritizertr.c @@ -68,7 +68,7 @@ * the priority of the current, running task and it now has the * priority. * - * Inputs: + * Input Parameters: * tcb: The TCB of the task that has been reprioritized * priority: The new task priority * diff --git a/arch/arm/src/armv7-a/arm_signal_dispatch.c b/arch/arm/src/armv7-a/arm_signal_dispatch.c index 5925923760..1b461f5cb9 100644 --- a/arch/arm/src/armv7-a/arm_signal_dispatch.c +++ b/arch/arm/src/armv7-a/arm_signal_dispatch.c @@ -67,12 +67,12 @@ * user-space, signal handler trampoline function. It is called from * up_signal_dispatch() in user-mode. * - * Inputs: + * Input Parameters: * sighand - The address user-space signal handling function * signo, info, and ucontext - Standard arguments to be passed to the * signal handling function. * - * Return: + * Returned Value: * None. This function does not return in the normal sense. It returns * via an architecture specific system call made by up_signal_handler(). * However, this will look like a normal return by the caller of diff --git a/arch/arm/src/armv7-a/arm_unblocktask.c b/arch/arm/src/armv7-a/arm_unblocktask.c index e3d2fa3fc7..a9b0da6d2f 100644 --- a/arch/arm/src/armv7-a/arm_unblocktask.c +++ b/arch/arm/src/armv7-a/arm_unblocktask.c @@ -61,7 +61,7 @@ * but has been prepped to execute. Move the TCB to the * ready-to-run list, restore its context, and start execution. * - * Inputs: + * Input Parameters: * tcb: Refers to the tcb to be unblocked. This tcb is * in one of the waiting tasks lists. It must be moved to * the ready-to-run list and, if it is the highest priority diff --git a/arch/arm/src/armv7-a/arm_vfork.S b/arch/arm/src/armv7-a/arm_vfork.S index b7abc1c0f2..2e10c95099 100644 --- a/arch/arm/src/armv7-a/arm_vfork.S +++ b/arch/arm/src/armv7-a/arm_vfork.S @@ -88,10 +88,10 @@ * 5) up_vfork() then calls task_vforkstart() * 6) task_vforkstart() then executes the child thread. * - * Input Paremeters: + * Input Parameters: * None * - * Return: + * Returned Value: * Upon successful completion, vfork() returns 0 to the child process and * returns the process ID of the child process to the parent process. * Otherwise, -1 is returned to the parent, no child process is created, diff --git a/arch/arm/src/armv7-a/crt0.c b/arch/arm/src/armv7-a/crt0.c index a06e3f858e..f13148aa9b 100644 --- a/arch/arm/src/armv7-a/crt0.c +++ b/arch/arm/src/armv7-a/crt0.c @@ -67,13 +67,13 @@ int main(int argc, char *argv[]); * R4-R10 - static registers must be preserved * R12-R14 - LR and SP must be preserved * - * Inputs: + * Input Parameters: * R0 = sighand * The address user-space signal handling function * R1-R3 = signo, info, and ucontext * Standard arguments to be passed to the signal handling function. * - * Return: + * Returned Value: * None. This function does not return in the normal sense. It returns * via the SYS_signal_handler_return (see svcall.h) * diff --git a/arch/arm/src/armv7-a/gic.h b/arch/arm/src/armv7-a/gic.h index 8c882ad6dd..0281abae67 100644 --- a/arch/arm/src/armv7-a/gic.h +++ b/arch/arm/src/armv7-a/gic.h @@ -634,7 +634,7 @@ static inline unsigned int arm_gic_nlines(void) * If CONFIG_SMP is not selected, the cpuset is ignored and SGI is sent * only to the current CPU. * - * Input Paramters + * Input Parameters: * sgi - The SGI interrupt ID (0-15) * cpuset - The set of CPUs to receive the SGI * @@ -714,7 +714,7 @@ void arm_gic_initialize(void); * Since this API is not supported on all architectures, it should be * avoided in common implementations where possible. * - * Input Paramters: + * Input Parameters: * irq - The interrupt request to modify. * edge - False: Active HIGH level sensitive, True: Rising edge sensitive * @@ -735,7 +735,7 @@ int arm_gic_irq_trigger(int irq, bool edge); * the irq number of the interrupt and then to call arm_doirq to dispatch * the interrupt. * - * Input parameters: + * Input Parameters: * regs - A pointer to the register save area on the stack. * ****************************************************************************/ diff --git a/arch/arm/src/armv7-a/mmu.h b/arch/arm/src/armv7-a/mmu.h index c6338d3337..ba0870c235 100644 --- a/arch/arm/src/armv7-a/mmu.h +++ b/arch/arm/src/armv7-a/mmu.h @@ -897,7 +897,7 @@ struct section_mapping_s * Description: * Disable the MMU * - * Inputs: + * Input Parameters: * None * ************************************************************************************/ @@ -919,7 +919,7 @@ struct section_mapping_s * instruction that performs the operation. Software does not have to write a * value to the register before issuing the MCR instruction. * - * Inputs: + * Input Parameters: * None * ************************************************************************************/ @@ -934,7 +934,7 @@ struct section_mapping_s * Description: * Invalidate unified TLB entry by MVA all ASID Inner Shareable * - * Inputs: + * Input Parameters: * vaddr - The virtual address to be invalidated * ************************************************************************************/ @@ -952,7 +952,7 @@ struct section_mapping_s * Description: * Write the Domain Access Control Register (DACR) * - * Inputs: + * Input Parameters: * dacr - The new value of the DACR * ************************************************************************************/ @@ -979,7 +979,7 @@ struct section_mapping_s * Table Base Register 0 (TTBR0). Then it clears the TTB control * register (TTBCR), indicating that we are using TTBR0. * - * Inputs: + * Input Parameters: * ttb - The new value of the TTBR0 register * ************************************************************************************/ @@ -1012,7 +1012,7 @@ struct section_mapping_s * ldr r3, =MMUFLAGS <-- L2 MMU flags * pg_l2map r0, r1, r2, r3, r4 * - * Inputs: + * Input Parameters: * l2 - Physical or virtual start address in the L2 page table, depending * upon the context. (modified) * ppage - The physical address of the start of the region to span. Must @@ -1083,7 +1083,7 @@ struct section_mapping_s * ldr r4, =MMU_L1_PGTABFLAGS <-- L1 MMU flags * pg_l1span r0, r1, r2, r3, r4, r4 * - * Inputs (unmodified unless noted): + * Input Parameters (unmodified unless noted): * l1 - Physical or virtual address in the L1 table to begin writing (modified) * l2 - Physical start address in the L2 page table (modified) * npages - Number of pages to required to span that memory region (modified) @@ -1097,7 +1097,7 @@ struct section_mapping_s * ppage - After the first page, this will be the full number of pages. * tmp - scratch * - * Return: + * Returned Value: * Nothing of interest. * * Assumptions: @@ -1159,7 +1159,7 @@ struct section_mapping_s * Description: * Disable the MMU * - * Inputs: + * Input Parameters: * None * ************************************************************************************/ @@ -1188,7 +1188,7 @@ static inline void cp15_disable_mmu(void) * instruction that performs the operation. Software does not have to write a * value to the register before issuing the MCR instruction. * - * Inputs: + * Input Parameters: * None * ************************************************************************************/ @@ -1210,7 +1210,7 @@ static inline void cp15_invalidate_tlbs(void) * Description: * Invalidate unified TLB entry by MVA all ASID Inner Shareable * - * Inputs: + * Input Parameters: * vaddr - The virtual address to be invalidated * ************************************************************************************/ @@ -1235,7 +1235,7 @@ static inline void cp15_invalidate_tlb_bymva(uint32_t vaddr) * Description: * Write the Domain Access Control Register (DACR) * - * Inputs: + * Input Parameters: * dacr - The new value of the DACR * ************************************************************************************/ @@ -1269,7 +1269,7 @@ static inline void cp15_wrdacr(unsigned int dacr) * Table Base Register 0 (TTBR0). Then it clears the TTB control * register (TTBCR), indicating that we are using TTBR0. * - * Inputs: + * Input Parameters: * ttb - The new value of the TTBR0 register * ************************************************************************************/ diff --git a/arch/arm/src/armv7-a/smp.h b/arch/arm/src/armv7-a/smp.h index 7c9d1cc72a..1ae2bbfad8 100644 --- a/arch/arm/src/armv7-a/smp.h +++ b/arch/arm/src/armv7-a/smp.h @@ -93,7 +93,7 @@ extern uint32_t g_cpu3_idlestack[SMP_STACK_WORDS]; * * These functions are provided by the common ARMv7-A logic. * - * Input parameters: + * Input Parameters: * None * * Returned Value: @@ -129,7 +129,7 @@ void __cpu3_start(void); * This function must be provided by the each ARMv7-A MCU and implement * MCU-specific initialization logic. * - * Input parameters: + * Input Parameters: * cpu - The CPU index. This is the same value that would be obtained by * calling up_cpu_index(); * diff --git a/arch/arm/src/armv7-m/gnu/up_fullcontextrestore.S b/arch/arm/src/armv7-m/gnu/up_fullcontextrestore.S index a9ccb0d572..7b5171a449 100644 --- a/arch/arm/src/armv7-m/gnu/up_fullcontextrestore.S +++ b/arch/arm/src/armv7-m/gnu/up_fullcontextrestore.S @@ -71,7 +71,7 @@ * * void up_fullcontextrestore(uint32_t *restoreregs) noreturn_function; * - * Return: + * Returned Value: * None * ************************************************************************************/ diff --git a/arch/arm/src/armv7-m/gnu/up_saveusercontext.S b/arch/arm/src/armv7-m/gnu/up_saveusercontext.S index 7ebd2e4836..a4d96ef8fa 100644 --- a/arch/arm/src/armv7-m/gnu/up_saveusercontext.S +++ b/arch/arm/src/armv7-m/gnu/up_saveusercontext.S @@ -71,7 +71,7 @@ * * int up_saveusercontext(uint32_t *saveregs); * - * Return: + * Returned Value: * 0: Normal return * 1: Context switch return * diff --git a/arch/arm/src/armv7-m/gnu/up_signal_handler.S b/arch/arm/src/armv7-m/gnu/up_signal_handler.S index 2cc31da4d1..daf9448c14 100644 --- a/arch/arm/src/armv7-m/gnu/up_signal_handler.S +++ b/arch/arm/src/armv7-m/gnu/up_signal_handler.S @@ -71,13 +71,13 @@ * R4-R10 - static registers must be preserved * R12-R14 - LR and SP must be preserved * - * Inputs: + * Input Parameters: * R0 = sighand * The address user-space signal handling function * R1-R3 = signo, info, and ucontext * Standard arguments to be passed to the signal handling function. * - * Return: + * Returned Value: * None. This function does not return in the normal sense. It returns * via the SYS_signal_handler_return (see svcall.h) * diff --git a/arch/arm/src/armv7-m/gnu/up_switchcontext.S b/arch/arm/src/armv7-m/gnu/up_switchcontext.S index c0ddf15162..7c72411d3e 100644 --- a/arch/arm/src/armv7-m/gnu/up_switchcontext.S +++ b/arch/arm/src/armv7-m/gnu/up_switchcontext.S @@ -72,7 +72,7 @@ * * void up_switchcontext(uint32_t *saveregs, uint32_t *restoreregs); * - * Return: + * Returned Value: * None * ************************************************************************************/ diff --git a/arch/arm/src/armv7-m/gnu/vfork.S b/arch/arm/src/armv7-m/gnu/vfork.S index 784ab83ce7..fa3cfc1bea 100644 --- a/arch/arm/src/armv7-m/gnu/vfork.S +++ b/arch/arm/src/armv7-m/gnu/vfork.S @@ -88,10 +88,10 @@ * 5) up_vfork() then calls task_vforkstart() * 6) task_vforkstart() then executes the child thread. * - * Input Paremeters: + * Input Parameters: * None * - * Return: + * Returned Value: * Upon successful completion, vfork() returns 0 to the child process and returns * the process ID of the child process to the parent process. Otherwise, -1 is * returned to the parent, no child process is created, and errno is set to diff --git a/arch/arm/src/armv7-m/iar/up_fullcontextrestore.S b/arch/arm/src/armv7-m/iar/up_fullcontextrestore.S index 045c903a32..034bbfc8e8 100644 --- a/arch/arm/src/armv7-m/iar/up_fullcontextrestore.S +++ b/arch/arm/src/armv7-m/iar/up_fullcontextrestore.S @@ -72,7 +72,7 @@ * * void up_fullcontextrestore(uint32_t *restoreregs) noreturn_function; * - * Return: + * Returned Value: * None * ************************************************************************************/ diff --git a/arch/arm/src/armv7-m/iar/up_saveusercontext.S b/arch/arm/src/armv7-m/iar/up_saveusercontext.S index b8f27a7772..07a82c620a 100644 --- a/arch/arm/src/armv7-m/iar/up_saveusercontext.S +++ b/arch/arm/src/armv7-m/iar/up_saveusercontext.S @@ -72,7 +72,7 @@ * * int up_saveusercontext(uint32_t *saveregs); * - * Return: + * Returned Value: * 0: Normal return * 1: Context switch return * diff --git a/arch/arm/src/armv7-m/iar/up_switchcontext.S b/arch/arm/src/armv7-m/iar/up_switchcontext.S index 5936503d73..a115a498bf 100644 --- a/arch/arm/src/armv7-m/iar/up_switchcontext.S +++ b/arch/arm/src/armv7-m/iar/up_switchcontext.S @@ -73,7 +73,7 @@ * * void up_switchcontext(uint32_t *saveregs, uint32_t *restoreregs); * - * Return: + * Returned Value: * None * ************************************************************************************/ diff --git a/arch/arm/src/armv7-m/iar/vfork.S b/arch/arm/src/armv7-m/iar/vfork.S index 6018a28a00..e7352aee1e 100644 --- a/arch/arm/src/armv7-m/iar/vfork.S +++ b/arch/arm/src/armv7-m/iar/vfork.S @@ -89,10 +89,10 @@ * 5) up_vfork() then calls task_vforkstart() * 6) task_vforkstart() then executes the child thread. * - * Input Paremeters: + * Input Parameters: * None * - * Return: + * Returned Value: * Upon successful completion, vfork() returns 0 to the child process and returns * the process ID of the child process to the parent process. Otherwise, -1 is * returned to the parent, no child process is created, and errno is set to diff --git a/arch/arm/src/armv7-m/up_blocktask.c b/arch/arm/src/armv7-m/up_blocktask.c index 5e62e0fb9f..68151cb09b 100644 --- a/arch/arm/src/armv7-m/up_blocktask.c +++ b/arch/arm/src/armv7-m/up_blocktask.c @@ -61,7 +61,7 @@ * the ready to run list must be stopped. Save its context * and move it to the inactive list specified by task_state. * - * Inputs: + * Input Parameters: * tcb: Refers to a task in the ready-to-run list (normally * the task at the head of the list). It most be * stopped, its context saved and moved into one of the diff --git a/arch/arm/src/armv7-m/up_reprioritizertr.c b/arch/arm/src/armv7-m/up_reprioritizertr.c index 5e65a3d338..22c80ed298 100644 --- a/arch/arm/src/armv7-m/up_reprioritizertr.c +++ b/arch/arm/src/armv7-m/up_reprioritizertr.c @@ -67,7 +67,7 @@ * the priority of the current, running task and it now has the * priority. * - * Inputs: + * Input Parameters: * tcb: The TCB of the task that has been reprioritized * priority: The new task priority * diff --git a/arch/arm/src/armv7-m/up_signal_dispatch.c b/arch/arm/src/armv7-m/up_signal_dispatch.c index 9ec7d15152..c29d9c769a 100644 --- a/arch/arm/src/armv7-m/up_signal_dispatch.c +++ b/arch/arm/src/armv7-m/up_signal_dispatch.c @@ -66,12 +66,12 @@ * user-space, signal handler trampoline function. It is called from * up_signal_dispatch() in user-mode. * - * Inputs: + * Input Parameters: * sighand - The address user-space signal handling function * signo, info, and ucontext - Standard arguments to be passed to the * signal handling function. * - * Return: + * Returned Value: * None. This function does not return in the normal sense. It returns * via an architecture specific system call made by up_signal_handler(). * However, this will look like a normal return by the caller of diff --git a/arch/arm/src/armv7-m/up_unblocktask.c b/arch/arm/src/armv7-m/up_unblocktask.c index 3c9ae8df14..7ecbbd0e57 100644 --- a/arch/arm/src/armv7-m/up_unblocktask.c +++ b/arch/arm/src/armv7-m/up_unblocktask.c @@ -60,7 +60,7 @@ * but has been prepped to execute. Move the TCB to the * ready-to-run list, restore its context, and start execution. * - * Inputs: + * Input Parameters: * tcb: Refers to the tcb to be unblocked. This tcb is * in one of the waiting tasks lists. It must be moved to * the ready-to-run list and, if it is the highest priority diff --git a/arch/arm/src/armv7-r/arm_blocktask.c b/arch/arm/src/armv7-r/arm_blocktask.c index 58cefee3cf..c35093df07 100644 --- a/arch/arm/src/armv7-r/arm_blocktask.c +++ b/arch/arm/src/armv7-r/arm_blocktask.c @@ -62,7 +62,7 @@ * the ready to run list must be stopped. Save its context * and move it to the inactive list specified by task_state. * - * Inputs: + * Input Parameters: * tcb: Refers to a task in the ready-to-run list (normally * the task at the head of the list). It most be * stopped, its context saved and moved into one of the diff --git a/arch/arm/src/armv7-r/arm_dataabort.c b/arch/arm/src/armv7-r/arm_dataabort.c index 52f5d12436..f5939f80e5 100644 --- a/arch/arm/src/armv7-r/arm_dataabort.c +++ b/arch/arm/src/armv7-r/arm_dataabort.c @@ -54,7 +54,7 @@ /**************************************************************************** * Name: arm_dataabort * - * Input parameters: + * Input Parameters: * regs - The standard, ARM register save array. * dfar - Fault address register. * dfsr - Fault status register. diff --git a/arch/arm/src/armv7-r/arm_fullcontextrestore.S b/arch/arm/src/armv7-r/arm_fullcontextrestore.S index 06daa22182..9de8e405b7 100644 --- a/arch/arm/src/armv7-r/arm_fullcontextrestore.S +++ b/arch/arm/src/armv7-r/arm_fullcontextrestore.S @@ -75,7 +75,7 @@ * * void up_fullcontextrestore(uint32_t *restoreregs) noreturn_function; * - * Return: + * Returned Value: * None * ****************************************************************************/ diff --git a/arch/arm/src/armv7-r/arm_reprioritizertr.c b/arch/arm/src/armv7-r/arm_reprioritizertr.c index db96424eb2..85b8ee22c0 100644 --- a/arch/arm/src/armv7-r/arm_reprioritizertr.c +++ b/arch/arm/src/armv7-r/arm_reprioritizertr.c @@ -68,7 +68,7 @@ * the priority of the current, running task and it now has the * priority. * - * Inputs: + * Input Parameters: * tcb: The TCB of the task that has been reprioritized * priority: The new task priority * diff --git a/arch/arm/src/armv7-r/arm_signal_dispatch.c b/arch/arm/src/armv7-r/arm_signal_dispatch.c index 5fa1b3a647..c09c1481b6 100644 --- a/arch/arm/src/armv7-r/arm_signal_dispatch.c +++ b/arch/arm/src/armv7-r/arm_signal_dispatch.c @@ -79,12 +79,12 @@ * user-space, signal handler trampoline function. It is called from * up_signal_dispatch() in user-mode. * - * Inputs: + * Input Parameters: * sighand - The address user-space signal handling function * signo, info, and ucontext - Standard arguments to be passed to the * signal handling function. * - * Return: + * Returned Value: * None. This function does not return in the normal sense. It returns * via an architecture specific system call made by up_signal_handler(). * However, this will look like a normal return by the caller of diff --git a/arch/arm/src/armv7-r/arm_signal_handler.S b/arch/arm/src/armv7-r/arm_signal_handler.S index 43f629a3ba..f2812a934f 100644 --- a/arch/arm/src/armv7-r/arm_signal_handler.S +++ b/arch/arm/src/armv7-r/arm_signal_handler.S @@ -76,13 +76,13 @@ * R4-R10 - static registers must be preserved * R12-R14 - LR and SP must be preserved * - * Inputs: + * Input Parameters: * R0 = sighand * The address user-space signal handling function * R1-R3 = signo, info, and ucontext * Standard arguments to be passed to the signal handling function. * - * Return: + * Returned Value: * None. This function does not return in the normal sense. It returns * via the SYS_signal_handler_return (see svcall.h) * diff --git a/arch/arm/src/armv7-r/arm_unblocktask.c b/arch/arm/src/armv7-r/arm_unblocktask.c index 0361c1cc81..10188aac10 100644 --- a/arch/arm/src/armv7-r/arm_unblocktask.c +++ b/arch/arm/src/armv7-r/arm_unblocktask.c @@ -73,7 +73,7 @@ * but has been prepped to execute. Move the TCB to the * ready-to-run list, restore its context, and start execution. * - * Inputs: + * Input Parameters: * tcb: Refers to the tcb to be unblocked. This tcb is * in one of the waiting tasks lists. It must be moved to * the ready-to-run list and, if it is the highest priority diff --git a/arch/arm/src/armv7-r/arm_vfork.S b/arch/arm/src/armv7-r/arm_vfork.S index 635a5759c4..5b9a49588f 100644 --- a/arch/arm/src/armv7-r/arm_vfork.S +++ b/arch/arm/src/armv7-r/arm_vfork.S @@ -88,10 +88,10 @@ * 5) up_vfork() then calls task_vforkstart() * 6) task_vforkstart() then executes the child thread. * - * Input Paremeters: + * Input Parameters: * None * - * Return: + * Returned Value: * Upon successful completion, vfork() returns 0 to the child process and * returns the process ID of the child process to the parent process. * Otherwise, -1 is returned to the parent, no child process is created, diff --git a/arch/arm/src/bcm2708/bcm_miniuart.c b/arch/arm/src/bcm2708/bcm_miniuart.c index dc17851f61..a035bd1213 100644 --- a/arch/arm/src/bcm2708/bcm_miniuart.c +++ b/arch/arm/src/bcm2708/bcm_miniuart.c @@ -640,7 +640,7 @@ static bool bcm_rxavailable(struct uart_dev_s *dev) * Return true if UART activated RX flow control to block more incoming * data * - * Input parameters: + * Input Parameters: * dev - UART device instance * nbuffered - the number of characters currently buffered * (if CONFIG_SERIAL_IFLOWCONTROL_WATERMARKS is diff --git a/arch/arm/src/common/up_checkstack.c b/arch/arm/src/common/up_checkstack.c index 03423fd426..fe75ed99cd 100644 --- a/arch/arm/src/common/up_checkstack.c +++ b/arch/arm/src/common/up_checkstack.c @@ -72,7 +72,7 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size, bool int_stack); * alloc - Allocation base address of the stack * size - The size of the stack in bytes * - * Returned value: + * Returned Value: * The estimated amount of stack space used. * ****************************************************************************/ @@ -182,7 +182,7 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size, bool int_stack) * Input Parameters: * None * - * Returned value: + * Returned Value: * The estimated amount of stack space used. * ****************************************************************************/ diff --git a/arch/arm/src/common/up_createstack.c b/arch/arm/src/common/up_createstack.c index 6643f94def..2f3bd3b4d4 100644 --- a/arch/arm/src/common/up_createstack.c +++ b/arch/arm/src/common/up_createstack.c @@ -97,7 +97,7 @@ * - adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The initial value of * the stack pointer. * - * Inputs: + * Input Parameters: * - tcb: The TCB of new task * - stack_size: The requested stack size. At least this much * must be allocated. diff --git a/arch/arm/src/common/up_releasestack.c b/arch/arm/src/common/up_releasestack.c index 9be9740a5b..7090916dde 100644 --- a/arch/arm/src/common/up_releasestack.c +++ b/arch/arm/src/common/up_releasestack.c @@ -69,7 +69,7 @@ * A task has been stopped. Free all stack related resources retained in * the defunct TCB. * - * Input Parmeters + * Input Parameters: * - dtcb: The TCB containing information about the stack to be released * - ttype: The thread type. This may be one of following (defined in * include/nuttx/sched.h): diff --git a/arch/arm/src/common/up_stackframe.c b/arch/arm/src/common/up_stackframe.c index dace2e9239..c3a1f055eb 100644 --- a/arch/arm/src/common/up_stackframe.c +++ b/arch/arm/src/common/up_stackframe.c @@ -98,7 +98,7 @@ * been removed from the stack. This will still be the initial value * of the stack pointer when the task is started. * - * Inputs: + * Input Parameters: * - tcb: The TCB of new task * - frame_size: The size of the stack frame to allocate. * diff --git a/arch/arm/src/common/up_usestack.c b/arch/arm/src/common/up_usestack.c index 55c6a0526f..7748fbd652 100644 --- a/arch/arm/src/common/up_usestack.c +++ b/arch/arm/src/common/up_usestack.c @@ -89,7 +89,7 @@ * - adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The * initial value of the stack pointer. * - * Inputs: + * Input Parameters: * - tcb: The TCB of new task * - stack_size: The allocated stack size. * diff --git a/arch/arm/src/common/up_vfork.c b/arch/arm/src/common/up_vfork.c index 5a69e310e3..ff43c9cc97 100644 --- a/arch/arm/src/common/up_vfork.c +++ b/arch/arm/src/common/up_vfork.c @@ -101,7 +101,7 @@ * Input Parameters: * context - Caller context information saved by vfork() * - * Return: + * Returned Value: * Upon successful completion, vfork() returns 0 to the child process and * returns the process ID of the child process to the parent process. * Otherwise, -1 is returned to the parent, no child process is created, diff --git a/arch/arm/src/dm320/dm320_framebuffer.c b/arch/arm/src/dm320/dm320_framebuffer.c index dcedcb62e5..94b69e65d3 100644 --- a/arch/arm/src/dm320/dm320_framebuffer.c +++ b/arch/arm/src/dm320/dm320_framebuffer.c @@ -1367,7 +1367,7 @@ static int dm320_setcursor(FAR struct fb_vtable_s *vtable, FAR struct fb_setcurs * Description: * Initialize the framebuffer video hardware associated with the display. * - * Input parameters: + * Input Parameters: * display - In the case of hardware with multiple displays, this * specifies the display. Normally this is zero. * @@ -1403,7 +1403,7 @@ int up_fbinitialize(int display) * Return a a reference to the framebuffer object for the specified video * plane of the specified plane. Many OSDs support multiple planes of video. * - * Input parameters: + * Input Parameters: * display - In the case of hardware with multiple displays, this * specifies the display. Normally this is zero. * vplane - Identifies the plane being queried. diff --git a/arch/arm/src/efm32/efm32_adc.c b/arch/arm/src/efm32/efm32_adc.c index e79c2a61ef..a1224e2d75 100644 --- a/arch/arm/src/efm32/efm32_adc.c +++ b/arch/arm/src/efm32/efm32_adc.c @@ -705,7 +705,7 @@ endif /* defined(ADC_COUNT) && (ADC_COUNT > 0) */ * Description: * Dump all timer registers. * - * Input parameters: + * Input Parameters: * priv - A reference to the ADC block status * * Returned Value: diff --git a/arch/arm/src/efm32/efm32_bitband.c b/arch/arm/src/efm32/efm32_bitband.c index fa45b660b8..a4810705c3 100644 --- a/arch/arm/src/efm32/efm32_bitband.c +++ b/arch/arm/src/efm32/efm32_bitband.c @@ -86,7 +86,7 @@ * Note * This function is only atomic on cores which fully support bitbanding. * - * Input Parmeters: + * Input Parameters: * addr Peripheral address location to modify bit in. * bit Bit position to modify, 0-31. * val Value to set bit to, 0 or 1. @@ -115,7 +115,7 @@ inline void bitband_set_peripheral(uint32_t addr, uint32_t bit, uint32_t val) * Note * This function is only atomic on cores which fully support bitbanding. * - * Input Parmeters: + * Input Parameters: * addr Peripheral address location to read. * bit Bit position to modify, 0-31. * @@ -145,7 +145,7 @@ inline uint32_t bitband_get_peripheral(uint32_t addr, uint32_t bit) * Note * This function is only atomic on cores which fully support bitbanding. * - * Input Parmeters: + * Input Parameters: * addr SRAM address location to modify bit in. * bit Bit position to modify, 0-31. * val Value to set bit to, 0 or 1. @@ -174,7 +174,7 @@ inline void bitband_set_sram(uint32_t addr, uint32_t bit, uint32_t val) * Note * This function is only atomic on cores which fully support bitbanding. * - * Input Parmeters: + * Input Parameters: * addr Peripheral address location to read. * bit Bit position to modify, 0-31. * diff --git a/arch/arm/src/efm32/efm32_dma.c b/arch/arm/src/efm32/efm32_dma.c index ef97e08d6c..f93497b4d3 100644 --- a/arch/arm/src/efm32/efm32_dma.c +++ b/arch/arm/src/efm32/efm32_dma.c @@ -319,7 +319,7 @@ void weak_function up_dmainitialize(void) * until the holder of a channel relinquishes the channel by calling * efm32_dmafree(). * - * Input parameters: + * Input Parameters: * None * * Returned Value: diff --git a/arch/arm/src/efm32/efm32_dma.h b/arch/arm/src/efm32/efm32_dma.h index 813b30bf70..19eec8b0e9 100644 --- a/arch/arm/src/efm32/efm32_dma.h +++ b/arch/arm/src/efm32/efm32_dma.h @@ -173,7 +173,7 @@ extern "C" * If no DMA channel is available, then efm32_dmachannel() will wait until the * holder of a channel relinquishes the channel by calling efm32_dmafree(). * - * Input parameters: + * Input Parameters: * None * * Returned Value: diff --git a/arch/arm/src/efm32/efm32_i2c.h b/arch/arm/src/efm32/efm32_i2c.h index 16e51434be..6218da8435 100644 --- a/arch/arm/src/efm32/efm32_i2c.h +++ b/arch/arm/src/efm32/efm32_i2c.h @@ -56,7 +56,7 @@ * instances of the interface, each of which may be set up with a * different frequency and slave address. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has multiple I2C interfaces) * * Returned Value: @@ -72,7 +72,7 @@ FAR struct i2c_master_s *efm32_i2cbus_initialize(int port); * Description: * De-initialize the selected I2C port, and power down the device. * - * Input Parameter: + * Input Parameters: * Device structure as returned by the efm32_i2cbus_initialize() * * Returned Value: diff --git a/arch/arm/src/efm32/efm32_pm.h b/arch/arm/src/efm32/efm32_pm.h index 6846de31a3..413eda45c1 100644 --- a/arch/arm/src/efm32/efm32_pm.h +++ b/arch/arm/src/efm32/efm32_pm.h @@ -110,7 +110,7 @@ int efm32_pmstop(bool lpds); * Input Parameters: * None * - * Returned Value. + * Returned Value: * On success, this function will not return (STANDBY mode can only be * terminated with a reset event). Otherwise, STANDBY mode did not occur * and a negated errno value is returned to indicate the cause of the diff --git a/arch/arm/src/efm32/efm32_pwm.c b/arch/arm/src/efm32/efm32_pwm.c index b9c7bd0271..ec0ac79555 100644 --- a/arch/arm/src/efm32/efm32_pwm.c +++ b/arch/arm/src/efm32/efm32_pwm.c @@ -284,7 +284,7 @@ static void pwm_putreg(struct efm32_pwmtimer_s *priv, int offset, uint32_t value * Description: * Dump all timer registers. * - * Input parameters: + * Input Parameters: * priv - A reference to the PWM block status * * Returned Value: @@ -345,7 +345,7 @@ static void pwm_dumpregs(struct efm32_pwmtimer_s *priv, FAR const char *msg) * Description: * (Re-)initialize the timer resources and start the pulsed output * - * Input parameters: + * Input Parameters: * priv - A reference to the lower half PWM driver state structure * info - A reference to the characteristics of the pulsed output * @@ -433,7 +433,7 @@ static int pwm_timer(FAR struct efm32_pwmtimer_s *priv, * Description: * Handle timer interrupts. * - * Input parameters: + * Input Parameters: * Standard interrupt handler arguments. * * Returned Value: @@ -529,7 +529,7 @@ static int pwm_interrupt(int irq, void *context, FAR void *arg) * Description: * Pick an optimal pulse count to program the RCR. * - * Input parameters: + * Input Parameters: * count - The total count remaining * * Returned Value: @@ -583,7 +583,7 @@ static uint8_t pwm_pulsecount(uint32_t count) * should configure and initialize the device so that it is ready for use. * It should not, however, output pulses until the start method is called. * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * * Returned Value: @@ -643,7 +643,7 @@ static int pwm_setup(FAR struct pwm_lowerhalf_s *dev) * stop pulsed output, free any resources, disable the timer hardware, and * put the system into the lowest possible power usage state * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * * Returned Value: @@ -678,7 +678,7 @@ static int pwm_shutdown(FAR struct pwm_lowerhalf_s *dev) * Description: * (Re-)initialize the timer resources and start the pulsed output * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * info - A reference to the characteristics of the pulsed output * @@ -717,7 +717,7 @@ static int pwm_start(FAR struct pwm_lowerhalf_s *dev, * Description: * Stop the pulsed output and reset the timer resources * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * * Returned Value: @@ -761,7 +761,7 @@ static int pwm_stop(FAR struct pwm_lowerhalf_s *dev) * Description: * Lower-half logic may support platform-specific ioctl commands * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * cmd - The ioctl command * arg - The argument accompanying the ioctl command diff --git a/arch/arm/src/efm32/efm32_rmu.c b/arch/arm/src/efm32/efm32_rmu.c index 57d7b0e02b..fbed325339 100644 --- a/arch/arm/src/efm32/efm32_rmu.c +++ b/arch/arm/src/efm32/efm32_rmu.c @@ -184,7 +184,7 @@ uint32_t g_efm32_rstcause; * Description: * Return next reset cause string, NULL if no more reset cause. * - * Input Parmeters: + * Input Parameters: * reg: reset cause register to decode (like g_efm32_rstcause) * idx: Use to keep in maind reset cause decoding position. * set *idx to zero before first call. diff --git a/arch/arm/src/efm32/efm32_rmu.h b/arch/arm/src/efm32/efm32_rmu.h index 1bcfec2d33..9a7a32dbdc 100644 --- a/arch/arm/src/efm32/efm32_rmu.h +++ b/arch/arm/src/efm32/efm32_rmu.h @@ -90,7 +90,7 @@ const char* efm32_reset_cause_list_str(uint32_t reg, unsigned int *idx); * Description: * Return next reset cause string, NULL if no more reset cause. * - * Input Parmeters: + * Input Parameters: * reg: reset cause register to decode (like g_efm32_rstcause) * idx: Use to keep in maind reset cause decoding position. * set *idx to zero before first call. diff --git a/arch/arm/src/efm32/efm32_spi.c b/arch/arm/src/efm32/efm32_spi.c index d7821a553e..7fe5139666 100644 --- a/arch/arm/src/efm32/efm32_spi.c +++ b/arch/arm/src/efm32/efm32_spi.c @@ -1570,7 +1570,7 @@ static void spi_recvblock(struct spi_dev_s *dev, void *rxbuffer, * Initialize the selected SPI port in its default state (Master, 8-bit, * mode 0, etc.) * - * Input Parameter: + * Input Parameters: * priv - private SPI device structure * * Returned Value: @@ -1695,7 +1695,7 @@ errout: * Description: * Initialize the selected SPI port * - * Input Parameter: + * Input Parameters: * port - SPI port number to initialize. One of {0,1,2} * * Returned Value: diff --git a/arch/arm/src/efm32/efm32_spi.h b/arch/arm/src/efm32/efm32_spi.h index 9e84fb68dc..bcaff84e13 100644 --- a/arch/arm/src/efm32/efm32_spi.h +++ b/arch/arm/src/efm32/efm32_spi.h @@ -59,7 +59,7 @@ struct spi_dev_s; /* Forward reference */ * Description: * Initialize the selected SPI port * - * Input Parameter: + * Input Parameters: * port - SPI port number to initialize. One of {0,1,2} * * Returned Value: diff --git a/arch/arm/src/efm32/efm32_timer.c b/arch/arm/src/efm32/efm32_timer.c index 6264c3a378..f8c1b1eaaf 100644 --- a/arch/arm/src/efm32/efm32_timer.c +++ b/arch/arm/src/efm32/efm32_timer.c @@ -77,7 +77,7 @@ * Description: * Dump all timer registers. * - * Input parameters: + * Input Parameters: * base - A base address of timer * * Returned Value: @@ -132,7 +132,7 @@ void efm32_timer_dumpregs(uintptr_t base, FAR const char *msg) * Description: * reset timer into reset state * - * Input parameters: + * Input Parameters: * base - A base address of timer * * Returned Value: @@ -192,7 +192,7 @@ void efm32_timer_reset(uintptr_t base) * Description: * set prescaler and top timer with best value to have "freq" * - * Input parameters: + * Input Parameters: * base - A base address of timer * clk_freq - Clock soure of timer. * freq - Wanted freqency. diff --git a/arch/arm/src/efm32/efm32_usbhost.c b/arch/arm/src/efm32/efm32_usbhost.c index cce11725fd..8c1866a797 100644 --- a/arch/arm/src/efm32/efm32_usbhost.c +++ b/arch/arm/src/efm32/efm32_usbhost.c @@ -1340,7 +1340,7 @@ static int efm32_ctrlchan_alloc(FAR struct efm32_usbhost_s *priv, * ep - A memory location provided by the caller in which to receive the * allocated endpoint descriptor. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -1402,7 +1402,7 @@ static int efm32_ctrlep_alloc(FAR struct efm32_usbhost_s *priv, * ep - A memory location provided by the caller in which to receive the * allocated endpoint descriptor. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -3791,7 +3791,7 @@ static void efm32_txfe_enable(FAR struct efm32_usbhost_s *priv, int chidx) * hport - The location to return the hub port descriptor that detected the * connection related event. * - * Returned Values: + * Returned Value: * Zero (OK) is returned on success when a device in connected or * disconnected. This function will not return until either (1) a device is * connected or disconnect to/from any hub port or until (2) some failure @@ -3882,7 +3882,7 @@ static int efm32_wait(FAR struct usbhost_connection_s *conn, * hport - The descriptor of the hub port that has the newly connected * device. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4010,7 +4010,7 @@ static int efm32_enumerate(FAR struct usbhost_connection_s *conn, * maxpacketsize - The maximum number of bytes that can be sent to or * received from the endpoint in a single data packet * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4069,7 +4069,7 @@ static int efm32_ep0configure(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep * ep - A memory location provided by the caller in which to receive the * allocated endpoint descriptor. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4126,7 +4126,7 @@ static int efm32_epalloc(FAR struct usbhost_driver_s *drvr, * the class create() method. * ep - The endpoint to be freed. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4194,7 +4194,7 @@ static int efm32_epfree(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep) * maxlen - The address of a memory location provided by the caller in which to * return the maximum size of the allocated buffer memory. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4240,7 +4240,7 @@ static int efm32_alloc(FAR struct usbhost_driver_s *drvr, * the class create() method. * buffer - The address of the allocated buffer memory to be freed. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4276,7 +4276,7 @@ static int efm32_free(FAR struct usbhost_driver_s *drvr, FAR uint8_t *buffer) * return the allocated buffer memory address. * buflen - The size of the buffer required. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4320,7 +4320,7 @@ static int efm32_ioalloc(FAR struct usbhost_driver_s *drvr, * the class create() method. * buffer - The address of the allocated buffer memory to be freed. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4363,7 +4363,7 @@ static int efm32_iofree(FAR struct usbhost_driver_s *drvr, FAR uint8_t *buffer) * NOTE: On an IN transaction, req and buffer may refer to the same allocated * memory. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4566,7 +4566,7 @@ static int efm32_ctrlout(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0, * (IN endpoint). buffer must have been allocated using DRVR_ALLOC * buflen - The length of the data to be sent or received. * - * Returned Values: + * Returned Value: * On success, a non-negative value is returned that indicates the number * of bytes successfully transferred. On a failure, a negated errno value is * returned that indicates the nature of the failure: @@ -4638,7 +4638,7 @@ static ssize_t efm32_transfer(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep * arg - The arbitrary parameter that will be passed to the callback function * when the transfer completes. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4694,7 +4694,7 @@ static int efm32_asynch(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep, * ep - The IN or OUT endpoint descriptor for the device endpoint on which an * asynchronous transfer should be transferred. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure. * @@ -4783,7 +4783,7 @@ static int efm32_cancel(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep) * related event * connected - True: device connected; false: device disconnected * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure. * @@ -4834,7 +4834,7 @@ static int efm32_connect(FAR struct usbhost_driver_s *drvr, * drvr - The USB host driver instance obtained as a parameter from the call to * the class create() method. * - * Returned Values: + * Returned Value: * None * * Assumptions: diff --git a/arch/arm/src/imx1/imx_cspi.h b/arch/arm/src/imx1/imx_cspi.h index f15872c49b..3d80a3d540 100644 --- a/arch/arm/src/imx1/imx_cspi.h +++ b/arch/arm/src/imx1/imx_cspi.h @@ -193,7 +193,7 @@ struct spi_dev_s; /* Forward reference */ * required. Theregore, all GPIO chip management is deferred to board- * specific logic. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple SPI interfaces) * * Returned Value: diff --git a/arch/arm/src/imx1/imx_spi.c b/arch/arm/src/imx1/imx_spi.c index 92208b78be..682805fdb7 100644 --- a/arch/arm/src/imx1/imx_spi.c +++ b/arch/arm/src/imx1/imx_spi.c @@ -1024,7 +1024,7 @@ static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t nw * required. Theregore, all GPIO chip management is deferred to board- * specific logic. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple SPI interfaces) * * Returned Value: diff --git a/arch/arm/src/imx6/imx_cpuboot.c b/arch/arm/src/imx6/imx_cpuboot.c index 818b327a4b..e747b701cf 100644 --- a/arch/arm/src/imx6/imx_cpuboot.c +++ b/arch/arm/src/imx6/imx_cpuboot.c @@ -249,7 +249,7 @@ void imx_cpu_enable(void) * This function must be provided by the each ARMv7-A MCU and implement * MCU-specific initialization logic. * - * Input parameters: + * Input Parameters: * cpu - The CPU index. This is the same value that would be obtained by * calling up_cpu_index(); * diff --git a/arch/arm/src/imx6/imx_ecspi.c b/arch/arm/src/imx6/imx_ecspi.c index 42c8017fc0..0a20c514b9 100644 --- a/arch/arm/src/imx6/imx_ecspi.c +++ b/arch/arm/src/imx6/imx_ecspi.c @@ -1209,7 +1209,7 @@ static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t nw * required. Theregore, all GPIO chip management is deferred to board- * specific logic. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple SPI interfaces) * * Returned Value: diff --git a/arch/arm/src/imx6/imx_ecspi.h b/arch/arm/src/imx6/imx_ecspi.h index ac30d2291f..4e3f8b977e 100644 --- a/arch/arm/src/imx6/imx_ecspi.h +++ b/arch/arm/src/imx6/imx_ecspi.h @@ -85,7 +85,7 @@ struct spi_dev_s; /* Forward reference */ * required. Theregore, all GPIO chip management is deferred to board- * specific logic. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple SPI interfaces) * * Returned Value: diff --git a/arch/arm/src/kinetis/kinetis.h b/arch/arm/src/kinetis/kinetis.h index a1558179fd..ef91886626 100644 --- a/arch/arm/src/kinetis/kinetis.h +++ b/arch/arm/src/kinetis/kinetis.h @@ -418,7 +418,7 @@ void kinetis_lowsetup(void); * Input Parameters: * first: - First TTY number to assign * - * Returns Value: + * Returned Value: * The next TTY number available for assignment * ****************************************************************************/ @@ -437,7 +437,7 @@ unsigned int kinetis_uart_serialinit(unsigned int first); * Input Parameters: * first: - First TTY number to assign * - * Returns Value: + * Returned Value: * The next TTY number available for assignment * ****************************************************************************/ @@ -587,7 +587,7 @@ void kinetis_pinirqinitialize(void); * pinisr - Pin interrupt service routine * arg - An argument that will be provided to the interrupt service routine. * - * Return Value: + * Returned Value: * Zero (OK) is returned on success; a negated errno value is returned on any * failure to indicate the nature of the failure. * @@ -678,10 +678,10 @@ void kinetis_clrpend(int irq); * Description: * Initialize SDIO for operation. * - * Input parameters: + * Input Parameters: * slotno - Not used. * - * Returned Values: + * Returned Value: * A reference to an SDIO interface structure. NULL is returned on failures. * ****************************************************************************/ @@ -705,7 +705,7 @@ FAR struct sdio_dev_s *sdhc_initialize(int slotno); * card has been removed from the slot. Only transitions * (inserted->removed or removed->inserted should be reported) * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -725,7 +725,7 @@ void sdhc_mediachange(FAR struct sdio_dev_s *dev, bool cardinslot); * dev - An instance of the SDIO driver device state structure. * wrprotect - true is a card is writeprotected. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ diff --git a/arch/arm/src/kinetis/kinetis_i2c.h b/arch/arm/src/kinetis/kinetis_i2c.h index 098e4d39ad..8cb4246a17 100644 --- a/arch/arm/src/kinetis/kinetis_i2c.h +++ b/arch/arm/src/kinetis/kinetis_i2c.h @@ -57,7 +57,7 @@ * instances of the interface, each of which may be set up with a * different frequency and slave address. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has multiple I2C interfaces) * * Returned Value: @@ -73,7 +73,7 @@ FAR struct i2c_master_s *kinetis_i2cbus_initialize(int port); * Description: * De-initialize the selected I2C port, and power down the device. * - * Input Parameter: + * Input Parameters: * Device structure as returned by the lpc43_i2cbus_initialize() * * Returned Value: diff --git a/arch/arm/src/kinetis/kinetis_lpserial.c b/arch/arm/src/kinetis/kinetis_lpserial.c index 262bda4a8a..3de8f6e3a6 100644 --- a/arch/arm/src/kinetis/kinetis_lpserial.c +++ b/arch/arm/src/kinetis/kinetis_lpserial.c @@ -965,7 +965,7 @@ static bool kinetis_rxavailable(struct uart_dev_s *dev) * Return true if UART activated RX flow control to block more incoming * data * - * Input parameters: + * Input Parameters: * dev - UART device instance * nbuffered - the number of characters currently buffered * (if CONFIG_SERIAL_IFLOWCONTROL_WATERMARKS is @@ -1145,7 +1145,7 @@ void kinetis_lpuart_earlyserialinit(void) * Input Parameters: * first: - First TTY number to assign * - * Returns Value: + * Returned Value: * The next TTY number available for assignment * ****************************************************************************/ diff --git a/arch/arm/src/kinetis/kinetis_pin.c b/arch/arm/src/kinetis/kinetis_pin.c index 8a2e329432..4a084f6c27 100644 --- a/arch/arm/src/kinetis/kinetis_pin.c +++ b/arch/arm/src/kinetis/kinetis_pin.c @@ -214,7 +214,7 @@ int kinetis_pinconfig(uint32_t cfgset) * Configure the digital filter associated with a port. The digital filter * capabilities of the PORT module are available in all digital pin muxing modes. * - * Input parmeters: + * Input Parameters: * port - Port number. See KINETIS_PORTn definitions in kinetis_port.h * lpo - true: Digital Filters are clocked by the bus clock * false: Digital Filters are clocked by the 1 kHz LPO clock diff --git a/arch/arm/src/kinetis/kinetis_pinirq.c b/arch/arm/src/kinetis/kinetis_pinirq.c index f40be80a8e..0a015b6ad4 100644 --- a/arch/arm/src/kinetis/kinetis_pinirq.c +++ b/arch/arm/src/kinetis/kinetis_pinirq.c @@ -267,7 +267,7 @@ void kinetis_pinirqinitialize(void) * pinisr - Pin interrupt service routine * arg - An argument that will be provided to the interrupt service routine. * - * Returns: + * Returned Value: * Zero (OK) is returned on success; a negated errno value is returned on any * failure to indicate the nature of the failure. * diff --git a/arch/arm/src/kinetis/kinetis_pwm.c b/arch/arm/src/kinetis/kinetis_pwm.c index 83f6c76699..b4dd646c9a 100644 --- a/arch/arm/src/kinetis/kinetis_pwm.c +++ b/arch/arm/src/kinetis/kinetis_pwm.c @@ -248,7 +248,7 @@ static void pwm_putreg(struct kinetis_pwmtimer_s *priv, int offset, uint32_t val * Description: * Dump all timer registers. * - * Input parameters: + * Input Parameters: * priv - A reference to the PWM block status * * Returned Value: @@ -347,7 +347,7 @@ static void pwm_dumpregs(struct kinetis_pwmtimer_s *priv, FAR const char *msg) * Description: * (Re-)initialize the timer resources and start the pulsed output * - * Input parameters: + * Input Parameters: * priv - A reference to the lower half PWM driver state structure * info - A reference to the characteristics of the pulsed output * @@ -541,7 +541,7 @@ static int pwm_timer(FAR struct kinetis_pwmtimer_s *priv, * should configure and initialize the device so that it is ready for use. * It should not, however, output pulses until the start method is called. * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * * Returned Value: @@ -589,7 +589,7 @@ static int pwm_setup(FAR struct pwm_lowerhalf_s *dev) * stop pulsed output, free any resources, disable the timer hardware, and * put the system into the lowest possible power usage state * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * * Returned Value: @@ -622,7 +622,7 @@ static int pwm_shutdown(FAR struct pwm_lowerhalf_s *dev) * Description: * (Re-)initialize the timer resources and start the pulsed output * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * info - A reference to the characteristics of the pulsed output * @@ -644,7 +644,7 @@ static int pwm_start(FAR struct pwm_lowerhalf_s *dev, * Description: * Stop the pulsed output and reset the timer resources * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * * Returned Value: @@ -728,7 +728,7 @@ static int pwm_stop(FAR struct pwm_lowerhalf_s *dev) * Description: * Lower-half logic may support platform-specific ioctl commands * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * cmd - The ioctl command * arg - The argument accompanying the ioctl command diff --git a/arch/arm/src/kinetis/kinetis_sdhc.c b/arch/arm/src/kinetis/kinetis_sdhc.c index ef59c16fe0..816a4ee18b 100644 --- a/arch/arm/src/kinetis/kinetis_sdhc.c +++ b/arch/arm/src/kinetis/kinetis_sdhc.c @@ -2795,7 +2795,7 @@ static void kinetis_callback(void *arg) * Input Parameters: * slotno - Not used. * - * Returned Values: + * Returned Value: * A reference to an SDIO interface structure. NULL is returned on failures. * ****************************************************************************/ @@ -2909,7 +2909,7 @@ FAR struct sdio_dev_s *sdhc_initialize(int slotno) * card has been removed from the slot. Only transitions * (inserted->removed or removed->inserted should be reported) * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -2956,7 +2956,7 @@ void sdhc_mediachange(FAR struct sdio_dev_s *dev, bool cardinslot) * dev - An instance of the SDIO driver device state structure. * wrprotect - true is a card is writeprotected. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ diff --git a/arch/arm/src/kinetis/kinetis_serial.c b/arch/arm/src/kinetis/kinetis_serial.c index 0f2a4b2ee4..23d327ec09 100644 --- a/arch/arm/src/kinetis/kinetis_serial.c +++ b/arch/arm/src/kinetis/kinetis_serial.c @@ -1334,7 +1334,7 @@ static bool up_rxavailable(struct uart_dev_s *dev) * Return true if UART activated RX flow control to block more incoming * data * - * Input parameters: + * Input Parameters: * dev - UART device instance * nbuffered - the number of characters currently buffered * (if CONFIG_SERIAL_IFLOWCONTROL_WATERMARKS is @@ -1561,7 +1561,7 @@ void kinetis_uart_earlyserialinit(void) * Input Parameters: * first: - First TTY number to assign * - * Returns Value: + * Returned Value: * The next TTY number available for assignment * ****************************************************************************/ diff --git a/arch/arm/src/kinetis/kinetis_spi.c b/arch/arm/src/kinetis/kinetis_spi.c index 3fc63b901e..ce3971518e 100644 --- a/arch/arm/src/kinetis/kinetis_spi.c +++ b/arch/arm/src/kinetis/kinetis_spi.c @@ -1109,7 +1109,7 @@ static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *rxbuffer, size_t * Description: * Initialize the selected SPI port. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple SPI interfaces) * * Returned Value: diff --git a/arch/arm/src/kinetis/kinetis_spi.h b/arch/arm/src/kinetis/kinetis_spi.h index 8222af4424..4d3ce60ce2 100644 --- a/arch/arm/src/kinetis/kinetis_spi.h +++ b/arch/arm/src/kinetis/kinetis_spi.h @@ -75,7 +75,7 @@ struct spi_dev_s; * Description: * Initialize the selected SPI bus * - * Input Parameter: + * Input Parameters: * bus number (for hardware that has mutiple SPI interfaces) * * Returned Value: diff --git a/arch/arm/src/kl/kl_gpio.h b/arch/arm/src/kl/kl_gpio.h index 4a81acd27e..78f7fdc122 100644 --- a/arch/arm/src/kl/kl_gpio.h +++ b/arch/arm/src/kl/kl_gpio.h @@ -370,7 +370,7 @@ bool kl_gpioread(uint32_t pinset); * - pinisr: Pin interrupt service routine * - pinarg: The argument that will accompany the pin interrupt * - * Returns: + * Returned Value: * Zero (OK) is returned on success; On any failure, a negated errno value is * returned to indicate the nature of the failure. * diff --git a/arch/arm/src/kl/kl_gpioirq.c b/arch/arm/src/kl/kl_gpioirq.c index 38f30c0870..a42be056ab 100644 --- a/arch/arm/src/kl/kl_gpioirq.c +++ b/arch/arm/src/kl/kl_gpioirq.c @@ -230,8 +230,8 @@ void kl_gpioirqinitialize(void) * - pinisr: Pin interrupt service routine * - pinarg: The argument that will accompany the pin interrupt * - * Returns: - * Returns: + * Returned Value: + * Returned Value: * Zero (OK) is returned on success; On any failure, a negated errno value is * returned to indicate the nature of the failure. * diff --git a/arch/arm/src/kl/kl_pwm.c b/arch/arm/src/kl/kl_pwm.c index a34aa0f817..cfa024b477 100644 --- a/arch/arm/src/kl/kl_pwm.c +++ b/arch/arm/src/kl/kl_pwm.c @@ -226,7 +226,7 @@ static void pwm_putreg(struct kl_pwmtimer_s *priv, int offset, uint32_t value) * Description: * Dump all timer registers. * - * Input parameters: + * Input Parameters: * priv - A reference to the PWM block status * * Returned Value: @@ -307,7 +307,7 @@ static void pwm_dumpregs(struct kl_pwmtimer_s *priv, FAR const char *msg) * Description: * (Re-)initialize the timer resources and start the pulsed output * - * Input parameters: + * Input Parameters: * priv - A reference to the lower half PWM driver state structure * info - A reference to the characteristics of the pulsed output * @@ -488,7 +488,7 @@ static int pwm_timer(FAR struct kl_pwmtimer_s *priv, * should configure and initialize the device so that it is ready for use. * It should not, however, output pulses until the start method is called. * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * * Returned Value: @@ -529,7 +529,7 @@ static int pwm_setup(FAR struct pwm_lowerhalf_s *dev) * stop pulsed output, free any resources, disable the timer hardware, and * put the system into the lowest possible power usage state * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * * Returned Value: @@ -562,7 +562,7 @@ static int pwm_shutdown(FAR struct pwm_lowerhalf_s *dev) * Description: * (Re-)initialize the timer resources and start the pulsed output * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * info - A reference to the characteristics of the pulsed output * @@ -584,7 +584,7 @@ static int pwm_start(FAR struct pwm_lowerhalf_s *dev, * Description: * Stop the pulsed output and reset the timer resources * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * * Returned Value: @@ -660,7 +660,7 @@ static int pwm_stop(FAR struct pwm_lowerhalf_s *dev) * Description: * Lower-half logic may support platform-specific ioctl commands * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * cmd - The ioctl command * arg - The argument accompanying the ioctl command diff --git a/arch/arm/src/kl/kl_spi.c b/arch/arm/src/kl/kl_spi.c index 81cda9c9da..187ae75e9e 100644 --- a/arch/arm/src/kl/kl_spi.c +++ b/arch/arm/src/kl/kl_spi.c @@ -612,7 +612,7 @@ static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *rxbuffer, size_t * Description: * Initialize the selected SPI port. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple SPI interfaces) * * Returned Value: diff --git a/arch/arm/src/kl/kl_spi.h b/arch/arm/src/kl/kl_spi.h index fd621858a6..968cf6abef 100644 --- a/arch/arm/src/kl/kl_spi.h +++ b/arch/arm/src/kl/kl_spi.h @@ -71,7 +71,7 @@ struct spi_dev_s; /* Forward reference */ * Description: * Initialize the selected SPI port. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple SPI interfaces) * * Returned Value: diff --git a/arch/arm/src/lc823450/lc823450_cpuidlestack.c b/arch/arm/src/lc823450/lc823450_cpuidlestack.c index e9418abfcc..3c7a6e58fd 100644 --- a/arch/arm/src/lc823450/lc823450_cpuidlestack.c +++ b/arch/arm/src/lc823450/lc823450_cpuidlestack.c @@ -82,7 +82,7 @@ * - adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The initial value of * the stack pointer. * - * Inputs: + * Input Parameters: * - cpu: CPU index that indicates which CPU the IDLE task is * being created for. * - tcb: The TCB of new CPU IDLE task diff --git a/arch/arm/src/lc823450/lc823450_sdc.c b/arch/arm/src/lc823450/lc823450_sdc.c index b0f0a357e2..e47ab04dcb 100644 --- a/arch/arm/src/lc823450/lc823450_sdc.c +++ b/arch/arm/src/lc823450/lc823450_sdc.c @@ -355,7 +355,9 @@ int lc823450_sdc_setclock(uint32_t ch, uint32_t limitclk, uint32_t sysclk) /**************************************************************************** * Name: lc823450_sdc_refmediatype * - * Return Values: 0(sd), 1(emmc) + * Returned Value: + * 0(sd), 1(emmc) + * ****************************************************************************/ int lc823450_sdc_refmediatype(uint32_t ch) diff --git a/arch/arm/src/lc823450/lc823450_spi.c b/arch/arm/src/lc823450/lc823450_spi.c index 038351d79a..51451b6001 100644 --- a/arch/arm/src/lc823450/lc823450_spi.c +++ b/arch/arm/src/lc823450/lc823450_spi.c @@ -512,7 +512,7 @@ static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t nw * Description: * Initialize the selected SPI port. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple SPI interfaces) * * Returned Value: diff --git a/arch/arm/src/lc823450/lc823450_syscontrol.c b/arch/arm/src/lc823450/lc823450_syscontrol.c index 82e6c2ee01..cd5458729b 100644 --- a/arch/arm/src/lc823450/lc823450_syscontrol.c +++ b/arch/arm/src/lc823450/lc823450_syscontrol.c @@ -102,7 +102,7 @@ uint32_t get_cpu_ver(void) /**************************************************************************** * Name: mod_stby_regs * - * Input parameters: + * Input Parameters: * enabits : specify regions to be enabled * disbits : specify regions to be disabled * diff --git a/arch/arm/src/lc823450/lc823450_wdt.c b/arch/arm/src/lc823450/lc823450_wdt.c index 80f7b49c21..cdd351c095 100644 --- a/arch/arm/src/lc823450/lc823450_wdt.c +++ b/arch/arm/src/lc823450/lc823450_wdt.c @@ -182,7 +182,7 @@ static void wdg_work_func(void *arg) * Input Parameters: * Usual interrupt handler arguments. * - * Returned Values: + * Returned Value: * Always returns OK. * ****************************************************************************/ @@ -223,7 +223,7 @@ static int lc823450_wdt_interrupt(int irq, FAR void *context, FAR void *arg) * lower - A pointer the publicly visible representation of the "lower-half" * driver state structure. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -246,7 +246,7 @@ static int lc823450_wdt_start(FAR struct watchdog_lowerhalf_s *lower) * lower - A pointer the publicly visible representation of the "lower-half" * driver state structure. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -271,7 +271,7 @@ static int lc823450_wdt_stop(FAR struct watchdog_lowerhalf_s *lower) * lower - A pointer the publicly visible representation of the "lower-half" * driver state structure. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -299,7 +299,7 @@ static int lc823450_wdt_keepalive(FAR struct watchdog_lowerhalf_s *lower) * driver state structure. * stawtus - The location to return the watchdog status information. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -362,7 +362,7 @@ static int lc823450_wdt_getstatus(FAR struct watchdog_lowerhalf_s *lower, * driver state structure. * timeout - The new timeout value in millisecnds. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -430,7 +430,7 @@ static int lc823450_wdt_settimeout(FAR struct watchdog_lowerhalf_s *lower, * function pointer is NULL, then the reset-on-expiration * behavior is restored, * - * Returned Values: + * Returned Value: * The previous watchdog expiration function pointer or NULL is there was * no previous function pointer, i.e., if the previous behavior was * reset-on-expiration (NULL is also returned if an error occurs). @@ -496,7 +496,7 @@ static xcpt_t lc823450_wdt_capture(FAR struct watchdog_lowerhalf_s *lower, * interpretation of this argument depends on the particular * command. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -526,7 +526,7 @@ static int lc823450_wdt_ioctl(FAR struct watchdog_lowerhalf_s *lower, int cmd, * Input Parameters: * None * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ diff --git a/arch/arm/src/lpc11xx/lpc11_i2c.h b/arch/arm/src/lpc11xx/lpc11_i2c.h index a9bc6fa3f7..cd739be1a3 100644 --- a/arch/arm/src/lpc11xx/lpc11_i2c.h +++ b/arch/arm/src/lpc11xx/lpc11_i2c.h @@ -57,7 +57,7 @@ * instances of the interface, each of which may be set up with a * different frequency and slave address. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has multiple I2C interfaces) * * Returned Value: @@ -73,7 +73,7 @@ FAR struct i2c_master_s *lpc11_i2cbus_initialize(int port); * Description: * De-initialize the selected I2C port, and power down the device. * - * Input Parameter: + * Input Parameters: * Device structure as returned by the lpc11_i2cbus_initialize() * * Returned Value: diff --git a/arch/arm/src/lpc11xx/lpc11_spi.c b/arch/arm/src/lpc11xx/lpc11_spi.c index 363cd6466a..e1bb8e0d6c 100644 --- a/arch/arm/src/lpc11xx/lpc11_spi.c +++ b/arch/arm/src/lpc11xx/lpc11_spi.c @@ -526,7 +526,7 @@ static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, * Description: * Initialize the selected SPI port. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has multiple SPI interfaces) * * Returned Value: diff --git a/arch/arm/src/lpc11xx/lpc11_spi.h b/arch/arm/src/lpc11xx/lpc11_spi.h index 1a6786d218..30ee2bbecf 100644 --- a/arch/arm/src/lpc11xx/lpc11_spi.h +++ b/arch/arm/src/lpc11xx/lpc11_spi.h @@ -76,7 +76,7 @@ extern "C" * Description: * Initialize the selected SPI port. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple SPI interfaces) * * Returned Value: diff --git a/arch/arm/src/lpc11xx/lpc11_ssp.c b/arch/arm/src/lpc11xx/lpc11_ssp.c index 32cccc29f3..c0c1498f7e 100644 --- a/arch/arm/src/lpc11xx/lpc11_ssp.c +++ b/arch/arm/src/lpc11xx/lpc11_ssp.c @@ -776,7 +776,7 @@ static void ssp_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, * Description: * Initialize the SSP0 * - * Input Parameter: + * Input Parameters: * None * * Returned Value: @@ -830,7 +830,7 @@ static inline FAR struct lpc11_sspdev_s *lpc11_ssp0initialize(void) * Description: * Initialize the SSP1 * - * Input Parameter: + * Input Parameters: * None * * Returned Value: @@ -884,7 +884,7 @@ static inline FAR struct lpc11_sspdev_s *lpc11_ssp1initialize(void) * Description: * Initialize the SSP2 * - * Input Parameter: + * Input Parameters: * None * * Returned Value: @@ -941,7 +941,7 @@ static inline FAR struct lpc11_sspdev_s *lpc11_ssp2initialize(void) * Description: * Initialize the selected SSP port. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has multiple SPI interfaces) * * Returned Value: diff --git a/arch/arm/src/lpc11xx/lpc11_ssp.h b/arch/arm/src/lpc11xx/lpc11_ssp.h index f117b1cf03..825c67faa3 100644 --- a/arch/arm/src/lpc11xx/lpc11_ssp.h +++ b/arch/arm/src/lpc11xx/lpc11_ssp.h @@ -76,7 +76,7 @@ extern "C" * Description: * Initialize the selected SSP port. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has multiple SPI interfaces) * * Returned Value: diff --git a/arch/arm/src/lpc11xx/lpc11_timer.c b/arch/arm/src/lpc11xx/lpc11_timer.c index a9ce65a073..75d3d334a4 100644 --- a/arch/arm/src/lpc11xx/lpc11_timer.c +++ b/arch/arm/src/lpc11xx/lpc11_timer.c @@ -214,7 +214,7 @@ static void timer_putreg(struct lpc11_timer_s *priv, int offset, * Description: * Dump all timer registers. * - * Input parameters: + * Input Parameters: * priv - A reference to the PWM block status * * Returned Value: @@ -256,7 +256,7 @@ static void timer_dumpregs(struct lpc11_timer_s *priv, FAR const char *msg) * Description: * (Re-)initialize the timer resources and start the pulsed output * - * Input parameters: + * Input Parameters: * priv - A reference to the lower half PWM driver state structure * info - A reference to the characteristics of the pulsed output * @@ -291,7 +291,7 @@ static int timer_timer(FAR struct lpc11_timer_s *priv, * Description: * Handle timer interrupts. * - * Input parameters: + * Input Parameters: * priv - A reference to the lower half PWM driver state structure * * Returned Value: @@ -325,7 +325,7 @@ static int timer_interrupt(struct lpc11_timer_s *priv) * Description: * Handle timer 1 and 8 interrupts. * - * Input parameters: + * Input Parameters: * Standard NuttX interrupt inputs * * Returned Value: @@ -348,7 +348,7 @@ static int timer_tim1interrupt(int irq, void *context) * should configure and initialize the device so that it is ready for use. * It should not, however, output pulses until the start method is called. * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * * Returned Value: @@ -436,7 +436,7 @@ static int timer_setup(FAR struct pwm_lowerhalf_s *dev) * stop pulsed output, free any resources, disable the timer hardware, and * put the system into the lowest possible power usage state * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half TIMER driver state structure * * Returned Value: @@ -462,7 +462,7 @@ static int timer_shutdown(FAR struct pwm_lowerhalf_s *dev) * Description: * (Re-)initialize the timer resources and start the pulsed output * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half TIMER driver state structure * info - A reference to the characteristics of the pulsed output * @@ -484,7 +484,7 @@ static int timer_start(FAR struct pwm_lowerhalf_s *dev, * Description: * Stop the pulsed output and reset the timer resources * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half TIMER driver state structure * * Returned Value: @@ -542,7 +542,7 @@ static int timer_stop(FAR struct pwm_lowerhalf_s *dev) * Description: * Lower-half logic may support platform-specific ioctl commands * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half TIMER driver state structure * cmd - The ioctl command * arg - The argument accompanying the ioctl command diff --git a/arch/arm/src/lpc17xx/lpc17_can.c b/arch/arm/src/lpc17xx/lpc17_can.c index 94f1987280..d7e8fcc461 100644 --- a/arch/arm/src/lpc17xx/lpc17_can.c +++ b/arch/arm/src/lpc17xx/lpc17_can.c @@ -1109,7 +1109,7 @@ static int can12_interrupt(int irq, void *context, FAR void *arg) * Where: * Tcan is the period of the APB clock (PCLK = CCLK / CONFIG_CAN1_DIVISOR). * - * Input Parameter: + * Input Parameters: * priv - A reference to the CAN block status * * Returned Value: @@ -1210,7 +1210,7 @@ static int can_bittiming(struct up_dev_s *priv) * Description: * Initialize the selected can port * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple can interfaces) * * Returned Value: diff --git a/arch/arm/src/lpc17xx/lpc17_can.h b/arch/arm/src/lpc17xx/lpc17_can.h index e15eaced5a..2cbb8014a9 100644 --- a/arch/arm/src/lpc17xx/lpc17_can.h +++ b/arch/arm/src/lpc17xx/lpc17_can.h @@ -71,7 +71,7 @@ extern "C" * Description: * Initialize the selected can port * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple can interfaces) * * Returned Value: diff --git a/arch/arm/src/lpc17xx/lpc17_i2c.h b/arch/arm/src/lpc17xx/lpc17_i2c.h index a7a6322461..044f0560c7 100644 --- a/arch/arm/src/lpc17xx/lpc17_i2c.h +++ b/arch/arm/src/lpc17xx/lpc17_i2c.h @@ -57,7 +57,7 @@ * instances of the interface, each of which may be set up with a * different frequency and slave address. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has multiple I2C interfaces) * * Returned Value: @@ -73,7 +73,7 @@ FAR struct i2c_master_s *lpc17_i2cbus_initialize(int port); * Description: * De-initialize the selected I2C port, and power down the device. * - * Input Parameter: + * Input Parameters: * Device structure as returned by the lpc17_i2cbus_initialize() * * Returned Value: diff --git a/arch/arm/src/lpc17xx/lpc17_lcd.c b/arch/arm/src/lpc17xx/lpc17_lcd.c index 90332fc12e..e7aebe109f 100644 --- a/arch/arm/src/lpc17xx/lpc17_lcd.c +++ b/arch/arm/src/lpc17xx/lpc17_lcd.c @@ -458,7 +458,7 @@ static int lpc17_setcursor(FAR struct fb_vtable_s *vtable, * Description: * Initialize the framebuffer video hardware associated with the display. * - * Input parameters: + * Input Parameters: * display - In the case of hardware with multiple displays, this * specifies the display. Normally this is zero. * @@ -717,7 +717,7 @@ int up_fbinitialize(int display) * Return a a reference to the framebuffer object for the specified video * plane of the specified plane. Many OSDs support multiple planes of video. * - * Input parameters: + * Input Parameters: * display - In the case of hardware with multiple displays, this * specifies the display. Normally this is zero. * vplane - Identifies the plane being queried. diff --git a/arch/arm/src/lpc17xx/lpc17_mcpwm.c b/arch/arm/src/lpc17xx/lpc17_mcpwm.c index db0d1a9d67..c076a10ce5 100644 --- a/arch/arm/src/lpc17xx/lpc17_mcpwm.c +++ b/arch/arm/src/lpc17xx/lpc17_mcpwm.c @@ -215,7 +215,7 @@ static void mcpwm_putreg(struct lpc17_mcpwmtimer_s *priv, int offset, uint32_t v * Description: * Dump all timer registers. * - * Input parameters: + * Input Parameters: * priv - A reference to the PWM block status * * Returned Value: @@ -258,7 +258,7 @@ static void mcpwm_dumpregs(FAR struct lpc17_mcpwmtimer_s *priv, * Description: * (Re-)initialize the timer resources and start the pulsed output * - * Input parameters: + * Input Parameters: * priv - A reference to the lower half PWM driver state structure * info - A reference to the characteristics of the pulsed output * @@ -290,7 +290,7 @@ static int mcpwm_timer(FAR struct lpc17_mcpwmtimer_s *priv, * Description: * Handle timer interrupts. * - * Input parameters: + * Input Parameters: * priv - A reference to the lower half PWM driver state structure * * Returned Value: @@ -324,7 +324,7 @@ static int mcpwm_interrupt(struct lpc17_mcpwmtimer_s *priv) * Description: * Handle timer 1 and 8 interrupts. * - * Input parameters: + * Input Parameters: * Standard NuttX interrupt inputs * * Returned Value: @@ -343,7 +343,7 @@ static int mcpwm_tim1interrupt(int irq, void *context) * Description: * Enable or disable APB clock for the timer peripheral * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * on - Enable clock if 'on' is 'true' and disable if 'false' * @@ -387,7 +387,7 @@ static void mcpwm_set_apb_clock(FAR struct lpc17_mcpwmtimer_s *priv, bool on) * should configure and initialize the device so that it is ready for use. * It should not, however, output pulses until the start method is called. * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * * Returned Value: @@ -488,7 +488,7 @@ static int mcpwm_setup(FAR struct pwm_lowerhalf_s *dev) * stop pulsed output, free any resources, disable the timer hardware, and * put the system into the lowest possible power usage state * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * * Returned Value: @@ -514,7 +514,7 @@ static int mcpwm_shutdown(FAR struct pwm_lowerhalf_s *dev) * Description: * (Re-)initialize the timer resources and start the pulsed output * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * info - A reference to the characteristics of the pulsed output * @@ -536,7 +536,7 @@ static int mcpwm_start(FAR struct pwm_lowerhalf_s *dev, * Description: * Stop the pulsed output and reset the timer resources * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * * Returned Value: @@ -594,7 +594,7 @@ static int mcpwm_stop(FAR struct pwm_lowerhalf_s *dev) * Description: * Lower-half logic may support platform-specific ioctl commands * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * cmd - The ioctl command * arg - The argument accompanying the ioctl command diff --git a/arch/arm/src/lpc17xx/lpc17_pwm.c b/arch/arm/src/lpc17xx/lpc17_pwm.c index df3be30a74..f28c099626 100644 --- a/arch/arm/src/lpc17xx/lpc17_pwm.c +++ b/arch/arm/src/lpc17xx/lpc17_pwm.c @@ -231,7 +231,7 @@ static void pwm_putreg(struct lpc17_pwmtimer_s *priv, int offset, uint32_t value * Description: * Dump all timer registers. * - * Input parameters: + * Input Parameters: * priv - A reference to the PWM block status * * Returned Value: @@ -273,7 +273,7 @@ static void pwm_dumpregs(struct lpc17_pwmtimer_s *priv, FAR const char *msg) * Description: * (Re-)initialize the timer resources and start the pulsed output * - * Input parameters: + * Input Parameters: * priv - A reference to the lower half PWM driver state structure * info - A reference to the characteristics of the pulsed output * @@ -308,7 +308,7 @@ static int pwm_timer(FAR struct lpc17_pwmtimer_s *priv, * Description: * Handle timer interrupts. * - * Input parameters: + * Input Parameters: * priv - A reference to the lower half PWM driver state structure * * Returned Value: @@ -342,7 +342,7 @@ static int pwm_interrupt(struct lpc17_pwmtimer_s *priv) * Description: * Handle timer 1 and 8 interrupts. * - * Input parameters: + * Input Parameters: * Standard NuttX interrupt inputs * * Returned Value: @@ -361,7 +361,7 @@ static int pwm_tim1interrupt(int irq, void *context, FAR void *arg) * Description: * Enable or disable APB clock for the timer peripheral * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * on - Enable clock if 'on' is 'true' and disable if 'false' * @@ -405,7 +405,7 @@ static void pwm_set_apb_clock(FAR struct lpc17_pwmtimer_s *priv, bool on) * should configure and initialize the device so that it is ready for use. * It should not, however, output pulses until the start method is called. * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * * Returned Value: @@ -459,7 +459,7 @@ static int pwm_setup(FAR struct pwm_lowerhalf_s *dev) * stop pulsed output, free any resources, disable the timer hardware, and * put the system into the lowest possible power usage state * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * * Returned Value: @@ -485,7 +485,7 @@ static int pwm_shutdown(FAR struct pwm_lowerhalf_s *dev) * Description: * (Re-)initialize the timer resources and start the pulsed output * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * info - A reference to the characteristics of the pulsed output * @@ -507,7 +507,7 @@ static int pwm_start(FAR struct pwm_lowerhalf_s *dev, * Description: * Stop the pulsed output and reset the timer resources * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * * Returned Value: @@ -565,7 +565,7 @@ static int pwm_stop(FAR struct pwm_lowerhalf_s *dev) * Description: * Lower-half logic may support platform-specific ioctl commands * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * cmd - The ioctl command * arg - The argument accompanying the ioctl command diff --git a/arch/arm/src/lpc17xx/lpc17_sdcard.c b/arch/arm/src/lpc17xx/lpc17_sdcard.c index 96cdb510f9..1d21e582c5 100644 --- a/arch/arm/src/lpc17xx/lpc17_sdcard.c +++ b/arch/arm/src/lpc17xx/lpc17_sdcard.c @@ -2701,7 +2701,7 @@ static void lpc17_default(void) * Input Parameters: * slotno - Not used. * - * Returned Values: + * Returned Value: * A reference to an SD card interface structure. NULL is returned on failures. * ****************************************************************************/ @@ -2787,7 +2787,7 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno) * card has been removed from the slot. Only transitions * (inserted->removed or removed->inserted should be reported) * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -2833,7 +2833,7 @@ void sdio_mediachange(FAR struct sdio_dev_s *dev, bool cardinslot) * dev - An instance of the SD card driver device state structure. * wrprotect - true is a card is writeprotected. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ diff --git a/arch/arm/src/lpc17xx/lpc17_sdcard.h b/arch/arm/src/lpc17xx/lpc17_sdcard.h index 520175ec25..82f94264c7 100644 --- a/arch/arm/src/lpc17xx/lpc17_sdcard.h +++ b/arch/arm/src/lpc17xx/lpc17_sdcard.h @@ -71,7 +71,7 @@ extern "C" * Input Parameters: * slotno - Not used. * - * Returned Values: + * Returned Value: * A reference to an SDIO interface structure. NULL is returned on failures. * ****************************************************************************/ @@ -93,7 +93,7 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno); * card has been removed from the slot. Only transitions * (inserted->removed or removed->inserted should be reported) * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -111,7 +111,7 @@ void sdio_mediachange(FAR struct sdio_dev_s *dev, bool cardinslot); * dev - An instance of the SDIO driver device state structure. * wrprotect - true is a card is writeprotected. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ diff --git a/arch/arm/src/lpc17xx/lpc17_spi.c b/arch/arm/src/lpc17xx/lpc17_spi.c index 60deac4fb5..f653df2d36 100644 --- a/arch/arm/src/lpc17xx/lpc17_spi.c +++ b/arch/arm/src/lpc17xx/lpc17_spi.c @@ -518,7 +518,7 @@ static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t nw * Description: * Initialize the selected SPI port. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple SPI interfaces) * * Returned Value: diff --git a/arch/arm/src/lpc17xx/lpc17_spi.h b/arch/arm/src/lpc17xx/lpc17_spi.h index 27d9ba8bb9..f0be0e9978 100644 --- a/arch/arm/src/lpc17xx/lpc17_spi.h +++ b/arch/arm/src/lpc17xx/lpc17_spi.h @@ -78,7 +78,7 @@ struct spi_dev_s; /* Forward reference */ * Description: * Initialize the selected SPI port. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple SPI interfaces) * * Returned Value: diff --git a/arch/arm/src/lpc17xx/lpc17_ssp.c b/arch/arm/src/lpc17xx/lpc17_ssp.c index 98220105dc..af8fb4bc42 100644 --- a/arch/arm/src/lpc17xx/lpc17_ssp.c +++ b/arch/arm/src/lpc17xx/lpc17_ssp.c @@ -765,7 +765,7 @@ static void ssp_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t nw * Description: * Initialize the SSP0 * - * Input Parameter: + * Input Parameters: * None * * Returned Value: @@ -819,7 +819,7 @@ static inline FAR struct lpc17_sspdev_s *lpc17_ssp0initialize(void) * Description: * Initialize the SSP1 * - * Input Parameter: + * Input Parameters: * None * * Returned Value: @@ -873,7 +873,7 @@ static inline FAR struct lpc17_sspdev_s *lpc17_ssp1initialize(void) * Description: * Initialize the SSP2 * - * Input Parameter: + * Input Parameters: * None * * Returned Value: @@ -930,7 +930,7 @@ static inline FAR struct lpc17_sspdev_s *lpc17_ssp2initialize(void) * Description: * Initialize the selected SSP port. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple SPI interfaces) * * Returned Value: diff --git a/arch/arm/src/lpc17xx/lpc17_ssp.h b/arch/arm/src/lpc17xx/lpc17_ssp.h index c679206ca1..dd8ba3c766 100644 --- a/arch/arm/src/lpc17xx/lpc17_ssp.h +++ b/arch/arm/src/lpc17xx/lpc17_ssp.h @@ -76,7 +76,7 @@ extern "C" * Description: * Initialize the selected SSP port. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple SPI interfaces) * * Returned Value: diff --git a/arch/arm/src/lpc17xx/lpc17_timer.c b/arch/arm/src/lpc17xx/lpc17_timer.c index 434f416021..8540d1b386 100644 --- a/arch/arm/src/lpc17xx/lpc17_timer.c +++ b/arch/arm/src/lpc17xx/lpc17_timer.c @@ -215,7 +215,7 @@ static void timer_putreg(struct lpc17_timer_s *priv, int offset, * Description: * Dump all timer registers. * - * Input parameters: + * Input Parameters: * priv - A reference to the PWM block status * * Returned Value: @@ -257,7 +257,7 @@ static void timer_dumpregs(struct lpc17_timer_s *priv, FAR const char *msg) * Description: * (Re-)initialize the timer resources and start the pulsed output * - * Input parameters: + * Input Parameters: * priv - A reference to the lower half PWM driver state structure * info - A reference to the characteristics of the pulsed output * @@ -292,7 +292,7 @@ static int timer_timer(FAR struct lpc17_timer_s *priv, * Description: * Handle timer interrupts. * - * Input parameters: + * Input Parameters: * priv - A reference to the lower half PWM driver state structure * * Returned Value: @@ -326,7 +326,7 @@ static int timer_interrupt(struct lpc17_timer_s *priv) * Description: * Handle timer 1 and 8 interrupts. * - * Input parameters: + * Input Parameters: * Standard NuttX interrupt inputs * * Returned Value: @@ -349,7 +349,7 @@ static int timer_tim1interrupt(int irq, void *context) * should configure and initialize the device so that it is ready for use. * It should not, however, output pulses until the start method is called. * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * * Returned Value: @@ -437,7 +437,7 @@ static int timer_setup(FAR struct pwm_lowerhalf_s *dev) * stop pulsed output, free any resources, disable the timer hardware, and * put the system into the lowest possible power usage state * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half TIMER driver state structure * * Returned Value: @@ -463,7 +463,7 @@ static int timer_shutdown(FAR struct pwm_lowerhalf_s *dev) * Description: * (Re-)initialize the timer resources and start the pulsed output * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half TIMER driver state structure * info - A reference to the characteristics of the pulsed output * @@ -485,7 +485,7 @@ static int timer_start(FAR struct pwm_lowerhalf_s *dev, * Description: * Stop the pulsed output and reset the timer resources * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half TIMER driver state structure * * Returned Value: @@ -543,7 +543,7 @@ static int timer_stop(FAR struct pwm_lowerhalf_s *dev) * Description: * Lower-half logic may support platform-specific ioctl commands * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half TIMER driver state structure * cmd - The ioctl command * arg - The argument accompanying the ioctl command diff --git a/arch/arm/src/lpc17xx/lpc17_usbhost.c b/arch/arm/src/lpc17xx/lpc17_usbhost.c index fd51d9df2c..fb8abb6467 100644 --- a/arch/arm/src/lpc17xx/lpc17_usbhost.c +++ b/arch/arm/src/lpc17xx/lpc17_usbhost.c @@ -1933,7 +1933,7 @@ static int lpc17_usbinterrupt(int irq, void *context, FAR void *arg) * hport - The location to return the hub port descriptor that detected the * connection related event. * - * Returned Values: + * Returned Value: * Zero (OK) is returned on success when a device in connected or * disconnected. This function will not return until either (1) a device is * connected or disconnect to/from any hub port or until (2) some failure @@ -2029,7 +2029,7 @@ static int lpc17_wait(struct usbhost_connection_s *conn, * hport - The descriptor of the hub port that has the newly connected * device. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -2128,7 +2128,7 @@ static int lpc17_enumerate(FAR struct usbhost_connection_s *conn, * mps (maxpacketsize) - The maximum number of bytes that can be sent to or * received from the endpoint in a single data packet * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -2183,7 +2183,7 @@ static int lpc17_ep0configure(struct usbhost_driver_s *drvr, usbhost_ep_t ep0, * ep - A memory location provided by the caller in which to receive the * allocated endpoint descriptor. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -2339,7 +2339,7 @@ static int lpc17_epalloc(struct usbhost_driver_s *drvr, * the class create() method. * ep - The endpint to be freed. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -2422,7 +2422,7 @@ static int lpc17_epfree(struct usbhost_driver_s *drvr, usbhost_ep_t ep) * maxlen - The address of a memory location provided by the caller in which to * return the maximum size of the allocated buffer memory. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -2468,7 +2468,7 @@ static int lpc17_alloc(struct usbhost_driver_s *drvr, * the class create() method. * buffer - The address of the allocated buffer memory to be freed. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -2508,7 +2508,7 @@ static int lpc17_free(struct usbhost_driver_s *drvr, uint8_t *buffer) * return the allocated buffer memory address. * buflen - The size of the buffer required. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -2553,7 +2553,7 @@ static int lpc17_ioalloc(struct usbhost_driver_s *drvr, * the class create() method. * buffer - The address of the allocated buffer memory to be freed. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -2600,7 +2600,7 @@ static int lpc17_iofree(struct usbhost_driver_s *drvr, uint8_t *buffer) * NOTE: On an IN transaction, req and buffer may refer to the same allocated * memory. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -2701,7 +2701,7 @@ static int lpc17_ctrlout(struct usbhost_driver_s *drvr, usbhost_ep_t ep0, * (IN endpoint). buffer must have been allocated using DRVR_ALLOC * buflen - The length of the data to be sent or received. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure. * @@ -2779,7 +2779,7 @@ static int lpc17_transfer_common(struct lpc17_usbhost_s *priv, * buflen - The length of the data to be sent or received. * alloc - The location to return the allocated DMA buffer. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure. * @@ -2851,7 +2851,7 @@ static int lpc17_dma_alloc(struct lpc17_usbhost_s *priv, * buflen - The length of the data to be sent or received. * alloc - The allocated DMA buffer to be freed. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure. * @@ -2913,7 +2913,7 @@ static void lpc17_dma_free(struct lpc17_usbhost_s *priv, * (IN endpoint). buffer must have been allocated using DRVR_ALLOC * buflen - The length of the data to be sent or received. * - * Returned Values: + * Returned Value: * On success, a non-negative value is returned that indicates the number * of bytes successfully transferred. On a failure, a negated errno value is * returned that indicates the nature of the failure: @@ -3087,7 +3087,7 @@ errout_with_sem: * ep - The IN or OUT endpoint descriptor for the device endpoint on which the * transfer was performed. * - * Returned Values: + * Returned Value: * None * * Assumptions: @@ -3189,7 +3189,7 @@ static void lpc17_asynch_completion(struct lpc17_usbhost_s *priv, * arg - The arbitrary parameter that will be passed to the callback function * when the transfer completes. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -3306,7 +3306,7 @@ errout_with_sem: * ep - The IN or OUT endpoint descriptor for the device endpoint on which an * asynchronous transfer should be transferred. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure. * @@ -3451,7 +3451,7 @@ static int lpc17_cancel(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep) * related event * connected - True: device connected; false: device disconnected * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure. * @@ -3502,7 +3502,7 @@ static int lpc17_connect(FAR struct usbhost_driver_s *drvr, * hport - The port from which the device is being disconnected. Might be a port * on a hub. * - * Returned Values: + * Returned Value: * None * * Assumptions: @@ -3531,7 +3531,7 @@ static void lpc17_disconnect(struct usbhost_driver_s *drvr, * Input Parameters: * priv - private driver state instance. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ diff --git a/arch/arm/src/lpc214x/lpc214x_spi.h b/arch/arm/src/lpc214x/lpc214x_spi.h index 69c94d89c0..e4934d9d38 100644 --- a/arch/arm/src/lpc214x/lpc214x_spi.h +++ b/arch/arm/src/lpc214x/lpc214x_spi.h @@ -171,7 +171,7 @@ struct spi_dev_s; /* Forward reference */ * Description: * Initialize the selected SPI port * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple SPI interfaces) * * Returned Value: diff --git a/arch/arm/src/lpc2378/lpc23xx_i2c.h b/arch/arm/src/lpc2378/lpc23xx_i2c.h index 5658269f20..1ae069c5f7 100644 --- a/arch/arm/src/lpc2378/lpc23xx_i2c.h +++ b/arch/arm/src/lpc2378/lpc23xx_i2c.h @@ -163,7 +163,7 @@ * instances of the interface, each of which may be set up with a * different frequency and slave address. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has multiple I2C interfaces) * * Returned Value: @@ -179,7 +179,7 @@ FAR struct i2c_master_s *lpc2378_i2cbus_initialize(int port); * Description: * De-initialize the selected I2C port, and power down the device. * - * Input Parameter: + * Input Parameters: * Device structure as returned by the lpc2378_i2cbus_initialize() * * Returned Value: diff --git a/arch/arm/src/lpc2378/lpc23xx_spi.c b/arch/arm/src/lpc2378/lpc23xx_spi.c index bc7f46cf07..b9006f4e5c 100644 --- a/arch/arm/src/lpc2378/lpc23xx_spi.c +++ b/arch/arm/src/lpc2378/lpc23xx_spi.c @@ -525,7 +525,7 @@ static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t nw * Description: * Initialize the selected SPI port * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has multiple SPI interfaces) * * Returned Value: diff --git a/arch/arm/src/lpc2378/lpc23xx_spi.h b/arch/arm/src/lpc2378/lpc23xx_spi.h index 8b5fbda37c..280c2f44e2 100644 --- a/arch/arm/src/lpc2378/lpc23xx_spi.h +++ b/arch/arm/src/lpc2378/lpc23xx_spi.h @@ -161,7 +161,7 @@ struct spi_dev_s; /* Forward reference */ * Description: * Initialize the selected SPI port * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has multiple SPI interfaces) * * Returned Value: diff --git a/arch/arm/src/lpc31xx/lpc31.h b/arch/arm/src/lpc31xx/lpc31.h index 00ce6b8e35..ca3c0ad8fb 100644 --- a/arch/arm/src/lpc31xx/lpc31.h +++ b/arch/arm/src/lpc31xx/lpc31.h @@ -176,7 +176,7 @@ void lpc31_clockconfig(void); * Description: * Initialize the selected SPI port * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple SPI interfaces) * * Returned Value: @@ -315,7 +315,7 @@ void lpc31_usbhost_vbusdrive(int rhport, bool enable); * Input Parameters: * slotno - Not used. * - * Returned Values: + * Returned Value: * A reference to an SDIO interface structure. NULL is returned on failures. * ****************************************************************************/ @@ -337,7 +337,7 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno); * card has been removed from the slot. Only transitions * (inserted->removed or removed->inserted should be reported) * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -355,7 +355,7 @@ void sdio_mediachange(FAR struct sdio_dev_s *dev, bool cardinslot); * dev - An instance of the SDIO driver device state structure. * wrprotect - true is a card is writeprotected. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ diff --git a/arch/arm/src/lpc31xx/lpc31_ehci.c b/arch/arm/src/lpc31xx/lpc31_ehci.c index 26772ea81a..6b90a1b2eb 100644 --- a/arch/arm/src/lpc31xx/lpc31_ehci.c +++ b/arch/arm/src/lpc31xx/lpc31_ehci.c @@ -2087,7 +2087,7 @@ static struct lpc31_qtd_s *lpc31_qtd_statusphase(uint32_t tokenbits) * * Assumption: The caller holds the EHCI exclsem. * - * Returned value: + * Returned Value: * Zero (OK) is returned on success; a negated errno value is return on * any failure. * @@ -2368,7 +2368,7 @@ errout_with_qh: * * Assumption: The caller holds the EHCI exclsem. * - * Returned value: + * Returned Value: * Zero (OK) is returned on success; a negated errno value is return on * any failure. * @@ -2475,7 +2475,7 @@ errout_with_qh: * complete, but will be re-acquired when before returning. The state of * EHCI resources could be very different upon return. * - * Returned value: + * Returned Value: * On success, this function returns the number of bytes actually transferred. * For control transfers, this size includes the size of the control request * plus the size of the data (which could be short); For bulk transfers, this @@ -2555,7 +2555,7 @@ static ssize_t lpc31_transfer_wait(struct lpc31_epinfo_s *epinfo) * callback - The function to be called when the completes * arg - An arbitrary argument that will be provided with the callback. * - * Returned Values: + * Returned Value: * None * * Assumptions: @@ -2608,7 +2608,7 @@ static inline int lpc31_ioc_async_setup(struct lpc31_rhport_s *rhport, * epinfo - The IN or OUT endpoint descriptor for the device endpoint on * which the transfer was performed. * - * Returned Values: + * Returned Value: * None * * Assumptions: @@ -3428,7 +3428,7 @@ static int lpc31_ehci_interrupt(int irq, FAR void *context, FAR void *arg) * hport - The location to return the hub port descriptor that detected the * connection related event. * - * Returned Values: + * Returned Value: * Zero (OK) is returned on success when a device in connected or * disconnected. This function will not return until either (1) a device is * connected or disconnect to/from any hub port or until (2) some failure @@ -3530,7 +3530,7 @@ static int lpc31_wait(FAR struct usbhost_connection_s *conn, * hport - The descriptor of the hub port that has the newly connected * device. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -3839,7 +3839,7 @@ static int lpc31_enumerate(FAR struct usbhost_connection_s *conn, * maxpacketsize - The maximum number of bytes that can be sent to or * received from the endpoint in a single data packet * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -3882,7 +3882,7 @@ static int lpc31_ep0configure(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep * ep - A memory location provided by the caller in which to receive the * allocated endpoint descriptor. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -3965,7 +3965,7 @@ static int lpc31_epalloc(FAR struct usbhost_driver_s *drvr, * the class create() method. * ep - The endpint to be freed. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4010,7 +4010,7 @@ static int lpc31_epfree(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep) * maxlen - The address of a memory location provided by the caller in which * to return the maximum size of the allocated buffer memory. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4055,7 +4055,7 @@ static int lpc31_alloc(FAR struct usbhost_driver_s *drvr, * to the class create() method. * buffer - The address of the allocated buffer memory to be freed. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4092,7 +4092,7 @@ static int lpc31_free(FAR struct usbhost_driver_s *drvr, FAR uint8_t *buffer) * return the allocated buffer memory address. * buflen - The size of the buffer required. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4131,7 +4131,7 @@ static int lpc31_ioalloc(FAR struct usbhost_driver_s *drvr, FAR uint8_t **buffer * the class create() method. * buffer - The address of the allocated buffer memory to be freed. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4176,7 +4176,7 @@ static int lpc31_iofree(FAR struct usbhost_driver_s *drvr, FAR uint8_t *buffer) * NOTE: On an IN transaction, req and buffer may refer to the same allocated * memory. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4277,7 +4277,7 @@ static int lpc31_ctrlout(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0, * (IN endpoint). buffer must have been allocated using DRVR_ALLOC * buflen - The length of the data to be sent or received. * - * Returned Values: + * Returned Value: * On success, a non-negative value is returned that indicates the number * of bytes successfully transferred. On a failure, a negated errno value is * returned that indicates the nature of the failure: @@ -4387,7 +4387,7 @@ errout_with_sem: * arg - The arbitrary parameter that will be passed to the callback function * when the transfer completes. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4480,7 +4480,7 @@ errout_with_sem: * ep - The IN or OUT endpoint descriptor for the device endpoint on which an * asynchronous transfer should be transferred. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure. * @@ -4677,7 +4677,7 @@ errout_with_sem: * related event * connected - True: device connected; false: device disconnected * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure. * @@ -4728,7 +4728,7 @@ static int lpc31_connect(FAR struct usbhost_driver_s *drvr, * hport - The port from which the device is being disconnected. Might be a port * on a hub. * - * Returned Values: + * Returned Value: * None * * Assumptions: diff --git a/arch/arm/src/lpc31xx/lpc31_i2c.h b/arch/arm/src/lpc31xx/lpc31_i2c.h index 10280a5773..ac14998d22 100644 --- a/arch/arm/src/lpc31xx/lpc31_i2c.h +++ b/arch/arm/src/lpc31xx/lpc31_i2c.h @@ -206,7 +206,7 @@ * instances of the interface, each of which may be set up with a * different frequency and slave address. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has multiple I2C interfaces) * * Returned Value: @@ -222,7 +222,7 @@ FAR struct i2c_master_s *lpc31_i2cbus_initialize(int port); * Description: * De-initialize the selected I2C port, and power down the device. * - * Input Parameter: + * Input Parameters: * Device structure as returned by the lpc31_i2cbus_initialize() * * Returned Value: diff --git a/arch/arm/src/lpc31xx/lpc31_spi.c b/arch/arm/src/lpc31xx/lpc31_spi.c index d0275a502d..c4e1851163 100644 --- a/arch/arm/src/lpc31xx/lpc31_spi.c +++ b/arch/arm/src/lpc31xx/lpc31_spi.c @@ -903,7 +903,7 @@ static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *rxbuffer, size_t * Description: * Initialize the selected SPI port * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple SPI interfaces) * * Returned Value: diff --git a/arch/arm/src/lpc43xx/lpc43_can.c b/arch/arm/src/lpc43xx/lpc43_can.c index 415a7b28ef..7013ffd6dd 100644 --- a/arch/arm/src/lpc43xx/lpc43_can.c +++ b/arch/arm/src/lpc43xx/lpc43_can.c @@ -1152,7 +1152,7 @@ static void can_setuprxobj(struct up_dev_s *priv) * Where: * Tcan is the period of the APB clock (PCLK = CCLK / CONFIG_CAN1_DIVISOR). * - * Input Parameter: + * Input Parameters: * priv - A reference to the CAN block status * * Returned Value: @@ -1210,7 +1210,7 @@ static int can_bittiming(struct up_dev_s *priv) * Description: * Initialize the selected can port * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple can interfaces) * * Returned Value: diff --git a/arch/arm/src/lpc43xx/lpc43_can.h b/arch/arm/src/lpc43xx/lpc43_can.h index f321c9b72f..37074c6df3 100644 --- a/arch/arm/src/lpc43xx/lpc43_can.h +++ b/arch/arm/src/lpc43xx/lpc43_can.h @@ -64,7 +64,7 @@ extern "C" * Description: * Initialize the selected can port * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple can interfaces) * * Returned Value: diff --git a/arch/arm/src/lpc43xx/lpc43_ehci.c b/arch/arm/src/lpc43xx/lpc43_ehci.c index 3b24b4f282..3908fb1a8e 100644 --- a/arch/arm/src/lpc43xx/lpc43_ehci.c +++ b/arch/arm/src/lpc43xx/lpc43_ehci.c @@ -1971,7 +1971,7 @@ static struct lpc43_qtd_s *lpc43_qtd_statusphase(uint32_t tokenbits) * * Assumption: The caller holds the EHCI exclsem. * - * Returned value: + * Returned Value: * Zero (OK) is returned on success; a negated errno value is return on * any failure. * @@ -2251,7 +2251,7 @@ errout_with_qh: * * Assumption: The caller holds the EHCI exclsem. * - * Returned value: + * Returned Value: * Zero (OK) is returned on success; a negated errno value is return on * any failure. * @@ -2358,7 +2358,7 @@ errout_with_qh: * complete, but will be re-acquired when before returning. The state of * EHCI resources could be very different upon return. * - * Returned value: + * Returned Value: * On success, this function returns the number of bytes actually transferred. * For control transfers, this size includes the size of the control request * plus the size of the data (which could be short); For bulk transfers, this @@ -2420,7 +2420,7 @@ static ssize_t lpc43_transfer_wait(struct lpc43_epinfo_s *epinfo) * callback - The function to be called when the completes * arg - An arbitrary argument that will be provided with the callback. * - * Returned Values: + * Returned Value: * None * * Assumptions: @@ -2473,7 +2473,7 @@ static inline int lpc43_ioc_async_setup(struct lpc43_rhport_s *rhport, * epinfo - The IN or OUT endpoint descriptor for the device endpoint on * which the transfer was performed. * - * Returned Values: + * Returned Value: * None * * Assumptions: @@ -3265,7 +3265,7 @@ static int lpc43_ehci_interrupt(int irq, FAR void *context, FAR void *arg) * hport - The location to return the hub port descriptor that detected the * connection related event. * - * Returned Values: + * Returned Value: * Zero (OK) is returned on success when a device in connected or * disconnected. This function will not return until either (1) a device is * connected or disconnect to/from any hub port or until (2) some failure @@ -3367,7 +3367,7 @@ static int lpc43_wait(FAR struct usbhost_connection_s *conn, * hport - The descriptor of the hub port that has the newly connected * device. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -3676,7 +3676,7 @@ static int lpc43_enumerate(FAR struct usbhost_connection_s *conn, * maxpacketsize - The maximum number of bytes that can be sent to or * received from the endpoint in a single data packet * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -3719,7 +3719,7 @@ static int lpc43_ep0configure(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep * ep - A memory location provided by the caller in which to receive the * allocated endpoint descriptor. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -3802,7 +3802,7 @@ static int lpc43_epalloc(FAR struct usbhost_driver_s *drvr, * the class create() method. * ep - The endpint to be freed. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -3847,7 +3847,7 @@ static int lpc43_epfree(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep) * maxlen - The address of a memory location provided by the caller in which * to return the maximum size of the allocated buffer memory. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -3889,7 +3889,7 @@ static int lpc43_alloc(FAR struct usbhost_driver_s *drvr, * to the class create() method. * buffer - The address of the allocated buffer memory to be freed. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -3926,7 +3926,7 @@ static int lpc43_free(FAR struct usbhost_driver_s *drvr, FAR uint8_t *buffer) * return the allocated buffer memory address. * buflen - The size of the buffer required. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -3962,7 +3962,7 @@ static int lpc43_ioalloc(FAR struct usbhost_driver_s *drvr, FAR uint8_t **buffer * the class create() method. * buffer - The address of the allocated buffer memory to be freed. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4007,7 +4007,7 @@ static int lpc43_iofree(FAR struct usbhost_driver_s *drvr, FAR uint8_t *buffer) * NOTE: On an IN transaction, req and buffer may refer to the same allocated * memory. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4108,7 +4108,7 @@ static int lpc43_ctrlout(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0, * (IN endpoint). buffer must have been allocated using DRVR_ALLOC * buflen - The length of the data to be sent or received. * - * Returned Values: + * Returned Value: * On success, a non-negative value is returned that indicates the number * of bytes successfully transferred. On a failure, a negated errno value is * returned that indicates the nature of the failure: @@ -4218,7 +4218,7 @@ errout_with_sem: * arg - The arbitrary parameter that will be passed to the callback function * when the transfer completes. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4311,7 +4311,7 @@ errout_with_sem: * ep - The IN or OUT endpoint descriptor for the device endpoint on which an * asynchronous transfer should be transferred. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure. * @@ -4508,7 +4508,7 @@ errout_with_sem: * related event * connected - True: device connected; false: device disconnected * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure. * @@ -4559,7 +4559,7 @@ static int lpc43_connect(FAR struct usbhost_driver_s *drvr, * hport - The port from which the device is being disconnected. Might be a port * on a hub. * - * Returned Values: + * Returned Value: * None * * Assumptions: diff --git a/arch/arm/src/lpc43xx/lpc43_i2c.h b/arch/arm/src/lpc43xx/lpc43_i2c.h index ae8d94a7f8..224fbaa593 100644 --- a/arch/arm/src/lpc43xx/lpc43_i2c.h +++ b/arch/arm/src/lpc43xx/lpc43_i2c.h @@ -57,7 +57,7 @@ * instances of the interface, each of which may be set up with a * different frequency and slave address. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has multiple I2C interfaces) * * Returned Value: @@ -73,7 +73,7 @@ FAR struct i2c_master_s *lpc43_i2cbus_initialize(int port); * Description: * De-initialize the selected I2C port, and power down the device. * - * Input Parameter: + * Input Parameters: * Device structure as returned by the lpc43_i2cbus_initialize() * * Returned Value: diff --git a/arch/arm/src/lpc43xx/lpc43_pinconfig.c b/arch/arm/src/lpc43xx/lpc43_pinconfig.c index 0a274dd6a8..738b4b8daf 100644 --- a/arch/arm/src/lpc43xx/lpc43_pinconfig.c +++ b/arch/arm/src/lpc43xx/lpc43_pinconfig.c @@ -68,7 +68,7 @@ * Description: * Configure a pin based on bit-encoded description of the pin. * - * Input Value: + * Input Parameters: * 20-bit encoded value describing the pin. * * Returned Value: diff --git a/arch/arm/src/lpc43xx/lpc43_pinconfig.h b/arch/arm/src/lpc43xx/lpc43_pinconfig.h index d3a8a822a6..6b82878981 100644 --- a/arch/arm/src/lpc43xx/lpc43_pinconfig.h +++ b/arch/arm/src/lpc43xx/lpc43_pinconfig.h @@ -262,7 +262,7 @@ extern "C" * Description: * Configure a pin based on bit-encoded description of the pin. * - * Input Value: + * Input Parameters: * 20-bit encoded value describing the pin. * * Returned Value: diff --git a/arch/arm/src/lpc43xx/lpc43_sdmmc.c b/arch/arm/src/lpc43xx/lpc43_sdmmc.c index c3504e7a15..a84c6b8de9 100644 --- a/arch/arm/src/lpc43xx/lpc43_sdmmc.c +++ b/arch/arm/src/lpc43xx/lpc43_sdmmc.c @@ -2709,7 +2709,7 @@ static void lpc43_callback(struct lpc43_dev_s *priv) * Input Parameters: * slotno - Not used. * - * Returned Values: + * Returned Value: * A reference to an SD card interface structure. NULL is returned on failures. * ****************************************************************************/ diff --git a/arch/arm/src/lpc43xx/lpc43_sdmmc.h b/arch/arm/src/lpc43xx/lpc43_sdmmc.h index 7a27088415..449ee0f7a5 100644 --- a/arch/arm/src/lpc43xx/lpc43_sdmmc.h +++ b/arch/arm/src/lpc43xx/lpc43_sdmmc.h @@ -71,7 +71,7 @@ extern "C" * Input Parameters: * slotno - Not used. * - * Returned Values: + * Returned Value: * A reference to an SDIO interface structure. NULL is returned on failures. * ****************************************************************************/ diff --git a/arch/arm/src/lpc43xx/lpc43_spi.c b/arch/arm/src/lpc43xx/lpc43_spi.c index a77996513b..2181b4fa2f 100644 --- a/arch/arm/src/lpc43xx/lpc43_spi.c +++ b/arch/arm/src/lpc43xx/lpc43_spi.c @@ -505,7 +505,7 @@ static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t nw * Description: * Initialize the SPI port * - * Input Parameter: + * Input Parameters: * port Port number (must be zero) * * Returned Value: @@ -564,7 +564,7 @@ static FAR struct spi_dev_s *lpc43_spiport_initialize(int port) * 1 - SSP0 * 2 - SSP1 * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has multiple SPI interfaces) * * Returned Value: diff --git a/arch/arm/src/lpc43xx/lpc43_spi.h b/arch/arm/src/lpc43xx/lpc43_spi.h index d0414f9af6..b642f9c490 100644 --- a/arch/arm/src/lpc43xx/lpc43_spi.h +++ b/arch/arm/src/lpc43xx/lpc43_spi.h @@ -98,7 +98,7 @@ extern "C" * 1 - SSP0 * 2 - SSP1 * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has multiple SPI interfaces) * * Returned Value: diff --git a/arch/arm/src/lpc43xx/lpc43_spifi.c b/arch/arm/src/lpc43xx/lpc43_spifi.c index 57349370c0..ed2f01f2c9 100644 --- a/arch/arm/src/lpc43xx/lpc43_spifi.c +++ b/arch/arm/src/lpc43xx/lpc43_spifi.c @@ -1132,7 +1132,7 @@ static inline int lpc43_rominit(FAR struct lpc43_dev_s *priv) * Input Parameters: * None * - * Returned value: + * Returned Value: * One success, a reference to the initialized MTD device instance is * returned; NULL is returned on any failure. * @@ -1220,7 +1220,7 @@ FAR struct mtd_dev_s *lpc43_spifi_initialize(void) * Input Parameters: * high * - * Returned value: + * Returned Value: * None. * ****************************************************************************/ diff --git a/arch/arm/src/lpc43xx/lpc43_spifi.h b/arch/arm/src/lpc43xx/lpc43_spifi.h index 4445919259..30f85b8328 100644 --- a/arch/arm/src/lpc43xx/lpc43_spifi.h +++ b/arch/arm/src/lpc43xx/lpc43_spifi.h @@ -118,7 +118,7 @@ extern "C" * Input Parameters: * None * - * Returned value: + * Returned Value: * One success, a reference to the initialized MTD device instance is * returned; NULL is returned on any failure. * diff --git a/arch/arm/src/lpc43xx/lpc43_ssp.c b/arch/arm/src/lpc43xx/lpc43_ssp.c index 2660b00654..a9816b9366 100644 --- a/arch/arm/src/lpc43xx/lpc43_ssp.c +++ b/arch/arm/src/lpc43xx/lpc43_ssp.c @@ -664,7 +664,7 @@ static void ssp_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, * Description: * Initialize the SSP0 * - * Input Parameter: + * Input Parameters: * None * * Returned Value: @@ -717,7 +717,7 @@ static inline FAR struct lpc43_sspdev_s *lpc43_ssp0initialize(void) * Description: * Initialize the SSP1 * - * Input Parameter: + * Input Parameters: * None * * Returned Value: @@ -777,7 +777,7 @@ static inline FAR struct lpc43_sspdev_s *lpc43_ssp1initialize(void) * Description: * Initialize the selected SSP port (0=SSP0, 1=SSP1) * - * Input Parameter: + * Input Parameters: * port - Port number (0=SSP0, 1=SSP1) * * Returned Value: diff --git a/arch/arm/src/lpc43xx/lpc43_ssp.h b/arch/arm/src/lpc43xx/lpc43_ssp.h index 5bf708859e..27be5a5130 100644 --- a/arch/arm/src/lpc43xx/lpc43_ssp.h +++ b/arch/arm/src/lpc43xx/lpc43_ssp.h @@ -95,7 +95,7 @@ extern "C" * Description: * Initialize the selected SSP port (0=SSP0, 1=SSP1) * - * Input Parameter: + * Input Parameters: * port - Port number (0=SSP0, 1=SSP1) * * Returned Value: diff --git a/arch/arm/src/lpc43xx/lpc43_timer.c b/arch/arm/src/lpc43xx/lpc43_timer.c index decc110dd4..7c68ffd449 100644 --- a/arch/arm/src/lpc43xx/lpc43_timer.c +++ b/arch/arm/src/lpc43xx/lpc43_timer.c @@ -331,7 +331,7 @@ void tmr_clk_disable(uint16_t tmrid) * Input Parameters: * Usual interrupt callback arguments. * - * Returned Values: + * Returned Value: * Always returns OK. * ****************************************************************************/ @@ -401,7 +401,7 @@ static int lpc43_interrupt(int irq, FAR void *context, FAR void *arg) * lower - A pointer the publicly visible representation of the "lower-half" * driver state structure. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -465,7 +465,7 @@ static int lpc43_start(FAR struct timer_lowerhalf_s *lower) * lower - A pointer the publicly visible representation of the "lower-half" * driver state structure. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -509,7 +509,7 @@ static int lpc43_stop(FAR struct timer_lowerhalf_s *lower) * half" driver state structure. * status - The location to return the status information. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -564,7 +564,7 @@ static int lpc43_getstatus(FAR struct timer_lowerhalf_s *lower, * half" driver state structure. * timeout - The new timeout value in milliseconds. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -627,7 +627,7 @@ static int lpc43_settimeout(FAR struct timer_lowerhalf_s *lower, * function pointer is NULL, then the reset-on-expiration * behavior is restored, * - * Returned Values: + * Returned Value: * The previous timer expiration function pointer or NULL is there was * no previous function pointer. * @@ -667,7 +667,7 @@ static void lpc43_setcallback(FAR struct timer_lowerhalf_s *lower, * interpretation of this argument depends on the particular * command. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -700,7 +700,7 @@ static int lpc43_ioctl(FAR struct timer_lowerhalf_s *lower, int cmd, * devpath - The full path to the timer. This should be of the form * /dev/tmr0 * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ diff --git a/arch/arm/src/lpc43xx/lpc43_timer.h b/arch/arm/src/lpc43xx/lpc43_timer.h index 194d917c31..7eed9b2dcd 100644 --- a/arch/arm/src/lpc43xx/lpc43_timer.h +++ b/arch/arm/src/lpc43xx/lpc43_timer.h @@ -80,7 +80,7 @@ extern "C" * devpath - The full path to the timer. This should be of the form * /dev/timer0 * irq - irq associated with the timer - * Returned Values: + * Returned Value: * None * ****************************************************************************/ diff --git a/arch/arm/src/lpc43xx/lpc43_wdt.h b/arch/arm/src/lpc43xx/lpc43_wdt.h index af427504e4..c1d88a01e6 100644 --- a/arch/arm/src/lpc43xx/lpc43_wdt.h +++ b/arch/arm/src/lpc43xx/lpc43_wdt.h @@ -78,7 +78,7 @@ extern "C" * devpath - The full path to the watchdog. This should be of the form * /dev/watchdog0 * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ diff --git a/arch/arm/src/lpc43xx/lpc43_wwdt.c b/arch/arm/src/lpc43xx/lpc43_wwdt.c index 872e8d5f3f..fb60102d42 100644 --- a/arch/arm/src/lpc43xx/lpc43_wwdt.c +++ b/arch/arm/src/lpc43xx/lpc43_wwdt.c @@ -206,7 +206,7 @@ static void lpc43_setwarning(uint32_t warning) * Input Parameters: * Usual interrupt handler arguments. * - * Returned Values: + * Returned Value: * Always returns OK. * ****************************************************************************/ @@ -254,7 +254,7 @@ static int lpc43_interrupt(int irq, FAR void *context) * lower - A pointer the publicly visible representation of the * "lower-half" driver state structure. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -295,7 +295,7 @@ static int lpc43_start(FAR struct watchdog_lowerhalf_s *lower) * lower - A pointer the publicly visible representation of the "lower-half" * driver state structure. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -329,7 +329,7 @@ static int lpc43_stop(FAR struct watchdog_lowerhalf_s *lower) * lower - A pointer the publicly visible representation of the "lower-half" * driver state structure. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -361,7 +361,7 @@ static int lpc43_keepalive(FAR struct watchdog_lowerhalf_s *lower) * driver state structure. * status - The location to return the watchdog status information. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -419,7 +419,7 @@ static int lpc43_getstatus(FAR struct watchdog_lowerhalf_s *lower, * "lower-half" driver state structure. * timeout - The new timeout value in milliseconds. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -494,7 +494,7 @@ static int lpc43_settimeout(FAR struct watchdog_lowerhalf_s *lower, * function pointer is NULL, then the reset-on-expiration * behavior is restored, * - * Returned Values: + * Returned Value: * The previous watchdog expiration function pointer or NULL is there was * no previous function pointer, i.e., if the previous behavior was * reset-on-expiration (NULL is also returned if an error occurs). @@ -563,7 +563,7 @@ static xcpt_t lpc43_capture(FAR struct watchdog_lowerhalf_s *lower, * interpretation of this argument depends on the particular * command. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -620,7 +620,7 @@ static int lpc43_ioctl(FAR struct watchdog_lowerhalf_s *lower, int cmd, * devpath - The full path to the watchdog. This should be of the form * /dev/watchdog0 * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ diff --git a/arch/arm/src/lpc54xx/lpc54_i2c_master.h b/arch/arm/src/lpc54xx/lpc54_i2c_master.h index 1655d0fec5..fc9e80f662 100644 --- a/arch/arm/src/lpc54xx/lpc54_i2c_master.h +++ b/arch/arm/src/lpc54xx/lpc54_i2c_master.h @@ -57,7 +57,7 @@ * instances of the interface, each of which may be set up with a * different frequency and slave address. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has multiple I2C interfaces) * * Returned Value: @@ -73,7 +73,7 @@ FAR struct i2c_master_s *lpc54_i2cbus_initialize(int port); * Description: * De-initialize the selected I2C port, and power down the device. * - * Input Parameter: + * Input Parameters: * Device structure as returned by the lpc54_i2cbus_initialize() * * Returned Value: diff --git a/arch/arm/src/lpc54xx/lpc54_lcd.c b/arch/arm/src/lpc54xx/lpc54_lcd.c index 25cb80fc33..2b8b5aa262 100644 --- a/arch/arm/src/lpc54xx/lpc54_lcd.c +++ b/arch/arm/src/lpc54xx/lpc54_lcd.c @@ -441,7 +441,7 @@ static int lpc54_setcursor(FAR struct fb_vtable_s *vtable, * Description: * Initialize the framebuffer video hardware associated with the display. * - * Input parameters: + * Input Parameters: * display - In the case of hardware with multiple displays, this * specifies the display. Normally this is zero. * @@ -802,7 +802,7 @@ int up_fbinitialize(int display) * Return a a reference to the framebuffer object for the specified video * plane of the specified plane. Many OSDs support multiple planes of video. * - * Input parameters: + * Input Parameters: * display - In the case of hardware with multiple displays, this * specifies the display. Normally this is zero. * vplane - Identifies the plane being queried. diff --git a/arch/arm/src/lpc54xx/lpc54_sdmmc.c b/arch/arm/src/lpc54xx/lpc54_sdmmc.c index 626db2654f..292732040d 100644 --- a/arch/arm/src/lpc54xx/lpc54_sdmmc.c +++ b/arch/arm/src/lpc54xx/lpc54_sdmmc.c @@ -2709,7 +2709,7 @@ static void lpc54_callback(struct lpc54_dev_s *priv) * Input Parameters: * slotno - Not used. * - * Returned Values: + * Returned Value: * A reference to an SD card interface structure. NULL is returned on failures. * ****************************************************************************/ diff --git a/arch/arm/src/lpc54xx/lpc54_sdmmc.h b/arch/arm/src/lpc54xx/lpc54_sdmmc.h index 7eb00403c5..a56fe2095b 100644 --- a/arch/arm/src/lpc54xx/lpc54_sdmmc.h +++ b/arch/arm/src/lpc54xx/lpc54_sdmmc.h @@ -71,7 +71,7 @@ extern "C" * Input Parameters: * slotno - Not used. * - * Returned Values: + * Returned Value: * A reference to an SDIO interface structure. NULL is returned on failures. * ****************************************************************************/ diff --git a/arch/arm/src/lpc54xx/lpc54_serial.c b/arch/arm/src/lpc54xx/lpc54_serial.c index 7c74dec93b..996affee4c 100644 --- a/arch/arm/src/lpc54xx/lpc54_serial.c +++ b/arch/arm/src/lpc54xx/lpc54_serial.c @@ -1421,7 +1421,7 @@ void lpc54_earlyserialinit(void) * Input Parameters: * None * - * Returns Value: + * Returned Value: * None * ****************************************************************************/ diff --git a/arch/arm/src/lpc54xx/lpc54_spi_master.c b/arch/arm/src/lpc54xx/lpc54_spi_master.c index 35dd60ed8f..443bcb3333 100644 --- a/arch/arm/src/lpc54xx/lpc54_spi_master.c +++ b/arch/arm/src/lpc54xx/lpc54_spi_master.c @@ -1665,7 +1665,7 @@ static void lpc54_spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, * ... * 9 - SSP9 * - * Input Parameter: + * Input Parameters: * port - SPI peripheral number. 0..9 * * Returned Value: diff --git a/arch/arm/src/lpc54xx/lpc54_spi_master.h b/arch/arm/src/lpc54xx/lpc54_spi_master.h index aba9a30e72..9205dd66f4 100644 --- a/arch/arm/src/lpc54xx/lpc54_spi_master.h +++ b/arch/arm/src/lpc54xx/lpc54_spi_master.h @@ -98,7 +98,7 @@ extern "C" * ... * 9 - SPI9 * - * Input Parameter: + * Input Parameters: * port - SPI peripheral number, 0.. 9. * * Returned Value: diff --git a/arch/arm/src/lpc54xx/lpc54_wwdt.c b/arch/arm/src/lpc54xx/lpc54_wwdt.c index a664d2ba99..c442ee318e 100644 --- a/arch/arm/src/lpc54xx/lpc54_wwdt.c +++ b/arch/arm/src/lpc54xx/lpc54_wwdt.c @@ -207,7 +207,7 @@ static void lpc54_setwarning(uint32_t warning) * Input Parameters: * Usual interrupt handler arguments. * - * Returned Values: + * Returned Value: * Always returns OK. * ****************************************************************************/ @@ -255,7 +255,7 @@ static int lpc54_wwdt_interrupt(int irq, FAR void *context) * lower - A pointer the publicly visible representation of the * "lower-half" driver state structure. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -296,7 +296,7 @@ static int lpc54_start(FAR struct watchdog_lowerhalf_s *lower) * lower - A pointer the publicly visible representation of the "lower-half" * driver state structure. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -330,7 +330,7 @@ static int lpc54_stop(FAR struct watchdog_lowerhalf_s *lower) * lower - A pointer the publicly visible representation of the "lower-half" * driver state structure. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -362,7 +362,7 @@ static int lpc54_keepalive(FAR struct watchdog_lowerhalf_s *lower) * driver state structure. * status - The location to return the watchdog status information. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -420,7 +420,7 @@ static int lpc54_getstatus(FAR struct watchdog_lowerhalf_s *lower, * "lower-half" driver state structure. * timeout - The new timeout value in milliseconds. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -495,7 +495,7 @@ static int lpc54_settimeout(FAR struct watchdog_lowerhalf_s *lower, * function pointer is NULL, then the reset-on-expiration * behavior is restored, * - * Returned Values: + * Returned Value: * The previous watchdog expiration function pointer or NULL is there was * no previous function pointer, i.e., if the previous behavior was * reset-on-expiration (NULL is also returned if an error occurs). @@ -564,7 +564,7 @@ static xcpt_t lpc54_capture(FAR struct watchdog_lowerhalf_s *lower, * interpretation of this argument depends on the particular * command. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -621,7 +621,7 @@ static int lpc54_ioctl(FAR struct watchdog_lowerhalf_s *lower, int cmd, * devpath - The full path to the watchdog. This should be of the form * /dev/watchdog0 * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ diff --git a/arch/arm/src/lpc54xx/lpc54_wwdt.h b/arch/arm/src/lpc54xx/lpc54_wwdt.h index db0822a48e..baffd8c167 100644 --- a/arch/arm/src/lpc54xx/lpc54_wwdt.h +++ b/arch/arm/src/lpc54xx/lpc54_wwdt.h @@ -78,7 +78,7 @@ extern "C" * devpath - The full path to the watchdog. This should be of the form * /dev/watchdog0 * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ diff --git a/arch/arm/src/nuc1xx/nuc_gpio.c b/arch/arm/src/nuc1xx/nuc_gpio.c index 0e2b11d54c..e5c86c2934 100644 --- a/arch/arm/src/nuc1xx/nuc_gpio.c +++ b/arch/arm/src/nuc1xx/nuc_gpio.c @@ -74,7 +74,7 @@ * function, it must be unconfigured with nuc_unconfiggpio() with * the same cfgset first before it can be set to non-alternative function. * - * Returns: + * Returned Value: * OK on success * ERROR on invalid port, or when pin is locked as ALT function. * diff --git a/arch/arm/src/nuc1xx/nuc_gpio.h b/arch/arm/src/nuc1xx/nuc_gpio.h index 1fca1dc0e5..9d08dbac1a 100644 --- a/arch/arm/src/nuc1xx/nuc_gpio.h +++ b/arch/arm/src/nuc1xx/nuc_gpio.h @@ -208,7 +208,7 @@ extern "C" * function, it must be unconfigured with nuc_unconfiggpio() with * the same cfgset first before it can be set to non-alternative function. * - * Returns: + * Returned Value: * OK on success * ERROR on invalid port, or when pin is locked as ALT function. * diff --git a/arch/arm/src/sam34/sam4cm_cpuidlestack.c b/arch/arm/src/sam34/sam4cm_cpuidlestack.c index 411ebfaad7..1f3dd7fad8 100644 --- a/arch/arm/src/sam34/sam4cm_cpuidlestack.c +++ b/arch/arm/src/sam34/sam4cm_cpuidlestack.c @@ -115,7 +115,7 @@ void up_idle(void) * - adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The initial value of * the stack pointer. * - * Inputs: + * Input Parameters: * - cpu: CPU index that indicates which CPU the IDLE task is * being created for. * - tcb: The TCB of new CPU IDLE task diff --git a/arch/arm/src/sam34/sam_hsmci.c b/arch/arm/src/sam34/sam_hsmci.c index 25006b7f19..0a1f1c2d32 100644 --- a/arch/arm/src/sam34/sam_hsmci.c +++ b/arch/arm/src/sam34/sam_hsmci.c @@ -2670,7 +2670,7 @@ static void sam_callback(void *arg) * Input Parameters: * slotno - Not used. * - * Returned Values: + * Returned Value: * A reference to an SDIO interface structure. NULL is returned on failures. * ****************************************************************************/ @@ -2745,7 +2745,7 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno) * card has been removed from the slot. Only transitions * (inserted->removed or removed->inserted should be reported) * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -2792,7 +2792,7 @@ void sdio_mediachange(FAR struct sdio_dev_s *dev, bool cardinslot) * dev - An instance of the SDIO driver device state structure. * wrprotect - true is a card is writeprotected. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ diff --git a/arch/arm/src/sam34/sam_hsmci.h b/arch/arm/src/sam34/sam_hsmci.h index 3339c2d295..78dc02069c 100644 --- a/arch/arm/src/sam34/sam_hsmci.h +++ b/arch/arm/src/sam34/sam_hsmci.h @@ -87,7 +87,7 @@ extern "C" * Input Parameters: * slotno - Not used. * - * Returned Values: + * Returned Value: * A reference to an SDIO interface structure. NULL is returned on failures. * ****************************************************************************/ @@ -109,7 +109,7 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno); * card has been removed from the slot. Only transitions * (inserted->removed or removed->inserted should be reported) * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -127,7 +127,7 @@ void sdio_mediachange(FAR struct sdio_dev_s *dev, bool cardinslot); * dev - An instance of the SDIO driver device state structure. * wrprotect - true is a card is writeprotected. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ diff --git a/arch/arm/src/sam34/sam_rtt.c b/arch/arm/src/sam34/sam_rtt.c index 7978b01bf3..1b945e42e8 100644 --- a/arch/arm/src/sam34/sam_rtt.c +++ b/arch/arm/src/sam34/sam_rtt.c @@ -270,7 +270,7 @@ static void sam34_putreg(uint32_t val, uint32_t addr) * Input Parameters: * Usual interrupt handler arguments. * - * Returned Values: + * Returned Value: * Always returns OK. * ****************************************************************************/ @@ -354,7 +354,7 @@ static int sam34_interrupt(int irq, FAR void *context, FAR void *arg) * lower - A pointer the publicly visible representation of the "lower-half" * driver state structure. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -417,7 +417,7 @@ static int sam34_start(FAR struct timer_lowerhalf_s *lower) * lower - A pointer the publicly visible representation of the "lower-half" * driver state structure. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -456,7 +456,7 @@ static int sam34_stop(FAR struct timer_lowerhalf_s *lower) * driver state structure. * status - The location to return the status information. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -507,7 +507,7 @@ static int sam34_getstatus(FAR struct timer_lowerhalf_s *lower, * driver state structure. * timeout - The new timeout value in milliseconds. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -559,7 +559,7 @@ static int sam34_settimeout(FAR struct timer_lowerhalf_s *lower, * behavior is restored, * arg - Argument that will be provided in the callback * - * Returned Values: + * Returned Value: * The previous timer expiration function pointer or NULL is there was * no previous function pointer. * @@ -599,7 +599,7 @@ static void sam34_setcallback(FAR struct timer_lowerhalf_s *lower, * interpretation of this argument depends on the particular * command. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -632,7 +632,7 @@ static int sam34_ioctl(FAR struct timer_lowerhalf_s *lower, int cmd, * devpath - The full path to the timer. This should be of the form * /dev/rtt0 * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ diff --git a/arch/arm/src/sam34/sam_rtt.h b/arch/arm/src/sam34/sam_rtt.h index f300747efb..3a00c17fbd 100644 --- a/arch/arm/src/sam34/sam_rtt.h +++ b/arch/arm/src/sam34/sam_rtt.h @@ -80,7 +80,7 @@ extern "C" * devpath - The full path to the timer. This should be of the form * /dev/rtt0 * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ diff --git a/arch/arm/src/sam34/sam_spi.c b/arch/arm/src/sam34/sam_spi.c index 79bc6ca9ea..212293b26d 100644 --- a/arch/arm/src/sam34/sam_spi.c +++ b/arch/arm/src/sam34/sam_spi.c @@ -1711,7 +1711,7 @@ static void spi_recvblock(struct spi_dev_s *dev, void *buffer, size_t nwords) * Description: * Initialize the selected SPI port * - * Input Parameter: + * Input Parameters: * cs - Chip select number (identifying the "logical" SPI port) * * Returned Value: diff --git a/arch/arm/src/sam34/sam_spi.h b/arch/arm/src/sam34/sam_spi.h index 8cebb2f121..b9cbcce76d 100644 --- a/arch/arm/src/sam34/sam_spi.h +++ b/arch/arm/src/sam34/sam_spi.h @@ -117,7 +117,7 @@ struct spi_dev_s; /* Forward reference */ * Description: * Initialize the selected SPI port * - * Input Parameter: + * Input Parameters: * cs - Chip select number (identifying the "logical" SPI port) * * Returned Value: @@ -182,7 +182,7 @@ struct spi_dev_s *sam_spibus_initialize(int port); * devid - Identifies the (logical) device * selected - TRUE:Select the device, FALSE:De-select the device * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -204,7 +204,7 @@ void sam_spi1select(uint32_t devid, bool selected); * dev - SPI device info * devid - Identifies the (logical) device * - * Returned Values: + * Returned Value: * Bit-encoded SPI status (see include/nuttx/spi/spi.h. * ****************************************************************************/ @@ -235,7 +235,7 @@ uint8_t sam_spi1status(FAR struct spi_dev_s *dev, uint32_t devid); * dev - SPI device info * devid - Identifies the (logical) device * - * Returned Values: + * Returned Value: * Zero on success; a negated errno on failure. * ****************************************************************************/ diff --git a/arch/arm/src/sam34/sam_tc.c b/arch/arm/src/sam34/sam_tc.c index 1faab8b159..3212174623 100644 --- a/arch/arm/src/sam34/sam_tc.c +++ b/arch/arm/src/sam34/sam_tc.c @@ -250,7 +250,7 @@ static void sam34_putreg(uint32_t val, uint32_t addr) * Input Parameters: * Usual interrupt handler arguments. * - * Returned Values: + * Returned Value: * Always returns OK. * ****************************************************************************/ @@ -309,7 +309,7 @@ static int sam34_interrupt(int irq, FAR void *context, FAR void *arg) * lower - A pointer the publicly visible representation of the "lower-half" * driver state structure. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -365,7 +365,7 @@ static int sam34_start(FAR struct timer_lowerhalf_s *lower) * lower - A pointer the publicly visible representation of the "lower-half" * driver state structure. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -401,7 +401,7 @@ static int sam34_stop(FAR struct timer_lowerhalf_s *lower) * driver state structure. * status - The location to return the status information. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -454,7 +454,7 @@ static int sam34_getstatus(FAR struct timer_lowerhalf_s *lower, * driver state structure. * timeout - The new timeout value in milliseconds. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -507,7 +507,7 @@ static int sam34_settimeout(FAR struct timer_lowerhalf_s *lower, * behavior is restored, * arg - Argument to be provided with the callback. * - * Returned Values: + * Returned Value: * The previous timer expiration function pointer or NULL is there was * no previous function pointer. * @@ -547,7 +547,7 @@ static void sam34_setcallback(FAR struct timer_lowerhalf_s *lower, * interpretation of this argument depends on the particular * command. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -580,7 +580,7 @@ static int sam34_ioctl(FAR struct timer_lowerhalf_s *lower, int cmd, * devpath - The full path to the timer. This should be of the form * /dev/tc0 * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ diff --git a/arch/arm/src/sam34/sam_tc.h b/arch/arm/src/sam34/sam_tc.h index df7b3caf29..3667213d75 100644 --- a/arch/arm/src/sam34/sam_tc.h +++ b/arch/arm/src/sam34/sam_tc.h @@ -79,7 +79,7 @@ extern "C" * devpath - The full path to the timer. This should be of the form * /dev/tc0 * irq - irq associated with the timer - * Returned Values: + * Returned Value: * None * ****************************************************************************/ diff --git a/arch/arm/src/sam34/sam_twi.h b/arch/arm/src/sam34/sam_twi.h index 87c31b3032..06868044b2 100644 --- a/arch/arm/src/sam34/sam_twi.h +++ b/arch/arm/src/sam34/sam_twi.h @@ -57,7 +57,7 @@ * instances of the interface, each of which may be set up with a * different frequency and slave address. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has multiple I2C interfaces) * * Returned Value: @@ -73,7 +73,7 @@ FAR struct i2c_master_s *sam_i2cbus_initialize(int port); * Description: * De-initialize the selected I2C port, and power down the device. * - * Input Parameter: + * Input Parameters: * Device structure as returned by the sam_i2cbus_initialize() * * Returned Value: diff --git a/arch/arm/src/sam34/sam_wdt.c b/arch/arm/src/sam34/sam_wdt.c index cf88b37fec..4e902f46b5 100644 --- a/arch/arm/src/sam34/sam_wdt.c +++ b/arch/arm/src/sam34/sam_wdt.c @@ -251,7 +251,7 @@ static void sam34_putreg(uint32_t val, uint32_t addr) * Input Parameters: * Usual interrupt handler arguments. * - * Returned Values: + * Returned Value: * Always returns OK. * ****************************************************************************/ @@ -294,7 +294,7 @@ static int sam34_interrupt(int irq, FAR void *context, FAR void *arg) * lower - A pointer the publicly visible representation of the "lower-half" * driver state structure. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -338,7 +338,7 @@ static int sam34_start(FAR struct watchdog_lowerhalf_s *lower) * lower - A pointer the publicly visible representation of the "lower-half" * driver state structure. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -369,7 +369,7 @@ static int sam34_stop(FAR struct watchdog_lowerhalf_s *lower) * lower - A pointer the publicly visible representation of the "lower-half" * driver state structure. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -393,7 +393,7 @@ static int sam34_keepalive(FAR struct watchdog_lowerhalf_s *lower) * driver state structure. * status - The location to return the watchdog status information. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -449,7 +449,7 @@ static int sam34_getstatus(FAR struct watchdog_lowerhalf_s *lower, * driver state structure. * timeout - The new timeout value in millisecnds. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -516,7 +516,7 @@ static int sam34_settimeout(FAR struct watchdog_lowerhalf_s *lower, * function pointer is NULL, then the reset-on-expiration * behavior is restored, * - * Returned Values: + * Returned Value: * The previous watchdog expiration function pointer or NULL is there was * no previous function pointer, i.e., if the previous behavior was * reset-on-expiration (NULL is also returned if an error occurs). @@ -589,7 +589,7 @@ static xcpt_t sam34_capture(FAR struct watchdog_lowerhalf_s *lower, * interpretation of this argument depends on the particular * command. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -649,7 +649,7 @@ static int sam34_ioctl(FAR struct watchdog_lowerhalf_s *lower, int cmd, * devpath - The full path to the watchdog. This should be of the form * /dev/watchdog0 * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ diff --git a/arch/arm/src/sam34/sam_wdt.h b/arch/arm/src/sam34/sam_wdt.h index 77a1fbab40..3330cc01e7 100644 --- a/arch/arm/src/sam34/sam_wdt.h +++ b/arch/arm/src/sam34/sam_wdt.h @@ -79,7 +79,7 @@ extern "C" * devpath - The full path to the watchdog. This should be of the form * /dev/watchdog0 * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ diff --git a/arch/arm/src/sama5/sam_adc.c b/arch/arm/src/sama5/sam_adc.c index c61f44a3df..d6975391a4 100644 --- a/arch/arm/src/sama5/sam_adc.c +++ b/arch/arm/src/sama5/sam_adc.c @@ -591,7 +591,7 @@ static bool sam_adc_checkreg(struct sam_adc_s *priv, bool wr, * thread sets ready when it has completed processing the last sample * data. * - * Input Parameters + * Input Parameters: * arg - The ADC private data structure cast to (void *) * * Returned Value: @@ -838,7 +838,7 @@ static int sam_adc_dmasetup(FAR struct sam_adc_s *priv, FAR uint8_t *buffer, * sam_adc_endconversion will re-enable EOC interrupts when it completes * processing all pending EOC events. * - * Input Parameters + * Input Parameters: * arg - The ADC private data structure cast to (void *) * * Returned Value: diff --git a/arch/arm/src/sama5/sam_can.c b/arch/arm/src/sama5/sam_can.c index 956ae680e8..960c2e5346 100644 --- a/arch/arm/src/sama5/sam_can.c +++ b/arch/arm/src/sama5/sam_can.c @@ -579,7 +579,7 @@ static void can_semtake(FAR struct sam_can_s *priv) * Description: * Allocate one mailbox * - * Input Parameter: + * Input Parameters: * priv - A pointer to the private data structure for this CAN peripheral * * Returned Value: @@ -626,7 +626,7 @@ static int can_mballoc(FAR struct sam_can_s *priv) * Description: * Free one mailbox * - * Input Parameter: + * Input Parameters: * priv - A pointer to the private data structure for this CAN peripheral * mbndx - Index of the mailbox to be freed * @@ -670,7 +670,7 @@ static void can_mbfree(FAR struct sam_can_s *priv, int mbndx) * Description: * Configure and enable mailbox(es) for reception * - * Input Parameter: + * Input Parameters: * priv - A pointer to the private data structure for this CAN peripheral * * Returned Value: @@ -1592,7 +1592,7 @@ static void can_interrupt(int irq, void *context, FAR void *arg) * Tphs1 = Tq * (PHASE1 + 1) * Tphs2 = Tq * (PHASE2 + 1) * - * Input Parameter: + * Input Parameters: * config - A reference to the CAN constant configuration * * Returned Value: @@ -1706,7 +1706,7 @@ static int can_bittiming(struct sam_can_s *priv) * Description: * Use the SAMA5 auto-baud feature to correct the initial timing * - * Input Parameter: + * Input Parameters: * priv - A pointer to the private data structure for this CAN block * * Returned Value: @@ -1776,7 +1776,7 @@ static int can_autobaud(struct sam_can_s *priv) * Description: * CAN cell initialization * - * Input Parameter: + * Input Parameters: * priv - A pointer to the private data structure for this CAN peripheral * * Returned Value: @@ -1889,7 +1889,7 @@ static int can_hwinitialize(struct sam_can_s *priv) * Description: * Initialize the selected CAN port * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple CAN interfaces) * * Returned Value: diff --git a/arch/arm/src/sama5/sam_can.h b/arch/arm/src/sama5/sam_can.h index 83a08f756b..bff7c1efbf 100644 --- a/arch/arm/src/sama5/sam_can.h +++ b/arch/arm/src/sama5/sam_can.h @@ -125,7 +125,7 @@ extern "C" * Description: * Initialize the selected CAN port * - * Input Parameter: + * Input Parameters: * Port number: 0=CAN0, 1=CAN1 * * Returned Value: diff --git a/arch/arm/src/sama5/sam_ehci.c b/arch/arm/src/sama5/sam_ehci.c index 9b25316272..bd87be9f93 100644 --- a/arch/arm/src/sama5/sam_ehci.c +++ b/arch/arm/src/sama5/sam_ehci.c @@ -1903,7 +1903,7 @@ static struct sam_qtd_s *sam_qtd_statusphase(uint32_t tokenbits) * * Assumption: The caller holds the EHCI exclsem. * - * Returned value: + * Returned Value: * Zero (OK) is returned on success; a negated errno value is return on * any failure. * @@ -2183,7 +2183,7 @@ errout_with_qh: * * Assumption: The caller holds the EHCI exclsem. * - * Returned value: + * Returned Value: * Zero (OK) is returned on success; a negated errno value is return on * any failure. * @@ -2290,7 +2290,7 @@ errout_with_qh: * complete, but will be re-acquired when before returning. The state of * EHCI resources could be very different upon return. * - * Returned value: + * Returned Value: * On success, this function returns the number of bytes actually transferred. * For control transfers, this size includes the size of the control request * plus the size of the data (which could be short); For bulk transfers, this @@ -2370,7 +2370,7 @@ static ssize_t sam_transfer_wait(struct sam_epinfo_s *epinfo) * callback - The function to be called when the completes * arg - An arbitrary argument that will be provided with the callback. * - * Returned Values: + * Returned Value: * None * * Assumptions: @@ -2423,7 +2423,7 @@ static inline int sam_ioc_async_setup(struct sam_rhport_s *rhport, * epinfo - The IN or OUT endpoint descriptor for the device endpoint on * which the transfer was performed. * - * Returned Values: + * Returned Value: * None * * Assumptions: @@ -3265,7 +3265,7 @@ static int sam_uhphs_interrupt(int irq, FAR void *context, FAR void *arg) * hport - The location to return the hub port descriptor that detected the * connection related event. * - * Returned Values: + * Returned Value: * Zero (OK) is returned on success when a device in connected or * disconnected. This function will not return until either (1) a device is * connected or disconnect to/from any hub port or until (2) some failure @@ -3367,7 +3367,7 @@ static int sam_wait(FAR struct usbhost_connection_s *conn, * hport - The descriptor of the hub port that has the newly connected * device. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -3659,7 +3659,7 @@ static int sam_enumerate(FAR struct usbhost_connection_s *conn, * maxpacketsize - The maximum number of bytes that can be sent to or * received from the endpoint in a single data packet * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -3703,7 +3703,7 @@ static int sam_ep0configure(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0, * ep - A memory location provided by the caller in which to receive the * allocated endpoint descriptor. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -3786,7 +3786,7 @@ static int sam_epalloc(FAR struct usbhost_driver_s *drvr, * the class create() method. * ep - The endpint to be freed. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -3831,7 +3831,7 @@ static int sam_epfree(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep) * maxlen - The address of a memory location provided by the caller in which * to return the maximum size of the allocated buffer memory. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -3876,7 +3876,7 @@ static int sam_alloc(FAR struct usbhost_driver_s *drvr, * to the class create() method. * buffer - The address of the allocated buffer memory to be freed. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -3913,7 +3913,7 @@ static int sam_free(FAR struct usbhost_driver_s *drvr, FAR uint8_t *buffer) * return the allocated buffer memory address. * buflen - The size of the buffer required. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -3952,7 +3952,7 @@ static int sam_ioalloc(FAR struct usbhost_driver_s *drvr, FAR uint8_t **buffer, * the class create() method. * buffer - The address of the allocated buffer memory to be freed. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -3996,7 +3996,7 @@ static int sam_iofree(FAR struct usbhost_driver_s *drvr, FAR uint8_t *buffer) * NOTE: On an IN transaction, req and buffer may refer to the same allocated * memory. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4097,7 +4097,7 @@ static int sam_ctrlout(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0, * (IN endpoint). buffer must have been allocated using DRVR_ALLOC * buflen - The length of the data to be sent or received. * - * Returned Values: + * Returned Value: * On success, a non-negative value is returned that indicates the number * of bytes successfully transferred. On a failure, a negated errno value is * returned that indicates the nature of the failure: @@ -4208,7 +4208,7 @@ errout_with_sem: * arg - The arbitrary parameter that will be passed to the callback function * when the transfer completes. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4301,7 +4301,7 @@ errout_with_sem: * ep - The IN or OUT endpoint descriptor for the device endpoint on which an * asynchronous transfer should be transferred. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure. * @@ -4490,7 +4490,7 @@ errout_with_sem: * related event * connected - True: device connected; false: device disconnected * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure. * @@ -4541,7 +4541,7 @@ static int sam_connect(FAR struct usbhost_driver_s *drvr, * hport - The port from which the device is being disconnected. Might be a port * on a hub. * - * Returned Values: + * Returned Value: * None * * Assumptions: diff --git a/arch/arm/src/sama5/sam_hsmci.c b/arch/arm/src/sama5/sam_hsmci.c index e47248e2eb..3b8e48610e 100644 --- a/arch/arm/src/sama5/sam_hsmci.c +++ b/arch/arm/src/sama5/sam_hsmci.c @@ -3160,7 +3160,7 @@ static void sam_callback(void *arg) * Input Parameters: * slotno - Not used. * - * Returned Values: + * Returned Value: * A reference to an SDIO interface structure. NULL is returned on failures. * ****************************************************************************/ @@ -3353,7 +3353,7 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno) * card has been removed from the slot. Only transitions * (inserted->removed or removed->inserted should be reported) * - * Returned Values: + * Returned Value: * None * * Assumptions: @@ -3406,7 +3406,7 @@ void sdio_mediachange(FAR struct sdio_dev_s *dev, bool cardinslot) * dev - An instance of the SDIO driver device state structure. * wrprotect - true is a card is write protected. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ diff --git a/arch/arm/src/sama5/sam_hsmci.h b/arch/arm/src/sama5/sam_hsmci.h index c28bf89594..a3257e7d58 100644 --- a/arch/arm/src/sama5/sam_hsmci.h +++ b/arch/arm/src/sama5/sam_hsmci.h @@ -87,7 +87,7 @@ extern "C" * Input Parameters: * slotno - Not used. * - * Returned Values: + * Returned Value: * A reference to an SDIO interface structure. NULL is returned on failures. * ****************************************************************************/ @@ -118,7 +118,7 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno); * bootloader that brought us into SDRAM and it is that bootloader that * has configured the clocking. * - * Input parameters: + * Input Parameters: * target - The target SD frequency * * Returned Value: @@ -143,7 +143,7 @@ uint32_t sam_hsmci_clkdiv(uint32_t target); * card has been removed from the slot. Only transitions * (inserted->removed or removed->inserted should be reported) * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -161,7 +161,7 @@ void sdio_mediachange(FAR struct sdio_dev_s *dev, bool cardinslot); * dev - An instance of the SDIO driver device state structure. * wrprotect - true is a card is writeprotected. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ diff --git a/arch/arm/src/sama5/sam_hsmci_clkdiv.c b/arch/arm/src/sama5/sam_hsmci_clkdiv.c index 4ddba13e82..4a56bed140 100644 --- a/arch/arm/src/sama5/sam_hsmci_clkdiv.c +++ b/arch/arm/src/sama5/sam_hsmci_clkdiv.c @@ -97,7 +97,7 @@ * bootloader that brought us into SDRAM and it is that bootloader that * has configured the clocking. * - * Input parameters: + * Input Parameters: * target - The target SD frequency * * Returned Value: diff --git a/arch/arm/src/sama5/sam_irq.c b/arch/arm/src/sama5/sam_irq.c index fd4dfd8c5c..fbdc1eda5c 100644 --- a/arch/arm/src/sama5/sam_irq.c +++ b/arch/arm/src/sama5/sam_irq.c @@ -261,7 +261,7 @@ static uint32_t *sam_fiqhandler(int irq, uint32_t *regs) * Description: * Return true if the peripheral secure. * - * Input Parameter: + * Input Parameters: * PID = IRQ number * ****************************************************************************/ @@ -576,7 +576,7 @@ void up_irqinitialize(void) * the irq number of the interrupt and then to call arm_doirq to dispatch * the interrupt. * - * Input parameters: + * Input Parameters: * regs - A pointer to the register save area on the stack. * ****************************************************************************/ diff --git a/arch/arm/src/sama5/sam_lcd.c b/arch/arm/src/sama5/sam_lcd.c index 4e27e1ef2a..67f1ac0628 100644 --- a/arch/arm/src/sama5/sam_lcd.c +++ b/arch/arm/src/sama5/sam_lcd.c @@ -2901,7 +2901,7 @@ static void sam_show_hcr(void) * Description: * Initialize the framebuffer video hardware associated with the display. * - * Input parameters: + * Input Parameters: * display - In the case of hardware with multiple displays, this * specifies the display. Normally this is zero. * @@ -3001,7 +3001,7 @@ int up_fbinitialize(int display) * Return a a reference to the framebuffer object for the specified video * plane of the specified plane. Many OSDs support multiple planes of video. * - * Input parameters: + * Input Parameters: * display - In the case of hardware with multiple displays, this * specifies the display. Normally this is zero. * vplane - Identifies the plane being queried. diff --git a/arch/arm/src/sama5/sam_nand.c b/arch/arm/src/sama5/sam_nand.c index ae0c22936d..a0fb369ce1 100644 --- a/arch/arm/src/sama5/sam_nand.c +++ b/arch/arm/src/sama5/sam_nand.c @@ -353,10 +353,10 @@ void nand_unlock(void) * Waiting for the completion of a page program, erase and random read * completion. * - * Input parameters: + * Input Parameters: * priv Pointer to a sam_nandcs_s instance. * - * Returned value. + * Returned Value: * None * ****************************************************************************/ @@ -376,13 +376,13 @@ static void nand_wait_ready(struct sam_nandcs_s *priv) * Description: * Use the HOST NAND FLASH controller to send a command to the NFC. * - * Input parameters: + * Input Parameters: * priv - Lower-half, private NAND FLASH device state * cmd - command to send * acycle - address cycle when command access id decoded * cycle0 - address at first cycle * - * Returned value. + * Returned Value: * None * ****************************************************************************/ @@ -414,10 +414,10 @@ static void nand_nfc_cmdsend(struct sam_nandcs_s *priv, uint32_t cmd, * Description: * Check if a program or erase operation completed successfully * - * Input parameters: + * Input Parameters: * priv - Lower-half, private NAND FLASH device state * - * Returned value. + * Returned Value: * OK on success, a negated errnor value on failure * ****************************************************************************/ @@ -451,7 +451,7 @@ static int nand_operation_complete(struct sam_nandcs_s *priv) * address cycles. The resulting values are stored in the provided * variables if they are not null. * - * Input parameters: + * Input Parameters: * priv - Lower-half, private NAND FLASH device state * coladdr - Column address to translate. * rowaddr - Row address to translate. @@ -459,7 +459,7 @@ static int nand_operation_complete(struct sam_nandcs_s *priv) * acycle1234 - Four address cycles. * rowonly - True:Only ROW address is used. * - * Returned value. + * Returned Value: * Number of address cycles converted. * ****************************************************************************/ @@ -565,10 +565,10 @@ static int nand_translate_address(struct sam_nandcs_s *priv, * Description: * Map the number of address cycles the bit setting for the NFC command * - * Input parameters: + * Input Parameters: * ncycles - Number of address cycles * - * Returned value. + * Returned Value: * NFC command value * ****************************************************************************/ @@ -602,7 +602,7 @@ static uint32_t nand_get_acycle(int ncycles) * Description: * Sends NAND CLE/ALE command. * - * Input parameters: + * Input Parameters: * priv - Pointer to a sam_nandcs_s instance. * mode - SMC ALE CLE mode parameter. * cmd1 - First command to be sent. @@ -610,7 +610,7 @@ static uint32_t nand_get_acycle(int ncycles) * coladdr - Column address. * rowaddr - Row address. * - * Returned value. + * Returned Value: * None * ****************************************************************************/ @@ -670,10 +670,10 @@ static void nand_nfc_cleale(struct sam_nandcs_s *priv, uint8_t mode, * Description: * Wait for NFC command done * - * Input parameters: + * Input Parameters: * priv - CS state structure instance * - * Returned value. + * Returned Value: * None * ****************************************************************************/ @@ -716,10 +716,10 @@ static void nand_wait_cmddone(struct sam_nandcs_s *priv) * Description: * Setup to wait for CMDDONE event * - * Input parameters: + * Input Parameters: * priv - CS state structure instance * - * Returned value. + * Returned Value: * None * ****************************************************************************/ @@ -758,10 +758,10 @@ static void nand_setup_cmddone(struct sam_nandcs_s *priv) * Description: * Wait for a transfer to complete * - * Input parameters: + * Input Parameters: * priv - CS state structure instance * - * Returned value. + * Returned Value: * None * ****************************************************************************/ @@ -804,10 +804,10 @@ static void nand_wait_xfrdone(struct sam_nandcs_s *priv) * Description: * Setup to wait for XFDONE event * - * Input parameters: + * Input Parameters: * priv - CS state structure instance * - * Returned value. + * Returned Value: * None * ****************************************************************************/ @@ -846,10 +846,10 @@ static void nand_setup_xfrdone(struct sam_nandcs_s *priv) * Description: * Wait for read/busy edge detection * - * Input parameters: + * Input Parameters: * priv - CS state structure instance * - * Returned value. + * Returned Value: * None * ****************************************************************************/ @@ -892,10 +892,10 @@ static void nand_wait_rbedge(struct sam_nandcs_s *priv) * Description: * Setup to wait for RBEDGE0 event * - * Input parameters: + * Input Parameters: * priv - CS state structure instance * - * Returned value. + * Returned Value: * None * ****************************************************************************/ @@ -934,10 +934,10 @@ static void nand_setup_rbedge(struct sam_nandcs_s *priv) * Description: * Wait for NFC not busy * - * Input parameters: + * Input Parameters: * priv - CS state structure instance * - * Returned value. + * Returned Value: * None * ****************************************************************************/ @@ -965,10 +965,10 @@ static void nand_wait_nfcbusy(struct sam_nandcs_s *priv) * This latching capability function is needed to prevent loss of pending * status when sampling the HSMC_SR register. * - * Input parameters: + * Input Parameters: * None * - * Returned value. + * Returned Value: * Current HSMC_SR register value; * ****************************************************************************/ @@ -1041,10 +1041,10 @@ static uint32_t nand_nfc_poll(void) * Description: * HSMC interrupt handler * - * Input parameters: + * Input Parameters: * Standard interrupt arguments * - * Returned value. + * Returned Value: * Always returns OK * ****************************************************************************/ @@ -1203,10 +1203,10 @@ static void nand_dma_sampledone(struct sam_nandcs_s *priv, int result) * Description: * Wait for the completion of a DMA transfer * - * Input parameters: + * Input Parameters: * Wait for read/busy edge detection * - * Returned value. + * Returned Value: * The result of the DMA. OK on success; a negated ernno value on failure. * ****************************************************************************/ @@ -1266,7 +1266,7 @@ static void nand_dmacallback(DMA_HANDLE handle, void *arg, int result) * nbytes - The number of bytes to transfer * dmaflags - Describes the DMA configuration * - * Returned Value + * Returned Value: * OK on success; a negated errno value on failure. * ****************************************************************************/ @@ -1355,7 +1355,7 @@ static int nand_dma_read(struct sam_nandcs_s *priv, * nbytes - The number of bytes to transfer * dmaflags - Describes the DMA configuration * - * Returned Value + * Returned Value: * OK on success; a negated errno value on failure. * ****************************************************************************/ @@ -1440,7 +1440,7 @@ static int nand_dma_write(struct sam_nandcs_s *priv, * offset - If reading from NFC SRAM, this is the offset into * the SRAM. * - * Returned Value + * Returned Value: * OK on success; a negated errno value on failure. * ****************************************************************************/ @@ -1506,7 +1506,7 @@ static int nand_nfcsram_read(struct sam_nandcs_s *priv, uint8_t *buffer, * nfcsram - True: Use NFC Host SRAM * buffer - Buffer that provides the data for the write * - * Returned Value + * Returned Value: * OK on success; a negated errno value on failure. * ****************************************************************************/ @@ -1590,13 +1590,13 @@ static int nand_read(struct sam_nandcs_s *priv, uint8_t *buffer, * Description: * Reads the data area of a page of a NAND FLASH into the provided buffer. * - * Input parameters: + * Input Parameters: * priv - Lower-half, raw NAND FLASH interface * block - Number of the block where the page to read resides. * page - Number of the page to read inside the given block. * data - Buffer where the data area will be stored. * - * Returned value. + * Returned Value: * OK is returned in succes; a negated errno value is returned on failure. * ****************************************************************************/ @@ -1743,7 +1743,7 @@ static int nand_read_pmecc(struct sam_nandcs_s *priv, off_t block, * buffer - Buffer that provides the data for the write * offset - Data offset in bytes * - * Returned Value + * Returned Value: * OK on success; a negated errno value on failure. * ****************************************************************************/ @@ -1806,7 +1806,7 @@ static int nand_nfcsram_write(struct sam_nandcs_s *priv, uint8_t *buffer, * buffer - Buffer that provides the data for the write * offset - Data offset in bytes * - * Returned Value + * Returned Value: * OK on success; a negated errno value on failure. * ****************************************************************************/ @@ -1891,14 +1891,14 @@ static int nand_write(struct sam_nandcs_s *priv, uint8_t *buffer, * provided buffers. The raw NAND contents are returned with no ECC * corrections. * - * Input parameters: + * Input Parameters: * priv - Lower-half, private NAND FLASH device state * block - Number of the block where the page to read resides. * page - Number of the page to read inside the given block. * data - Buffer where the data area will be stored. * spare - Buffer where the spare area will be stored. * - * Returned value. + * Returned Value: * OK is returned in succes; a negated errno value is returned on failure. * ****************************************************************************/ @@ -2007,13 +2007,13 @@ static int nand_readpage_noecc(struct sam_nandcs_s *priv, off_t block, * Reads the data and/or the spare areas of a page of a NAND FLASH into the * provided buffers. PMECC is used * - * Input parameters: + * Input Parameters: * priv - Lower-half, private NAND FLASH device state * block - Number of the block where the page to read resides. * page - Number of the page to read inside the given block. * data - Buffer where the data area will be stored. * - * Returned value. + * Returned Value: * OK is returned in succes; a negated errno value is returned on failure. * ****************************************************************************/ @@ -2127,14 +2127,14 @@ errout: * Writes the data and/or the spare area of a page on a NAND FLASH chip. * No ECC calculations are performed. * - * Input parameters: + * Input Parameters: * priv - Lower-half, private NAND FLASH device state * block - Number of the block where the page to write resides. * page - Number of the page to write inside the given block. * data - Buffer containing the data to be writting * spare - Buffer conatining the spare data to be written. * - * Returned value. + * Returned Value: * OK is returned in succes; a negated errno value is returned on failure. * ****************************************************************************/ @@ -2281,13 +2281,13 @@ static int nand_writepage_noecc(struct sam_nandcs_s *priv, off_t block, * performed. The redundancy is appended to the page and written in the * spare area. * - * Input parameters: + * Input Parameters: * priv - Lower-half, private NAND FLASH device state * block - Number of the block where the page to write resides. * page - Number of the page to write inside the given block. * data - Buffer containing the data to be writting * - * Returned value. + * Returned Value: * OK is returned in succes; a negated errno value is returned on failure. * ****************************************************************************/ @@ -2495,11 +2495,11 @@ errout: * Description: * Erases the specified block of the device. * - * Input parameters: + * Input Parameters: * raw - Lower-half, raw NAND FLASH interface * block - Number of the physical block to erase. * - * Returned value. + * Returned Value: * OK is returned in succes; a negated errno value is returned on failure. * ****************************************************************************/ @@ -2575,14 +2575,14 @@ static int nand_eraseblock(struct nand_raw_s *raw, off_t block) * Reads the data and/or the spare areas of a page of a NAND FLASH into the * provided buffers. This is a raw read of the flash contents. * - * Input parameters: + * Input Parameters: * raw - Lower-half, raw NAND FLASH interface * block - Number of the block where the page to read resides. * page - Number of the page to read inside the given block. * data - Buffer where the data area will be stored. * spare - Buffer where the spare area will be stored. * - * Returned value. + * Returned Value: * OK is returned in succes; a negated errno value is returned on failure. * ****************************************************************************/ @@ -2612,14 +2612,14 @@ static int nand_rawread(struct nand_raw_s *raw, off_t block, * Writes the data and/or the spare area of a page on a NAND FLASH chip. * This is a raw write of the flash contents. * - * Input parameters: + * Input Parameters: * raw - Lower-half, raw NAND FLASH interface * block - Number of the block where the page to write resides. * page - Number of the page to write inside the given block. * data - Buffer containing the data to be writting * spare - Buffer containing the spare data to be written. * - * Returned value. + * Returned Value: * OK is returned in succes; a negated errno value is returned on failure. * ****************************************************************************/ @@ -2651,14 +2651,14 @@ static int nand_rawwrite(struct nand_raw_s *raw, off_t block, * provided buffers. Hardware ECC checking will be performed if so * configured. * - * Input parameters: + * Input Parameters: * raw - Lower-half, raw NAND FLASH interface * block - Number of the block where the page to read resides. * page - Number of the page to read inside the given block. * data - Buffer where the data area will be stored. * spare - Buffer where the spare area will be stored. * - * Returned value. + * Returned Value: * OK is returned in succes; a negated errno value is returned on failure. * ****************************************************************************/ @@ -2713,14 +2713,14 @@ static int nand_readpage(struct nand_raw_s *raw, off_t block, * Writes the data and/or the spare area of a page on a NAND FLASH chip. * Hardware ECC checking will be performed if so configured. * - * Input parameters: + * Input Parameters: * raw - Lower-half, raw NAND FLASH interface * block - Number of the block where the page to write resides. * page - Number of the page to write inside the given block. * data - Buffer containing the data to be writting * spare - Buffer conatining the spare data to be written. * - * Returned value. + * Returned Value: * OK is returned in succes; a negated errno value is returned on failure. * ****************************************************************************/ @@ -2775,10 +2775,10 @@ static int nand_writepage(struct nand_raw_s *raw, off_t block, * Description: * Resets a NAND FLASH device * - * Input parameters: + * Input Parameters: * priv - Lower-half, private NAND FLASH device state * - * Returned value. + * Returned Value: * None * ****************************************************************************/ @@ -2803,11 +2803,11 @@ static void nand_reset(struct sam_nandcs_s *priv) * performed here. Those necessary NAND features are provided by common, * higher level NAND MTD layers found in drivers/mtd. * - * Input parameters: + * Input Parameters: * cs - Chip select number (in the event that multiple NAND devices * are connected on-board). * - * Returned value. + * Returned Value: * On success a non-NULL pointer to an MTD device structure is returned; * NULL is returned on a failure. * diff --git a/arch/arm/src/sama5/sam_nand.h b/arch/arm/src/sama5/sam_nand.h index 808b719aa5..69c6b729e9 100644 --- a/arch/arm/src/sama5/sam_nand.h +++ b/arch/arm/src/sama5/sam_nand.h @@ -397,11 +397,11 @@ EXTERN struct sam_nand_s g_nand; * performed here. Those necessary NAND features are provided by common, * higher level NAND MTD layers found in drivers/mtd. * - * Input parameters: + * Input Parameters: * cs - Chip select number (in the event that multiple NAND devices * are connected on-board). * - * Returned value. + * Returned Value: * On success a non-NULL pointer to an MTD device structure is returned; * NULL is returned on a failure. * @@ -428,7 +428,7 @@ struct mtd_dev_s *sam_nand_initialize(int cs); * cs - Chip select number (in the event that multiple NAND devices * are connected on-board). * - * Returned Values: + * Returned Value: * OK if the HSMC was successfully configured for this CS. A negated * errno value is returned on a failure. This would fail with -ENODEV, * for example, if the board does not support NAND FLASH on the requested @@ -449,7 +449,7 @@ int board_nandflash_config(int cs); * cs - Chip select number (in the event that multiple NAND devices * are connected on-board). * - * Returned Values: + * Returned Value: * True: NAND is busy, False: NAND is ready * ****************************************************************************/ @@ -470,7 +470,7 @@ bool board_nand_busy(int cs); * are connected on-board). * enable - True: enable Chip Select, False: Disable Chip select * - * Returned Values: + * Returned Value: * OK if the HSMC was successfully configured for this CS. A negated * errno value is returned on a failure. This would fail with -ENODEV, * for example, if the board does not support NAND FLASH on the requested diff --git a/arch/arm/src/sama5/sam_ohci.c b/arch/arm/src/sama5/sam_ohci.c index 7b87c382c6..fac941d686 100644 --- a/arch/arm/src/sama5/sam_ohci.c +++ b/arch/arm/src/sama5/sam_ohci.c @@ -1543,7 +1543,7 @@ static int sam_enqueuetd(struct sam_rhport_s *rhport, struct sam_eplist_s *eplis * Input Parameters: * rhpndx - Root hub port index. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -1629,7 +1629,7 @@ static int sam_ep0enqueue(struct sam_rhport_s *rhport) * ep0 - The control endpoint to be released. May be the control endpoint for * an attached hub. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -2319,7 +2319,7 @@ static void sam_ohci_bottomhalf(void *arg) * hport - The location to return the hub port descriptor that detected the * connection related event. * - * Returned Values: + * Returned Value: * Zero (OK) is returned on success when a device in connected or * disconnected. This function will not return until either (1) a device is * connected or disconnect to/from any hub port or until (2) some failure @@ -2437,7 +2437,7 @@ static int sam_wait(struct usbhost_connection_s *conn, * hport - The descriptor of the hub port that has the newly connected * device. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -2564,7 +2564,7 @@ static int sam_enumerate(struct usbhost_connection_s *conn, * maxpacketsize - The maximum number of bytes that can be sent to or * received from the endpoint in a single data packet * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -2627,7 +2627,7 @@ static int sam_ep0configure(struct usbhost_driver_s *drvr, usbhost_ep_t ep0, * ep - A memory location provided by the caller in which to receive the * allocated endpoint descriptor. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -2832,7 +2832,7 @@ errout: * the class create() method. * ep - The endpoint to be freed. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -2924,7 +2924,7 @@ static int sam_epfree(struct usbhost_driver_s *drvr, usbhost_ep_t ep) * maxlen - The address of a memory location provided by the caller in which to * return the maximum size of the allocated buffer memory. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -2969,7 +2969,7 @@ static int sam_alloc(struct usbhost_driver_s *drvr, * to the class create() method. * buffer - The address of the allocated buffer memory to be freed. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -3008,7 +3008,7 @@ static int sam_free(struct usbhost_driver_s *drvr, uint8_t *buffer) * return the allocated buffer memory address. * buflen - The size of the buffer required. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -3042,7 +3042,7 @@ static int sam_ioalloc(struct usbhost_driver_s *drvr, uint8_t **buffer, * the class create() method. * buffer - The address of the allocated buffer memory to be freed. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -3087,7 +3087,7 @@ static int sam_iofree(struct usbhost_driver_s *drvr, uint8_t *buffer) * NOTE: On an IN transaction, req and buffer may refer to the same allocated * memory. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -3206,7 +3206,7 @@ static int sam_ctrlout(struct usbhost_driver_s *drvr, usbhost_ep_t ep0, * (IN endpoint). buffer must have been allocated using DRVR_ALLOC * buflen - The length of the data to be sent or received. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure. * @@ -3296,7 +3296,7 @@ static int sam_transfer_common(struct sam_rhport_s *rhport, * (IN endpoint). buffer must have been allocated using DRVR_ALLOC * buflen - The length of the data to be sent or received. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure: * @@ -3445,7 +3445,7 @@ errout: * eplist - The internal representation of the device endpoint on which * to perform the transfer. * - * Returned Values: + * Returned Value: * None * * Assumptions: @@ -3555,7 +3555,7 @@ static void sam_asynch_completion(struct sam_eplist_s *eplist) * arg - The arbitrary parameter that will be passed to the callback function * when the transfer completes. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -3635,7 +3635,7 @@ errout: * ep - The IN or OUT endpoint descriptor for the device endpoint on which an * asynchronous transfer should be transferred. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure. * @@ -3780,7 +3780,7 @@ static int sam_cancel(struct usbhost_driver_s *drvr, usbhost_ep_t ep) * related event * connected - True: device connected; false: device disconnected * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure. * @@ -3831,7 +3831,7 @@ static int sam_connect(struct usbhost_driver_s *drvr, * hport - The port from which the device is being disconnected. Might be a port * on a hub. * - * Returned Values: + * Returned Value: * None * * Assumptions: diff --git a/arch/arm/src/sama5/sam_pwm.c b/arch/arm/src/sama5/sam_pwm.c index 90b204eac3..1758bee1a7 100644 --- a/arch/arm/src/sama5/sam_pwm.c +++ b/arch/arm/src/sama5/sam_pwm.c @@ -754,7 +754,7 @@ static void pwm_chan_putreg(struct sam_pwm_chan_s *chan, int offset, * Description: * Dump all timer registers. * - * Input parameters: + * Input Parameters: * chan - A reference to the PWM channel instance * * Returned Value: @@ -827,7 +827,7 @@ static void pwm_dumpregs(struct sam_pwm_chan_s *chan, FAR const char *msg) * Description: * Handle timer interrupts. * - * Input parameters: + * Input Parameters: * Standard interrupt handler inputs * * Returned Value: @@ -854,7 +854,7 @@ static int pwm_interrupt(int irq, void *context, FAR void *arg) * use. It will not, however, output pulses until the start method is * called. * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * * Returned Value: @@ -897,7 +897,7 @@ static int pwm_setup(FAR struct pwm_lowerhalf_s *dev) * stop pulsed output, free any resources, disable the timer hardware, and * put the system into the lowest possible power usage state * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * * Returned Value: @@ -927,7 +927,7 @@ static int pwm_shutdown(FAR struct pwm_lowerhalf_s *dev) * Description: * (Re-)initialize the timer resources and start the pulsed output * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * info - A reference to the characteristics of the pulsed output * @@ -1049,7 +1049,7 @@ static int pwm_start(FAR struct pwm_lowerhalf_s *dev, * Description: * Stop the pulsed output and reset the timer resources * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * * Returned Value: @@ -1086,7 +1086,7 @@ static int pwm_stop(FAR struct pwm_lowerhalf_s *dev) * Description: * Lower-half logic may support platform-specific ioctl commands * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * cmd - The ioctl command * arg - The argument accompanying the ioctl command @@ -1145,7 +1145,7 @@ static int pwm_ioctl(FAR struct pwm_lowerhalf_s *dev, int cmd, unsigned long arg * regbits = PWM_CLK_PREB_DIV(prelog2); * prescaler = (1 << prelog2) * - * Input parameters: + * Input Parameters: * mck - The main clock frequency * fclk - The desired clock A or B frequency * @@ -1193,7 +1193,7 @@ static unsigned int pwm_clk_prescaler_log2(uint32_t mck, uint32_t fclk) * * div = MCK / prescaler / frequency * - * Input parameters: + * Input Parameters: * mck - The main clock frequency * fclk - The desired clock A or B frequency * prelog2 - The log2(prescaler) value previously selected by @@ -1231,7 +1231,7 @@ static unsigned int pwm_clk_divider(uint32_t mck, uint32_t fclk, * * frequency = MCK / prescaler / div * - * Input parameters: + * Input Parameters: * mck - The main clock frequency * prelog2 - The log2(prescaler) value previously selected by * pwm_prescale_log2(). @@ -1255,7 +1255,7 @@ static uint32_t pwm_clk_frequency(uint32_t mck, unsigned int prelog2, * Description: * Lower-half logic may support platform-specific ioctl commands * - * Input parameters: + * Input Parameters: * chan - A reference to the PWM channel instance * * Returned Value: diff --git a/arch/arm/src/sama5/sam_spi.c b/arch/arm/src/sama5/sam_spi.c index 457aa04f19..eaf5882020 100644 --- a/arch/arm/src/sama5/sam_spi.c +++ b/arch/arm/src/sama5/sam_spi.c @@ -1638,7 +1638,7 @@ static void spi_recvblock(struct spi_dev_s *dev, void *buffer, size_t nwords) * Description: * Initialize the selected SPI port * - * Input Parameter: + * Input Parameters: * cs - Chip select number (identifying the "logical" SPI port) * * Returned Value: diff --git a/arch/arm/src/sama5/sam_spi.h b/arch/arm/src/sama5/sam_spi.h index 705f2248e7..4a8697f25a 100644 --- a/arch/arm/src/sama5/sam_spi.h +++ b/arch/arm/src/sama5/sam_spi.h @@ -111,7 +111,7 @@ struct spi_dev_s; /* Forward reference */ * Description: * Initialize the selected SPI port * - * Input Parameter: + * Input Parameters: * cs - Chip select number (identifying the "logical" SPI port) * * Returned Value: @@ -175,7 +175,7 @@ struct spi_dev_s *sam_spibus_initialize(int port); * devid - Identifies the (logical) device * selected - TRUE:Select the device, FALSE:De-select the device * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -197,7 +197,7 @@ void sam_spi1select(uint32_t devid, bool selected); * dev - SPI device info * devid - Identifies the (logical) device * - * Returned Values: + * Returned Value: * Bit-encoded SPI status (see include/nuttx/spi/spi.h. * ****************************************************************************/ @@ -228,7 +228,7 @@ uint8_t sam_spi1status(FAR struct spi_dev_s *dev, uint32_t devid); * dev - SPI device info * devid - Identifies the (logical) device * - * Returned Values: + * Returned Value: * Zero on success; a negated errno on failure. * ****************************************************************************/ diff --git a/arch/arm/src/sama5/sam_ssc.c b/arch/arm/src/sama5/sam_ssc.c index 0c86991030..176b2235cc 100644 --- a/arch/arm/src/sama5/sam_ssc.c +++ b/arch/arm/src/sama5/sam_ssc.c @@ -2786,7 +2786,7 @@ static int ssc_tx_configure(struct sam_ssc_s *priv) * Setup the MCK/2 divider based on the currently selected data width and * the sample rate * - * Input Parameter: + * Input Parameters: * priv - I2C device structure (only the sample rate and data length is * needed at this point). * @@ -2843,7 +2843,7 @@ static uint32_t ssc_mck2divider(struct sam_ssc_s *priv) * Description: * Enable and configure clocking to the SSC * - * Input Parameter: + * Input Parameters: * priv - Partially initialized I2C device structure (only the PID is * needed at this point). * @@ -3394,7 +3394,7 @@ static void ssc1_configure(struct sam_ssc_s *priv) * Description: * Initialize the selected SSC port * - * Input Parameter: + * Input Parameters: * port - I2S "port" number (identifying the "logical" SSC port) * * Returned Value: diff --git a/arch/arm/src/sama5/sam_ssc.h b/arch/arm/src/sama5/sam_ssc.h index b7ecafe5a4..7ae4dafe07 100644 --- a/arch/arm/src/sama5/sam_ssc.h +++ b/arch/arm/src/sama5/sam_ssc.h @@ -83,7 +83,7 @@ extern "C" * Description: * Initialize the selected I2S port. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple I2S interfaces) * * Returned Value: diff --git a/arch/arm/src/sama5/sam_tsd.c b/arch/arm/src/sama5/sam_tsd.c index 36fc9e6d00..875091a878 100644 --- a/arch/arm/src/sama5/sam_tsd.c +++ b/arch/arm/src/sama5/sam_tsd.c @@ -432,7 +432,7 @@ errout: * The ADC hardware can filter the touchscreen samples by averaging. The * function selects (or de-selects) that filtering. * - * Input Parameters + * Input Parameters: * priv - The touchscreen private data structure * tsav - The new (shifted) value of the TSAV field of the ADC TSMR regsiter. * @@ -494,7 +494,7 @@ static void sam_tsd_setaverage(struct sam_tsd_s *priv, uint32_t tsav) * will re-enable TSD interrupts when it completes processing all pending * TSD events. * - * Input Parameters + * Input Parameters: * arg - The touchscreen private data structure cast to (void *) * * Returned Value: @@ -1707,7 +1707,7 @@ errout_with_priv: * Description: * Handles ADC interrupts associated with touchscreen channels * - * Input parmeters: + * Input Parameters: * pending - Current set of pending interrupts being handled * * Returned Value: diff --git a/arch/arm/src/sama5/sam_tsd.h b/arch/arm/src/sama5/sam_tsd.h index 3ae36434b7..ff0d6a5ead 100644 --- a/arch/arm/src/sama5/sam_tsd.h +++ b/arch/arm/src/sama5/sam_tsd.h @@ -119,7 +119,7 @@ int sam_tsd_register(FAR struct sam_adc_s *adc, int minor); * Description: * Handles ADC interrupts associated with touchscreen channels * - * Input parmeters: + * Input Parameters: * pending - Current set of pending interrupts being handled * * Returned Value: diff --git a/arch/arm/src/sama5/sam_twi.h b/arch/arm/src/sama5/sam_twi.h index e8d75e1335..f966bec8f8 100644 --- a/arch/arm/src/sama5/sam_twi.h +++ b/arch/arm/src/sama5/sam_twi.h @@ -57,7 +57,7 @@ * instances of the interface, each of which may be set up with a * different frequency and slave address. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has multiple I2C interfaces) * * Returned Value: @@ -73,7 +73,7 @@ FAR struct i2c_master_s *sam_i2cbus_initialize(int port); * Description: * De-initialize the selected I2C port, and power down the device. * - * Input Parameter: + * Input Parameters: * Device structure as returned by the sam_i2cbus_initialize() * * Returned Value: diff --git a/arch/arm/src/sama5/sam_wdt.c b/arch/arm/src/sama5/sam_wdt.c index 9d3f7dd61e..0fd0fa21ee 100644 --- a/arch/arm/src/sama5/sam_wdt.c +++ b/arch/arm/src/sama5/sam_wdt.c @@ -254,7 +254,7 @@ static void sam_putreg(uint32_t regval, uintptr_t regaddr) * Input Parameters: * Usual interrupt handler arguments. * - * Returned Values: + * Returned Value: * Always returns OK. * ****************************************************************************/ @@ -290,7 +290,7 @@ static int sam_interrupt(int irq, FAR void *context, FAR void *arg) * lower - A pointer the publicly visible representation of the "lower-half" * driver state structure. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -320,7 +320,7 @@ static int sam_start(FAR struct watchdog_lowerhalf_s *lower) * lower - A pointer the publicly visible representation of the "lower-half" * driver state structure. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -350,7 +350,7 @@ static int sam_stop(FAR struct watchdog_lowerhalf_s *lower) * lower - A pointer the publicly visible representation of the "lower-half" * driver state structure. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -378,7 +378,7 @@ static int sam_keepalive(FAR struct watchdog_lowerhalf_s *lower) * driver state structure. * stawtus - The location to return the watchdog status information. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -435,7 +435,7 @@ static int sam_getstatus(FAR struct watchdog_lowerhalf_s *lower, * driver state structure. * timeout - The new timeout value in millisecnds. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -554,7 +554,7 @@ static int sam_settimeout(FAR struct watchdog_lowerhalf_s *lower, * function pointer is NULL, then the reset-on-expiration * behavior is restored, * - * Returned Values: + * Returned Value: * The previous watchdog expiration function pointer or NULL is there was * no previous function pointer, i.e., if the previous behavior was * reset-on-expiration (NULL is also returned if an error occurs). @@ -619,7 +619,7 @@ static xcpt_t sam_capture(FAR struct watchdog_lowerhalf_s *lower, * interpretation of this argument depends on the particular * command. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -649,7 +649,7 @@ static int sam_ioctl(FAR struct watchdog_lowerhalf_s *lower, int cmd, * Input Parameters: * None * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ diff --git a/arch/arm/src/sama5/sam_wdt.h b/arch/arm/src/sama5/sam_wdt.h index 0f9eab7b75..ba3a067b1d 100644 --- a/arch/arm/src/sama5/sam_wdt.h +++ b/arch/arm/src/sama5/sam_wdt.h @@ -76,7 +76,7 @@ extern "C" * * At a minimum, this function should call watchdog_register(). * - * Input parameters: + * Input Parameters: * None * * Returned Value: diff --git a/arch/arm/src/samdl/sam_port.h b/arch/arm/src/samdl/sam_port.h index c03edcbcb5..3227c54803 100644 --- a/arch/arm/src/samdl/sam_port.h +++ b/arch/arm/src/samdl/sam_port.h @@ -343,7 +343,7 @@ extern "C" * Description: * Configure a PORT pin based on bit-encoded description of the pin. * - * Returns: + * Returned Value: * OK (always) * ****************************************************************************/ diff --git a/arch/arm/src/samdl/sam_spi.c b/arch/arm/src/samdl/sam_spi.c index dbecb7e09b..9f398fd9e9 100644 --- a/arch/arm/src/samdl/sam_spi.c +++ b/arch/arm/src/samdl/sam_spi.c @@ -1322,7 +1322,7 @@ static void spi_pad_configure(struct sam_spidev_s *priv) * Description: * Initialize the selected SPI port * - * Input Parameter: + * Input Parameters: * port - SPI "port" number (i.e., SERCOM number) * * Returned Value: diff --git a/arch/arm/src/samdl/sam_spi.h b/arch/arm/src/samdl/sam_spi.h index 7e0cbfa9e0..d4044ab19c 100644 --- a/arch/arm/src/samdl/sam_spi.h +++ b/arch/arm/src/samdl/sam_spi.h @@ -94,7 +94,7 @@ struct spi_dev_s; /* Forward reference */ * Description: * Initialize the selected SPI port * - * Input Parameter: + * Input Parameters: * port - SPI "port" number (i.e., SERCOM number) * * Returned Value: @@ -161,7 +161,7 @@ struct spi_dev_s *sam_spibus_initialize(int port); * devid - Identifies the (logical) device * selected - TRUE:Select the device, FALSE:De-select the device * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -206,7 +206,7 @@ void sam_spi5select(FAR struct spi_dev_s *dev, uint32_t devid, * dev - SPI device info * devid - Identifies the (logical) device * - * Returned Values: + * Returned Value: * Bit-encoded SPI status (see include/nuttx/spi/spi.h. * ****************************************************************************/ @@ -254,7 +254,7 @@ uint8_t sam_spi5status(FAR struct spi_dev_s *dev, uint32_t devid); * dev - SPI device info * devid - Identifies the (logical) device * - * Returned Values: + * Returned Value: * Zero on success; a negated errno on failure. * ****************************************************************************/ diff --git a/arch/arm/src/samv7/sam_hsmci.c b/arch/arm/src/samv7/sam_hsmci.c index 4f5e0d87d9..213be4f878 100644 --- a/arch/arm/src/samv7/sam_hsmci.c +++ b/arch/arm/src/samv7/sam_hsmci.c @@ -3234,7 +3234,7 @@ static void sam_callback(void *arg) * Input Parameters: * slotno - Not used. * - * Returned Values: + * Returned Value: * A reference to an SDIO interface structure. NULL is returned on failures. * ****************************************************************************/ @@ -3385,7 +3385,7 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno) * card has been removed from the slot. Only transitions * (inserted->removed or removed->inserted should be reported) * - * Returned Values: + * Returned Value: * None * * Assumptions: @@ -3438,7 +3438,7 @@ void sdio_mediachange(FAR struct sdio_dev_s *dev, bool cardinslot) * dev - An instance of the SDIO driver device state structure. * wrprotect - true is a card is write protected. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ diff --git a/arch/arm/src/samv7/sam_hsmci.h b/arch/arm/src/samv7/sam_hsmci.h index fa5992082d..990ce462d5 100644 --- a/arch/arm/src/samv7/sam_hsmci.h +++ b/arch/arm/src/samv7/sam_hsmci.h @@ -85,7 +85,7 @@ extern "C" * Input Parameters: * slotno - Not used. * - * Returned Values: + * Returned Value: * A reference to an SDIO interface structure. NULL is returned on failures. * ****************************************************************************/ @@ -116,7 +116,7 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno); * bootloader that brought us into SDRAM and it is that bootloader that * has configured the clocking. * - * Input parameters: + * Input Parameters: * target - The target SD frequency * * Returned Value: @@ -141,7 +141,7 @@ uint32_t sam_hsmci_clkdiv(uint32_t target); * card has been removed from the slot. Only transitions * (inserted->removed or removed->inserted should be reported) * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -159,7 +159,7 @@ void sdio_mediachange(FAR struct sdio_dev_s *dev, bool cardinslot); * dev - An instance of the SDIO driver device state structure. * wrprotect - true is a card is writeprotected. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ diff --git a/arch/arm/src/samv7/sam_hsmci_clkdiv.c b/arch/arm/src/samv7/sam_hsmci_clkdiv.c index 83b85b6cb6..0da3872621 100644 --- a/arch/arm/src/samv7/sam_hsmci_clkdiv.c +++ b/arch/arm/src/samv7/sam_hsmci_clkdiv.c @@ -96,7 +96,7 @@ * bootloader that brought us into SDRAM and it is that bootloader that * has configured the clocking. * - * Input parameters: + * Input Parameters: * target - The target SD frequency * * Returned Value: diff --git a/arch/arm/src/samv7/sam_mcan.c b/arch/arm/src/samv7/sam_mcan.c index e72d089dc7..5be48501d1 100644 --- a/arch/arm/src/samv7/sam_mcan.c +++ b/arch/arm/src/samv7/sam_mcan.c @@ -1609,7 +1609,7 @@ static void mcan_buffer_release(FAR struct sam_mcan_s *priv) * standard CAN. In CAN FD mode, the values 9 to 15 are encoded to values * in the range 12 to 64. * - * Input Parameter: + * Input Parameters: * dlc - the DLC value to convert to a byte count * * Returned Value: @@ -1665,7 +1665,7 @@ static uint8_t mcan_dlc2bytes(FAR struct sam_mcan_s *priv, uint8_t dlc) * standard CAN. In CAN FD mode, the values 9 to 15 are encoded to values * in the range 12 to 64. * - * Input Parameter: + * Input Parameters: * nbytes - the byte count to convert to a DLC value * * Returned Value: @@ -3649,7 +3649,7 @@ static int mcan_interrupt(int irq, void *context, FAR void *arg) * Description: * MCAN hardware initialization * - * Input Parameter: + * Input Parameters: * priv - A pointer to the private data structure for this MCAN peripheral * * Returned Value: @@ -3924,7 +3924,7 @@ static int mcan_hw_initialize(struct sam_mcan_s *priv) * Description: * Initialize the selected MCAN port * - * Input Parameter: + * Input Parameters: * port - Port number (for hardware that has multiple MCAN interfaces), * 0=MCAN0, 1=MCAN1 * diff --git a/arch/arm/src/samv7/sam_mcan.h b/arch/arm/src/samv7/sam_mcan.h index 3672547788..0c5dc6c726 100644 --- a/arch/arm/src/samv7/sam_mcan.h +++ b/arch/arm/src/samv7/sam_mcan.h @@ -88,7 +88,7 @@ extern "C" * Description: * Initialize the selected MCAN port * - * Input Parameter: + * Input Parameters: * port - Port number (for hardware that has multiple CAN interfaces), * 0=MCAN0, 1=NCAN1 * diff --git a/arch/arm/src/samv7/sam_qspi.c b/arch/arm/src/samv7/sam_qspi.c index 7e47c6caf9..6e39c7f8e3 100644 --- a/arch/arm/src/samv7/sam_qspi.c +++ b/arch/arm/src/samv7/sam_qspi.c @@ -1714,7 +1714,7 @@ static int qspi_hw_initialize(struct sam_qspidev_s *priv) * Description: * Initialize the selected QSPI port in master mode * - * Input Parameter: + * Input Parameters: * intf - Interface number(must be zero) * * Returned Value: diff --git a/arch/arm/src/samv7/sam_qspi.h b/arch/arm/src/samv7/sam_qspi.h index 85d2e57d65..9b64f0531c 100644 --- a/arch/arm/src/samv7/sam_qspi.h +++ b/arch/arm/src/samv7/sam_qspi.h @@ -87,7 +87,7 @@ extern "C" * Description: * Initialize the selected QSPI port in master mode * - * Input Parameter: + * Input Parameters: * intf - Interface number(must be zero) * * Returned Value: diff --git a/arch/arm/src/samv7/sam_rswdt.c b/arch/arm/src/samv7/sam_rswdt.c index 6d5add03a2..5651e612ee 100644 --- a/arch/arm/src/samv7/sam_rswdt.c +++ b/arch/arm/src/samv7/sam_rswdt.c @@ -254,7 +254,7 @@ static void sam_putreg(uint32_t regval, uintptr_t regaddr) * Input Parameters: * Usual interrupt handler arguments. * - * Returned Values: + * Returned Value: * Always returns OK. * ****************************************************************************/ @@ -290,7 +290,7 @@ static int sam_interrupt(int irq, FAR void *context, FAR void *arg) * lower - A pointer the publicly visible representation of the "lower-half" * driver state structure. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -320,7 +320,7 @@ static int sam_start(FAR struct watchdog_lowerhalf_s *lower) * lower - A pointer the publicly visible representation of the "lower-half" * driver state structure. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -350,7 +350,7 @@ static int sam_stop(FAR struct watchdog_lowerhalf_s *lower) * lower - A pointer the publicly visible representation of the "lower-half" * driver state structure. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -378,7 +378,7 @@ static int sam_keepalive(FAR struct watchdog_lowerhalf_s *lower) * driver state structure. * stawtus - The location to return the watchdog status information. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -435,7 +435,7 @@ static int sam_getstatus(FAR struct watchdog_lowerhalf_s *lower, * driver state structure. * timeout - The new timeout value in millisecnds. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -554,7 +554,7 @@ static int sam_settimeout(FAR struct watchdog_lowerhalf_s *lower, * function pointer is NULL, then the reset-on-expiration * behavior is restored, * - * Returned Values: + * Returned Value: * The previous watchdog expiration function pointer or NULL is there was * no previous function pointer, i.e., if the previous behavior was * reset-on-expiration (NULL is also returned if an error occurs). @@ -619,7 +619,7 @@ static xcpt_t sam_capture(FAR struct watchdog_lowerhalf_s *lower, * interpretation of this argument depends on the particular * command. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -649,7 +649,7 @@ static int sam_ioctl(FAR struct watchdog_lowerhalf_s *lower, int cmd, * Input Parameters: * None * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ diff --git a/arch/arm/src/samv7/sam_spi.c b/arch/arm/src/samv7/sam_spi.c index 0ae37af28b..0f4a52c904 100644 --- a/arch/arm/src/samv7/sam_spi.c +++ b/arch/arm/src/samv7/sam_spi.c @@ -1985,7 +1985,7 @@ static void spi_recvblock(struct spi_dev_s *dev, void *buffer, size_t nwords) * Description: * Initialize the selected SPI port in master mode * - * Input Parameter: + * Input Parameters: * cs - Chip select number (identifying the "logical" SPI port) * * Returned Value: diff --git a/arch/arm/src/samv7/sam_spi.h b/arch/arm/src/samv7/sam_spi.h index 6e5a76e9ef..e7e715fd38 100644 --- a/arch/arm/src/samv7/sam_spi.h +++ b/arch/arm/src/samv7/sam_spi.h @@ -166,7 +166,7 @@ struct spi_sctrlr_s; /* Forward reference */ * Description: * Initialize the selected SPI port in master mode * - * Input Parameter: + * Input Parameters: * cs - Chip select number (identifying the "logical" SPI port) * * Returned Value: @@ -182,7 +182,7 @@ FAR struct spi_dev_s *sam_spibus_initialize(int port); * Description: * Initialize the selected SPI port in slave mode. * - * Input Parameter: + * Input Parameters: * port - Chip select number identifying the "logical" SPI port. Includes * encoded port and chip select information. * @@ -248,7 +248,7 @@ FAR struct spi_sctrlr_s *sam_spi_slave_initialize(int port); * devid - Identifies the (logical) device * selected - TRUE:Select the device, FALSE:De-select the device * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -270,7 +270,7 @@ void sam_spi1select(uint32_t devid, bool selected); * dev - SPI device info * devid - Identifies the (logical) device * - * Returned Values: + * Returned Value: * Bit-encoded SPI status (see include/nuttx/spi/spi.h. * ****************************************************************************/ @@ -301,7 +301,7 @@ uint8_t sam_spi1status(FAR struct spi_dev_s *dev, uint32_t devid); * dev - SPI device info * devid - Identifies the (logical) device * - * Returned Values: + * Returned Value: * Zero on success; a negated errno on failure. * ****************************************************************************/ diff --git a/arch/arm/src/samv7/sam_spi_slave.c b/arch/arm/src/samv7/sam_spi_slave.c index 19473aa05c..77a2cf6732 100644 --- a/arch/arm/src/samv7/sam_spi_slave.c +++ b/arch/arm/src/samv7/sam_spi_slave.c @@ -1059,7 +1059,7 @@ static void spi_qflush(struct spi_sctrlr_s *sctrlr) * Description: * Initialize the selected SPI port in slave mode. * - * Input Parameter: + * Input Parameters: * port - Chip select number identifying the "logical" SPI port. Includes * encoded port and chip select information. * diff --git a/arch/arm/src/samv7/sam_ssc.c b/arch/arm/src/samv7/sam_ssc.c index bb1114c444..8d56ff8f38 100644 --- a/arch/arm/src/samv7/sam_ssc.c +++ b/arch/arm/src/samv7/sam_ssc.c @@ -2765,7 +2765,7 @@ static int ssc_tx_configure(struct sam_ssc_s *priv) * Setup the MCK/2 divider based on the currently selected data width and * the sample rate * - * Input Parameter: + * Input Parameters: * priv - I2C device structure (only the sample rate and data length is * needed at this point). * @@ -2822,7 +2822,7 @@ static uint32_t ssc_mck2divider(struct sam_ssc_s *priv) * Description: * Enable and configure clocking to the SSC * - * Input Parameter: + * Input Parameters: * priv - Partially initialized I2C device structure (only the PID is * needed at this point). * @@ -3370,7 +3370,7 @@ static void ssc1_configure(struct sam_ssc_s *priv) * Description: * Initialize the selected SSC port * - * Input Parameter: + * Input Parameters: * port - I2S "port" number (identifying the "logical" SSC port) * * Returned Value: diff --git a/arch/arm/src/samv7/sam_ssc.h b/arch/arm/src/samv7/sam_ssc.h index 567b655c36..0db57fe361 100644 --- a/arch/arm/src/samv7/sam_ssc.h +++ b/arch/arm/src/samv7/sam_ssc.h @@ -82,7 +82,7 @@ extern "C" * Description: * Initialize the selected I2S port. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has multiple I2S interfaces) * * Returned Value: diff --git a/arch/arm/src/samv7/sam_twihs.h b/arch/arm/src/samv7/sam_twihs.h index 79f85a70e3..abcaba9b7d 100644 --- a/arch/arm/src/samv7/sam_twihs.h +++ b/arch/arm/src/samv7/sam_twihs.h @@ -57,7 +57,7 @@ * instances of the interface, each of which may be set up with a * different frequency and slave address. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has multiple I2C interfaces) * * Returned Value: @@ -73,7 +73,7 @@ FAR struct i2c_master_s *sam_i2cbus_initialize(int port); * Description: * De-initialize the selected I2C port, and power down the device. * - * Input Parameter: + * Input Parameters: * Device structure as returned by the sam_i2cbus_initialize() * * Returned Value: diff --git a/arch/arm/src/samv7/sam_wdt.c b/arch/arm/src/samv7/sam_wdt.c index 4ce21303c3..b6990b9370 100644 --- a/arch/arm/src/samv7/sam_wdt.c +++ b/arch/arm/src/samv7/sam_wdt.c @@ -254,7 +254,7 @@ static void sam_putreg(uint32_t regval, uintptr_t regaddr) * Input Parameters: * Usual interrupt handler arguments. * - * Returned Values: + * Returned Value: * Always returns OK. * ****************************************************************************/ @@ -290,7 +290,7 @@ static int sam_interrupt(int irq, FAR void *context, FAR void *arg) * lower - A pointer the publicly visible representation of the "lower-half" * driver state structure. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -320,7 +320,7 @@ static int sam_start(FAR struct watchdog_lowerhalf_s *lower) * lower - A pointer the publicly visible representation of the "lower-half" * driver state structure. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -350,7 +350,7 @@ static int sam_stop(FAR struct watchdog_lowerhalf_s *lower) * lower - A pointer the publicly visible representation of the "lower-half" * driver state structure. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -378,7 +378,7 @@ static int sam_keepalive(FAR struct watchdog_lowerhalf_s *lower) * driver state structure. * stawtus - The location to return the watchdog status information. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -435,7 +435,7 @@ static int sam_getstatus(FAR struct watchdog_lowerhalf_s *lower, * driver state structure. * timeout - The new timeout value in millisecnds. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -567,7 +567,7 @@ static int sam_settimeout(FAR struct watchdog_lowerhalf_s *lower, * function pointer is NULL, then the reset-on-expiration * behavior is restored, * - * Returned Values: + * Returned Value: * The previous watchdog expiration function pointer or NULL is there was * no previous function pointer, i.e., if the previous behavior was * reset-on-expiration (NULL is also returned if an error occurs). @@ -632,7 +632,7 @@ static xcpt_t sam_capture(FAR struct watchdog_lowerhalf_s *lower, * interpretation of this argument depends on the particular * command. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -662,7 +662,7 @@ static int sam_ioctl(FAR struct watchdog_lowerhalf_s *lower, int cmd, * Input Parameters: * None * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ diff --git a/arch/arm/src/samv7/sam_wdt.h b/arch/arm/src/samv7/sam_wdt.h index f5ee97a247..3fe31686ca 100644 --- a/arch/arm/src/samv7/sam_wdt.h +++ b/arch/arm/src/samv7/sam_wdt.h @@ -76,7 +76,7 @@ extern "C" * * At a minimum, this function should call watchdog_register(). * - * Input parameters: + * Input Parameters: * None * * Returned Value: @@ -96,7 +96,7 @@ int sam_wdt_initialize(void); * * At a minimum, this function should call watchdog_register(). * - * Input parameters: + * Input Parameters: * None * * Returned Value: diff --git a/arch/arm/src/stm32/stm32_1wire.c b/arch/arm/src/stm32/stm32_1wire.c index a4157006a6..93ab8000ee 100644 --- a/arch/arm/src/stm32/stm32_1wire.c +++ b/arch/arm/src/stm32/stm32_1wire.c @@ -500,7 +500,7 @@ static void stm32_1wire_set_baud(struct stm32_1wire_priv_s *priv) * Description: * Enable or disable APB clock for the USART peripheral * - * Input parameters: + * Input Parameters: * priv - A reference to the 1-Wire driver state structure * on - Enable clock if 'on' is 'true' and disable if 'false' * @@ -1149,7 +1149,7 @@ static int stm32_1wire_exchange(FAR struct onewire_dev_s *dev, bool reset, * instances of the interface, each of which may be set up with a * different frequency and slave address. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has multiple 1-Wire interfaces) * * Returned Value: @@ -1245,7 +1245,7 @@ FAR struct onewire_dev_s *stm32_1wireinitialize(int port) * Description: * De-initialize the selected 1-Wire port, and power down the device. * - * Input Parameter: + * Input Parameters: * Device structure as returned by the stm32_1wireinitialize() * * Returned Value: diff --git a/arch/arm/src/stm32/stm32_1wire.h b/arch/arm/src/stm32/stm32_1wire.h index 24cfe45592..7606c8f461 100644 --- a/arch/arm/src/stm32/stm32_1wire.h +++ b/arch/arm/src/stm32/stm32_1wire.h @@ -57,7 +57,7 @@ * instances of the interface, each of which may be set up with a * different frequency and slave address. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has multiple 1-Wire interfaces) * * Returned Value: @@ -73,7 +73,7 @@ FAR struct onewire_dev_s *stm32_1wireinitialize(int port); * Description: * De-initialize the selected 1-Wire port, and power down the device. * - * Input Parameter: + * Input Parameters: * Device structure as returned by the stm32_1wireinitialize() * * Returned Value: diff --git a/arch/arm/src/stm32/stm32_adc.c b/arch/arm/src/stm32/stm32_adc.c index 7ec37927bd..89e826f6f0 100644 --- a/arch/arm/src/stm32/stm32_adc.c +++ b/arch/arm/src/stm32/stm32_adc.c @@ -757,7 +757,7 @@ static void tim_modifyreg(FAR struct stm32_dev_s *priv, int offset, * Description: * Dump all timer registers. * - * Input parameters: + * Input Parameters: * priv - A reference to the ADC block status * * Returned Value: diff --git a/arch/arm/src/stm32/stm32_can.c b/arch/arm/src/stm32/stm32_can.c index a2fc3fac1d..2625c9123c 100644 --- a/arch/arm/src/stm32/stm32_can.c +++ b/arch/arm/src/stm32/stm32_can.c @@ -1644,7 +1644,7 @@ static int stm32can_txinterrupt(int irq, FAR void *context, FAR void *arg) * Where: * Tpclk1 is the period of the APB1 clock (PCLK1). * - * Input Parameter: + * Input Parameters: * priv - A reference to the CAN block status * * Returned Value: @@ -1743,7 +1743,7 @@ static int stm32can_bittiming(FAR struct stm32_can_s *priv) * peripheral, no registers are changed. The initialization mode is * required to change the baud rate. * - * Input Parameter: + * Input Parameters: * priv - A pointer to the private data structure for this CAN block * * Returned Value: @@ -1794,7 +1794,7 @@ static int stm32can_enterinitmode(FAR struct stm32_can_s *priv) * Description: * Put the CAN cell out of the Initialization mode (to Normal mode) * - * Input Parameter: + * Input Parameters: * priv - A pointer to the private data structure for this CAN block * * Returned Value: @@ -1844,7 +1844,7 @@ static int stm32can_exitinitmode(FAR struct stm32_can_s *priv) * Description: * CAN cell initialization * - * Input Parameter: + * Input Parameters: * priv - A pointer to the private data structure for this CAN block * * Returned Value: @@ -1927,7 +1927,7 @@ static int stm32can_cellinit(FAR struct stm32_can_s *priv) * are set to zero thus supressing all filtering because anything masked * with zero matches zero. * - * Input Parameter: + * Input Parameters: * priv - A pointer to the private data structure for this CAN block * * Returned Value: @@ -2014,7 +2014,7 @@ static int stm32can_filterinit(FAR struct stm32_can_s *priv) * Description: * Add a filter for extended CAN IDs * - * Input Parameter: + * Input Parameters: * priv - A pointer to the private data structure for this CAN block * arg - A pointer to a structure describing the filter * @@ -2039,7 +2039,7 @@ static int stm32can_addextfilter(FAR struct stm32_can_s *priv, * Description: * Remove a filter for extended CAN IDs * - * Input Parameter: + * Input Parameters: * priv - A pointer to the private data structure for this CAN block * arg - The filter index previously returned by the * CANIOC_ADD_EXTFILTER command @@ -2064,7 +2064,7 @@ static int stm32can_delextfilter(FAR struct stm32_can_s *priv, int arg) * Description: * Add a filter for standard CAN IDs * - * Input Parameter: + * Input Parameters: * priv - A pointer to the private data structure for this CAN block * arg - A pointer to a structure describing the filter * @@ -2087,7 +2087,7 @@ static int stm32can_addstdfilter(FAR struct stm32_can_s *priv, * Description: * Remove a filter for standard CAN IDs * - * Input Parameter: + * Input Parameters: * priv - A pointer to the private data structure for this CAN block * arg - The filter index previously returned by the * CANIOC_ADD_STDFILTER command @@ -2107,7 +2107,7 @@ static int stm32can_delstdfilter(FAR struct stm32_can_s *priv, int arg) /**************************************************************************** * Name: stm32can_txmb0empty * - * Input Parameter: + * Input Parameters: * tsr_regval - value of CAN transmit status register * * Returned Value: @@ -2124,7 +2124,7 @@ static bool stm32can_txmb0empty(uint32_t tsr_regval) /**************************************************************************** * Name: stm32can_txmb1empty * - * Input Parameter: + * Input Parameters: * tsr_regval - value of CAN transmit status register * * Returned Value: @@ -2141,7 +2141,7 @@ static bool stm32can_txmb1empty(uint32_t tsr_regval) /**************************************************************************** * Name: stm32can_txmb2empty * - * Input Parameter: + * Input Parameters: * tsr_regval - value of CAN transmit status register * * Returned Value: @@ -2165,7 +2165,7 @@ static bool stm32can_txmb2empty(uint32_t tsr_regval) * Description: * Initialize the selected CAN port * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple CAN interfaces) * * Returned Value: diff --git a/arch/arm/src/stm32/stm32_can.h b/arch/arm/src/stm32/stm32_can.h index f06231ab60..078e6b2a12 100644 --- a/arch/arm/src/stm32/stm32_can.h +++ b/arch/arm/src/stm32/stm32_can.h @@ -125,7 +125,7 @@ extern "C" * Description: * Initialize the selected CAN port * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple CAN interfaces) * * Returned Value: diff --git a/arch/arm/src/stm32/stm32_dma.h b/arch/arm/src/stm32/stm32_dma.h index 965fd6f30f..e9878d1157 100644 --- a/arch/arm/src/stm32/stm32_dma.h +++ b/arch/arm/src/stm32/stm32_dma.h @@ -175,7 +175,7 @@ extern "C" * Hmm.. I suppose this interface could be extended to make a non-blocking * version. Feel free to do that if that is what you need. * - * Input parameter: + * Input Parameters: * chan - Identifies the stream/channel resource * For the STM32 F1, this is simply the channel number as provided by * the DMACHAN_* definitions in chip/stm32f10xxx_dma.h. @@ -281,7 +281,7 @@ size_t stm32_dmaresidual(DMA_HANDLE handle); * only applies to memory addresses, it will return false for any peripheral * address. * - * Returned value: + * Returned Value: * True, if transfer is possible. * ****************************************************************************/ diff --git a/arch/arm/src/stm32/stm32_dma2d.c b/arch/arm/src/stm32/stm32_dma2d.c index a70ed75085..c9e2a0e54c 100644 --- a/arch/arm/src/stm32/stm32_dma2d.c +++ b/arch/arm/src/stm32/stm32_dma2d.c @@ -486,7 +486,7 @@ static int stm32_dma2dirq(int irq, void *context, FAR void *arg) * loading or dma transfer was completed. * Note! The caller must use this function within a critical section. * - * Return: + * Returned Value: * On success OK otherwise ERROR * ****************************************************************************/ @@ -532,7 +532,7 @@ static int stm32_dma2d_waitforirq(void) * Parameter: * pfcreg - PFC control Register * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -620,7 +620,7 @@ static int stm32_dma2d_start(void) * Parameter: * layer - Reference to the common layer state structure * - * Return: + * Returned Value: * memory address * ****************************************************************************/ @@ -646,7 +646,7 @@ static uint32_t stm32_dma2d_memaddress(FAR const struct stm32_dma2d_s *layer, * Parameter: * layer - Reference to the common layer state structure * - * Return: + * Returned Value: * line offset * ****************************************************************************/ @@ -670,7 +670,7 @@ static fb_coord_t stm32_dma2d_lineoffset(FAR const struct stm32_dma2d_s *layer, * layer - Reference to the common layer state structure * fmt - Reference to the location to store the pixel format * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -729,7 +729,7 @@ static int stm32_dma2d_pixelformat(uint8_t fmt, uint8_t *fmtmap) * layer - Reference to the common layer state structure * bpp - Reference to the location to store the pixel format * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -770,7 +770,7 @@ static int stm32_dma2d_bpp(uint8_t fmt, uint8_t *bpp) * Description: * Get a free layer id * - * Return: + * Returned Value: * The number of the free layer * -1 if no free layer is available * @@ -797,7 +797,7 @@ static int stm32_dma2d_lfreelid(void) * Description: * Allocate a new layer structure * - * Return: + * Returned Value: * A new allocated layer structure or NULL on error. * ****************************************************************************/ @@ -886,7 +886,7 @@ static void stm32_dma2d_llayerscleanup(void) * Description: * Helper to validate if the layer is valid * - * Return: + * Returned Value: * true if validates otherwise false * ****************************************************************************/ @@ -908,7 +908,7 @@ static inline bool stm32_dma2d_lvalidate(FAR const struct stm32_dma2d_s *layer) * ypos - The y position inside the whole layer * area - the area inside the whole layer * - * Return: + * Returned Value: * true if area is inside the whole layer otherwise false * ****************************************************************************/ @@ -1162,7 +1162,7 @@ static void stm32_dma2d_lpfc(FAR const struct stm32_dma2d_s *layer, * layer - Reference to the layer control structure * vinfo - Reference to the video info structure * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -1199,7 +1199,7 @@ static int stm32_dma2dgetvideoinfo(FAR struct dma2d_layer_s *layer, * planeno - Number of the plane * pinfo - Reference to the plane info structure * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -1235,7 +1235,7 @@ static int stm32_dma2dgetplaneinfo(FAR struct dma2d_layer_s *layer, int planeno, * layer - Reference to the layer structure * lid - Reference to store the layer id * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -1271,7 +1271,7 @@ static int stm32_dma2dgetlid(FAR struct dma2d_layer_s *layer, int *lid) * layer - Reference to the layer structure * cmap - color lookup table with up the 256 entries * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -1390,7 +1390,7 @@ static int stm32_dma2dsetclut(FAR struct dma2d_layer_s *layer, * cmap - Reference to valid color lookup table accept up the 256 color * entries * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -1482,7 +1482,7 @@ static int stm32_dma2dgetclut(FAR struct dma2d_layer_s *layer, * layer - Reference to the layer structure * alpha - Alpha value * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -1517,7 +1517,7 @@ static int stm32_dma2dsetalpha(FAR struct dma2d_layer_s *layer, uint8_t alpha) * layer - Reference to the layer structure * alpha - Reference to store the alpha value * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -1554,7 +1554,7 @@ static int stm32_dma2dgetalpha(FAR struct dma2d_layer_s *layer, uint8_t *alpha) * layer - Reference to the layer structure * mode - Blend mode (see DMA2D_BLEND_*) * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -1603,7 +1603,7 @@ static int stm32_dma2dsetblendmode(FAR struct dma2d_layer_s *layer, * layer - Reference to the layer structure * mode - Reference to store the blend mode * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -1643,7 +1643,7 @@ static int stm32_dma2dgetblendmode(FAR struct dma2d_layer_s *layer, * src - Valid reference to the source layer * srcarea - Valid reference to the selected area of the source layer * - * Return: + * Returned Value: * OK - On success * -EINVAL - If one of the parameter invalid or if the size of the selected * source area outside the visible area of the destination layer. @@ -1752,7 +1752,7 @@ static int stm32_dma2dblit(FAR struct dma2d_layer_s *dest, * back - Reference to the background layer * backarea - Reference to the selected area of the background layer * - * Return: + * Returned Value: * OK - On success * -EINVAL - If one of the parameter invalid or if the size of the selected * source area outside the visible area of the destination layer. @@ -1859,7 +1859,7 @@ static int stm32_dma2dblend(FAR struct dma2d_layer_s *dest, * color - Color to fill the selected area. Color must be formatted * according to the layer pixel format. * - * Return: + * Returned Value: * OK - On success * -EINVAL - If one of the parameter invalid or if the size of the selected * area outside the visible area of the layer. @@ -1935,7 +1935,7 @@ static int stm32_dma2dfillarea(FAR struct dma2d_layer_s *layer, * Parameter: * lid - Layer identifier * - * Return: + * Returned Value: * Reference to the dma2d layer control structure on success or Null if no * related exist. * @@ -1968,7 +1968,7 @@ FAR struct dma2d_layer_s *up_dma2dgetlayer(int lid) * height - Layer height * fmt - Pixel format of the layer * - * Return: + * Returned Value: * On success - A valid dma2d layer reference * On error - NULL * @@ -2090,7 +2090,7 @@ FAR struct dma2d_layer_s *up_dma2dcreatelayer(fb_coord_t width, * Parameter: * layer - Reference to the layer to remove * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -2132,7 +2132,7 @@ int up_dma2dremovelayer(FAR struct dma2d_layer_s *layer) * Description: * Initialize the dma2d controller * - * Return: + * Returned Value: * OK - On success * An error if initializing failed. * @@ -2248,7 +2248,7 @@ void up_dma2duninitialize(void) * layer - a valid reference to the low level ltdc layer structure * clut - a pointer to a valid memory region to hold 256 clut colors * - * Return: + * Returned Value: * On success - A valid dma2d layer reference * On error - NULL * diff --git a/arch/arm/src/stm32/stm32_dma2d.h b/arch/arm/src/stm32/stm32_dma2d.h index a62d16f7af..258ae69531 100644 --- a/arch/arm/src/stm32/stm32_dma2d.h +++ b/arch/arm/src/stm32/stm32_dma2d.h @@ -74,7 +74,7 @@ struct dma2d_layer_s * layer - Reference to the layer control structure * vinfo - Reference to the video info structure * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL */ @@ -92,7 +92,7 @@ struct dma2d_layer_s * planeno - Number of the plane * pinfo - Reference to the plane info structure * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL */ @@ -109,7 +109,7 @@ struct dma2d_layer_s * layer - Reference to the layer structure * lid - Reference to store the layer id * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL */ @@ -127,7 +127,7 @@ struct dma2d_layer_s * layer - Reference to the layer structure * cmap - color lookup table with up the 256 entries * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL */ @@ -145,7 +145,7 @@ struct dma2d_layer_s * cmap - Reference to valid color lookup table accept up the 256 color * entries * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL */ @@ -167,7 +167,7 @@ struct dma2d_layer_s * layer - Reference to the layer structure * alpha - Alpha value * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL */ @@ -183,7 +183,7 @@ struct dma2d_layer_s * layer - Reference to the layer structure * alpha - Reference to store the alpha value * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL */ @@ -201,7 +201,7 @@ struct dma2d_layer_s * layer - Reference to the layer structure * mode - Blend mode (see DMA2D_BLEND_*) * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -230,7 +230,7 @@ struct dma2d_layer_s * layer - Reference to the layer structure * mode - Reference to store the blend mode * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL */ @@ -250,7 +250,7 @@ struct dma2d_layer_s * src - Reference to the source layer * srcarea - Reference to the selected area of the source layer * - * Return: + * Returned Value: * OK - On success * -EINVAL - If one of the parameter invalid or if the size of the * selected source area outside the visible area of the @@ -281,7 +281,7 @@ struct dma2d_layer_s * back - Reference to the background layer * backarea - Reference to the selected area of the background layer * - * Return: + * Returned Value: * OK - On success * -EINVAL - If one of the parameter invalid or if the size of the * selected source area outside the visible area of the @@ -308,7 +308,7 @@ struct dma2d_layer_s * color - Color to fill the selected area. Color must be formatted * according to the layer pixel format. * - * Return: + * Returned Value: * OK - On success * -EINVAL - If one of the parameter invalid or if the size of the * selected area outside the visible area of the layer. @@ -340,7 +340,7 @@ struct stm32_ltdc_s; /* Forward declaration */ * Parameter: * layer - a valid reference to the low level ltdc layer structure * - * Return: + * Returned Value: * On success - A valid dma2d layer reference * On error - NULL and errno is set to * -EINVAL if one of the parameter is invalid @@ -358,7 +358,7 @@ FAR struct dma2d_layer_s *stm32_dma2dinitltdc(FAR struct stm32_ltdc_s *layer); * Parameter: * lid - Layer identifier * - * Return: + * Returned Value: * Reference to the dma2d layer control structure on success or Null if no * related exist. * @@ -377,7 +377,7 @@ FAR struct dma2d_layer_s *up_dma2dgetlayer(int lid); * height - Layer height * fmt - Pixel format of the layer * - * Return: + * Returned Value: * On success - A valid dma2d layer reference * On error - NULL and errno is set to * -EINVAL if one of the parameter is invalid @@ -399,7 +399,7 @@ FAR struct dma2d_layer_s *up_dma2dcreatelayer(fb_coord_t width, * Parameter: * layer - Reference to the layer to remove * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -413,7 +413,7 @@ int up_dma2dremovelayer(FAR struct dma2d_layer_s *layer); * Description: * Initialize the dma2d controller * - * Return: + * Returned Value: * OK - On success * An error if initializing failed. * diff --git a/arch/arm/src/stm32/stm32_exti.h b/arch/arm/src/stm32/stm32_exti.h index 8e46e239da..376d65f774 100644 --- a/arch/arm/src/stm32/stm32_exti.h +++ b/arch/arm/src/stm32/stm32_exti.h @@ -123,7 +123,7 @@ int stm32_exti_alarm(bool risingedge, bool fallingedge, bool event, xcpt_t func, * - func: when non-NULL, generate interrupt * - arg: Argument passed to the interrupt callback * - * Returns: + * Returned Value: * Zero (OK) on success; a negated errno value on failure indicating the * nature of the failure. * diff --git a/arch/arm/src/stm32/stm32_exti_alarm.c b/arch/arm/src/stm32/stm32_exti_alarm.c index 414817a6b8..77de848e9f 100644 --- a/arch/arm/src/stm32/stm32_exti_alarm.c +++ b/arch/arm/src/stm32/stm32_exti_alarm.c @@ -108,7 +108,7 @@ static int stm32_exti_alarm_isr(int irq, void *context, FAR void *arg) * - func: when non-NULL, generate interrupt * - arg: Argument passed to the interrupt callback * - * Returns: + * Returned Value: * Zero (OK) on success; a negated errno value on failure indicating the * nature of the failure. * diff --git a/arch/arm/src/stm32/stm32_exti_pwr.c b/arch/arm/src/stm32/stm32_exti_pwr.c index 5ab6138ac4..36d2167283 100644 --- a/arch/arm/src/stm32/stm32_exti_pwr.c +++ b/arch/arm/src/stm32/stm32_exti_pwr.c @@ -114,7 +114,7 @@ static int stm32_exti_pvd_isr(int irq, void *context, FAR void *arg) * - func: when non-NULL, generate interrupt * - arg: Argument passed to the interrupt callback * - * Returns: + * Returned Value: * Zero (OK) returned on success; a negated errno value is returned on * failure. * diff --git a/arch/arm/src/stm32/stm32_exti_pwr.h b/arch/arm/src/stm32/stm32_exti_pwr.h index c4841dffeb..e48ca3f2ee 100644 --- a/arch/arm/src/stm32/stm32_exti_pwr.h +++ b/arch/arm/src/stm32/stm32_exti_pwr.h @@ -59,7 +59,7 @@ * - func: when non-NULL, generate interrupt * - arg: Argument passed to the interrupt callback * - * Returns: + * Returned Value: * Zero (OK) returned on success; a negated errno value is returned on * failure. * diff --git a/arch/arm/src/stm32/stm32_exti_wakeup.c b/arch/arm/src/stm32/stm32_exti_wakeup.c index 9dd9ad7d99..d265361f87 100644 --- a/arch/arm/src/stm32/stm32_exti_wakeup.c +++ b/arch/arm/src/stm32/stm32_exti_wakeup.c @@ -107,7 +107,7 @@ static int stm32_exti_wakeup_isr(int irq, void *context, FAR void *arg) * - event: generate event when set * - func: when non-NULL, generate interrupt * - * Returns: + * Returned Value: * Zero (OK) on success; a negated errno value on failure indicating the * nature of the failure. * diff --git a/arch/arm/src/stm32/stm32_flash.h b/arch/arm/src/stm32/stm32_flash.h index 6da1b0b703..4d5003b056 100644 --- a/arch/arm/src/stm32/stm32_flash.h +++ b/arch/arm/src/stm32/stm32_flash.h @@ -56,7 +56,7 @@ * Description: * Get EEPROM data memory size * - * Returns: + * Returned Value: * Length of EEPROM memory region * ************************************************************************************/ @@ -69,7 +69,7 @@ size_t stm32_eeprom_size(void); * Description: * Get EEPROM data memory address * - * Returns: + * Returned Value: * Address of EEPROM memory region * ************************************************************************************/ @@ -82,7 +82,7 @@ size_t stm32_eeprom_getaddress(void); * Description: * Write buffer to EEPROM data memory address * - * Returns: + * Returned Value: * Number of written bytes or error code. * ************************************************************************************/ @@ -95,7 +95,7 @@ ssize_t stm32_eeprom_write(size_t addr, const void *buf, size_t buflen); * Description: * Erase memory on EEPROM data memory address * - * Returns: + * Returned Value: * Number of erased bytes or error code. * ************************************************************************************/ diff --git a/arch/arm/src/stm32/stm32_gpio.c b/arch/arm/src/stm32/stm32_gpio.c index 727f0c943a..7a1d7800c4 100644 --- a/arch/arm/src/stm32/stm32_gpio.c +++ b/arch/arm/src/stm32/stm32_gpio.c @@ -261,7 +261,7 @@ void stm32_gpioinit(void) * function, it must be unconfigured with stm32_unconfiggpio() with * the same cfgset first before it can be set to non-alternative function. * - * Returns: + * Returned Value: * OK on success * A negated errono valu on invalid port, or when pin is locked as ALT * function. @@ -667,7 +667,7 @@ int stm32_configgpio(uint32_t cfgset) * operate in PWM mode could produce excessive on-board currents and trigger * over-current/alarm function. * - * Returns: + * Returned Value: * OK on success * A negated errno value on invalid port * diff --git a/arch/arm/src/stm32/stm32_hrtim.c b/arch/arm/src/stm32/stm32_hrtim.c index 09da49edf9..a8069194bb 100644 --- a/arch/arm/src/stm32/stm32_hrtim.c +++ b/arch/arm/src/stm32/stm32_hrtim.c @@ -2560,7 +2560,7 @@ static int hrtim_gpios_config(FAR struct stm32_hrtim_s *priv) * Description: * Configure HRTIM Captures * - * Input parameters: + * Input Parameters: * priv - A reference to the HRTIM block * timer - HRTIM Timer index * capture - capture trigers configuration @@ -2618,7 +2618,7 @@ errout: * Description: * Configure HRTIM Captures * - * Input parameters: + * Input Parameters: * priv - A reference to the HRTIM block * * Returned Value: @@ -2669,7 +2669,7 @@ static int hrtim_capture_config(FAR struct stm32_hrtim_s *priv) * Description: * Get HRTIM Timer Capture register * - * Input parameters: + * Input Parameters: * priv - A reference to the HRTIM block * timer - HRTIM Timer index * index - Capture register index @@ -4516,7 +4516,7 @@ void hrtim_irq_ack(FAR struct hrtim_dev_s *dev, uint8_t timer, int source); * Description: * Set HRTIM Timer mode * - * Input parameters: + * Input Parameters: * priv - A reference to the HRTIM block * timer - HRTIM Timer index * mode - Timer mode configuration @@ -4685,7 +4685,7 @@ errout: * Description: * Try update HRTIM Timer compare register. * - * Input parameters: + * Input Parameters: * dev - HRTIM device structure * timer - HRTIM Timer index * index - Compare register timer @@ -4759,7 +4759,7 @@ errout: * Description: * Try update HRTIM Timer period register. * - * Input parameters: + * Input Parameters: * dev - HRTIM device structure * timer - HRTIM Timer index * per - New period register value @@ -4784,7 +4784,7 @@ static int hrtim_per_update(FAR struct hrtim_dev_s *dev, uint8_t timer, * Description: * Get HRTIM Timer period value * - * Input parameters: + * Input Parameters: * dev - HRTIM device structure * timer - HRTIM Timer index * @@ -4806,7 +4806,7 @@ static uint16_t hrtim_per_get(FAR struct hrtim_dev_s *dev, uint8_t timer) * Description: * Get HRTIM Timer compare register * - * Input parameters: + * Input Parameters: * priv - A reference to the HRTIM block * timer - HRTIM Timer index * index - Compare register timer @@ -4868,7 +4868,7 @@ errout: * Description: * Get HRTIM Timer clock value * - * Input parameters: + * Input Parameters: * dev - HRTIM device structure * timer - HRTIM Timer index * @@ -4904,7 +4904,7 @@ errout: * Description: * Set HRTIM Timer Reset events * - * Input parameters: + * Input Parameters: * priv - A reference to the HRTIM block * timer - HRTIM Timer index * reset - Reset configuration diff --git a/arch/arm/src/stm32/stm32_i2c.h b/arch/arm/src/stm32/stm32_i2c.h index f36ee952f5..c61f17332b 100644 --- a/arch/arm/src/stm32/stm32_i2c.h +++ b/arch/arm/src/stm32/stm32_i2c.h @@ -79,7 +79,7 @@ * instances of the interface, each of which may be set up with a * different frequency and slave address. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has multiple I2C interfaces) * * Returned Value: @@ -95,7 +95,7 @@ FAR struct i2c_master_s *stm32_i2cbus_initialize(int port); * Description: * De-initialize the selected I2C port, and power down the device. * - * Input Parameter: + * Input Parameters: * Device structure as returned by the stm32_i2cbus_initialize() * * Returned Value: diff --git a/arch/arm/src/stm32/stm32_i2s.c b/arch/arm/src/stm32/stm32_i2s.c index 46ac8f6eec..f68eb8683d 100644 --- a/arch/arm/src/stm32/stm32_i2s.c +++ b/arch/arm/src/stm32/stm32_i2s.c @@ -2160,7 +2160,7 @@ errout_with_exclsem: * Setup the MCK divider based on the currently selected data width and * the sample rate * - * Input Parameter: + * Input Parameters: * priv - I2C device structure (only the sample rate and data length is * needed at this point). * @@ -2562,7 +2562,7 @@ static void i2s3_configure(struct stm32_i2s_s *priv) * Description: * Initialize the selected i2S port * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple I2S interfaces) * * Returned Value: diff --git a/arch/arm/src/stm32/stm32_i2s.h b/arch/arm/src/stm32/stm32_i2s.h index 5e6d51b817..fc7a702b7e 100644 --- a/arch/arm/src/stm32/stm32_i2s.h +++ b/arch/arm/src/stm32/stm32_i2s.h @@ -71,7 +71,7 @@ extern "C" * Description: * Initialize the selected I2S port * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple I2S interfaces) * * Returned Value: diff --git a/arch/arm/src/stm32/stm32_iwdg.c b/arch/arm/src/stm32/stm32_iwdg.c index d26ec9f71a..2ceaf9bd4b 100644 --- a/arch/arm/src/stm32/stm32_iwdg.c +++ b/arch/arm/src/stm32/stm32_iwdg.c @@ -315,7 +315,7 @@ static inline void stm32_setprescaler(FAR struct stm32_lowerhalf_s *priv) * lower - A pointer the publicly visible representation of the "lower-half" * driver state structure. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -371,7 +371,7 @@ static int stm32_start(FAR struct watchdog_lowerhalf_s *lower) * lower - A pointer the publicly visible representation of the "lower-half" * driver state structure. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -396,7 +396,7 @@ static int stm32_stop(FAR struct watchdog_lowerhalf_s *lower) * lower - A pointer the publicly visible representation of the "lower-half" * driver state structure. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -429,7 +429,7 @@ static int stm32_keepalive(FAR struct watchdog_lowerhalf_s *lower) * driver state structure. * status - The location to return the watchdog status information. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -488,7 +488,7 @@ static int stm32_getstatus(FAR struct watchdog_lowerhalf_s *lower, * driver state structure. * timeout - The new timeout value in milliseconds. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -639,7 +639,7 @@ static int stm32_settimeout(FAR struct watchdog_lowerhalf_s *lower, * /dev/watchdog0 * lsifreq - The calibrated LSI clock frequency * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ diff --git a/arch/arm/src/stm32/stm32_ltdc.c b/arch/arm/src/stm32/stm32_ltdc.c index 5b794d17dd..25644116de 100644 --- a/arch/arm/src/stm32/stm32_ltdc.c +++ b/arch/arm/src/stm32/stm32_ltdc.c @@ -1162,7 +1162,7 @@ static int stm32_ltdcirq(int irq, void *context, FAR void *arg) * that a register reload was been completed. * Note! The caller must use this function within a critical section. * - * Return: + * Returned Value: * OK - On success otherwise ERROR * ****************************************************************************/ @@ -1457,7 +1457,7 @@ static inline uint8_t stm32_ltdc_lgetopac(FAR struct stm32_layer_s *layer) * Parameter: * layer - Reference to the layer control structure * - * Return: + * Returned Value: * true - layer valid * false - layer invalid * @@ -1487,7 +1487,7 @@ static inline bool stm32_ltdc_lvalidate(FAR const struct stm32_layer_s *layer) * srcxpos - Top left x position from where data visible in the active area * srcypos - Top left y position from where data visible in the active area * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -1958,7 +1958,7 @@ static void stm32_ltdc_lenable(FAR struct stm32_layer_s *layer) * layer - Reference to the layer control structure * color - The color to clear * - * Return: + * Returned Value: * OK - On success * -EINVAL - If one of the parameter invalid * @@ -2172,7 +2172,7 @@ static void stm32_ltdc_linit(int lid) * vtable - The framebuffer driver object * vinfo - the videoinfo object * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -2207,7 +2207,7 @@ static int stm32_getvideoinfo(struct fb_vtable_s *vtable, * vtable - The framebuffer driver object * pinfo - the planeinfo object * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -2242,7 +2242,7 @@ static int stm32_getplaneinfo(struct fb_vtable_s *vtable, int planeno, * vtable - The framebuffer driver object * cmap - the color table * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -2269,7 +2269,7 @@ static int stm32_getcmap(struct fb_vtable_s *vtable, * vtable - The framebuffer driver object * cmap - the color table * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -2296,7 +2296,7 @@ static int stm32_putcmap(struct fb_vtable_s *vtable, * layer - Reference to the layer control structure * vinfo - Reference to the video info structure * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -2330,7 +2330,7 @@ static int stm32_lgetvideoinfo(struct ltdc_layer_s *layer, * planeno - Number of the plane * pinfo - Reference to the plane info structure * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -2364,7 +2364,7 @@ static int stm32_lgetplaneinfo(struct ltdc_layer_s *layer, int planeno, * layer - Reference to the layer structure * cmap - color lookup table with up the 256 entries * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -2424,7 +2424,7 @@ static int stm32_setclut(struct ltdc_layer_s *layer, * cmap - Reference to valid color lookup table accept up the 256 color * entries * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -2523,7 +2523,7 @@ static int stm32_getclut(struct ltdc_layer_s *layer, * e.g. get the current active or inactive layer. * See LTDC_LAYER_* for possible values * - * Return: + * Returned Value: * OK - On success * Null if invalid flag * @@ -2600,7 +2600,7 @@ static int stm32_getlid(FAR struct ltdc_layer_s *layer, int *lid, * layer - Reference to the layer structure * argb - ARGB8888 color value * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -2636,7 +2636,7 @@ static int stm32_setcolor(FAR struct ltdc_layer_s *layer, uint32_t argb) * layer - Reference to the layer structure * argb - Reference to store the ARGB8888 color value * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -2673,7 +2673,7 @@ static int stm32_getcolor(FAR struct ltdc_layer_s *layer, uint32_t *argb) * layer - Reference to the layer structure * rgb - RGB888 color value * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -2709,7 +2709,7 @@ static int stm32_setcolorkey(FAR struct ltdc_layer_s *layer, uint32_t rgb) * layer - Reference to the layer structure * rgb - Reference to store the RGB888 color key * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -2750,7 +2750,7 @@ static int stm32_getcolorkey(FAR struct ltdc_layer_s *layer, uint32_t *rgb) * layer - Reference to the layer structure * alpha - Alpha value * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -2786,7 +2786,7 @@ static int stm32_setalpha(FAR struct ltdc_layer_s *layer, uint8_t alpha) * layer - Reference to the layer structure * alpha - Reference to store the alpha value * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -2823,7 +2823,7 @@ static int stm32_getalpha(FAR struct ltdc_layer_s *layer, uint8_t *alpha) * layer - Reference to the layer structure * mode - Blend mode (see LTDC_BLEND_*) * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -2955,7 +2955,7 @@ static int stm32_setblendmode(FAR struct ltdc_layer_s *layer, uint32_t mode) * layer - Reference to the layer structure * mode - Reference to store the blend mode * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL ****************************************************************************/ @@ -2994,7 +2994,7 @@ static int stm32_getblendmode(FAR struct ltdc_layer_s *layer, uint32_t *mode) * srcxpos - x position of the visible pixel of the whole layer * srcypos - y position of the visible pixel of the whole layer * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -3056,7 +3056,7 @@ static int stm32_setarea(FAR struct ltdc_layer_s *layer, * srcxpos - Reference to store the referenced x position of the whole layer * srcypos - Reference to store the reterenced y position of the whole layer * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -3096,7 +3096,7 @@ static int stm32_getarea(FAR struct ltdc_layer_s *layer, * layer - Reference to the layer structure * mode - operation mode * - * Return: + * Returned Value: * OK - On success * -EINVAL - If one of the parameter invalid * -ECANCELED - Operation cancelled, something goes wrong @@ -3259,7 +3259,7 @@ static int stm32_update(FAR struct ltdc_layer_s *layer, uint32_t mode) * src - Reference to the source layer * srcarea - Reference to the selected area of the source layer * - * Return: + * Returned Value: * OK - On success * -EINVAL - If one of the parameter invalid or if the size of the selected * source area outside the visible area of the destination layer. @@ -3310,7 +3310,7 @@ static int stm32_blit(FAR struct ltdc_layer_s *dest, * back - Reference to the background layer * backarea - Reference to the selected area of the background layer * - * Return: + * Returned Value: * OK - On success * -EINVAL - If one of the parameter invalid or if the size of the selected * source area outside the visible area of the destination layer. @@ -3360,7 +3360,7 @@ static int stm32_blend(FAR struct ltdc_layer_s *dest, * color - Color to fill the selected area. Color must be formatted * according to the layer pixel format. * - * Return: + * Returned Value: * OK - On success * -EINVAL - If one of the parameter invalid or if the size of the selected * area outside the visible area of the layer. @@ -3402,7 +3402,7 @@ static int stm32_fillarea(FAR struct ltdc_layer_s *layer, * Parameter: * lid - Layer identifier * - * Return: + * Returned Value: * Reference to the layer control structure on success or Null if lid * is invalid. * @@ -3428,7 +3428,7 @@ FAR struct ltdc_layer_s *stm32_ltdcgetlayer(int lid) * Description: * Initialize the ltdc controller * - * Return: + * Returned Value: * OK * ****************************************************************************/ @@ -3517,10 +3517,10 @@ int stm32_ltdcinitialize(void) * Return a a reference to the framebuffer object for the specified video * plane. * - * Input parameters: + * Input Parameters: * None * - * Returned value: + * Returned Value: * Reference to the framebuffer object (NULL on failure) * ****************************************************************************/ diff --git a/arch/arm/src/stm32/stm32_ltdc.h b/arch/arm/src/stm32/stm32_ltdc.h index 33ebc3e558..7c73de31fe 100644 --- a/arch/arm/src/stm32/stm32_ltdc.h +++ b/arch/arm/src/stm32/stm32_ltdc.h @@ -133,7 +133,7 @@ struct ltdc_layer_s * layer - Reference to the layer control structure * vinfo - Reference to the video info structure * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL */ @@ -151,7 +151,7 @@ struct ltdc_layer_s * planeno - Number of the plane * pinfo - Reference to the plane info structure * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL */ @@ -171,7 +171,7 @@ struct ltdc_layer_s * e.g. get the current active or inactive layer. * See LTDC_LAYER_* for possible values * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL */ @@ -192,7 +192,7 @@ struct ltdc_layer_s * enable - Enable or disable clut support (if false cmap is ignored and can * be NULL) * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL */ @@ -210,7 +210,7 @@ struct ltdc_layer_s * cmap - Reference to valid color lookup table accept up the 256 color * entries * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL */ @@ -229,7 +229,7 @@ struct ltdc_layer_s * layer - Reference to the layer structure * argb - ARGB8888 color value * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL */ @@ -245,7 +245,7 @@ struct ltdc_layer_s * layer - Reference to the layer structure * argb - Reference to store the ARGB8888 color value * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL */ @@ -263,7 +263,7 @@ struct ltdc_layer_s * layer - Reference to the layer structure * rgb - RGB888 color key * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL */ @@ -279,7 +279,7 @@ struct ltdc_layer_s * layer - Reference to the layer structure * rgb - Reference to store the RGB888 color key * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL */ @@ -301,7 +301,7 @@ struct ltdc_layer_s * layer - Reference to the layer structure * alpha - Alpha value * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL */ @@ -317,7 +317,7 @@ struct ltdc_layer_s * layer - Reference to the layer structure * alpha - Reference to store the alpha value * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL */ @@ -335,7 +335,7 @@ struct ltdc_layer_s * layer - Reference to the layer structure * mode - Blend mode (see LTDC_BLEND_*) * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -373,7 +373,7 @@ struct ltdc_layer_s * layer - Reference to the layer structure * mode - Reference to store the blend mode * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL */ @@ -400,7 +400,7 @@ struct ltdc_layer_s * srcxpos - x position of the visible pixel of the whole layer * srcypos - y position of the visible pixel of the whole layer * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -426,7 +426,7 @@ struct ltdc_layer_s * srcxpos - Reference to store the referenced x position of the whole layer * srcypos - Reference to store the reterenced y position of the whole layer * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL */ @@ -445,7 +445,7 @@ struct ltdc_layer_s * layer - Reference to the layer structure * mode - operation mode (see LTDC_UPDATE_*) * - * Return: + * Returned Value: * OK - On success * -EINVAL - If one of the parameter invalid * -ECANCELED - Operation cancelled, something goes wrong @@ -489,7 +489,7 @@ struct ltdc_layer_s * src - Reference to the source layer * srcarea - Reference to the selected area of the source layer * - * Return: + * Returned Value: * OK - On success * -EINVAL - If one of the parameter invalid or if the size of the selected * source area outside the visible area of the destination layer. @@ -518,7 +518,7 @@ struct ltdc_layer_s * back - Reference to the background layer * backarea - Reference to the selected area of the background layer * - * Return: + * Returned Value: * OK - On success * -EINVAL - If one of the parameter invalid or if the size of the selected * source area outside the visible area of the destination layer. @@ -543,7 +543,7 @@ struct ltdc_layer_s * color - Color to fill the selected area. Color must be formatted * according to the layer pixel format. * - * Return: + * Returned Value: * OK - On success * -EINVAL - If one of the parameter invalid or if the size of the selected * area outside the visible area of the layer. @@ -607,7 +607,7 @@ struct stm32_ltdc_s * Description: * Initialize the ltdc controller * - * Return: + * Returned Value: * OK * ************************************************************************************/ @@ -625,7 +625,7 @@ void stm32_ltdcuninitialize(void); * Parameter: * lid - Layer identifier * - * Return: + * Returned Value: * Reference to the layer control structure on success or Null if parameter * invalid. * diff --git a/arch/arm/src/stm32/stm32_otgfshost.c b/arch/arm/src/stm32/stm32_otgfshost.c index 8a6382d345..1b29ae09e5 100644 --- a/arch/arm/src/stm32/stm32_otgfshost.c +++ b/arch/arm/src/stm32/stm32_otgfshost.c @@ -1265,7 +1265,7 @@ static int stm32_ctrlchan_alloc(FAR struct stm32_usbhost_s *priv, * ep - A memory location provided by the caller in which to receive the * allocated endpoint descriptor. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -1327,7 +1327,7 @@ static int stm32_ctrlep_alloc(FAR struct stm32_usbhost_s *priv, * ep - A memory location provided by the caller in which to receive the * allocated endpoint descriptor. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -3820,7 +3820,7 @@ static void stm32_txfe_enable(FAR struct stm32_usbhost_s *priv, int chidx) * hport - The location to return the hub port descriptor that detected the * connection related event. * - * Returned Values: + * Returned Value: * Zero (OK) is returned on success when a device in connected or * disconnected. This function will not return until either (1) a device is * connected or disconnect to/from any hub port or until (2) some failure @@ -3911,7 +3911,7 @@ static int stm32_wait(FAR struct usbhost_connection_s *conn, * hport - The descriptor of the hub port that has the newly connected * device. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4041,7 +4041,7 @@ static int stm32_enumerate(FAR struct usbhost_connection_s *conn, * maxpacketsize - The maximum number of bytes that can be sent to or * received from the endpoint in a single data packet * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4100,7 +4100,7 @@ static int stm32_ep0configure(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep * ep - A memory location provided by the caller in which to receive the * allocated endpoint descriptor. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4156,7 +4156,7 @@ static int stm32_epalloc(FAR struct usbhost_driver_s *drvr, * the class create() method. * ep - The endpoint to be freed. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4224,7 +4224,7 @@ static int stm32_epfree(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep) * maxlen - The address of a memory location provided by the caller in which to * return the maximum size of the allocated buffer memory. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4270,7 +4270,7 @@ static int stm32_alloc(FAR struct usbhost_driver_s *drvr, * the class create() method. * buffer - The address of the allocated buffer memory to be freed. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4306,7 +4306,7 @@ static int stm32_free(FAR struct usbhost_driver_s *drvr, FAR uint8_t *buffer) * return the allocated buffer memory address. * buflen - The size of the buffer required. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4350,7 +4350,7 @@ static int stm32_ioalloc(FAR struct usbhost_driver_s *drvr, * the class create() method. * buffer - The address of the allocated buffer memory to be freed. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4393,7 +4393,7 @@ static int stm32_iofree(FAR struct usbhost_driver_s *drvr, FAR uint8_t *buffer) * NOTE: On an IN transaction, req and buffer may refer to the same allocated * memory. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4596,7 +4596,7 @@ static int stm32_ctrlout(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0, * (IN endpoint). buffer must have been allocated using DRVR_ALLOC * buflen - The length of the data to be sent or received. * - * Returned Values: + * Returned Value: * On success, a non-negative value is returned that indicates the number * of bytes successfully transferred. On a failure, a negated errno value is * returned that indicates the nature of the failure: @@ -4668,7 +4668,7 @@ static ssize_t stm32_transfer(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep * arg - The arbitrary parameter that will be passed to the callback function * when the transfer completes. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4724,7 +4724,7 @@ static int stm32_asynch(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep, * ep - The IN or OUT endpoint descriptor for the device endpoint on which an * asynchronous transfer should be transferred. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure. * @@ -4813,7 +4813,7 @@ static int stm32_cancel(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep) * related event * connected - True: device connected; false: device disconnected * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure. * @@ -4865,7 +4865,7 @@ static int stm32_connect(FAR struct usbhost_driver_s *drvr, * hport - The port from which the device is being disconnected. Might be a port * on a hub. * - * Returned Values: + * Returned Value: * None * * Assumptions: diff --git a/arch/arm/src/stm32/stm32_otghshost.c b/arch/arm/src/stm32/stm32_otghshost.c index ad1091d02f..c276742ab7 100644 --- a/arch/arm/src/stm32/stm32_otghshost.c +++ b/arch/arm/src/stm32/stm32_otghshost.c @@ -1270,7 +1270,7 @@ static int stm32_ctrlchan_alloc(FAR struct stm32_usbhost_s *priv, * ep - A memory location provided by the caller in which to receive the * allocated endpoint descriptor. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -1332,7 +1332,7 @@ static int stm32_ctrlep_alloc(FAR struct stm32_usbhost_s *priv, * ep - A memory location provided by the caller in which to receive the * allocated endpoint descriptor. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -3825,7 +3825,7 @@ static void stm32_txfe_enable(FAR struct stm32_usbhost_s *priv, int chidx) * hport - The location to return the hub port descriptor that detected the * connection related event. * - * Returned Values: + * Returned Value: * Zero (OK) is returned on success when a device in connected or * disconnected. This function will not return until either (1) a device is * connected or disconnect to/from any hub port or until (2) some failure @@ -3916,7 +3916,7 @@ static int stm32_wait(FAR struct usbhost_connection_s *conn, * hport - The descriptor of the hub port that has the newly connected * device. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4046,7 +4046,7 @@ static int stm32_enumerate(FAR struct usbhost_connection_s *conn, * maxpacketsize - The maximum number of bytes that can be sent to or * received from the endpoint in a single data packet * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4105,7 +4105,7 @@ static int stm32_ep0configure(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep * ep - A memory location provided by the caller in which to receive the * allocated endpoint descriptor. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4161,7 +4161,7 @@ static int stm32_epalloc(FAR struct usbhost_driver_s *drvr, * the class create() method. * ep - The endpoint to be freed. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4229,7 +4229,7 @@ static int stm32_epfree(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep) * maxlen - The address of a memory location provided by the caller in which to * return the maximum size of the allocated buffer memory. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4275,7 +4275,7 @@ static int stm32_alloc(FAR struct usbhost_driver_s *drvr, * the class create() method. * buffer - The address of the allocated buffer memory to be freed. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4311,7 +4311,7 @@ static int stm32_free(FAR struct usbhost_driver_s *drvr, FAR uint8_t *buffer) * return the allocated buffer memory address. * buflen - The size of the buffer required. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4355,7 +4355,7 @@ static int stm32_ioalloc(FAR struct usbhost_driver_s *drvr, * the class create() method. * buffer - The address of the allocated buffer memory to be freed. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4398,7 +4398,7 @@ static int stm32_iofree(FAR struct usbhost_driver_s *drvr, FAR uint8_t *buffer) * NOTE: On an IN transaction, req and buffer may refer to the same allocated * memory. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4601,7 +4601,7 @@ static int stm32_ctrlout(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0, * (IN endpoint). buffer must have been allocated using DRVR_ALLOC * buflen - The length of the data to be sent or received. * - * Returned Values: + * Returned Value: * On success, a non-negative value is returned that indicates the number * of bytes successfully transferred. On a failure, a negated errno value is * returned that indicates the nature of the failure: @@ -4673,7 +4673,7 @@ static ssize_t stm32_transfer(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep * arg - The arbitrary parameter that will be passed to the callback function * when the transfer completes. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4729,7 +4729,7 @@ static int stm32_asynch(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep, * ep - The IN or OUT endpoint descriptor for the device endpoint on which an * asynchronous transfer should be transferred. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure. * @@ -4818,7 +4818,7 @@ static int stm32_cancel(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep) * related event * connected - True: device connected; false: device disconnected * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure. * @@ -4870,7 +4870,7 @@ static int stm32_connect(FAR struct usbhost_driver_s *drvr, * hport - The port from which the device is being disconnected. Might be a port * on a hub. * - * Returned Values: + * Returned Value: * None * * Assumptions: diff --git a/arch/arm/src/stm32/stm32_pm.h b/arch/arm/src/stm32/stm32_pm.h index 7fc93ba688..8feee1f566 100644 --- a/arch/arm/src/stm32/stm32_pm.h +++ b/arch/arm/src/stm32/stm32_pm.h @@ -102,7 +102,7 @@ int stm32_pmstop(bool lpds); * Input Parameters: * None * - * Returned Value. + * Returned Value: * On success, this function will not return (STANDBY mode can only be * terminated with a reset event). Otherwise, STANDBY mode did not occur * and a negated errno value is returned to indicate the cause of the diff --git a/arch/arm/src/stm32/stm32_pminitialize.c b/arch/arm/src/stm32/stm32_pminitialize.c index e9b6d4780c..243bc53aa4 100644 --- a/arch/arm/src/stm32/stm32_pminitialize.c +++ b/arch/arm/src/stm32/stm32_pminitialize.c @@ -76,10 +76,10 @@ * *before* any other device drivers are initialized (since they may * attempt to register with the power management subsystem). * - * Input parameters: + * Input Parameters: * None. * - * Returned value: + * Returned Value: * None. * ****************************************************************************/ diff --git a/arch/arm/src/stm32/stm32_pmstandby.c b/arch/arm/src/stm32/stm32_pmstandby.c index 2b4de6a6f0..952e14317f 100644 --- a/arch/arm/src/stm32/stm32_pmstandby.c +++ b/arch/arm/src/stm32/stm32_pmstandby.c @@ -71,7 +71,7 @@ * Input Parameters: * None * - * Returned Value. + * Returned Value: * On success, this function will not return (STANDBY mode can only be * terminated with a reset event). Otherwise, STANDBY mode did not occur * and a negated errno value is returned to indicate the cause of the diff --git a/arch/arm/src/stm32/stm32_pwm.c b/arch/arm/src/stm32/stm32_pwm.c index 0e9db50059..7aadb98ae7 100644 --- a/arch/arm/src/stm32/stm32_pwm.c +++ b/arch/arm/src/stm32/stm32_pwm.c @@ -1095,7 +1095,7 @@ static void pwm_putreg(struct stm32_pwmtimer_s *priv, int offset, uint16_t value * Description: * Dump all timer registers. * - * Input parameters: + * Input Parameters: * priv - A reference to the PWM block status * * Returned Value: @@ -1182,7 +1182,7 @@ static void pwm_dumpregs(struct stm32_pwmtimer_s *priv, FAR const char *msg) * Description: * (Re-)initialize the timer resources and start the pulsed output * - * Input parameters: + * Input Parameters: * priv - A reference to the lower half PWM driver state structure * info - A reference to the characteristics of the pulsed output * @@ -1815,7 +1815,7 @@ static int pwm_timer(FAR struct stm32_pwmtimer_s *priv, * Description: * Try to change only channel duty. * - * Input parameters: + * Input Parameters: * priv - A reference to the lower half PWM driver state structure * channel - Channel to by updated * duty - New duty. @@ -1897,7 +1897,7 @@ static int pwm_update_duty(FAR struct stm32_pwmtimer_s *priv, uint8_t channel, * Description: * Handle timer interrupts. * - * Input parameters: + * Input Parameters: * priv - A reference to the lower half PWM driver state structure * * Returned Value: @@ -1980,7 +1980,7 @@ static int pwm_interrupt(struct stm32_pwmtimer_s *priv) * Description: * Handle timer 1 and 8 interrupts. * - * Input parameters: + * Input Parameters: * Standard NuttX interrupt inputs * * Returned Value: @@ -2008,7 +2008,7 @@ static int pwm_tim8interrupt(int irq, void *context, FAR void *arg) * Description: * Pick an optimal pulse count to program the RCR. * - * Input parameters: + * Input Parameters: * count - The total count remaining * * Returned Value: @@ -2055,7 +2055,7 @@ static uint8_t pwm_pulsecount(uint32_t count) * Description: * Enable or disable APB clock for the timer peripheral * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * on - Enable clock if 'on' is 'true' and disable if 'false' * @@ -2188,7 +2188,7 @@ static void pwm_set_apb_clock(FAR struct stm32_pwmtimer_s *priv, bool on) * should configure and initialize the device so that it is ready for use. * It should not, however, output pulses until the start method is called. * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * * Returned Value: @@ -2241,7 +2241,7 @@ static int pwm_setup(FAR struct pwm_lowerhalf_s *dev) * stop pulsed output, free any resources, disable the timer hardware, and * put the system into the lowest possible power usage state * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * * Returned Value: @@ -2303,7 +2303,7 @@ static int pwm_shutdown(FAR struct pwm_lowerhalf_s *dev) * Description: * (Re-)initialize the timer resources and start the pulsed output * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * info - A reference to the characteristics of the pulsed output * @@ -2390,7 +2390,7 @@ static int pwm_start(FAR struct pwm_lowerhalf_s *dev, * Description: * Stop the pulsed output and reset the timer resources * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * * Returned Value: @@ -2549,7 +2549,7 @@ static int pwm_stop(FAR struct pwm_lowerhalf_s *dev) * Description: * Lower-half logic may support platform-specific ioctl commands * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * cmd - The ioctl command * arg - The argument accompanying the ioctl command diff --git a/arch/arm/src/stm32/stm32_pwr.c b/arch/arm/src/stm32/stm32_pwr.c index 04cf7e9387..5a4b863b55 100644 --- a/arch/arm/src/stm32/stm32_pwr.c +++ b/arch/arm/src/stm32/stm32_pwr.c @@ -263,7 +263,7 @@ void stm32_pwr_enablebkp(bool writable) * wupin - Selects the WKUP pin to enable/disable * wupon - state to set it to * - * Returned Values: + * Returned Value: * Zero (OK) is returned on success; A negated errno value is returned on any * failure. The only cause of failure is if the selected MCU does not support * the requested wakeup pin. @@ -359,7 +359,7 @@ bool stm32_pwr_getwuf(void) * Input Parameters: * regon - state to set it to * - * Returned Values: + * Returned Value: * None * ************************************************************************************/ @@ -390,7 +390,7 @@ void stm32_pwr_enablebreg(bool regon) * Input Parameters: * vos - Properly aligned voltage scaling select bits for the PWR_CR register. * - * Returned Values: + * Returned Value: * None * * Assumptions: @@ -432,7 +432,7 @@ void stm32_pwr_setvos(uint16_t vos) * Input Parameters: * pls - PVD level * - * Returned Values: + * Returned Value: * None * * Assumptions: diff --git a/arch/arm/src/stm32/stm32_pwr.h b/arch/arm/src/stm32/stm32_pwr.h index b93b34108c..ee56a40d18 100644 --- a/arch/arm/src/stm32/stm32_pwr.h +++ b/arch/arm/src/stm32/stm32_pwr.h @@ -152,7 +152,7 @@ void stm32_pwr_enablebkp(bool writable); * wupin - Selects the WKUP pin to enable/disable * wupon - state to set it to * - * Returned Values: + * Returned Value: * Zero (OK) is returned on success; A negated errno value is returned on any * failure. The only cause of failure is if the selected MCU does not support * the requested wakeup pin. @@ -195,7 +195,7 @@ bool stm32_pwr_getwuf(void); * Input Parameters: * regon - state to set it to * - * Returned Values: + * Returned Value: * None * ************************************************************************************/ @@ -215,7 +215,7 @@ void stm32_pwr_enablebreg(bool regon); * Input Parameters: * vos - Properly aligned voltage scaling select bits for the PWR_CR register. * - * Returned Values: + * Returned Value: * None * * Assumptions: @@ -237,7 +237,7 @@ void stm32_pwr_setvos(uint16_t vos); * Input Parameters: * pls - PVD level * - * Returned Values: + * Returned Value: * None * * Assumptions: diff --git a/arch/arm/src/stm32/stm32_qencoder.c b/arch/arm/src/stm32/stm32_qencoder.c index 5bc98ad322..661e737f8a 100644 --- a/arch/arm/src/stm32/stm32_qencoder.c +++ b/arch/arm/src/stm32/stm32_qencoder.c @@ -574,7 +574,7 @@ static void stm32_putreg32(FAR struct stm32_lowerhalf_s *priv, int offset, uint3 * Description: * Dump all timer registers. * - * Input parameters: + * Input Parameters: * priv - A reference to the QENCODER block status * * Returned Value: @@ -1173,7 +1173,7 @@ static int stm32_ioctl(FAR struct qe_lowerhalf_s *lower, int cmd, unsigned long * devpath - The full path to the driver to register. E.g., "/dev/qe0" * tim - The timer number to used. 'tim' must be an element of {1,2,3,4,5,8} * - * Returned Values: + * Returned Value: * Zero on success; A negated errno value is returned on failure. * ************************************************************************************/ diff --git a/arch/arm/src/stm32/stm32_qencoder.h b/arch/arm/src/stm32/stm32_qencoder.h index bea28531b6..98c5b25f11 100644 --- a/arch/arm/src/stm32/stm32_qencoder.h +++ b/arch/arm/src/stm32/stm32_qencoder.h @@ -130,7 +130,7 @@ * devpath - The full path to the driver to register. E.g., "/dev/qe0" * tim - The timer number to used. 'tim' must be an element of {1,2,3,4,5,8} * - * Returned Values: + * Returned Value: * Zero on success; A negated errno value is returned on failure. * ************************************************************************************/ diff --git a/arch/arm/src/stm32/stm32_sdadc.c b/arch/arm/src/stm32/stm32_sdadc.c index e8236a05f9..eaaf486e9d 100644 --- a/arch/arm/src/stm32/stm32_sdadc.c +++ b/arch/arm/src/stm32/stm32_sdadc.c @@ -456,7 +456,7 @@ static void tim_modifyreg(FAR struct stm32_dev_s *priv, int offset, * Description: * Dump all timer registers. * - * Input parameters: + * Input Parameters: * priv - A reference to the SDADC block state * * Returned Value: diff --git a/arch/arm/src/stm32/stm32_sdio.c b/arch/arm/src/stm32/stm32_sdio.c index 1413334419..1d9f99e72b 100644 --- a/arch/arm/src/stm32/stm32_sdio.c +++ b/arch/arm/src/stm32/stm32_sdio.c @@ -2954,7 +2954,7 @@ static void stm32_default(void) * Input Parameters: * slotno - Not used. * - * Returned Values: + * Returned Value: * A reference to an SDIO interface structure. NULL is returned on failures. * ****************************************************************************/ @@ -3028,7 +3028,7 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno) * card has been removed from the slot. Only transitions * (inserted->removed or removed->inserted should be reported) * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -3075,7 +3075,7 @@ void sdio_mediachange(FAR struct sdio_dev_s *dev, bool cardinslot) * dev - An instance of the SDIO driver device state structure. * wrprotect - true is a card is writeprotected. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ diff --git a/arch/arm/src/stm32/stm32_sdio.h b/arch/arm/src/stm32/stm32_sdio.h index 04c65ba00f..4fc477a0e4 100644 --- a/arch/arm/src/stm32/stm32_sdio.h +++ b/arch/arm/src/stm32/stm32_sdio.h @@ -71,7 +71,7 @@ extern "C" * Input Parameters: * slotno - Not used. * - * Returned Values: + * Returned Value: * A reference to an SDIO interface structure. NULL is returned on failures. * ****************************************************************************/ @@ -93,7 +93,7 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno); * card has been removed from the slot. Only transitions * (inserted->removed or removed->inserted should be reported) * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -111,7 +111,7 @@ void sdio_mediachange(FAR struct sdio_dev_s *dev, bool cardinslot); * dev - An instance of the SDIO driver device state structure. * wrprotect - true is a card is writeprotected. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ diff --git a/arch/arm/src/stm32/stm32_serial.c b/arch/arm/src/stm32/stm32_serial.c index 74b70ffd06..a14404835b 100644 --- a/arch/arm/src/stm32/stm32_serial.c +++ b/arch/arm/src/stm32/stm32_serial.c @@ -1381,7 +1381,7 @@ static void up_set_format(struct uart_dev_s *dev) * Description: * Enable or disable APB clock for the USART peripheral * - * Input parameters: + * Input Parameters: * dev - A reference to the UART driver state structure * on - Enable clock if 'on' is 'true' and disable if 'false' * @@ -2274,7 +2274,7 @@ static bool up_rxavailable(struct uart_dev_s *dev) * Return true if UART activated RX flow control to block more incoming * data * - * Input parameters: + * Input Parameters: * dev - UART device instance * nbuffered - the number of characters currently buffered * (if CONFIG_SERIAL_IFLOWCONTROL_WATERMARKS is diff --git a/arch/arm/src/stm32/stm32_spi.c b/arch/arm/src/stm32/stm32_spi.c index 1be51d49c2..585a3e9231 100644 --- a/arch/arm/src/stm32/stm32_spi.c +++ b/arch/arm/src/stm32/stm32_spi.c @@ -1670,7 +1670,7 @@ static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *rxbuffer, size_t * Description: * Initialize the selected SPI bus in its default state (Master, 8-bit, mode 0, etc.) * - * Input Parameter: + * Input Parameters: * priv - private SPI device structure * * Returned Value: @@ -1775,7 +1775,7 @@ static void spi_bus_initialize(FAR struct stm32_spidev_s *priv) * Description: * Initialize the selected SPI bus * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple SPI interfaces) * * Returned Value: diff --git a/arch/arm/src/stm32/stm32_spi.h b/arch/arm/src/stm32/stm32_spi.h index ee99808c6a..bcc2f0e14b 100644 --- a/arch/arm/src/stm32/stm32_spi.h +++ b/arch/arm/src/stm32/stm32_spi.h @@ -78,7 +78,7 @@ struct spi_dev_s; * Description: * Initialize the selected SPI bus * - * Input Parameter: + * Input Parameters: * bus number (for hardware that has mutiple SPI interfaces) * * Returned Value: diff --git a/arch/arm/src/stm32/stm32_tim.h b/arch/arm/src/stm32/stm32_tim.h index bc6ef090c6..2e0828fafa 100644 --- a/arch/arm/src/stm32/stm32_tim.h +++ b/arch/arm/src/stm32/stm32_tim.h @@ -208,7 +208,7 @@ int stm32_tim_deinit(FAR struct stm32_tim_dev_s *dev); * devpath - The full path to the timer device. This should be of the form /dev/timer0 * timer - the timer number. * - * Returned Values: + * Returned Value: * Zero (OK) is returned on success; A negated errno value is returned * to indicate the nature of any failure. * diff --git a/arch/arm/src/stm32/stm32_tim_lowerhalf.c b/arch/arm/src/stm32/stm32_tim_lowerhalf.c index d8415ac040..d0a9619517 100644 --- a/arch/arm/src/stm32/stm32_tim_lowerhalf.c +++ b/arch/arm/src/stm32/stm32_tim_lowerhalf.c @@ -261,7 +261,7 @@ static struct stm32_lowerhalf_s g_tim14_lowerhalf = * * Input Parameters: * - * Returned Values: + * Returned Value: * ****************************************************************************/ @@ -297,7 +297,7 @@ static int stm32_timer_handler(int irq, void * context, void * arg) * lower - A pointer the publicly visible representation of the "lower-half" * driver state structure. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -335,7 +335,7 @@ static int stm32_start(FAR struct timer_lowerhalf_s *lower) * lower - A pointer the publicly visible representation of the "lower-half" * driver state structure. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -369,7 +369,7 @@ static int stm32_stop(struct timer_lowerhalf_s *lower) * driver state structure. * timeout - The new timeout value in microseconds. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -414,7 +414,7 @@ static int stm32_settimeout(FAR struct timer_lowerhalf_s *lower, uint32_t timeou * behavior is restored, * arg - Argument that will be provided in the callback * - * Returned Values: + * Returned Value: * The previous timer expiration function pointer or NULL is there was * no previous function pointer. * @@ -462,7 +462,7 @@ static void stm32_setcallback(FAR struct timer_lowerhalf_s *lower, * form /dev/timer0 * timer - the timer's number. * - * Returned Values: + * Returned Value: * Zero (OK) is returned on success; A negated errno value is returned * to indicate the nature of any failure. * diff --git a/arch/arm/src/stm32/stm32_wdg.h b/arch/arm/src/stm32/stm32_wdg.h index 64815bfe90..264734b9f5 100644 --- a/arch/arm/src/stm32/stm32_wdg.h +++ b/arch/arm/src/stm32/stm32_wdg.h @@ -79,7 +79,7 @@ extern "C" * /dev/watchdog0 * lsifreq - The calibrated LSI clock frequency * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -100,7 +100,7 @@ void stm32_iwdginitialize(FAR const char *devpath, uint32_t lsifreq); * devpath - The full path to the watchdog. This should be of the form * /dev/watchdog0 * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ diff --git a/arch/arm/src/stm32/stm32_wwdg.c b/arch/arm/src/stm32/stm32_wwdg.c index 79d34656da..ba2b994fa4 100644 --- a/arch/arm/src/stm32/stm32_wwdg.c +++ b/arch/arm/src/stm32/stm32_wwdg.c @@ -281,7 +281,7 @@ static void stm32_setwindow(FAR struct stm32_lowerhalf_s *priv, uint8_t window) * Input Parameters: * Usual interrupt handler arguments. * - * Returned Values: + * Returned Value: * Always returns OK. * ****************************************************************************/ @@ -329,7 +329,7 @@ static int stm32_interrupt(int irq, FAR void *context, FAR void *arg) * lower - A pointer the publicly visible representation of the "lower-half" * driver state structure. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -361,7 +361,7 @@ static int stm32_start(FAR struct watchdog_lowerhalf_s *lower) * lower - A pointer the publicly visible representation of the "lower-half" * driver state structure. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -395,7 +395,7 @@ static int stm32_stop(FAR struct watchdog_lowerhalf_s *lower) * lower - A pointer the publicly visible representation of the "lower-half" * driver state structure. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -426,7 +426,7 @@ static int stm32_keepalive(FAR struct watchdog_lowerhalf_s *lower) * driver state structure. * status - The location to return the watchdog status information. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -482,7 +482,7 @@ static int stm32_getstatus(FAR struct watchdog_lowerhalf_s *lower, * "lower-half" driver state structure. * timeout - The new timeout value in milliseconds. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -618,7 +618,7 @@ static int stm32_settimeout(FAR struct watchdog_lowerhalf_s *lower, * function pointer is NULL, then the reset-on-expiration * behavior is restored, * - * Returned Values: + * Returned Value: * The previous watchdog expiration function pointer or NULL is there was * no previous function pointer, i.e., if the previous behavior was * reset-on-expiration (NULL is also returned if an error occurs). @@ -686,7 +686,7 @@ static xcpt_t stm32_capture(FAR struct watchdog_lowerhalf_s *lower, * interpretation of this argument depends on the particular * command. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -742,7 +742,7 @@ static int stm32_ioctl(FAR struct watchdog_lowerhalf_s *lower, int cmd, * devpath - The full path to the watchdog. This should be of the form * /dev/watchdog0 * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ diff --git a/arch/arm/src/stm32/stm32f10xxx_dma.c b/arch/arm/src/stm32/stm32f10xxx_dma.c index c3c666e937..72da836ad1 100644 --- a/arch/arm/src/stm32/stm32f10xxx_dma.c +++ b/arch/arm/src/stm32/stm32f10xxx_dma.c @@ -395,7 +395,7 @@ void weak_function up_dmainitialize(void) * Hmm.. I suppose this interface could be extended to make a non-blocking * version. Feel free to do that if that is what you need. * - * Input parameter: + * Input Parameters: * chndx - Identifies the stream/channel resource. For the STM32 F1, this * is simply the channel number as provided by the DMACHAN_* definitions * in chip/stm32f10xxx_dma.h. @@ -626,7 +626,7 @@ size_t stm32_dmaresidual(DMA_HANDLE handle) * of the processor. Note that this only applies to memory addresses, it * will return false for any peripheral address. * - * Returned value: + * Returned Value: * True, if transfer is possible. * ****************************************************************************/ diff --git a/arch/arm/src/stm32/stm32f20xxx_dma.c b/arch/arm/src/stm32/stm32f20xxx_dma.c index 8c06819f7a..86b95f7f13 100644 --- a/arch/arm/src/stm32/stm32f20xxx_dma.c +++ b/arch/arm/src/stm32/stm32f20xxx_dma.c @@ -525,7 +525,7 @@ void weak_function up_dmainitialize(void) * Hmm.. I suppose this interface could be extended to make a non-blocking * version. Feel free to do that if that is what you need. * - * Input parameter: + * Input Parameters: * dmamap - Identifies the stream/channel resource. For the STM32 F2, this * is a bit-encoded value as provided by the DMAMAP_* definitions * in chip/stm32f20xxx_dma.h @@ -856,7 +856,7 @@ size_t stm32_dmaresidual(DMA_HANDLE handle) * of the processor. Note that this only applies to memory addresses, it * will return false for any peripheral address. * - * Returned value: + * Returned Value: * True, if transfer is possible. * ****************************************************************************/ diff --git a/arch/arm/src/stm32/stm32f33xxx_adc.c b/arch/arm/src/stm32/stm32f33xxx_adc.c index 4eb887e148..412c3453d7 100644 --- a/arch/arm/src/stm32/stm32f33xxx_adc.c +++ b/arch/arm/src/stm32/stm32f33xxx_adc.c @@ -804,7 +804,7 @@ static void tim_modifyreg(FAR struct stm32_dev_s *priv, int offset, * Description: * Dump all timer registers. * - * Input parameters: + * Input Parameters: * priv - A reference to the ADC block status * * Returned Value: diff --git a/arch/arm/src/stm32/stm32f33xxx_dma.c b/arch/arm/src/stm32/stm32f33xxx_dma.c index af091e2fec..1c0c626e60 100644 --- a/arch/arm/src/stm32/stm32f33xxx_dma.c +++ b/arch/arm/src/stm32/stm32f33xxx_dma.c @@ -343,7 +343,7 @@ void weak_function up_dmainitialize(void) * Hmm.. I suppose this interface could be extended to make a non-blocking * version. Feel free to do that if that is what you need. * - * Input parameter: + * Input Parameters: * chndx - Identifies the stream/channel resource. For the STM32 F1, this * is simply the channel number as provided by the DMACHAN_* definitions * in chip/stm32f10xxx_dma.h. @@ -574,7 +574,7 @@ size_t stm32_dmaresidual(DMA_HANDLE handle) * of the processor. Note that this only applies to memory addresses, it * will return false for any peripheral address. * - * Returned value: + * Returned Value: * True, if transfer is possible. * ****************************************************************************/ diff --git a/arch/arm/src/stm32/stm32f40xxx_dma.c b/arch/arm/src/stm32/stm32f40xxx_dma.c index 6dedd5a337..7f528f1a33 100644 --- a/arch/arm/src/stm32/stm32f40xxx_dma.c +++ b/arch/arm/src/stm32/stm32f40xxx_dma.c @@ -524,7 +524,7 @@ void weak_function up_dmainitialize(void) * Hmm.. I suppose this interface could be extended to make a non-blocking * version. Feel free to do that if that is what you need. * - * Input parameter: + * Input Parameters: * dmamap - Identifies the stream/channel resource. For the STM32 F4, this * is a bit-encoded value as provided by the DMAMAP_* definitions * in chip/stm32f40xxx_dma.h @@ -863,7 +863,7 @@ size_t stm32_dmaresidual(DMA_HANDLE handle) * of the processor. Note that this only applies to memory addresses, it * will return false for any peripheral address. * - * Returned value: + * Returned Value: * True, if transfer is possible. * ****************************************************************************/ diff --git a/arch/arm/src/stm32f0/stm32f0_gpio.c b/arch/arm/src/stm32f0/stm32f0_gpio.c index ffa77a43ec..d6ee49b6e9 100644 --- a/arch/arm/src/stm32f0/stm32f0_gpio.c +++ b/arch/arm/src/stm32f0/stm32f0_gpio.c @@ -115,7 +115,7 @@ void stm32f0_gpioinit(void) * function, it must be unconfigured with stm32f0_unconfiggpio() with * the same cfgset first before it can be set to non-alternative function. * - * Returns: + * Returned Value: * OK on success * A negated errono valu on invalid port, or when pin is locked as ALT * function. @@ -336,7 +336,7 @@ int stm32f0_configgpio(uint32_t cfgset) * operate in PWM mode could produce excessive on-board currents and trigger * over-current/alarm function. * - * Returns: + * Returned Value: * OK on success * A negated errno value on invalid port * diff --git a/arch/arm/src/stm32f0/stm32f0_gpio.h b/arch/arm/src/stm32f0/stm32f0_gpio.h index 4cbe0a40df..14c95cce3f 100644 --- a/arch/arm/src/stm32f0/stm32f0_gpio.h +++ b/arch/arm/src/stm32f0/stm32f0_gpio.h @@ -256,7 +256,7 @@ EXTERN const uint32_t g_gpiobase[STM32F0_NPORTS]; * function, it must be unconfigured with stm32f0_unconfiggpio() with * the same cfgset first before it can be set to non-alternative function. * - * Returns: + * Returned Value: * OK on success * ERROR on invalid port, or when pin is locked as ALT function. * @@ -277,7 +277,7 @@ int stm32f0_configgpio(uint32_t cfgset); * operate in PWM mode could produce excessive on-board currents and trigger * over-current/alarm function. * - * Returns: + * Returned Value: * OK on success * ERROR on invalid port * diff --git a/arch/arm/src/stm32f0/stm32f0_i2c.h b/arch/arm/src/stm32f0/stm32f0_i2c.h index 29bcbdccd1..dd127b788a 100644 --- a/arch/arm/src/stm32f0/stm32f0_i2c.h +++ b/arch/arm/src/stm32f0/stm32f0_i2c.h @@ -74,7 +74,7 @@ * instances of the interface, each of which may be set up with a * different frequency and slave address. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has multiple I2C interfaces) * * Returned Value: @@ -90,7 +90,7 @@ FAR struct i2c_master_s *stm32f0_i2cbus_initialize(int port); * Description: * De-initialize the selected I2C port, and power down the device. * - * Input Parameter: + * Input Parameters: * Device structure as returned by the stm32f0_i2cbus_initialize() * * Returned Value: diff --git a/arch/arm/src/stm32f0/stm32f0_serial.c b/arch/arm/src/stm32f0/stm32f0_serial.c index 91d6cc9828..3231ebdf6d 100644 --- a/arch/arm/src/stm32f0/stm32f0_serial.c +++ b/arch/arm/src/stm32f0/stm32f0_serial.c @@ -1033,7 +1033,7 @@ static void stm32f0serial_setformat(FAR struct uart_dev_s *dev) * Description: * Enable or disable APB clock for the USART peripheral * - * Input parameters: + * Input Parameters: * dev - A reference to the USART driver state structure * on - Enable clock if 'on' is 'true' and disable if 'false' * @@ -1907,7 +1907,7 @@ static bool stm32f0serial_rxavailable(FAR struct uart_dev_s *dev) * Return true if USART activated RX flow control to block more incoming * data * - * Input parameters: + * Input Parameters: * dev - USART device instance * nbuffered - the number of characters currently buffered * (if CONFIG_SERIAL_IFLOWCONTROL_WATERMARKS is diff --git a/arch/arm/src/stm32f7/stm32_adc.c b/arch/arm/src/stm32f7/stm32_adc.c index 0d226ab46a..587983c40a 100644 --- a/arch/arm/src/stm32f7/stm32_adc.c +++ b/arch/arm/src/stm32f7/stm32_adc.c @@ -568,7 +568,7 @@ static void tim_modifyreg(FAR struct stm32_dev_s *priv, int offset, * Description: * Dump all timer registers. * - * Input parameters: + * Input Parameters: * priv - A reference to the ADC block status * * Returned Value: diff --git a/arch/arm/src/stm32f7/stm32_dma.c b/arch/arm/src/stm32f7/stm32_dma.c index a5d185944d..7a083e3239 100644 --- a/arch/arm/src/stm32f7/stm32_dma.c +++ b/arch/arm/src/stm32f7/stm32_dma.c @@ -527,7 +527,7 @@ void weak_function up_dmainitialize(void) * Hmm.. I suppose this interface could be extended to make a non-blocking * version. Feel free to do that if that is what you need. * - * Input parameter: + * Input Parameters: * dmamap - Identifies the stream/channel resource. For the STM32 F7, this * is a bit-encoded value as provided by the DMAMAP_* definitions * in chip/stm32f7xxxxxxx_dma.h @@ -874,7 +874,7 @@ size_t stm32_dmaresidual(DMA_HANDLE handle) * ccr. * ccr - DMA stream configuration register * - * Returned value: + * Returned Value: * True, if transfer is possible. * ****************************************************************************/ diff --git a/arch/arm/src/stm32f7/stm32_dma.h b/arch/arm/src/stm32f7/stm32_dma.h index e0494d5381..567e233064 100644 --- a/arch/arm/src/stm32f7/stm32_dma.h +++ b/arch/arm/src/stm32f7/stm32_dma.h @@ -135,7 +135,7 @@ extern "C" * Hmm.. I suppose this interface could be extended to make a non-blocking * version. Feel free to do that if that is what you need. * - * Input parameter: + * Input Parameters: * chan - Identifies the stream/channel resource * For the STM32 F7, this is a bit encoded value as provided by the * the DMAMAP_* definitions in chip/stm32f7xxxxxxx_dma.h @@ -248,7 +248,7 @@ size_t stm32_dmaresidual(DMA_HANDLE handle); * ccr. * ccr - DMA stream configuration register * - * Returned value: + * Returned Value: * True, if transfer is possible. * ****************************************************************************/ diff --git a/arch/arm/src/stm32f7/stm32_dma2d.c b/arch/arm/src/stm32f7/stm32_dma2d.c index 8e6276484e..9e952d2ead 100644 --- a/arch/arm/src/stm32f7/stm32_dma2d.c +++ b/arch/arm/src/stm32f7/stm32_dma2d.c @@ -481,7 +481,7 @@ static int stm32_dma2dirq(int irq, void *context, FAR void *arg) * loading or dma transfer was completed. * Note! The caller must use this function within a critical section. * - * Return: + * Returned Value: * On success OK otherwise ERROR * ****************************************************************************/ @@ -526,7 +526,7 @@ static int stm32_dma2d_waitforirq(void) * Parameter: * pfcreg - PFC control Register * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -614,7 +614,7 @@ static int stm32_dma2d_start(void) * Parameter: * layer - Reference to the common layer state structure * - * Return: + * Returned Value: * memory address * ****************************************************************************/ @@ -640,7 +640,7 @@ static uint32_t stm32_dma2d_memaddress(FAR const struct stm32_dma2d_s *layer, * Parameter: * layer - Reference to the common layer state structure * - * Return: + * Returned Value: * line offset * ****************************************************************************/ @@ -664,7 +664,7 @@ static fb_coord_t stm32_dma2d_lineoffset(FAR const struct stm32_dma2d_s *layer, * layer - Reference to the common layer state structure * fmt - Reference to the location to store the pixel format * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -723,7 +723,7 @@ static int stm32_dma2d_pixelformat(uint8_t fmt, uint8_t *fmtmap) * layer - Reference to the common layer state structure * bpp - Reference to the location to store the pixel format * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -764,7 +764,7 @@ static int stm32_dma2d_bpp(uint8_t fmt, uint8_t *bpp) * Description: * Get a free layer id * - * Return: + * Returned Value: * The number of the free layer * -1 if no free layer is available * @@ -791,7 +791,7 @@ static int stm32_dma2d_lfreelid(void) * Description: * Allocate a new layer structure * - * Return: + * Returned Value: * A new allocated layer structure or NULL on error. * ****************************************************************************/ @@ -880,7 +880,7 @@ static void stm32_dma2d_llayerscleanup(void) * Description: * Helper to validate if the layer is valid * - * Return: + * Returned Value: * true if validates otherwise false * ****************************************************************************/ @@ -902,7 +902,7 @@ static inline bool stm32_dma2d_lvalidate(FAR const struct stm32_dma2d_s *layer) * ypos - The y position inside the whole layer * area - the area inside the whole layer * - * Return: + * Returned Value: * true if area is inside the whole layer otherwise false * ****************************************************************************/ @@ -1156,7 +1156,7 @@ static void stm32_dma2d_lpfc(FAR const struct stm32_dma2d_s *layer, * layer - Reference to the layer control structure * vinfo - Reference to the video info structure * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -1193,7 +1193,7 @@ static int stm32_dma2dgetvideoinfo(FAR struct dma2d_layer_s *layer, * planeno - Number of the plane * pinfo - Reference to the plane info structure * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -1229,7 +1229,7 @@ static int stm32_dma2dgetplaneinfo(FAR struct dma2d_layer_s *layer, int planeno, * layer - Reference to the layer structure * lid - Reference to store the layer id * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -1265,7 +1265,7 @@ static int stm32_dma2dgetlid(FAR struct dma2d_layer_s *layer, int *lid) * layer - Reference to the layer structure * cmap - color lookup table with up the 256 entries * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -1384,7 +1384,7 @@ static int stm32_dma2dsetclut(FAR struct dma2d_layer_s *layer, * cmap - Reference to valid color lookup table accept up the 256 color * entries * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -1476,7 +1476,7 @@ static int stm32_dma2dgetclut(FAR struct dma2d_layer_s *layer, * layer - Reference to the layer structure * alpha - Alpha value * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -1511,7 +1511,7 @@ static int stm32_dma2dsetalpha(FAR struct dma2d_layer_s *layer, uint8_t alpha) * layer - Reference to the layer structure * alpha - Reference to store the alpha value * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -1548,7 +1548,7 @@ static int stm32_dma2dgetalpha(FAR struct dma2d_layer_s *layer, uint8_t *alpha) * layer - Reference to the layer structure * mode - Blend mode (see DMA2D_BLEND_*) * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -1597,7 +1597,7 @@ static int stm32_dma2dsetblendmode(FAR struct dma2d_layer_s *layer, * layer - Reference to the layer structure * mode - Reference to store the blend mode * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -1637,7 +1637,7 @@ static int stm32_dma2dgetblendmode(FAR struct dma2d_layer_s *layer, * src - Valid reference to the source layer * srcarea - Valid reference to the selected area of the source layer * - * Return: + * Returned Value: * OK - On success * -EINVAL - If one of the parameter invalid or if the size of the selected * source area outside the visible area of the destination layer. @@ -1746,7 +1746,7 @@ static int stm32_dma2dblit(FAR struct dma2d_layer_s *dest, * back - Reference to the background layer * backarea - Reference to the selected area of the background layer * - * Return: + * Returned Value: * OK - On success * -EINVAL - If one of the parameter invalid or if the size of the selected * source area outside the visible area of the destination layer. @@ -1853,7 +1853,7 @@ static int stm32_dma2dblend(FAR struct dma2d_layer_s *dest, * color - Color to fill the selected area. Color must be formatted * according to the layer pixel format. * - * Return: + * Returned Value: * OK - On success * -EINVAL - If one of the parameter invalid or if the size of the selected * area outside the visible area of the layer. @@ -1929,7 +1929,7 @@ static int stm32_dma2dfillarea(FAR struct dma2d_layer_s *layer, * Parameter: * lid - Layer identifier * - * Return: + * Returned Value: * Reference to the dma2d layer control structure on success or Null if no * related exist. * @@ -1962,7 +1962,7 @@ FAR struct dma2d_layer_s *up_dma2dgetlayer(int lid) * height - Layer height * fmt - Pixel format of the layer * - * Return: + * Returned Value: * On success - A valid dma2d layer reference * On error - NULL * @@ -2082,7 +2082,7 @@ FAR struct dma2d_layer_s *up_dma2dcreatelayer(fb_coord_t width, * Parameter: * layer - Reference to the layer to remove * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -2124,7 +2124,7 @@ int up_dma2dremovelayer(FAR struct dma2d_layer_s *layer) * Description: * Initialize the dma2d controller * - * Return: + * Returned Value: * OK - On success * An error if initializing failed. * @@ -2240,7 +2240,7 @@ void up_dma2duninitialize(void) * layer - a valid reference to the low level ltdc layer structure * clut - a pointer to a valid memory region to hold 256 clut colors * - * Return: + * Returned Value: * On success - A valid dma2d layer reference * On error - NULL * diff --git a/arch/arm/src/stm32f7/stm32_dma2d.h b/arch/arm/src/stm32f7/stm32_dma2d.h index 26d9f0faa8..9ffc8289cd 100644 --- a/arch/arm/src/stm32f7/stm32_dma2d.h +++ b/arch/arm/src/stm32f7/stm32_dma2d.h @@ -74,7 +74,7 @@ struct dma2d_layer_s * layer - Reference to the layer control structure * vinfo - Reference to the video info structure * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL */ @@ -92,7 +92,7 @@ struct dma2d_layer_s * planeno - Number of the plane * pinfo - Reference to the plane info structure * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL */ @@ -109,7 +109,7 @@ struct dma2d_layer_s * layer - Reference to the layer structure * lid - Reference to store the layer id * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL */ @@ -127,7 +127,7 @@ struct dma2d_layer_s * layer - Reference to the layer structure * cmap - color lookup table with up the 256 entries * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL */ @@ -145,7 +145,7 @@ struct dma2d_layer_s * cmap - Reference to valid color lookup table accept up the 256 color * entries * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL */ @@ -167,7 +167,7 @@ struct dma2d_layer_s * layer - Reference to the layer structure * alpha - Alpha value * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL */ @@ -183,7 +183,7 @@ struct dma2d_layer_s * layer - Reference to the layer structure * alpha - Reference to store the alpha value * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL */ @@ -201,7 +201,7 @@ struct dma2d_layer_s * layer - Reference to the layer structure * mode - Blend mode (see DMA2D_BLEND_*) * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -230,7 +230,7 @@ struct dma2d_layer_s * layer - Reference to the layer structure * mode - Reference to store the blend mode * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL */ @@ -250,7 +250,7 @@ struct dma2d_layer_s * src - Reference to the source layer * srcarea - Reference to the selected area of the source layer * - * Return: + * Returned Value: * OK - On success * -EINVAL - If one of the parameter invalid or if the size of the * selected source area outside the visible area of the @@ -281,7 +281,7 @@ struct dma2d_layer_s * back - Reference to the background layer * backarea - Reference to the selected area of the background layer * - * Return: + * Returned Value: * OK - On success * -EINVAL - If one of the parameter invalid or if the size of the * selected source area outside the visible area of the @@ -308,7 +308,7 @@ struct dma2d_layer_s * color - Color to fill the selected area. Color must be formatted * according to the layer pixel format. * - * Return: + * Returned Value: * OK - On success * -EINVAL - If one of the parameter invalid or if the size of the * selected area outside the visible area of the layer. @@ -340,7 +340,7 @@ struct stm32_ltdc_s; /* Forward declaration */ * Parameter: * layer - a valid reference to the low level ltdc layer structure * - * Return: + * Returned Value: * On success - A valid dma2d layer reference * On error - NULL and errno is set to * -EINVAL if one of the parameter is invalid @@ -358,7 +358,7 @@ FAR struct dma2d_layer_s *stm32_dma2dinitltdc(FAR struct stm32_ltdc_s *layer); * Parameter: * lid - Layer identifier * - * Return: + * Returned Value: * Reference to the dma2d layer control structure on success or Null if no * related exist. * @@ -377,7 +377,7 @@ FAR struct dma2d_layer_s *up_dma2dgetlayer(int lid); * height - Layer height * fmt - Pixel format of the layer * - * Return: + * Returned Value: * On success - A valid dma2d layer reference * On error - NULL and errno is set to * -EINVAL if one of the parameter is invalid @@ -399,7 +399,7 @@ FAR struct dma2d_layer_s *up_dma2dcreatelayer(fb_coord_t width, * Parameter: * layer - Reference to the layer to remove * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -413,7 +413,7 @@ int up_dma2dremovelayer(FAR struct dma2d_layer_s *layer); * Description: * Initialize the dma2d controller * - * Return: + * Returned Value: * OK - On success * An error if initializing failed. * diff --git a/arch/arm/src/stm32f7/stm32_exti_alarm.c b/arch/arm/src/stm32f7/stm32_exti_alarm.c index 8fba01b53a..552241b490 100644 --- a/arch/arm/src/stm32f7/stm32_exti_alarm.c +++ b/arch/arm/src/stm32f7/stm32_exti_alarm.c @@ -116,7 +116,7 @@ static int stm32_exti_alarm_isr(int irq, void *context, FAR void *arg) * - func: when non-NULL, generate interrupt * - arg: Argument passed to the interrupt callback * - * Returns: + * Returned Value: * Zero (OK) on success; a negated errno value on failure indicating the * nature of the failure. * diff --git a/arch/arm/src/stm32f7/stm32_exti_pwr.c b/arch/arm/src/stm32f7/stm32_exti_pwr.c index 3c4f2d07a3..f521aaff24 100644 --- a/arch/arm/src/stm32f7/stm32_exti_pwr.c +++ b/arch/arm/src/stm32f7/stm32_exti_pwr.c @@ -122,7 +122,7 @@ static int stm32_exti_pvd_isr(int irq, void *context, void *arg) * - event: generate event when set * - func: when non-NULL, generate interrupt * - * Returns: + * Returned Value: * Zero (OK) returned on success; a negated errno value is returned on * failure. * diff --git a/arch/arm/src/stm32f7/stm32_exti_pwr.h b/arch/arm/src/stm32f7/stm32_exti_pwr.h index 67e22d05ff..90b0185d59 100644 --- a/arch/arm/src/stm32f7/stm32_exti_pwr.h +++ b/arch/arm/src/stm32f7/stm32_exti_pwr.h @@ -60,7 +60,7 @@ * - func: when non-NULL, generate interrupt * - arg: Argument passed to the interrupt callback * - * Returns: + * Returned Value: * Zero (OK) returned on success; a negated errno value is returned on * failure. * diff --git a/arch/arm/src/stm32f7/stm32_gpio.c b/arch/arm/src/stm32f7/stm32_gpio.c index e9b3f0d8a9..cf153dd482 100644 --- a/arch/arm/src/stm32f7/stm32_gpio.c +++ b/arch/arm/src/stm32f7/stm32_gpio.c @@ -136,7 +136,7 @@ void stm32_gpioinit(void) * function, it must be unconfigured with stm32_unconfiggpio() with * the same cfgset first before it can be set to non-alternative function. * - * Returns: + * Returned Value: * OK on success * A negated errono value on invalid port, or when pin is locked as ALT * function. @@ -359,7 +359,7 @@ int stm32_configgpio(uint32_t cfgset) * operate in PWM mode could produce excessive on-board currents and trigger * over-current/alarm function. * - * Returns: + * Returned Value: * OK on success * A negated errno value on invalid port * diff --git a/arch/arm/src/stm32f7/stm32_i2c.h b/arch/arm/src/stm32f7/stm32_i2c.h index c560817638..e2223f53c8 100644 --- a/arch/arm/src/stm32f7/stm32_i2c.h +++ b/arch/arm/src/stm32f7/stm32_i2c.h @@ -74,7 +74,7 @@ * instances of the interface, each of which may be set up with a * different frequency and slave address. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has multiple I2C interfaces) * * Returned Value: @@ -90,7 +90,7 @@ FAR struct i2c_master_s *stm32_i2cbus_initialize(int port); * Description: * De-initialize the selected I2C port, and power down the device. * - * Input Parameter: + * Input Parameters: * Device structure as returned by the stm32_i2cbus_initialize() * * Returned Value: diff --git a/arch/arm/src/stm32f7/stm32_ltdc.c b/arch/arm/src/stm32f7/stm32_ltdc.c index 3a992d928f..c84b766fa2 100644 --- a/arch/arm/src/stm32f7/stm32_ltdc.c +++ b/arch/arm/src/stm32f7/stm32_ltdc.c @@ -1168,7 +1168,7 @@ static int stm32_ltdcirq(int irq, void *context, FAR void *arg) * that a register reload was been completed. * Note! The caller must use this function within a critical section. * - * Return: + * Returned Value: * OK - On success otherwise ERROR * ****************************************************************************/ @@ -1467,7 +1467,7 @@ static inline uint8_t stm32_ltdc_lgetopac(FAR struct stm32_layer_s *layer) * Parameter: * layer - Reference to the layer control structure * - * Return: + * Returned Value: * true - layer valid * false - layer invalid * @@ -1497,7 +1497,7 @@ static inline bool stm32_ltdc_lvalidate(FAR const struct stm32_layer_s *layer) * srcxpos - Top left x position from where data visible in the active area * srcypos - Top left y position from where data visible in the active area * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -1968,7 +1968,7 @@ static void stm32_ltdc_lenable(FAR struct stm32_layer_s *layer) * layer - Reference to the layer control structure * color - The color to clear * - * Return: + * Returned Value: * OK - On success * -EINVAL - If one of the parameter invalid * @@ -2182,7 +2182,7 @@ static void stm32_ltdc_linit(int lid) * vtable - The framebuffer driver object * vinfo - the videoinfo object * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -2217,7 +2217,7 @@ static int stm32_getvideoinfo(struct fb_vtable_s *vtable, * vtable - The framebuffer driver object * pinfo - the planeinfo object * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -2252,7 +2252,7 @@ static int stm32_getplaneinfo(struct fb_vtable_s *vtable, int planeno, * vtable - The framebuffer driver object * cmap - the color table * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -2279,7 +2279,7 @@ static int stm32_getcmap(struct fb_vtable_s *vtable, * vtable - The framebuffer driver object * cmap - the color table * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -2306,7 +2306,7 @@ static int stm32_putcmap(struct fb_vtable_s *vtable, * layer - Reference to the layer control structure * vinfo - Reference to the video info structure * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -2340,7 +2340,7 @@ static int stm32_lgetvideoinfo(struct ltdc_layer_s *layer, * planeno - Number of the plane * pinfo - Reference to the plane info structure * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -2374,7 +2374,7 @@ static int stm32_lgetplaneinfo(struct ltdc_layer_s *layer, int planeno, * layer - Reference to the layer structure * cmap - color lookup table with up the 256 entries * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -2434,7 +2434,7 @@ static int stm32_setclut(struct ltdc_layer_s *layer, * cmap - Reference to valid color lookup table accept up the 256 color * entries * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -2533,7 +2533,7 @@ static int stm32_getclut(struct ltdc_layer_s *layer, * e.g. get the current active or inactive layer. * See LTDC_LAYER_* for possible values * - * Return: + * Returned Value: * OK - On success * Null if invalid flag * @@ -2610,7 +2610,7 @@ static int stm32_getlid(FAR struct ltdc_layer_s *layer, int *lid, * layer - Reference to the layer structure * argb - ARGB8888 color value * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -2646,7 +2646,7 @@ static int stm32_setcolor(FAR struct ltdc_layer_s *layer, uint32_t argb) * layer - Reference to the layer structure * argb - Reference to store the ARGB8888 color value * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -2683,7 +2683,7 @@ static int stm32_getcolor(FAR struct ltdc_layer_s *layer, uint32_t *argb) * layer - Reference to the layer structure * rgb - RGB888 color value * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -2719,7 +2719,7 @@ static int stm32_setcolorkey(FAR struct ltdc_layer_s *layer, uint32_t rgb) * layer - Reference to the layer structure * rgb - Reference to store the RGB888 color key * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -2760,7 +2760,7 @@ static int stm32_getcolorkey(FAR struct ltdc_layer_s *layer, uint32_t *rgb) * layer - Reference to the layer structure * alpha - Alpha value * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -2796,7 +2796,7 @@ static int stm32_setalpha(FAR struct ltdc_layer_s *layer, uint8_t alpha) * layer - Reference to the layer structure * alpha - Reference to store the alpha value * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -2833,7 +2833,7 @@ static int stm32_getalpha(FAR struct ltdc_layer_s *layer, uint8_t *alpha) * layer - Reference to the layer structure * mode - Blend mode (see LTDC_BLEND_*) * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -2965,7 +2965,7 @@ static int stm32_setblendmode(FAR struct ltdc_layer_s *layer, uint32_t mode) * layer - Reference to the layer structure * mode - Reference to store the blend mode * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL ****************************************************************************/ @@ -3004,7 +3004,7 @@ static int stm32_getblendmode(FAR struct ltdc_layer_s *layer, uint32_t *mode) * srcxpos - x position of the visible pixel of the whole layer * srcypos - y position of the visible pixel of the whole layer * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -3066,7 +3066,7 @@ static int stm32_setarea(FAR struct ltdc_layer_s *layer, * srcxpos - Reference to store the referenced x position of the whole layer * srcypos - Reference to store the reterenced y position of the whole layer * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -3106,7 +3106,7 @@ static int stm32_getarea(FAR struct ltdc_layer_s *layer, * layer - Reference to the layer structure * mode - operation mode * - * Return: + * Returned Value: * OK - On success * -EINVAL - If one of the parameter invalid * -ECANCELED - Operation cancelled, something goes wrong @@ -3269,7 +3269,7 @@ static int stm32_update(FAR struct ltdc_layer_s *layer, uint32_t mode) * src - Reference to the source layer * srcarea - Reference to the selected area of the source layer * - * Return: + * Returned Value: * OK - On success * -EINVAL - If one of the parameter invalid or if the size of the selected * source area outside the visible area of the destination layer. @@ -3320,7 +3320,7 @@ static int stm32_blit(FAR struct ltdc_layer_s *dest, * back - Reference to the background layer * backarea - Reference to the selected area of the background layer * - * Return: + * Returned Value: * OK - On success * -EINVAL - If one of the parameter invalid or if the size of the selected * source area outside the visible area of the destination layer. @@ -3370,7 +3370,7 @@ static int stm32_blend(FAR struct ltdc_layer_s *dest, * color - Color to fill the selected area. Color must be formatted * according to the layer pixel format. * - * Return: + * Returned Value: * OK - On success * -EINVAL - If one of the parameter invalid or if the size of the selected * area outside the visible area of the layer. @@ -3412,7 +3412,7 @@ static int stm32_fillarea(FAR struct ltdc_layer_s *layer, * Parameter: * lid - Layer identifier * - * Return: + * Returned Value: * Reference to the layer control structure on success or Null if lid * is invalid. * @@ -3452,7 +3452,7 @@ void stm32_ltdcreset(void) * Description: * Initialize the ltdc controller * - * Return: + * Returned Value: * OK * ****************************************************************************/ @@ -3541,10 +3541,10 @@ int stm32_ltdcinitialize(void) * Return a a reference to the framebuffer object for the specified video * plane. * - * Input parameters: + * Input Parameters: * None * - * Returned value: + * Returned Value: * Reference to the framebuffer object (NULL on failure) * ****************************************************************************/ diff --git a/arch/arm/src/stm32f7/stm32_ltdc.h b/arch/arm/src/stm32f7/stm32_ltdc.h index 8b3593e86d..c2226ec43e 100644 --- a/arch/arm/src/stm32f7/stm32_ltdc.h +++ b/arch/arm/src/stm32f7/stm32_ltdc.h @@ -125,7 +125,7 @@ struct ltdc_layer_s * layer - Reference to the layer control structure * vinfo - Reference to the video info structure * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL */ @@ -143,7 +143,7 @@ struct ltdc_layer_s * planeno - Number of the plane * pinfo - Reference to the plane info structure * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL */ @@ -163,7 +163,7 @@ struct ltdc_layer_s * e.g. get the current active or inactive layer. * See LTDC_LAYER_* for possible values * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL */ @@ -184,7 +184,7 @@ struct ltdc_layer_s * enable - Enable or disable clut support (if false cmap is ignored and can * be NULL) * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL */ @@ -202,7 +202,7 @@ struct ltdc_layer_s * cmap - Reference to valid color lookup table accept up the 256 color * entries * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL */ @@ -221,7 +221,7 @@ struct ltdc_layer_s * layer - Reference to the layer structure * argb - ARGB8888 color value * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL */ @@ -237,7 +237,7 @@ struct ltdc_layer_s * layer - Reference to the layer structure * argb - Reference to store the ARGB8888 color value * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL */ @@ -255,7 +255,7 @@ struct ltdc_layer_s * layer - Reference to the layer structure * rgb - RGB888 color key * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL */ @@ -271,7 +271,7 @@ struct ltdc_layer_s * layer - Reference to the layer structure * rgb - Reference to store the RGB888 color key * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL */ @@ -293,7 +293,7 @@ struct ltdc_layer_s * layer - Reference to the layer structure * alpha - Alpha value * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL */ @@ -309,7 +309,7 @@ struct ltdc_layer_s * layer - Reference to the layer structure * alpha - Reference to store the alpha value * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL */ @@ -327,7 +327,7 @@ struct ltdc_layer_s * layer - Reference to the layer structure * mode - Blend mode (see LTDC_BLEND_*) * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -365,7 +365,7 @@ struct ltdc_layer_s * layer - Reference to the layer structure * mode - Reference to store the blend mode * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL */ @@ -392,7 +392,7 @@ struct ltdc_layer_s * srcxpos - x position of the visible pixel of the whole layer * srcypos - y position of the visible pixel of the whole layer * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL * @@ -418,7 +418,7 @@ struct ltdc_layer_s * srcxpos - Reference to store the referenced x position of the whole layer * srcypos - Reference to store the reterenced y position of the whole layer * - * Return: + * Returned Value: * On success - OK * On error - -EINVAL */ @@ -437,7 +437,7 @@ struct ltdc_layer_s * layer - Reference to the layer structure * mode - operation mode (see LTDC_UPDATE_*) * - * Return: + * Returned Value: * OK - On success * -EINVAL - If one of the parameter invalid * -ECANCELED - Operation cancelled, something goes wrong @@ -481,7 +481,7 @@ struct ltdc_layer_s * src - Reference to the source layer * srcarea - Reference to the selected area of the source layer * - * Return: + * Returned Value: * OK - On success * -EINVAL - If one of the parameter invalid or if the size of the selected * source area outside the visible area of the destination layer. @@ -510,7 +510,7 @@ struct ltdc_layer_s * back - Reference to the background layer * backarea - Reference to the selected area of the background layer * - * Return: + * Returned Value: * OK - On success * -EINVAL - If one of the parameter invalid or if the size of the selected * source area outside the visible area of the destination layer. @@ -535,7 +535,7 @@ struct ltdc_layer_s * color - Color to fill the selected area. Color must be formatted * according to the layer pixel format. * - * Return: + * Returned Value: * OK - On success * -EINVAL - If one of the parameter invalid or if the size of the selected * area outside the visible area of the layer. @@ -609,7 +609,7 @@ struct stm32_ltdc_s * Description: * Initialize the ltdc controller * - * Return: + * Returned Value: * OK * ************************************************************************************/ @@ -627,7 +627,7 @@ void stm32_ltdcuninitialize(void); * Parameter: * lid - Layer identifier * - * Return: + * Returned Value: * Reference to the layer control structure on success or Null if parameter * invalid. * diff --git a/arch/arm/src/stm32f7/stm32_otghost.c b/arch/arm/src/stm32f7/stm32_otghost.c index 548a6f393d..1a9b8c1fea 100644 --- a/arch/arm/src/stm32f7/stm32_otghost.c +++ b/arch/arm/src/stm32f7/stm32_otghost.c @@ -1265,7 +1265,7 @@ static int stm32_ctrlchan_alloc(FAR struct stm32_usbhost_s *priv, * ep - A memory location provided by the caller in which to receive the * allocated endpoint descriptor. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value * is returned indicating the nature of the failure * @@ -1327,7 +1327,7 @@ static int stm32_ctrlep_alloc(FAR struct stm32_usbhost_s *priv, * ep - A memory location provided by the caller in which to receive the * allocated endpoint descriptor. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value * is returned indicating the nature of the failure * @@ -3819,7 +3819,7 @@ static void stm32_txfe_enable(FAR struct stm32_usbhost_s *priv, int chidx) * hport - The location to return the hub port descriptor that detected the * connection related event. * - * Returned Values: + * Returned Value: * Zero (OK) is returned on success when a device in connected or * disconnected. This function will not return until either (1) a device is * connected or disconnect to/from any hub port or until (2) some failure @@ -3910,7 +3910,7 @@ static int stm32_wait(FAR struct usbhost_connection_s *conn, * hport - The descriptor of the hub port that has the newly connected * device. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4040,7 +4040,7 @@ static int stm32_enumerate(FAR struct usbhost_connection_s *conn, * maxpacketsize - The maximum number of bytes that can be sent to or * received from the endpoint in a single data packet * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4099,7 +4099,7 @@ static int stm32_ep0configure(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep * ep - A memory location provided by the caller in which to receive the * allocated endpoint descriptor. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4155,7 +4155,7 @@ static int stm32_epalloc(FAR struct usbhost_driver_s *drvr, * the class create() method. * ep - The endpoint to be freed. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4223,7 +4223,7 @@ static int stm32_epfree(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep) * maxlen - The address of a memory location provided by the caller in which to * return the maximum size of the allocated buffer memory. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4269,7 +4269,7 @@ static int stm32_alloc(FAR struct usbhost_driver_s *drvr, * the class create() method. * buffer - The address of the allocated buffer memory to be freed. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4305,7 +4305,7 @@ static int stm32_free(FAR struct usbhost_driver_s *drvr, FAR uint8_t *buffer) * return the allocated buffer memory address. * buflen - The size of the buffer required. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4349,7 +4349,7 @@ static int stm32_ioalloc(FAR struct usbhost_driver_s *drvr, * the class create() method. * buffer - The address of the allocated buffer memory to be freed. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4392,7 +4392,7 @@ static int stm32_iofree(FAR struct usbhost_driver_s *drvr, FAR uint8_t *buffer) * NOTE: On an IN transaction, req and buffer may refer to the same allocated * memory. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4595,7 +4595,7 @@ static int stm32_ctrlout(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0, * (IN endpoint). buffer must have been allocated using DRVR_ALLOC * buflen - The length of the data to be sent or received. * - * Returned Values: + * Returned Value: * On success, a non-negative value is returned that indicates the number * of bytes successfully transferred. On a failure, a negated errno value is * returned that indicates the nature of the failure: @@ -4667,7 +4667,7 @@ static ssize_t stm32_transfer(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep * arg - The arbitrary parameter that will be passed to the callback function * when the transfer completes. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4723,7 +4723,7 @@ static int stm32_asynch(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep, * ep - The IN or OUT endpoint descriptor for the device endpoint on which an * asynchronous transfer should be transferred. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure. * @@ -4812,7 +4812,7 @@ static int stm32_cancel(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep) * related event * connected - True: device connected; false: device disconnected * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure. * @@ -4864,7 +4864,7 @@ static int stm32_connect(FAR struct usbhost_driver_s *drvr, * hport - The port from which the device is being disconnected. Might be a port * on a hub. * - * Returned Values: + * Returned Value: * None * * Assumptions: diff --git a/arch/arm/src/stm32f7/stm32_pwr.c b/arch/arm/src/stm32f7/stm32_pwr.c index c9d2d5dae4..573796a788 100644 --- a/arch/arm/src/stm32f7/stm32_pwr.c +++ b/arch/arm/src/stm32f7/stm32_pwr.c @@ -200,7 +200,7 @@ void stm32_pwr_enablebkp(bool writable) * Input Parameters: * regon - state to set it to * - * Returned Values: + * Returned Value: * None * ************************************************************************************/ @@ -229,7 +229,7 @@ void stm32_pwr_enablebreg(bool regon) * Input Parameters: * vos - Properly aligned voltage scaling select bits for the PWR_CR register. * - * Returned Values: + * Returned Value: * None * * Assumptions: @@ -264,7 +264,7 @@ void stm32_pwr_setvos(uint16_t vos) * Input Parameters: * pls - PVD level * - * Returned Values: + * Returned Value: * None * * Assumptions: diff --git a/arch/arm/src/stm32f7/stm32_pwr.h b/arch/arm/src/stm32f7/stm32_pwr.h index c80de12ae1..b332e424a0 100644 --- a/arch/arm/src/stm32f7/stm32_pwr.h +++ b/arch/arm/src/stm32f7/stm32_pwr.h @@ -119,7 +119,7 @@ void stm32_pwr_enablebkp(bool writable); * Input Parameters: * regon - state to set it to * - * Returned Values: + * Returned Value: * None * ************************************************************************************/ diff --git a/arch/arm/src/stm32f7/stm32_sdmmc.c b/arch/arm/src/stm32f7/stm32_sdmmc.c index c3530fc3fe..86481dd42f 100644 --- a/arch/arm/src/stm32f7/stm32_sdmmc.c +++ b/arch/arm/src/stm32f7/stm32_sdmmc.c @@ -3157,7 +3157,7 @@ static void stm32_default(struct stm32_dev_s *priv) * Input Parameters: * slotno - Not used. * - * Returned Values: + * Returned Value: * A reference to an SDIO interface structure. NULL is returned on failures. * ****************************************************************************/ @@ -3293,7 +3293,7 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno) * card has been removed from the slot. Only transitions * (inserted->removed or removed->inserted should be reported) * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -3340,7 +3340,7 @@ void sdio_mediachange(FAR struct sdio_dev_s *dev, bool cardinslot) * dev - An instance of the SDIO driver device state structure. * wrprotect - true is a card is writeprotected. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ diff --git a/arch/arm/src/stm32f7/stm32_sdmmc.h b/arch/arm/src/stm32f7/stm32_sdmmc.h index 8e722497c5..095af54805 100644 --- a/arch/arm/src/stm32f7/stm32_sdmmc.h +++ b/arch/arm/src/stm32f7/stm32_sdmmc.h @@ -72,7 +72,7 @@ extern "C" * Input Parameters: * slotno - Not used. * - * Returned Values: + * Returned Value: * A reference to an SDIO interface structure. NULL is returned on failures. * ****************************************************************************/ @@ -94,7 +94,7 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno); * card has been removed from the slot. Only transitions * (inserted->removed or removed->inserted should be reported) * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -112,7 +112,7 @@ void sdio_mediachange(FAR struct sdio_dev_s *dev, bool cardinslot); * dev - An instance of the SDIO driver device state structure. * wrprotect - true is a card is writeprotected. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ diff --git a/arch/arm/src/stm32f7/stm32_serial.c b/arch/arm/src/stm32f7/stm32_serial.c index 3f639e178e..ba6edead30 100644 --- a/arch/arm/src/stm32f7/stm32_serial.c +++ b/arch/arm/src/stm32f7/stm32_serial.c @@ -1369,7 +1369,7 @@ static void up_set_format(struct uart_dev_s *dev) * Description: * Enable or disable APB clock for the USART peripheral * - * Input parameters: + * Input Parameters: * dev - A reference to the UART driver state structure * on - Enable clock if 'on' is 'true' and disable if 'false' * @@ -2235,7 +2235,7 @@ static bool up_rxavailable(struct uart_dev_s *dev) * Return true if UART activated RX flow control to block more incoming * data * - * Input parameters: + * Input Parameters: * dev - UART device instance * nbuffered - the number of characters currently buffered * (if CONFIG_SERIAL_IFLOWCONTROL_WATERMARKS is diff --git a/arch/arm/src/stm32f7/stm32_spi.c b/arch/arm/src/stm32f7/stm32_spi.c index 9278ebaad7..cd1dc67989 100644 --- a/arch/arm/src/stm32f7/stm32_spi.c +++ b/arch/arm/src/stm32f7/stm32_spi.c @@ -1699,7 +1699,7 @@ static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *rxbuffer, size_t * Description: * Initialize the selected SPI bus in its default state (Master, 8-bit, mode 0, etc.) * - * Input Parameter: + * Input Parameters: * priv - private SPI device structure * * Returned Value: @@ -1788,7 +1788,7 @@ static void spi_bus_initialize(FAR struct stm32_spidev_s *priv) * Description: * Initialize the selected SPI bus * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple SPI interfaces) * * Returned Value: diff --git a/arch/arm/src/stm32f7/stm32_spi.h b/arch/arm/src/stm32f7/stm32_spi.h index 2775107356..f8c1ee9a1f 100644 --- a/arch/arm/src/stm32f7/stm32_spi.h +++ b/arch/arm/src/stm32f7/stm32_spi.h @@ -71,7 +71,7 @@ struct spi_dev_s; /* Forward reference */ * Description: * Initialize the selected SPI bus * - * Input Parameter: + * Input Parameters: * bus number (for hardware that has mutiple SPI interfaces) * * Returned Value: diff --git a/arch/arm/src/stm32f7/stm32_tim.h b/arch/arm/src/stm32f7/stm32_tim.h index 5f3bf82c10..06d7fe8e84 100644 --- a/arch/arm/src/stm32f7/stm32_tim.h +++ b/arch/arm/src/stm32f7/stm32_tim.h @@ -196,7 +196,7 @@ int stm32_tim_deinit(FAR struct stm32_tim_dev_s *dev); * devpath - The full path to the timer device. This should be of the form /dev/timer0 * timer - the timer number. * - * Returned Values: + * Returned Value: * Zero (OK) is returned on success; A negated errno value is returned * to indicate the nature of any failure. * diff --git a/arch/arm/src/stm32l4/stm32l4_adc.c b/arch/arm/src/stm32l4/stm32l4_adc.c index 56a9ae81d7..2576ec182e 100644 --- a/arch/arm/src/stm32l4/stm32l4_adc.c +++ b/arch/arm/src/stm32l4/stm32l4_adc.c @@ -592,7 +592,7 @@ static void tim_modifyreg(FAR struct stm32_dev_s *priv, int offset, * Description: * Dump all timer registers. * - * Input parameters: + * Input Parameters: * priv - A reference to the ADC block status * * Returned Value: diff --git a/arch/arm/src/stm32l4/stm32l4_can.c b/arch/arm/src/stm32l4/stm32l4_can.c index 7667481c6c..2bc5dcd2e6 100644 --- a/arch/arm/src/stm32l4/stm32l4_can.c +++ b/arch/arm/src/stm32l4/stm32l4_can.c @@ -1627,7 +1627,7 @@ static int stm32l4can_txinterrupt(int irq, FAR void *context, FAR void *arg) * Where: * Tpclk1 is the period of the APB1 clock (PCLK1). * - * Input Parameter: + * Input Parameters: * priv - A reference to the CAN block status * * Returned Value: @@ -1726,7 +1726,7 @@ static int stm32l4can_bittiming(FAR struct stm32l4_can_s *priv) * peripheral, no registers are changed. The initialization mode is * required to change the baud rate. * - * Input Parameter: + * Input Parameters: * priv - A pointer to the private data structure for this CAN block * * Returned Value: @@ -1777,7 +1777,7 @@ static int stm32l4can_enterinitmode(FAR struct stm32l4_can_s *priv) * Description: * Put the CAN cell out of the Initialization mode (to Normal mode) * - * Input Parameter: + * Input Parameters: * priv - A pointer to the private data structure for this CAN block * * Returned Value: @@ -1827,7 +1827,7 @@ static int stm32l4can_exitinitmode(FAR struct stm32l4_can_s *priv) * Description: * CAN cell initialization * - * Input Parameter: + * Input Parameters: * priv - A pointer to the private data structure for this CAN block * * Returned Value: @@ -1905,7 +1905,7 @@ static int stm32l4can_cellinit(FAR struct stm32l4_can_s *priv) * are set to zero thus supressing all filtering because anything masked * with zero matches zero. * - * Input Parameter: + * Input Parameters: * priv - A pointer to the private data structure for this CAN block * * Returned Value: @@ -1981,7 +1981,7 @@ static int stm32l4can_filterinit(FAR struct stm32l4_can_s *priv) * Description: * Add a filter for extended CAN IDs * - * Input Parameter: + * Input Parameters: * priv - A pointer to the private data structure for this CAN block * arg - A pointer to a structure describing the filter * @@ -2006,7 +2006,7 @@ static int stm32l4can_addextfilter(FAR struct stm32l4_can_s *priv, * Description: * Remove a filter for extended CAN IDs * - * Input Parameter: + * Input Parameters: * priv - A pointer to the private data structure for this CAN block * arg - The filter index previously returned by the * CANIOC_ADD_EXTFILTER command @@ -2031,7 +2031,7 @@ static int stm32l4can_delextfilter(FAR struct stm32l4_can_s *priv, int arg) * Description: * Add a filter for standard CAN IDs * - * Input Parameter: + * Input Parameters: * priv - A pointer to the private data structure for this CAN block * arg - A pointer to a structure describing the filter * @@ -2054,7 +2054,7 @@ static int stm32l4can_addstdfilter(FAR struct stm32l4_can_s *priv, * Description: * Remove a filter for standard CAN IDs * - * Input Parameter: + * Input Parameters: * priv - A pointer to the private data structure for this CAN block * arg - The filter index previously returned by the * CANIOC_ADD_STDFILTER command @@ -2081,7 +2081,7 @@ static int stm32l4can_delstdfilter(FAR struct stm32l4_can_s *priv, int arg) * Description: * Initialize the selected CAN port * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple CAN interfaces) * * Returned Value: diff --git a/arch/arm/src/stm32l4/stm32l4_can.h b/arch/arm/src/stm32l4/stm32l4_can.h index ded35c173b..c7ff34733d 100644 --- a/arch/arm/src/stm32l4/stm32l4_can.h +++ b/arch/arm/src/stm32l4/stm32l4_can.h @@ -122,7 +122,7 @@ extern "C" * Description: * Initialize the selected CAN port * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple CAN interfaces) * * Returned Value: diff --git a/arch/arm/src/stm32l4/stm32l4_comp.c b/arch/arm/src/stm32l4/stm32l4_comp.c index 8e2f4ff908..0c954c7c8b 100644 --- a/arch/arm/src/stm32l4/stm32l4_comp.c +++ b/arch/arm/src/stm32l4/stm32l4_comp.c @@ -342,7 +342,7 @@ static int stm32l4_exti_comp_isr(int irq, void *context, FAR void *arg) * Parameters: * cfg - configuration * - * Returns: + * Returned Value: * 0 on success, a negated errno value on failure * ****************************************************************************/ diff --git a/arch/arm/src/stm32l4/stm32l4_dfsdm.c b/arch/arm/src/stm32l4/stm32l4_dfsdm.c index 89a57ea86e..4e54b77c51 100644 --- a/arch/arm/src/stm32l4/stm32l4_dfsdm.c +++ b/arch/arm/src/stm32l4/stm32l4_dfsdm.c @@ -545,7 +545,7 @@ static void tim_modifyreg(FAR struct stm32_dev_s *priv, int offset, * Description: * Dump all timer registers. * - * Input parameters: + * Input Parameters: * priv - A reference to the DFSDM block status * * Returned Value: diff --git a/arch/arm/src/stm32l4/stm32l4_dma.h b/arch/arm/src/stm32l4/stm32l4_dma.h index 5eb679be70..c312465267 100644 --- a/arch/arm/src/stm32l4/stm32l4_dma.h +++ b/arch/arm/src/stm32l4/stm32l4_dma.h @@ -145,7 +145,7 @@ extern "C" * Hmm.. I suppose this interface could be extended to make a non-blocking * version. Feel free to do that if that is what you need. * - * Input parameter: + * Input Parameters: * chan - Identifies the stream/channel resource * This is a bit encoded value as provided by the DMACHAN_* definitions * in chip/stm32l4x6xx_dma.h @@ -249,7 +249,7 @@ size_t stm32l4_dmaresidual(DMA_HANDLE handle); * only applies to memory addresses, it will return false for any peripheral * address. * - * Returned value: + * Returned Value: * True, if transfer is possible. * ****************************************************************************/ diff --git a/arch/arm/src/stm32l4/stm32l4_exti.h b/arch/arm/src/stm32l4/stm32l4_exti.h index 14d2e7100a..098ac6e720 100644 --- a/arch/arm/src/stm32l4/stm32l4_exti.h +++ b/arch/arm/src/stm32l4/stm32l4_exti.h @@ -101,7 +101,7 @@ int stm32l4_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge, * - func: when non-NULL, generate interrupt * - arg: Argument passed to the interrupt callback * - * Returns: + * Returned Value: * Zero (OK) on success; a negated errno value on failure indicating the * nature of the failure. * @@ -124,7 +124,7 @@ int stm32l4_exti_alarm(bool risingedge, bool fallingedge, bool event, * - func: when non-NULL, generate interrupt * - arg: Argument passed to the interrupt callback * - * Returns: + * Returned Value: * Zero (OK) on success; a negated errno value on failure indicating the * nature of the failure. * @@ -148,7 +148,7 @@ int stm32l4_exti_wakeup(bool risingedge, bool fallingedge, bool event, * - func: when non-NULL, generate interrupt * - arg: Argument passed to the interrupt callback * - * Returns: + * Returned Value: * Zero (OK) returned on success; a negated errno value is returned on * failure. * diff --git a/arch/arm/src/stm32l4/stm32l4_exti_alarm.c b/arch/arm/src/stm32l4/stm32l4_exti_alarm.c index 2a0b3fbb0e..e0016e0637 100644 --- a/arch/arm/src/stm32l4/stm32l4_exti_alarm.c +++ b/arch/arm/src/stm32l4/stm32l4_exti_alarm.c @@ -108,7 +108,7 @@ static int stm32l4_exti_alarm_isr(int irq, void *context, FAR void *arg) * - event: generate event when set * - func: when non-NULL, generate interrupt * - * Returns: + * Returned Value: * Zero (OK) on success; a negated errno value on failure indicating the * nature of the failure. * diff --git a/arch/arm/src/stm32l4/stm32l4_exti_comp.c b/arch/arm/src/stm32l4/stm32l4_exti_comp.c index 147eb3f4b4..44d029e0b3 100644 --- a/arch/arm/src/stm32l4/stm32l4_exti_comp.c +++ b/arch/arm/src/stm32l4/stm32l4_exti_comp.c @@ -129,7 +129,7 @@ static int stm32l4_exti_comp_isr(int irq, void *context, FAR void *arg) * - func: when non-NULL, generate interrupt * - arg: Argument passed to the interrupt callback * - * Returns: + * Returned Value: * Zero (OK) returned on success; a negated errno value is returned on * failure. * diff --git a/arch/arm/src/stm32l4/stm32l4_exti_pwr.c b/arch/arm/src/stm32l4/stm32l4_exti_pwr.c index ab19f6f3cb..7d5df67098 100644 --- a/arch/arm/src/stm32l4/stm32l4_exti_pwr.c +++ b/arch/arm/src/stm32l4/stm32l4_exti_pwr.c @@ -113,7 +113,7 @@ static int stm32l4_exti_pvd_isr(int irq, void *context, FAR void *arg) * - event: generate event when set * - func: when non-NULL, generate interrupt * - * Returns: + * Returned Value: * Zero (OK) returned on success; a negated errno value is returned on * failure. * diff --git a/arch/arm/src/stm32l4/stm32l4_exti_pwr.h b/arch/arm/src/stm32l4/stm32l4_exti_pwr.h index 27e584779b..c6e10a0fa7 100644 --- a/arch/arm/src/stm32l4/stm32l4_exti_pwr.h +++ b/arch/arm/src/stm32l4/stm32l4_exti_pwr.h @@ -59,7 +59,7 @@ * - func: when non-NULL, generate interrupt * - arg: Argument passed to the interrupt callback * - * Returns: + * Returned Value: * Zero (OK) returned on success; a negated errno value is returned on * failure. * diff --git a/arch/arm/src/stm32l4/stm32l4_exti_wakeup.c b/arch/arm/src/stm32l4/stm32l4_exti_wakeup.c index 195cf2c1ac..ddac94add3 100644 --- a/arch/arm/src/stm32l4/stm32l4_exti_wakeup.c +++ b/arch/arm/src/stm32l4/stm32l4_exti_wakeup.c @@ -107,7 +107,7 @@ static int stm32l4_exti_wakeup_isr(int irq, void *context, FAR void *arg) * - event: generate event when set * - func: when non-NULL, generate interrupt * - * Returns: + * Returned Value: * Zero (OK) on success; a negated errno value on failure indicating the * nature of the failure. * diff --git a/arch/arm/src/stm32l4/stm32l4_gpio.c b/arch/arm/src/stm32l4/stm32l4_gpio.c index f46f341662..a33b88c08f 100644 --- a/arch/arm/src/stm32l4/stm32l4_gpio.c +++ b/arch/arm/src/stm32l4/stm32l4_gpio.c @@ -129,7 +129,7 @@ void stm32l4_gpioinit(void) * function, it must be unconfigured with stm32l4_unconfiggpio() with * the same cfgset first before it can be set to non-alternative function. * - * Returns: + * Returned Value: * OK on success * A negated errono valu on invalid port, or when pin is locked as ALT * function. @@ -351,7 +351,7 @@ int stm32l4_configgpio(uint32_t cfgset) * operate in PWM mode could produce excessive on-board currents and trigger * over-current/alarm function. * - * Returns: + * Returned Value: * OK on success * A negated errno value on invalid port * diff --git a/arch/arm/src/stm32l4/stm32l4_gpio.h b/arch/arm/src/stm32l4/stm32l4_gpio.h index 3c7b615c4e..56fb77a6bb 100644 --- a/arch/arm/src/stm32l4/stm32l4_gpio.h +++ b/arch/arm/src/stm32l4/stm32l4_gpio.h @@ -273,7 +273,7 @@ EXTERN const uint32_t g_gpiobase[STM32L4_NPORTS]; * function, it must be unconfigured with stm32l4_unconfiggpio() with * the same cfgset first before it can be set to non-alternative function. * - * Returns: + * Returned Value: * OK on success * ERROR on invalid port, or when pin is locked as ALT function. * @@ -294,7 +294,7 @@ int stm32l4_configgpio(uint32_t cfgset); * operate in PWM mode could produce excessive on-board currents and trigger * over-current/alarm function. * - * Returns: + * Returned Value: * OK on success * ERROR on invalid port * diff --git a/arch/arm/src/stm32l4/stm32l4_i2c.h b/arch/arm/src/stm32l4/stm32l4_i2c.h index 267ee1d664..3a38cc14bd 100644 --- a/arch/arm/src/stm32l4/stm32l4_i2c.h +++ b/arch/arm/src/stm32l4/stm32l4_i2c.h @@ -74,7 +74,7 @@ * instances of the interface, each of which may be set up with a * different frequency and slave address. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has multiple I2C interfaces) * * Returned Value: @@ -90,7 +90,7 @@ FAR struct i2c_master_s *stm32l4_i2cbus_initialize(int port); * Description: * De-initialize the selected I2C port, and power down the device. * - * Input Parameter: + * Input Parameters: * Device structure as returned by the stm32l4_i2cbus_initialize() * * Returned Value: diff --git a/arch/arm/src/stm32l4/stm32l4_iwdg.c b/arch/arm/src/stm32l4/stm32l4_iwdg.c index 9977e4d727..bf0b1392bb 100644 --- a/arch/arm/src/stm32l4/stm32l4_iwdg.c +++ b/arch/arm/src/stm32l4/stm32l4_iwdg.c @@ -312,7 +312,7 @@ static inline void stm32l4_setprescaler(FAR struct stm32l4_lowerhalf_s *priv) * lower - A pointer the publicly visible representation of the "lower-half" * driver state structure. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -360,7 +360,7 @@ static int stm32l4_start(FAR struct watchdog_lowerhalf_s *lower) * lower - A pointer the publicly visible representation of the "lower-half" * driver state structure. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -385,7 +385,7 @@ static int stm32l4_stop(FAR struct watchdog_lowerhalf_s *lower) * lower - A pointer the publicly visible representation of the "lower-half" * driver state structure. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -418,7 +418,7 @@ static int stm32l4_keepalive(FAR struct watchdog_lowerhalf_s *lower) * driver state structure. * status - The location to return the watchdog status information. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -477,7 +477,7 @@ static int stm32l4_getstatus(FAR struct watchdog_lowerhalf_s *lower, * driver state structure. * timeout - The new timeout value in milliseconds. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -602,7 +602,7 @@ static int stm32l4_settimeout(FAR struct watchdog_lowerhalf_s *lower, * /dev/watchdog0 * lsifreq - The calibrated LSI clock frequency * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ diff --git a/arch/arm/src/stm32l4/stm32l4_otgfshost.c b/arch/arm/src/stm32l4/stm32l4_otgfshost.c index b7e952d231..e676d9504f 100644 --- a/arch/arm/src/stm32l4/stm32l4_otgfshost.c +++ b/arch/arm/src/stm32l4/stm32l4_otgfshost.c @@ -1267,7 +1267,7 @@ static int stm32l4_ctrlchan_alloc(FAR struct stm32l4_usbhost_s *priv, * ep - A memory location provided by the caller in which to receive the * allocated endpoint descriptor. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -1329,7 +1329,7 @@ static int stm32l4_ctrlep_alloc(FAR struct stm32l4_usbhost_s *priv, * ep - A memory location provided by the caller in which to receive the * allocated endpoint descriptor. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -3825,7 +3825,7 @@ static void stm32l4_txfe_enable(FAR struct stm32l4_usbhost_s *priv, int chidx) * hport - The location to return the hub port descriptor that detected the * connection related event. * - * Returned Values: + * Returned Value: * Zero (OK) is returned on success when a device in connected or * disconnected. This function will not return until either (1) a device is * connected or disconnect to/from any hub port or until (2) some failure @@ -3916,7 +3916,7 @@ static int stm32l4_wait(FAR struct usbhost_connection_s *conn, * hport - The descriptor of the hub port that has the newly connected * device. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4046,7 +4046,7 @@ static int stm32l4_enumerate(FAR struct usbhost_connection_s *conn, * maxpacketsize - The maximum number of bytes that can be sent to or * received from the endpoint in a single data packet * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4105,7 +4105,7 @@ static int stm32l4_ep0configure(FAR struct usbhost_driver_s *drvr, * ep - A memory location provided by the caller in which to receive the * allocated endpoint descriptor. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4161,7 +4161,7 @@ static int stm32l4_epalloc(FAR struct usbhost_driver_s *drvr, * the class create() method. * ep - The endpoint to be freed. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4229,7 +4229,7 @@ static int stm32l4_epfree(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep) * maxlen - The address of a memory location provided by the caller in which to * return the maximum size of the allocated buffer memory. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4275,7 +4275,7 @@ static int stm32l4_alloc(FAR struct usbhost_driver_s *drvr, * the class create() method. * buffer - The address of the allocated buffer memory to be freed. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4311,7 +4311,7 @@ static int stm32l4_free(FAR struct usbhost_driver_s *drvr, FAR uint8_t *buffer) * return the allocated buffer memory address. * buflen - The size of the buffer required. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4355,7 +4355,7 @@ static int stm32l4_ioalloc(FAR struct usbhost_driver_s *drvr, * the class create() method. * buffer - The address of the allocated buffer memory to be freed. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4398,7 +4398,7 @@ static int stm32l4_iofree(FAR struct usbhost_driver_s *drvr, FAR uint8_t *buffer * NOTE: On an IN transaction, req and buffer may refer to the same allocated * memory. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4601,7 +4601,7 @@ static int stm32l4_ctrlout(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0, * (IN endpoint). buffer must have been allocated using DRVR_ALLOC * buflen - The length of the data to be sent or received. * - * Returned Values: + * Returned Value: * On success, a non-negative value is returned that indicates the number * of bytes successfully transferred. On a failure, a negated errno value is * returned that indicates the nature of the failure: @@ -4673,7 +4673,7 @@ static ssize_t stm32l4_transfer(FAR struct usbhost_driver_s *drvr, usbhost_ep_t * arg - The arbitrary parameter that will be passed to the callback function * when the transfer completes. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -4729,7 +4729,7 @@ static int stm32l4_asynch(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep, * ep - The IN or OUT endpoint descriptor for the device endpoint on which an * asynchronous transfer should be transferred. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure. * @@ -4818,7 +4818,7 @@ static int stm32l4_cancel(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep) * related event * connected - True: device connected; false: device disconnected * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure. * @@ -4870,7 +4870,7 @@ static int stm32l4_connect(FAR struct usbhost_driver_s *drvr, * hport - The port from which the device is being disconnected. Might be a port * on a hub. * - * Returned Values: + * Returned Value: * None * * Assumptions: diff --git a/arch/arm/src/stm32l4/stm32l4_pm.h b/arch/arm/src/stm32l4/stm32l4_pm.h index fd94299389..530be06fcb 100644 --- a/arch/arm/src/stm32l4/stm32l4_pm.h +++ b/arch/arm/src/stm32l4/stm32l4_pm.h @@ -108,7 +108,7 @@ int stm32l4_pmstop2(void); * Input Parameters: * None * - * Returned Value. + * Returned Value: * On success, this function will not return (STANDBY mode can only be * terminated with a reset event). Otherwise, STANDBY mode did not occur * and a negated errno value is returned to indicate the cause of the diff --git a/arch/arm/src/stm32l4/stm32l4_pminitialize.c b/arch/arm/src/stm32l4/stm32l4_pminitialize.c index 05988f21bf..89a8547a58 100644 --- a/arch/arm/src/stm32l4/stm32l4_pminitialize.c +++ b/arch/arm/src/stm32l4/stm32l4_pminitialize.c @@ -60,10 +60,10 @@ * *before* any other device drivers are initialized (since they may * attempt to register with the power management subsystem). * - * Input parameters: + * Input Parameters: * None. * - * Returned value: + * Returned Value: * None. * ****************************************************************************/ diff --git a/arch/arm/src/stm32l4/stm32l4_pmstandby.c b/arch/arm/src/stm32l4/stm32l4_pmstandby.c index c8730c14f9..331d8446f3 100644 --- a/arch/arm/src/stm32l4/stm32l4_pmstandby.c +++ b/arch/arm/src/stm32l4/stm32l4_pmstandby.c @@ -60,7 +60,7 @@ * Input Parameters: * None * - * Returned Value. + * Returned Value: * On success, this function will not return (STANDBY mode can only be * terminated with a reset event). Otherwise, STANDBY mode did not occur * and a negated errno value is returned to indicate the cause of the diff --git a/arch/arm/src/stm32l4/stm32l4_pwm.c b/arch/arm/src/stm32l4/stm32l4_pwm.c index 10531d20a8..0363944584 100644 --- a/arch/arm/src/stm32l4/stm32l4_pwm.c +++ b/arch/arm/src/stm32l4/stm32l4_pwm.c @@ -676,7 +676,7 @@ static void stm32l4pwm_putreg(struct stm32l4_pwmtimer_s *priv, int offset, * Description: * Dump all timer registers. * - * Input parameters: + * Input Parameters: * priv - A reference to the PWM block status * * Returned Value: @@ -734,7 +734,7 @@ static void stm32l4pwm_dumpregs(struct stm32l4_pwmtimer_s *priv, * Description: * (Re-)initialize the timer resources and start the pulsed output * - * Input parameters: + * Input Parameters: * priv - A reference to the lower half PWM driver state structure * info - A reference to the characteristics of the pulsed output * @@ -1360,7 +1360,7 @@ static int stm32l4pwm_timer(FAR struct stm32l4_pwmtimer_s *priv, * Description: * Try to change only channel duty. * - * Input parameters: + * Input Parameters: * priv - A reference to the lower half PWM driver state structure * channel - Channel to by updated * duty - New duty. @@ -1442,7 +1442,7 @@ static int stm32l4pwm_update_duty(FAR struct stm32l4_pwmtimer_s *priv, * Description: * Handle timer interrupts. * - * Input parameters: + * Input Parameters: * priv - A reference to the lower half PWM driver state structure * * Returned Value: @@ -1525,7 +1525,7 @@ static int stm32l4pwm_interrupt(struct stm32l4_pwmtimer_s *priv) * Description: * Handle timer 1 and 8 interrupts. * - * Input parameters: + * Input Parameters: * Standard NuttX interrupt inputs * * Returned Value: @@ -1553,7 +1553,7 @@ static int stm32l4pwm_tim8interrupt(int irq, void *context, FAR void *arg) * Description: * Pick an optimal pulse count to program the RCR. * - * Input parameters: + * Input Parameters: * count - The total count remaining * * Returned Value: @@ -1600,7 +1600,7 @@ static uint8_t stm32l4pwm_pulsecount(uint32_t count) * Description: * Enable or disable APB clock for the timer peripheral * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * on - Enable clock if 'on' is 'true' and disable if 'false' * @@ -1693,7 +1693,7 @@ static void stm32l4pwm_setapbclock(FAR struct stm32l4_pwmtimer_s *priv, bool on) * should configure and initialize the device so that it is ready for use. * It should not, however, output pulses until the start method is called. * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * * Returned Value: @@ -1755,7 +1755,7 @@ static int stm32l4pwm_setup(FAR struct pwm_lowerhalf_s *dev) * stop pulsed output, free any resources, disable the timer hardware, and * put the system into the lowest possible power usage state * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * * Returned Value: @@ -1816,7 +1816,7 @@ static int stm32l4pwm_shutdown(FAR struct pwm_lowerhalf_s *dev) * Description: * (Re-)initialize the timer resources and start the pulsed output * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * info - A reference to the characteristics of the pulsed output * @@ -1903,7 +1903,7 @@ static int stm32l4pwm_start(FAR struct pwm_lowerhalf_s *dev, * Description: * Stop the pulsed output and reset the timer resources * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * * Returned Value: @@ -2020,7 +2020,7 @@ static int stm32l4pwm_stop(FAR struct pwm_lowerhalf_s *dev) * Description: * Lower-half logic may support platform-specific ioctl commands * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * cmd - The ioctl command * arg - The argument accompanying the ioctl command diff --git a/arch/arm/src/stm32l4/stm32l4_qencoder.c b/arch/arm/src/stm32l4/stm32l4_qencoder.c index 9f8a20fc9f..683b2f6263 100644 --- a/arch/arm/src/stm32l4/stm32l4_qencoder.c +++ b/arch/arm/src/stm32l4/stm32l4_qencoder.c @@ -504,7 +504,7 @@ static void stm32l4_putreg32(FAR struct stm32l4_lowerhalf_s *priv, int offset, * Description: * Dump all timer registers. * - * Input parameters: + * Input Parameters: * priv - A reference to the QENCODER block status * * Returned Value: @@ -1108,7 +1108,7 @@ static int stm32l4_ioctl(FAR struct qe_lowerhalf_s *lower, int cmd, unsigned lon * devpath - The full path to the driver to register. E.g., "/dev/qe0" * tim - The timer number to used. 'tim' must be an element of {1,2,3,4,5,8} * - * Returned Values: + * Returned Value: * Zero on success; A negated errno value is returned on failure. * ************************************************************************************/ diff --git a/arch/arm/src/stm32l4/stm32l4_qencoder.h b/arch/arm/src/stm32l4/stm32l4_qencoder.h index 7fccca772b..b2d2b445c6 100644 --- a/arch/arm/src/stm32l4/stm32l4_qencoder.h +++ b/arch/arm/src/stm32l4/stm32l4_qencoder.h @@ -129,7 +129,7 @@ * devpath - The full path to the driver to register. E.g., "/dev/qe0" * tim - The timer number to used. 'tim' must be an element of {1,2,3,4,5,8} * - * Returned Values: + * Returned Value: * Zero on success; A negated errno value is returned on failure. * ************************************************************************************/ diff --git a/arch/arm/src/stm32l4/stm32l4_qspi.c b/arch/arm/src/stm32l4/stm32l4_qspi.c index 025e71f6d1..cf303e71b4 100644 --- a/arch/arm/src/stm32l4/stm32l4_qspi.c +++ b/arch/arm/src/stm32l4/stm32l4_qspi.c @@ -2421,7 +2421,7 @@ static int qspi_hw_initialize(struct stm32l4_qspidev_s *priv) * Description: * Initialize the selected QSPI port in master mode * - * Input Parameter: + * Input Parameters: * intf - Interface number(must be zero) * * Returned Value: @@ -2594,7 +2594,7 @@ errout_with_dmahandles: * Description: * Put the QSPI device into memory mapped mode * - * Input Parameter: + * Input Parameters: * dev - QSPI device * meminfo - parameters like for a memory transfer used for reading * @@ -2686,7 +2686,7 @@ void stm32l4_qspi_enter_memorymapped(struct qspi_dev_s* dev, * Description: * Take the QSPI device out of memory mapped mode * - * Input Parameter: + * Input Parameters: * dev - QSPI device * * Returned Value: diff --git a/arch/arm/src/stm32l4/stm32l4_qspi.h b/arch/arm/src/stm32l4/stm32l4_qspi.h index ed65850fc5..c9c87638ee 100644 --- a/arch/arm/src/stm32l4/stm32l4_qspi.h +++ b/arch/arm/src/stm32l4/stm32l4_qspi.h @@ -86,7 +86,7 @@ extern "C" * Description: * Initialize the selected QSPI port in master mode * - * Input Parameter: + * Input Parameters: * intf - Interface number(must be zero) * * Returned Value: @@ -103,7 +103,7 @@ FAR struct qspi_dev_s *stm32l4_qspi_initialize(int intf); * Description: * Put the QSPI device into memory mapped mode * - * Input Parameter: + * Input Parameters: * dev - QSPI device * meminfo - parameters like for a memory transfer used for reading * lpto - number of cycles to wait to automatically de-assert CS @@ -123,7 +123,7 @@ void stm32l4_qspi_enter_memorymapped(struct qspi_dev_s* dev, * Description: * Take the QSPI device out of memory mapped mode * - * Input Parameter: + * Input Parameters: * dev - QSPI device * * Returned Value: diff --git a/arch/arm/src/stm32l4/stm32l4_sai.c b/arch/arm/src/stm32l4/stm32l4_sai.c index 80d07f024f..21892409d5 100644 --- a/arch/arm/src/stm32l4/stm32l4_sai.c +++ b/arch/arm/src/stm32l4/stm32l4_sai.c @@ -479,7 +479,7 @@ static void sai_exclsem_take(struct stm32l4_sai_s *priv) * Setup the master clock divider based on the currently selected data width * and the sample rate * - * Input Parameter: + * Input Parameters: * priv - SAI device structure (only the sample rate and frequency are * needed at this point). * @@ -1288,7 +1288,7 @@ static void sai_buf_initialize(struct stm32l4_sai_s *priv) * Description: * Initialize the selected SAI port in its default state * - * Input Parameter: + * Input Parameters: * priv - private SAI device structure * * Returned Value: @@ -1353,7 +1353,7 @@ static void sai_portinitialize(struct stm32l4_sai_s *priv) * Description: * Initialize the selected SAI block * - * Input Parameter: + * Input Parameters: * intf - I2S interface number (identifying the "logical" SAI interface) * * Returned Value: diff --git a/arch/arm/src/stm32l4/stm32l4_sdmmc.c b/arch/arm/src/stm32l4/stm32l4_sdmmc.c index 2078c16258..38a7077d07 100644 --- a/arch/arm/src/stm32l4/stm32l4_sdmmc.c +++ b/arch/arm/src/stm32l4/stm32l4_sdmmc.c @@ -3099,7 +3099,7 @@ static void stm32_default(struct stm32_dev_s *priv) * Input Parameters: * slotno - Not used. * - * Returned Values: + * Returned Value: * A reference to an SDIO interface structure. NULL is returned on failures. * ****************************************************************************/ @@ -3234,7 +3234,7 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno) * card has been removed from the slot. Only transitions * (inserted->removed or removed->inserted should be reported) * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -3281,7 +3281,7 @@ void sdio_mediachange(FAR struct sdio_dev_s *dev, bool cardinslot) * dev - An instance of the SDIO driver device state structure. * wrprotect - true is a card is writeprotected. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ diff --git a/arch/arm/src/stm32l4/stm32l4_sdmmc.h b/arch/arm/src/stm32l4/stm32l4_sdmmc.h index 155cf209f1..0882acbb74 100644 --- a/arch/arm/src/stm32l4/stm32l4_sdmmc.h +++ b/arch/arm/src/stm32l4/stm32l4_sdmmc.h @@ -73,7 +73,7 @@ extern "C" * Input Parameters: * slotno - Not used. * - * Returned Values: + * Returned Value: * A reference to an SDIO interface structure. NULL is returned on failures. * ****************************************************************************/ @@ -95,7 +95,7 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno); * card has been removed from the slot. Only transitions * (inserted->removed or removed->inserted should be reported) * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -113,7 +113,7 @@ void sdio_mediachange(FAR struct sdio_dev_s *dev, bool cardinslot); * dev - An instance of the SDIO driver device state structure. * wrprotect - true is a card is writeprotected. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ diff --git a/arch/arm/src/stm32l4/stm32l4_serial.c b/arch/arm/src/stm32l4/stm32l4_serial.c index 67602e3c16..1cc67bb148 100644 --- a/arch/arm/src/stm32l4/stm32l4_serial.c +++ b/arch/arm/src/stm32l4/stm32l4_serial.c @@ -1218,7 +1218,7 @@ void stm32l4serial_pm_setsuspend(bool suspend) * Description: * Enable or disable APB clock for the USART peripheral * - * Input parameters: + * Input Parameters: * dev - A reference to the UART driver state structure * on - Enable clock if 'on' is 'true' and disable if 'false' * @@ -2100,7 +2100,7 @@ static bool stm32l4serial_rxavailable(FAR struct uart_dev_s *dev) * Return true if UART activated RX flow control to block more incoming * data * - * Input parameters: + * Input Parameters: * dev - UART device instance * nbuffered - the number of characters currently buffered * (if CONFIG_SERIAL_IFLOWCONTROL_WATERMARKS is diff --git a/arch/arm/src/stm32l4/stm32l4_spi.c b/arch/arm/src/stm32l4/stm32l4_spi.c index 7f5d1543a1..b98bd793e2 100644 --- a/arch/arm/src/stm32l4/stm32l4_spi.c +++ b/arch/arm/src/stm32l4/stm32l4_spi.c @@ -1481,7 +1481,7 @@ static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *rxbuffer, size_t * Description: * Initialize the selected SPI bus in its default state (Master, 8-bit, mode 0, etc.) * - * Input Parameter: + * Input Parameters: * priv - private SPI device structure * * Returned Value: @@ -1571,7 +1571,7 @@ static void spi_bus_initialize(FAR struct stm32l4_spidev_s *priv) * Description: * Initialize the selected SPI bus * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple SPI interfaces) * * Returned Value: diff --git a/arch/arm/src/stm32l4/stm32l4_spi.h b/arch/arm/src/stm32l4/stm32l4_spi.h index 7f5390f347..5d9f74db70 100644 --- a/arch/arm/src/stm32l4/stm32l4_spi.h +++ b/arch/arm/src/stm32l4/stm32l4_spi.h @@ -76,7 +76,7 @@ struct spi_dev_s; * Description: * Initialize the selected SPI bus * - * Input Parameter: + * Input Parameters: * bus number (for hardware that has mutiple SPI interfaces) * * Returned Value: diff --git a/arch/arm/src/stm32l4/stm32l4_tim.h b/arch/arm/src/stm32l4/stm32l4_tim.h index 8362ef1387..fa88892d3a 100644 --- a/arch/arm/src/stm32l4/stm32l4_tim.h +++ b/arch/arm/src/stm32l4/stm32l4_tim.h @@ -204,7 +204,7 @@ int stm32l4_tim_deinit(FAR struct stm32l4_tim_dev_s *dev); * devpath - The full path to the timer device. This should be of the form /dev/timer0 * timer - the timer number. * - * Returned Values: + * Returned Value: * Zero (OK) is returned on success; A negated errno value is returned * to indicate the nature of any failure. * diff --git a/arch/arm/src/stm32l4/stm32l4_tim_lowerhalf.c b/arch/arm/src/stm32l4/stm32l4_tim_lowerhalf.c index 59918c81ba..76f5bff364 100644 --- a/arch/arm/src/stm32l4/stm32l4_tim_lowerhalf.c +++ b/arch/arm/src/stm32l4/stm32l4_tim_lowerhalf.c @@ -231,7 +231,7 @@ static struct stm32l4_lowerhalf_s g_tim17_lowerhalf = * * Input Parameters: * - * Returned Values: + * Returned Value: * ****************************************************************************/ @@ -267,7 +267,7 @@ static int stm32l4_timer_handler(int irq, void *context, void *arg) * lower - A pointer the publicly visible representation of the "lower-half" * driver state structure. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -305,7 +305,7 @@ static int stm32l4_start(FAR struct timer_lowerhalf_s *lower) * lower - A pointer the publicly visible representation of the "lower-half" * driver state structure. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -339,7 +339,7 @@ static int stm32l4_stop(FAR struct timer_lowerhalf_s *lower) * driver state structure. * timeout - The new timeout value in microseconds. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -385,7 +385,7 @@ static int stm32l4_settimeout(FAR struct timer_lowerhalf_s *lower, * behavior is restored, * arg - Argument that will be provided in the callback * - * Returned Values: + * Returned Value: * The previous timer expiration function pointer or NULL is there was * no previous function pointer. * @@ -432,7 +432,7 @@ static void stm32l4_setcallback(FAR struct timer_lowerhalf_s *lower, * form /dev/timer0 * timer - the timer's number. * - * Returned Values: + * Returned Value: * Zero (OK) is returned on success; A negated errno value is returned * to indicate the nature of any failure. * diff --git a/arch/arm/src/stm32l4/stm32l4_wdg.h b/arch/arm/src/stm32l4/stm32l4_wdg.h index 794c5e2aef..0d2b003253 100644 --- a/arch/arm/src/stm32l4/stm32l4_wdg.h +++ b/arch/arm/src/stm32l4/stm32l4_wdg.h @@ -79,7 +79,7 @@ extern "C" * /dev/watchdog0 * lsifreq - The calibrated LSI clock frequency * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -100,7 +100,7 @@ void stm32l4_iwdginitialize(FAR const char *devpath, uint32_t lsifreq); * devpath - The full path to the watchdog. This should be of the form * /dev/watchdog0 * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ diff --git a/arch/arm/src/stm32l4/stm32l4x6xx_dma.c b/arch/arm/src/stm32l4/stm32l4x6xx_dma.c index cd194b2cba..d727be752b 100644 --- a/arch/arm/src/stm32l4/stm32l4x6xx_dma.c +++ b/arch/arm/src/stm32l4/stm32l4x6xx_dma.c @@ -394,7 +394,7 @@ void weak_function up_dmainitialize(void) * Hmm.. I suppose this interface could be extended to make a non-blocking * version. Feel free to do that if that is what you need. * - * Input parameter: + * Input Parameters: * chan - Identifies the stream/channel resource * This is a bit encoded value as provided by the DMACHAN_* definitions * in chip/stm32l4x6xx_dma.h @@ -642,7 +642,7 @@ size_t stm32l4_dmaresidual(DMA_HANDLE handle) * of the processor. Note that this only applies to memory addresses, it * will return false for any peripheral address. * - * Returned value: + * Returned Value: * True, if transfer is possible. * ****************************************************************************/ diff --git a/arch/arm/src/str71x/str71x.h b/arch/arm/src/str71x/str71x.h index 7b3bedf1df..aea504fe89 100644 --- a/arch/arm/src/str71x/str71x.h +++ b/arch/arm/src/str71x/str71x.h @@ -162,7 +162,7 @@ struct spi_dev_s; /* Forward reference */ * Initialize the selected SPI port. This function could get called * multiple times for each STR7 devices that needs an SPI reference. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple SPI interfaces) * * Returned Value: diff --git a/arch/arm/src/tiva/tiva_adc.h b/arch/arm/src/tiva/tiva_adc.h index 7f6edd4f9d..a717ad72f1 100644 --- a/arch/arm/src/tiva/tiva_adc.h +++ b/arch/arm/src/tiva/tiva_adc.h @@ -405,7 +405,7 @@ void tiva_adc_sample_rate(uint8_t rate); * to the FIFO. This is only required when the trigger source is set to the * processor. * - * Input parameters: + * Input Parameters: * adc - which ADC peripherals' sample sequencers to trigger * sse_mask - sample sequencer bitmask, each sse is 1 shifted by the sse * number. e.g. @@ -424,7 +424,7 @@ void tiva_adc_proc_trig(uint8_t adc, uint8_t sse_mask); * Description: * Returns raw interrupt status for the input ADC * - * Input parameters: + * Input Parameters: * adc - which ADC peripherals' interrupt status to retrieve * ****************************************************************************/ @@ -440,12 +440,12 @@ uint32_t tiva_adc_int_status(uint8_t adc); * Sets the operation state of an ADC's sample sequencer (SSE). SSEs must * be configured before being enabled. * - * Input parameters: + * Input Parameters: * adc - peripheral state * sse - sample sequencer * state - sample sequencer enable/disable state * - * Return value: + * Returned Value: * Actual state of the ACTSS register. * ****************************************************************************/ @@ -466,7 +466,7 @@ uint8_t tiva_adc_sse_enable(uint8_t adc, uint8_t sse, bool state); * - Always * - !!UNSUPPORTED: Comparators * - * Input parameters: + * Input Parameters: * adc - peripheral state * sse - sample sequencer * trigger - interrupt trigger @@ -482,7 +482,7 @@ void tiva_adc_sse_trigger(uint8_t adc, uint8_t sse, uint32_t trigger); * Additional triggering configuration for PWM. Sets which PWM and which * generator. * - * Input parameters: + * Input Parameters: * adc - peripheral state * sse - sample sequencer * cfg - which PWM modulator and generator to use, use TIVA_ADC_PWM_TRIG @@ -501,7 +501,7 @@ void tiva_adc_sse_pwm_trig(uint8_t adc, uint8_t sse, uint32_t cfg); * Sets the interrupt state of an ADC's sample sequencer (SSE). SSEs must * be enabled before setting interrupt state. * - * Input parameters: + * Input Parameters: * adc - peripheral state * sse - sample sequencer * state - sample sequencer enable/disable interrupt state @@ -516,7 +516,7 @@ void tiva_adc_sse_int_enable(uint8_t adc, uint8_t sse, bool state); * Description: * Returns interrupt status for the specificed SSE * - * Input parameters: + * Input Parameters: * adc - which ADC peripherals' interrupt status to retrieve * sse - which SSE interrupt status to retrieve * @@ -530,7 +530,7 @@ bool tiva_adc_sse_int_status(uint8_t adc, uint8_t sse); * Description: * Clears the interrupt bit for the SSE. * - * Input parameters: + * Input Parameters: * adc - peripheral state * sse - sample sequencer * state - sample sequencer @@ -547,11 +547,11 @@ void tiva_adc_sse_clear_int(uint8_t adc, uint8_t sse); * The input data buffer MUST be as large or larger than the sample sequencer. * otherwise * - * Input parameters: + * Input Parameters: * adc - peripheral state * sse - sample sequencer * - * Return value: + * Returned Value: * number of steps read from FIFO. * ****************************************************************************/ @@ -566,7 +566,7 @@ uint8_t tiva_adc_sse_data(uint8_t adc, uint8_t sse, int32_t *buf); * priority value ranges from 0 to 3, 0 being the highest priority, 3 being * the lowest. There can be no duplicate values. * - * Input parameters: + * Input Parameters: * adc - peripheral state * sse - sample sequencer * priority - conversion priority @@ -585,7 +585,7 @@ void tiva_adc_sse_priority(uint8_t adc, uint8_t sse, uint8_t priority); * * *SSEMUX only supported on TM4C129 devices * - * Input parameters: + * Input Parameters: * adc - peripheral state * sse - sample sequencer * chn - sample sequencer step @@ -601,7 +601,7 @@ void tiva_adc_sse_register_chn(uint8_t adc, uint8_t sse, uint8_t chn, uint32_t a * Description: * Sets the differential capability for a SSE. !! UNSUPPORTED * - * Input parameters: + * Input Parameters: * adc - peripheral state * sse - sample sequencer * chn - sample sequencer channel @@ -620,7 +620,7 @@ void tiva_adc_sse_differential(uint8_t adc, uint8_t sse, uint8_t chn, uint32_t d * This is not available on all devices, however on devices that do not * support this feature these reserved bits are ignored on write access. * - * Input parameters: + * Input Parameters: * adc - peripheral state * sse - sample sequencer * chn - sample sequencer channel @@ -652,7 +652,7 @@ void tiva_adc_sse_sample_hold_time(uint8_t adc, uint8_t sse, uint8_t chn, uint32 * * *Comparator/Differential functionality is unsupported and ignored. * - * Input parameters: + * Input Parameters: * adc - peripheral state * sse - sample sequencer * chn - sample sequencer channel @@ -669,7 +669,7 @@ void tiva_adc_sse_step_cfg(uint8_t adc, uint8_t sse, uint8_t chn, uint8_t cfg); * Dump all configured registers for the given ADC and SSE. This should * only be used to verify that configuration routines were accurate. * - * Input parameters: + * Input Parameters: * adc - peripheral state * sse - sample sequencer * diff --git a/arch/arm/src/tiva/tiva_adclib.c b/arch/arm/src/tiva/tiva_adclib.c index dc2768fc16..8d55333a02 100644 --- a/arch/arm/src/tiva/tiva_adclib.c +++ b/arch/arm/src/tiva/tiva_adclib.c @@ -624,7 +624,7 @@ void tiva_adc_sample_rate(uint8_t rate) * to the FIFO. This is only required when the trigger source is set to the * processor. * - * Input parameters: + * Input Parameters: * adc - which ADC peripherals' sample sequencers to trigger * sse_mask - sample sequencer bitmask, each sse is 1 shifted by the sse * number. e.g. @@ -650,7 +650,7 @@ void tiva_adc_proc_trig(uint8_t adc, uint8_t sse_mask) * Description: * Returns raw interrupt status for the input ADC * - * Input parameters: + * Input Parameters: * adc - which ADC peripherals' interrupt status to retrieve * ****************************************************************************/ @@ -670,12 +670,12 @@ uint32_t tiva_adc_int_status(uint8_t adc) * Sets the operation state of an ADC's sample sequencer (SSE). SSEs must * be configured before being enabled. * - * Input parameters: + * Input Parameters: * adc - peripheral state * sse - sample sequencer * state - sample sequencer enable/disable state * - * Return value: + * Returned Value: * Actual state of the ACTSS register. * ****************************************************************************/ @@ -711,7 +711,7 @@ uint8_t tiva_adc_sse_enable(uint8_t adc, uint8_t sse, bool state) * - Always * - !!UNSUPPORTED: Comparators * - * Input parameters: + * Input Parameters: * adc - peripheral state * sse - sample sequencer * trigger - interrupt trigger @@ -736,7 +736,7 @@ void tiva_adc_sse_trigger(uint8_t adc, uint8_t sse, uint32_t trigger) * Additional triggering configuration for PWM. Sets which PWM and which * generator. * - * Input parameters: + * Input Parameters: * adc - peripheral state * sse - sample sequencer * cfg - which PWM modulator and generator to use, use TIVA_ADC_PWM_TRIG @@ -762,7 +762,7 @@ void tiva_adc_sse_pwm_trig(uint8_t adc, uint8_t sse, uint32_t cfg) * Sets the interrupt state of an ADC's sample sequencer (SSE). SSEs must * be enabled before setting interrupt state. * - * Input parameters: + * Input Parameters: * adc - peripheral state * sse - sample sequencer * state - sample sequencer enable/disable interrupt state @@ -799,7 +799,7 @@ void tiva_adc_sse_int_enable(uint8_t adc, uint8_t sse, bool state) * Description: * Returns interrupt status for the specificed SSE * - * Input parameters: + * Input Parameters: * adc - which ADC peripherals' interrupt status to retrieve * sse - which SSE interrupt status to retrieve * @@ -818,7 +818,7 @@ bool tiva_adc_sse_int_status(uint8_t adc, uint8_t sse) * Description: * Clears the interrupt bit for the SSE. * - * Input parameters: + * Input Parameters: * adc - peripheral state * sse - sample sequencer * state - sample sequencer @@ -839,11 +839,11 @@ void tiva_adc_sse_clear_int(uint8_t adc, uint8_t sse) * The input data buffer MUST be as large or larger than the sample sequencer. * otherwise * - * Input parameters: + * Input Parameters: * adc - peripheral state * sse - sample sequencer * - * Return value: + * Returned Value: * number of steps read from FIFO. * ****************************************************************************/ @@ -880,7 +880,7 @@ uint8_t tiva_adc_sse_data(uint8_t adc, uint8_t sse, int32_t *buf) * priority value ranges from 0 to 3, 0 being the highest priority, 3 being * the lowest. There can be no duplicate values. * - * Input parameters: + * Input Parameters: * adc - peripheral state * sse - sample sequencer * priority - conversion priority @@ -906,7 +906,7 @@ void tiva_adc_sse_priority(uint8_t adc, uint8_t sse, uint8_t priority) * * *SSEMUX only supported on TM4C129 devices * - * Input parameters: + * Input Parameters: * adc - peripheral state * sse - sample sequencer * chn - sample sequencer step @@ -940,7 +940,7 @@ void tiva_adc_sse_register_chn(uint8_t adc, uint8_t sse, uint8_t chn, * Description: * Sets the differential capability for a SSE. !! UNSUPPORTED * - * Input parameters: + * Input Parameters: * adc - peripheral state * sse - sample sequencer * chn - sample sequencer channel @@ -970,7 +970,7 @@ void tiva_adc_sse_differential(uint8_t adc, uint8_t sse, uint8_t chn, uint32_t d * This is not available on all devices, however on devices that do not * support this feature these reserved bits are ignored on write access. * - * Input parameters: + * Input Parameters: * adc - peripheral state * sse - sample sequencer * chn - sample sequencer channel @@ -1007,7 +1007,7 @@ void tiva_adc_sse_sample_hold_time(uint8_t adc, uint8_t sse, * * *Comparator/Differential functionality is unsupported and ignored. * - * Input parameters: + * Input Parameters: * adc - peripheral state * sse - sample sequencer * chn - sample sequencer channel @@ -1029,7 +1029,7 @@ void tiva_adc_sse_step_cfg(uint8_t adc, uint8_t sse, uint8_t chn, uint8_t cfg) * Dump all configured registers for the given ADC and SSE. This should * only be used to verify that configuration routines were accurate. * - * Input parameters: + * Input Parameters: * adc - peripheral state * sse - sample sequencer * diff --git a/arch/arm/src/tiva/tiva_adclow.c b/arch/arm/src/tiva/tiva_adclow.c index 577a430d2f..3d7262b015 100644 --- a/arch/arm/src/tiva/tiva_adclow.c +++ b/arch/arm/src/tiva/tiva_adclow.c @@ -655,7 +655,7 @@ static int tiva_adc_ioctl(struct adc_dev_s *dev, int cmd, unsigned long arg) * are disabled when this function runs. tiva_adc_read will * re-enable interrupts when it completes processing all pending events. * - * Input Parameters + * Input Parameters: * arg - The ADC SSE data structure cast to (void *) * * Returned Value: diff --git a/arch/arm/src/tiva/tiva_gpioirq.c b/arch/arm/src/tiva/tiva_gpioirq.c index 112887f8bf..a5d0e3dbe3 100644 --- a/arch/arm/src/tiva/tiva_gpioirq.c +++ b/arch/arm/src/tiva/tiva_gpioirq.c @@ -672,7 +672,7 @@ int tiva_gpioirqinitialize(void) * disabled to stop further interrupts. Otherwise, the new isr is linked * and the pin's interrupt mask is set. * - * Returns: + * Returned Value: * Zero (OK) is returned on success. Otherwise a negated errno value is * return to indicate the nature of the failure. * diff --git a/arch/arm/src/tiva/tiva_i2c.h b/arch/arm/src/tiva/tiva_i2c.h index 33acca1116..c43e167f86 100644 --- a/arch/arm/src/tiva/tiva_i2c.h +++ b/arch/arm/src/tiva/tiva_i2c.h @@ -59,7 +59,7 @@ * instances of the interface, each of which may be set up with a * different frequency and slave address. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has multiple I2C interfaces) * * Returned Value: @@ -75,7 +75,7 @@ FAR struct i2c_master_s *tiva_i2cbus_initialize(int port); * Description: * De-initialize the selected I2C port, and power down the device. * - * Input Parameter: + * Input Parameters: * Device structure as returned by the tiva_i2cbus_initialize() * * Returned Value: diff --git a/arch/arm/src/tiva/tiva_pwm.c b/arch/arm/src/tiva/tiva_pwm.c index 0e882f0f7c..b25e272255 100644 --- a/arch/arm/src/tiva/tiva_pwm.c +++ b/arch/arm/src/tiva/tiva_pwm.c @@ -421,7 +421,7 @@ static inline void tiva_pwm_putreg(struct tiva_pwm_chan_s *chan, * use. It will not, however, output pulses until the start method is * called. * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * * Returned Value: @@ -457,7 +457,7 @@ static int tiva_pwm_setup(FAR struct pwm_lowerhalf_s *dev) * stop pulsed output, free any resources, disable the timer hardware, and * put the system into the lowest possible power usage state * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * * Returned Value: @@ -487,7 +487,7 @@ static int tiva_pwm_shutdown(FAR struct pwm_lowerhalf_s *dev) * Description: * (Re-)initialize the timer resources and start the pulsed output * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * info - A reference to the characteristics of the pulsed output * handle - This is the handle that was provided to the lower-half @@ -569,7 +569,7 @@ static int tiva_pwm_start(FAR struct pwm_lowerhalf_s *dev, * Description: * Configure PWM registers and start the PWM timer * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * info - A reference to the characteristics of the pulsed output * @@ -659,7 +659,7 @@ static inline int tiva_pwm_timer(FAR struct tiva_pwm_chan_s *chan, * Description: * Stop the pulsed output and reset the timer resources * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * * Returned Value: @@ -692,7 +692,7 @@ static int tiva_pwm_stop(FAR struct pwm_lowerhalf_s *dev) * Description: * Lower-half logic may support platform-specific ioctl commands * - * Input parameters: + * Input Parameters: * dev - A reference to the lower half PWM driver state structure * cmd - The ioctl command * arg - The argument accompanying the ioctl command diff --git a/arch/arm/src/tiva/tiva_qencoder.c b/arch/arm/src/tiva/tiva_qencoder.c index b25f6dce18..a10eb6577d 100644 --- a/arch/arm/src/tiva/tiva_qencoder.c +++ b/arch/arm/src/tiva/tiva_qencoder.c @@ -177,7 +177,7 @@ static inline void tiva_qe_putreg(struct tiva_qe_s *qe, unsigned int offset, * use. It will not, however, output pulses until the start method is * called. * - * Input parameters: + * Input Parameters: * lower - A reference to the lower half QEI driver state structure * * Returned Value: @@ -260,7 +260,7 @@ static int tiva_qe_setup(FAR struct qe_lowerhalf_s *lower) * stop data collection, free any resources, disable the timer hardware, and * put the system into the lowest possible power usage state * - * Input parameters: + * Input Parameters: * lower - A reference to the lower half QEI driver state structure * * Returned Value: @@ -287,7 +287,7 @@ static int tiva_qe_shutdown(FAR struct qe_lowerhalf_s *lower) * Description: * Reset the position measurement to zero. * - * Input parameters: + * Input Parameters: * lower - A reference to the lower half QEI driver state structure * * Returned Value: @@ -312,7 +312,7 @@ static int tiva_qe_reset(FAR struct qe_lowerhalf_s *lower) * Description: * Return the position mesaured by QEI. * - * Input parameters: + * Input Parameters: * lower - A reference to the lower half QEI driver state structure * pos - pointer to the position returned * @@ -338,7 +338,7 @@ static int tiva_qe_position(FAR struct qe_lowerhalf_s *lower, FAR int32_t *pos) * Description: * Lower-half logic may support platform-specific ioctl commands * - * Input parameters: + * Input Parameters: * lower - A reference to the lower half QEI driver state structure * cmd - The ioctl command * arg - The argument accompanying the ioctl command @@ -383,7 +383,7 @@ static int tiva_qe_ioctl(FAR struct qe_lowerhalf_s *lower, int cmd, * Description: * Return the direction mesaured by QEI. * - * Input parameters: + * Input Parameters: * qe - A reference to the TIVA QEI structure * dir - pointer to the direction returned * @@ -414,7 +414,7 @@ static int tiva_qe_direction(FAR struct tiva_qe_s *qe, unsigned long *dir) * Description: * Return the velocity (A/B pulses per second) mesaured by QEI. * - * Input parameters: + * Input Parameters: * qe - A reference to the TIVA QEI structure * * Returned Value: @@ -437,7 +437,7 @@ static int tiva_qe_velocity(FAR struct tiva_qe_s *qe, unsigned long *vel) * Description: * Set reset mode as MAXPOS and also set maxpos value * - * Input parameters: + * Input Parameters: * qe - A reference to the TIVA QEI structure * ppr - pulses per round of encoder * diff --git a/arch/arm/src/tiva/tiva_ssi.c b/arch/arm/src/tiva/tiva_ssi.c index bd224363b0..d64e4dccdd 100644 --- a/arch/arm/src/tiva/tiva_ssi.c +++ b/arch/arm/src/tiva/tiva_ssi.c @@ -1495,7 +1495,7 @@ static void ssi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, * required. Theregore, all GPIO chip management is deferred to board- * specific logic. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple SSI interfaces) * * Returned Value: diff --git a/arch/arm/src/tiva/tiva_ssi.h b/arch/arm/src/tiva/tiva_ssi.h index d0976c2aee..8027ae3366 100644 --- a/arch/arm/src/tiva/tiva_ssi.h +++ b/arch/arm/src/tiva/tiva_ssi.h @@ -70,7 +70,7 @@ extern "C" * required. Theregore, all GPIO chip management is deferred to board- * specific logic. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple SSI interfaces) * * Returned Value: diff --git a/arch/arm/src/tiva/tiva_timer.h b/arch/arm/src/tiva/tiva_timer.h index 547cd11704..f5d9c6f9fe 100644 --- a/arch/arm/src/tiva/tiva_timer.h +++ b/arch/arm/src/tiva/tiva_timer.h @@ -835,7 +835,7 @@ static inline void tiva_gptm0_synchronize(uint32_t sync) * form /dev/timer0 * config - 32-bit timer configuration values. * - * Returned Values: + * Returned Value: * Zero (OK) is returned on success; A negated errno value is returned * to indicate the nature of any failure. * diff --git a/arch/arm/src/tiva/tiva_timerlow32.c b/arch/arm/src/tiva/tiva_timerlow32.c index 91f44618b0..9807588ec2 100644 --- a/arch/arm/src/tiva/tiva_timerlow32.c +++ b/arch/arm/src/tiva/tiva_timerlow32.c @@ -133,7 +133,7 @@ static const struct timer_ops_s g_timer_ops = * priv - A pointer to a private timer driver lower half instance * usecs - The number of usecs to convert * - * Returned Values: + * Returned Value: * The time converted to clock ticks. * ****************************************************************************/ @@ -161,7 +161,7 @@ static uint32_t tiva_usec2ticks(struct tiva_lowerhalf_s *priv, uint32_t usecs) * priv - A pointer to a private timer driver lower half instance * usecs - The number of ticks to convert * - * Returned Values: + * Returned Value: * The time converted to microseconds. * ****************************************************************************/ @@ -189,7 +189,7 @@ static uint32_t tiva_ticks2usec(struct tiva_lowerhalf_s *priv, uint32_t ticks) * priv - A pointer to a private timer driver lower half instance * timeout - The new timeout value in microseconds. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -224,7 +224,7 @@ static void tiva_timeout(struct tiva_lowerhalf_s *priv, uint32_t timeout) * Input Parameters: * Usual 32-bit timer interrupt handler arguments. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -287,7 +287,7 @@ static void tiva_timer_handler(TIMER_HANDLE handle, void *arg, uint32_t status) * lower - A pointer the publicly visible representation of the "lower-half" * driver state structure. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -324,7 +324,7 @@ static int tiva_start(struct timer_lowerhalf_s *lower) * lower - A pointer the publicly visible representation of the "lower-half" * driver state structure. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -362,7 +362,7 @@ static int tiva_stop(struct timer_lowerhalf_s *lower) * driver state structure. * status - The location to return the status information. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -415,7 +415,7 @@ static int tiva_getstatus(struct timer_lowerhalf_s *lower, * driver state structure. * timeout - The new timeout value in microseconds. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -456,7 +456,7 @@ static int tiva_settimeout(struct timer_lowerhalf_s *lower, uint32_t timeout) * function pointer is NULL, then the reset-on-expiration * behavior is restored, * - * Returned Values: + * Returned Value: * The previous timer expiration function pointer or NULL is there was * no previous function pointer. * @@ -496,7 +496,7 @@ static void tiva_setcallback(struct timer_lowerhalf_s *lower, * interpretation of this argument depends on the particular * command. * - * Returned Values: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ @@ -535,7 +535,7 @@ static int tiva_ioctl(struct timer_lowerhalf_s *lower, int cmd, * form /dev/timer0 * config - 32-bit timer configuration values. * - * Returned Values: + * Returned Value: * Zero (OK) is returned on success; A negated errno value is returned * to indicate the nature of any failure. * diff --git a/arch/arm/src/tms570/tms570_irq.c b/arch/arm/src/tms570/tms570_irq.c index 11d606d637..33f2890b74 100644 --- a/arch/arm/src/tms570/tms570_irq.c +++ b/arch/arm/src/tms570/tms570_irq.c @@ -198,7 +198,7 @@ void up_irqinitialize(void) * the irq number of the interrupt and then to call arm_doirq to dispatch * the interrupt. * - * Input parameters: + * Input Parameters: * regs - A pointer to the register save area on the stack. * ****************************************************************************/ @@ -240,7 +240,7 @@ uint32_t *arm_decodeirq(uint32_t *regs) * the irq number of the interrupt and then to call arm_doirq to dispatch * the interrupt. * - * Input parameters: + * Input Parameters: * regs - A pointer to the register save area on the stack. * ****************************************************************************/ diff --git a/arch/arm/src/tms570/tms570_selftest.h b/arch/arm/src/tms570/tms570_selftest.h index 696bc54fe3..727510fe32 100644 --- a/arch/arm/src/tms570/tms570_selftest.h +++ b/arch/arm/src/tms570/tms570_selftest.h @@ -90,7 +90,7 @@ void tms570_memtest_selftest(void); * Description: * Start the memory test on the selected set of RAMs. * - * Input Paramters: + * Input Parameters: * rinfol - The OR of each RAM grouping bit. See the PBIST_RINFOL* * definitions in chip/tms570_pbist.h * diff --git a/arch/arm/src/xmc4/xmc4_i2c.h b/arch/arm/src/xmc4/xmc4_i2c.h index f4a167b713..74f8acb168 100644 --- a/arch/arm/src/xmc4/xmc4_i2c.h +++ b/arch/arm/src/xmc4/xmc4_i2c.h @@ -57,7 +57,7 @@ * instances of the interface, each of which may be set up with a * different frequency and slave address. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has multiple I2C interfaces) * * Returned Value: @@ -73,7 +73,7 @@ FAR struct i2c_master_s *xmc4_i2cbus_initialize(int port); * Description: * De-initialize the selected I2C port, and power down the device. * - * Input Parameter: + * Input Parameters: * Device structure as returned by the lpc43_i2cbus_initialize() * * Returned Value: diff --git a/arch/arm/src/xmc4/xmc4_serial.c b/arch/arm/src/xmc4/xmc4_serial.c index fef3ac0773..36a23e91d7 100644 --- a/arch/arm/src/xmc4/xmc4_serial.c +++ b/arch/arm/src/xmc4/xmc4_serial.c @@ -1073,7 +1073,7 @@ void xmc4_earlyserialinit(void) * Input Parameters: * None * - * Returns Value: + * Returned Value: * None * ****************************************************************************/ diff --git a/arch/arm/src/xmc4/xmc4_spi.h b/arch/arm/src/xmc4/xmc4_spi.h index 5113665eda..73f4d69d4d 100644 --- a/arch/arm/src/xmc4/xmc4_spi.h +++ b/arch/arm/src/xmc4/xmc4_spi.h @@ -75,7 +75,7 @@ struct spi_dev_s; * Description: * Initialize the selected SPI bus * - * Input Parameter: + * Input Parameters: * bus number (for hardware that has mutiple SPI interfaces) * * Returned Value: diff --git a/arch/avr/src/at32uc3/at32uc3_gpioirq.c b/arch/avr/src/at32uc3/at32uc3_gpioirq.c index 66e8247655..03b704e08a 100644 --- a/arch/avr/src/at32uc3/at32uc3_gpioirq.c +++ b/arch/avr/src/at32uc3/at32uc3_gpioirq.c @@ -81,7 +81,7 @@ static struct g_gpiohandler_s g_gpiohandler[NR_GPIO_IRQS]; /**************************************************************************** * Name: gpio_baseaddress * - * Input: + * Input Parameters: * irq - A IRQ number in the range of 0 to NR_GPIO_IRQS. * * Description: @@ -114,7 +114,7 @@ static inline uint32_t gpio_baseaddress(unsigned int irq) /**************************************************************************** * Name: gpio_pin * - * Input: + * Input Parameters: * irq - A IRQ number in the range of 0 to NR_GPIO_IRQS. * * Description: diff --git a/arch/avr/src/avr/avr.h b/arch/avr/src/avr/avr.h index 0326d6d848..2e0c72ee38 100644 --- a/arch/avr/src/avr/avr.h +++ b/arch/avr/src/avr/avr.h @@ -144,7 +144,7 @@ uint8_t *up_doirq(uint8_t irq, uint8_t *regs); * Description: * Initialize the selected SPI port * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple SPI interfaces) * * Returned Value: diff --git a/arch/avr/src/avr/up_blocktask.c b/arch/avr/src/avr/up_blocktask.c index b03b967bad..868a517b40 100644 --- a/arch/avr/src/avr/up_blocktask.c +++ b/arch/avr/src/avr/up_blocktask.c @@ -61,7 +61,7 @@ * the ready to run list must be stopped. Save its context * and move it to the inactive list specified by task_state. * - * Inputs: + * Input Parameters: * tcb: Refers to a task in the ready-to-run list (normally * the task at the head of the list). It most be * stopped, its context saved and moved into one of the diff --git a/arch/avr/src/avr/up_checkstack.c b/arch/avr/src/avr/up_checkstack.c index 725a234d1a..96152af0d6 100644 --- a/arch/avr/src/avr/up_checkstack.c +++ b/arch/avr/src/avr/up_checkstack.c @@ -74,7 +74,7 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size); * alloc - Allocation base address of the stack * size - The size of the stack in bytes * - * Returned value: + * Returned Value: * The estimated amount of stack space used. * ****************************************************************************/ @@ -154,7 +154,7 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size) * Input Parameters: * None * - * Returned value: + * Returned Value: * The estimated amount of stack space used. * ****************************************************************************/ diff --git a/arch/avr/src/avr/up_createstack.c b/arch/avr/src/avr/up_createstack.c index 54efb1a3fb..d54b2049fe 100644 --- a/arch/avr/src/avr/up_createstack.c +++ b/arch/avr/src/avr/up_createstack.c @@ -81,7 +81,7 @@ * - adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The initial value of * the stack pointer. * - * Inputs: + * Input Parameters: * - tcb: The TCB of new task * - stack_size: The requested stack size. At least this much * must be allocated. diff --git a/arch/avr/src/avr/up_reprioritizertr.c b/arch/avr/src/avr/up_reprioritizertr.c index 846b59becf..28323ffbb7 100644 --- a/arch/avr/src/avr/up_reprioritizertr.c +++ b/arch/avr/src/avr/up_reprioritizertr.c @@ -67,7 +67,7 @@ * the priority of the current, running task and it now has the * priority. * - * Inputs: + * Input Parameters: * tcb: The TCB of the task that has been reprioritized * priority: The new task priority * diff --git a/arch/avr/src/avr/up_spi.c b/arch/avr/src/avr/up_spi.c index 24a4f377cb..98742cf4e2 100644 --- a/arch/avr/src/avr/up_spi.c +++ b/arch/avr/src/avr/up_spi.c @@ -440,7 +440,7 @@ static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t nw * Description: * Initialize the selected SPI port * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple SPI interfaces) * * Returned Value: diff --git a/arch/avr/src/avr/up_stackframe.c b/arch/avr/src/avr/up_stackframe.c index 0f7d3a8746..71c38c8aa4 100644 --- a/arch/avr/src/avr/up_stackframe.c +++ b/arch/avr/src/avr/up_stackframe.c @@ -86,7 +86,7 @@ * been removed from the stack. This will still be the initial value * of the stack pointer when the task is started. * - * Inputs: + * Input Parameters: * - tcb: The TCB of new task * - frame_size: The size of the stack frame to allocate. * diff --git a/arch/avr/src/avr/up_switchcontext.S b/arch/avr/src/avr/up_switchcontext.S index 3fc1b6ae42..c6ab3f8c08 100644 --- a/arch/avr/src/avr/up_switchcontext.S +++ b/arch/avr/src/avr/up_switchcontext.S @@ -74,7 +74,7 @@ * r24-r25: savregs * r22-r23: restoreregs * - * Return: + * Returned Value: * up_switchcontext forces a context switch to the task "canned" in restoreregs. * It does not 'return' in the normal sense, rather, it will context switch back * to the function point. When it does 'return,' it is because the blocked diff --git a/arch/avr/src/avr/up_unblocktask.c b/arch/avr/src/avr/up_unblocktask.c index d70b65405c..cea4c6df79 100644 --- a/arch/avr/src/avr/up_unblocktask.c +++ b/arch/avr/src/avr/up_unblocktask.c @@ -60,7 +60,7 @@ * but has been prepped to execute. Move the TCB to the * ready-to-run list, restore its context, and start execution. * - * Inputs: + * Input Parameters: * tcb: Refers to the tcb to be unblocked. This tcb is * in one of the waiting tasks lists. It must be moved to * the ready-to-run list and, if it is the highest priority diff --git a/arch/avr/src/avr/up_usestack.c b/arch/avr/src/avr/up_usestack.c index 0546d8c770..1e451d883c 100644 --- a/arch/avr/src/avr/up_usestack.c +++ b/arch/avr/src/avr/up_usestack.c @@ -79,7 +79,7 @@ * - adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The * initial value of the stack pointer. * - * Inputs: + * Input Parameters: * - tcb: The TCB of new task * - stack_size: The allocated stack size. * diff --git a/arch/avr/src/avr32/up_blocktask.c b/arch/avr/src/avr32/up_blocktask.c index 8449d82cbe..3e9304be28 100644 --- a/arch/avr/src/avr32/up_blocktask.c +++ b/arch/avr/src/avr32/up_blocktask.c @@ -62,7 +62,7 @@ * the ready to run list must be stopped. Save its context * and move it to the inactive list specified by task_state. * - * Inputs: + * Input Parameters: * tcb: Refers to a task in the ready-to-run list (normally * the task at the head of the list). It most be * stopped, its context saved and moved into one of the diff --git a/arch/avr/src/avr32/up_createstack.c b/arch/avr/src/avr32/up_createstack.c index 6bc17519bc..2244e9ba4e 100644 --- a/arch/avr/src/avr32/up_createstack.c +++ b/arch/avr/src/avr32/up_createstack.c @@ -81,7 +81,7 @@ * - adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The initial value of * the stack pointer. * - * Inputs: + * Input Parameters: * - tcb: The TCB of new task * - stack_size: The requested stack size. At least this much * must be allocated. diff --git a/arch/avr/src/avr32/up_reprioritizertr.c b/arch/avr/src/avr32/up_reprioritizertr.c index 1ce7a4c406..eb8023d720 100644 --- a/arch/avr/src/avr32/up_reprioritizertr.c +++ b/arch/avr/src/avr32/up_reprioritizertr.c @@ -68,7 +68,7 @@ * the priority of the current, running task and it now has the * priority. * - * Inputs: + * Input Parameters: * tcb: The TCB of the task that has been reprioritized * priority: The new task priority * diff --git a/arch/avr/src/avr32/up_stackframe.c b/arch/avr/src/avr32/up_stackframe.c index acd10d9216..dfcf128001 100644 --- a/arch/avr/src/avr32/up_stackframe.c +++ b/arch/avr/src/avr32/up_stackframe.c @@ -98,7 +98,7 @@ * been removed from the stack. This will still be the initial value * of the stack pointer when the task is started. * - * Inputs: + * Input Parameters: * - tcb: The TCB of new task * - frame_size: The size of the stack frame to allocate. * diff --git a/arch/avr/src/avr32/up_switchcontext.S b/arch/avr/src/avr32/up_switchcontext.S index 8820427e69..1542a64578 100644 --- a/arch/avr/src/avr32/up_switchcontext.S +++ b/arch/avr/src/avr32/up_switchcontext.S @@ -68,7 +68,7 @@ * * void up_switchcontext(uint32_t *saveregs, uint32_t *restoreregs); * - * Return: + * Returned Value: * up_switchcontext forces a context switch to the task "canned" in restoreregs. * It does not 'return' in the normal sense, rather, it will context switch back * to the function point. When it does 'return,' it is because the blocked diff --git a/arch/avr/src/avr32/up_unblocktask.c b/arch/avr/src/avr32/up_unblocktask.c index d8181344fd..c77c5dbdbb 100644 --- a/arch/avr/src/avr32/up_unblocktask.c +++ b/arch/avr/src/avr32/up_unblocktask.c @@ -61,7 +61,7 @@ * but has been prepped to execute. Move the TCB to the * ready-to-run list, restore its context, and start execution. * - * Inputs: + * Input Parameters: * tcb: Refers to the tcb to be unblocked. This tcb is * in one of the waiting tasks lists. It must be moved to * the ready-to-run list and, if it is the highest priority diff --git a/arch/avr/src/avr32/up_usestack.c b/arch/avr/src/avr32/up_usestack.c index 533c82a16c..4e6de52de8 100644 --- a/arch/avr/src/avr32/up_usestack.c +++ b/arch/avr/src/avr32/up_usestack.c @@ -78,7 +78,7 @@ * - adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The * initial value of the stack pointer. * - * Inputs: + * Input Parameters: * - tcb: The TCB of new task * - stack_size: The allocated stack size. * diff --git a/arch/avr/src/common/up_releasestack.c b/arch/avr/src/common/up_releasestack.c index 9cda128cab..f1abcd15d9 100644 --- a/arch/avr/src/common/up_releasestack.c +++ b/arch/avr/src/common/up_releasestack.c @@ -66,7 +66,7 @@ * A task has been stopped. Free all stack related resources retained in * the defunct TCB. * - * Input Parmeters + * Input Parameters: * - dtcb: The TCB containing information about the stack to be released * - ttype: The thread type. This may be one of following (defined in * include/nuttx/sched.h): diff --git a/arch/hc/src/common/up_blocktask.c b/arch/hc/src/common/up_blocktask.c index f6308cb729..9c69ac43db 100644 --- a/arch/hc/src/common/up_blocktask.c +++ b/arch/hc/src/common/up_blocktask.c @@ -62,7 +62,7 @@ * the ready to run list must be stopped. Save its context * and move it to the inactive list specified by task_state. * - * Inputs: + * Input Parameters: * tcb: Refers to a task in the ready-to-run list (normally * the task at the head of the list). It most be * stopped, its context saved and moved into one of the diff --git a/arch/hc/src/common/up_createstack.c b/arch/hc/src/common/up_createstack.c index f09b98a87a..5f954588f3 100644 --- a/arch/hc/src/common/up_createstack.c +++ b/arch/hc/src/common/up_createstack.c @@ -78,7 +78,7 @@ * - adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The initial value of * the stack pointer. * - * Inputs: + * Input Parameters: * - tcb: The TCB of new task * - stack_size: The requested stack size. At least this much * must be allocated. diff --git a/arch/hc/src/common/up_releasestack.c b/arch/hc/src/common/up_releasestack.c index 03d50098e1..5280674c99 100644 --- a/arch/hc/src/common/up_releasestack.c +++ b/arch/hc/src/common/up_releasestack.c @@ -66,7 +66,7 @@ * A task has been stopped. Free all stack related resources retained in * the defunct TCB. * - * Input Parmeters + * Input Parameters: * - dtcb: The TCB containing information about the stack to be released * - ttype: The thread type. This may be one of following (defined in * include/nuttx/sched.h): diff --git a/arch/hc/src/common/up_reprioritizertr.c b/arch/hc/src/common/up_reprioritizertr.c index 0b0d400d9a..757f2ad05c 100644 --- a/arch/hc/src/common/up_reprioritizertr.c +++ b/arch/hc/src/common/up_reprioritizertr.c @@ -68,7 +68,7 @@ * the priority of the current, running task and it now has the * priority. * - * Inputs: + * Input Parameters: * tcb: The TCB of the task that has been reprioritized * priority: The new task priority * diff --git a/arch/hc/src/common/up_stackframe.c b/arch/hc/src/common/up_stackframe.c index d712bb7d3b..57d899f08e 100644 --- a/arch/hc/src/common/up_stackframe.c +++ b/arch/hc/src/common/up_stackframe.c @@ -98,7 +98,7 @@ * been removed from the stack. This will still be the initial value * of the stack pointer when the task is started. * - * Inputs: + * Input Parameters: * - tcb: The TCB of new task * - frame_size: The size of the stack frame to allocate. * diff --git a/arch/hc/src/common/up_unblocktask.c b/arch/hc/src/common/up_unblocktask.c index c2ed818ac3..6ab177ecf1 100644 --- a/arch/hc/src/common/up_unblocktask.c +++ b/arch/hc/src/common/up_unblocktask.c @@ -61,7 +61,7 @@ * but has been prepped to execute. Move the TCB to the * ready-to-run list, restore its context, and start execution. * - * Inputs: + * Input Parameters: * tcb: Refers to the tcb to be unblocked. This tcb is * in one of the waiting tasks lists. It must be moved to * the ready-to-run list and, if it is the highest priority diff --git a/arch/hc/src/common/up_usestack.c b/arch/hc/src/common/up_usestack.c index 6160e92b5e..4ecf5351f7 100644 --- a/arch/hc/src/common/up_usestack.c +++ b/arch/hc/src/common/up_usestack.c @@ -77,7 +77,7 @@ * - adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The * initial value of the stack pointer. * - * Inputs: + * Input Parameters: * - tcb: The TCB of new task * - stack_size: The allocated stack size. * diff --git a/arch/hc/src/m9s12/m9s12.h b/arch/hc/src/m9s12/m9s12.h index 53da6a7726..48a09dde88 100644 --- a/arch/hc/src/m9s12/m9s12.h +++ b/arch/hc/src/m9s12/m9s12.h @@ -329,7 +329,7 @@ int hcs12_ethinitialize(int intf); * Description: * Initialize the selected SPI port * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has multiple SPI interfaces) * * Returned Value: diff --git a/arch/mips/src/common/up_createstack.c b/arch/mips/src/common/up_createstack.c index 69d5ff0486..715bf8151e 100644 --- a/arch/mips/src/common/up_createstack.c +++ b/arch/mips/src/common/up_createstack.c @@ -99,7 +99,7 @@ * - adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The initial value of * the stack pointer. * - * Inputs: + * Input Parameters: * - tcb: The TCB of new task * - stack_size: The requested stack size. At least this much * must be allocated. diff --git a/arch/mips/src/common/up_releasestack.c b/arch/mips/src/common/up_releasestack.c index a322f4c24c..d08bc2e6d9 100644 --- a/arch/mips/src/common/up_releasestack.c +++ b/arch/mips/src/common/up_releasestack.c @@ -66,7 +66,7 @@ * A task has been stopped. Free all stack related resources retained in * the defunct TCB. * - * Input Parmeters + * Input Parameters: * - dtcb: The TCB containing information about the stack to be released * - ttype: The thread type. This may be one of following (defined in * include/nuttx/sched.h): diff --git a/arch/mips/src/common/up_stackframe.c b/arch/mips/src/common/up_stackframe.c index 6c631f3e1f..45c8c05908 100644 --- a/arch/mips/src/common/up_stackframe.c +++ b/arch/mips/src/common/up_stackframe.c @@ -100,7 +100,7 @@ * been removed from the stack. This will still be the initial value * of the stack pointer when the task is started. * - * Inputs: + * Input Parameters: * - tcb: The TCB of new task * - frame_size: The size of the stack frame to allocate. * diff --git a/arch/mips/src/common/up_usestack.c b/arch/mips/src/common/up_usestack.c index b4e3098fc4..041057a40e 100644 --- a/arch/mips/src/common/up_usestack.c +++ b/arch/mips/src/common/up_usestack.c @@ -98,7 +98,7 @@ * - adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The * initial value of the stack pointer. * - * Inputs: + * Input Parameters: * - tcb: The TCB of new task * - stack_size: The allocated stack size. * diff --git a/arch/mips/src/mips32/up_blocktask.c b/arch/mips/src/mips32/up_blocktask.c index 1ad66ce9db..6ee466611d 100644 --- a/arch/mips/src/mips32/up_blocktask.c +++ b/arch/mips/src/mips32/up_blocktask.c @@ -63,7 +63,7 @@ * the ready to run list must be stopped. Save its context * and move it to the inactive list specified by task_state. * - * Inputs: + * Input Parameters: * tcb: Refers to a task in the ready-to-run list (normally * the task at the head of the list). It most be * stopped, its context saved and moved into one of the diff --git a/arch/mips/src/mips32/up_reprioritizertr.c b/arch/mips/src/mips32/up_reprioritizertr.c index 22a204d58b..cae6ed3af5 100644 --- a/arch/mips/src/mips32/up_reprioritizertr.c +++ b/arch/mips/src/mips32/up_reprioritizertr.c @@ -70,7 +70,7 @@ * the priority of the current, running task and it now has the * priority. * - * Inputs: + * Input Parameters: * tcb: The TCB of the task that has been reprioritized * priority: The new task priority * diff --git a/arch/mips/src/mips32/up_unblocktask.c b/arch/mips/src/mips32/up_unblocktask.c index 9e72ef17a6..8400b1f7cf 100644 --- a/arch/mips/src/mips32/up_unblocktask.c +++ b/arch/mips/src/mips32/up_unblocktask.c @@ -63,7 +63,7 @@ * but has been prepped to execute. Move the TCB to the * ready-to-run list, restore its context, and start execution. * - * Inputs: + * Input Parameters: * tcb: Refers to the tcb to be unblocked. This tcb is * in one of the waiting tasks lists. It must be moved to * the ready-to-run list and, if it is the highest priority diff --git a/arch/mips/src/mips32/up_vfork.c b/arch/mips/src/mips32/up_vfork.c index 06b79f7bb1..d62c2dd623 100644 --- a/arch/mips/src/mips32/up_vfork.c +++ b/arch/mips/src/mips32/up_vfork.c @@ -100,10 +100,10 @@ * * task_vforkabort() may be called if an error occurs between steps 3 and 6. * - * Input Paremeters: + * Input Parameters: * context - Caller context information saved by vfork() * - * Return: + * Returned Value: * Upon successful completion, vfork() returns 0 to the child process and * returns the process ID of the child process to the parent process. * Otherwise, -1 is returned to the parent, no child process is created, diff --git a/arch/mips/src/mips32/vfork.S b/arch/mips/src/mips32/vfork.S index 7012b45a41..bfcd9e51f4 100644 --- a/arch/mips/src/mips32/vfork.S +++ b/arch/mips/src/mips32/vfork.S @@ -86,10 +86,10 @@ * 5) up_vfork() then calls task_vforkstart() * 6) task_vforkstart() then executes the child thread. * - * Input Paremeters: + * Input Parameters: * None * - * Return: + * Returned Value: * Upon successful completion, vfork() returns 0 to the child process and returns * the process ID of the child process to the parent process. Otherwise, -1 is * returned to the parent, no child process is created, and errno is set to diff --git a/arch/mips/src/pic32mx/pic32mx-spi.c b/arch/mips/src/pic32mx/pic32mx-spi.c index e09688e42c..ed3e8bae41 100644 --- a/arch/mips/src/pic32mx/pic32mx-spi.c +++ b/arch/mips/src/pic32mx/pic32mx-spi.c @@ -842,7 +842,7 @@ static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t nw * Description: * Initialize the selected SPI port * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple SPI interfaces) * * Returned Value: diff --git a/arch/mips/src/pic32mx/pic32mx.h b/arch/mips/src/pic32mx/pic32mx.h index 480ff80fb8..e76f02c871 100644 --- a/arch/mips/src/pic32mx/pic32mx.h +++ b/arch/mips/src/pic32mx/pic32mx.h @@ -391,7 +391,7 @@ void pic32mx_dumpgpio(uint32_t pinset, const char *msg); * Description: * Initialize the selected SPI port * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple SPI interfaces) * * Returned Value: diff --git a/arch/mips/src/pic32mz/pic32mz-spi.c b/arch/mips/src/pic32mz/pic32mz-spi.c index 287c538b7d..ea2f906cb9 100644 --- a/arch/mips/src/pic32mz/pic32mz-spi.c +++ b/arch/mips/src/pic32mz/pic32mz-spi.c @@ -1199,7 +1199,7 @@ static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, * Description: * Initialize the selected SPI port * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple SPI interfaces) * * Returned Value: diff --git a/arch/mips/src/pic32mz/pic32mz-spi.h b/arch/mips/src/pic32mz/pic32mz-spi.h index ce4d772e0a..4770661d3f 100644 --- a/arch/mips/src/pic32mz/pic32mz-spi.h +++ b/arch/mips/src/pic32mz/pic32mz-spi.h @@ -78,7 +78,7 @@ struct spi_dev_s; /* Forward reference */ * Description: * Initialize the selected SPI port * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple SPI interfaces) * * Returned Value: diff --git a/arch/misoc/src/lm32/lm32_blocktask.c b/arch/misoc/src/lm32/lm32_blocktask.c index f313da11cc..7bc951cfbf 100644 --- a/arch/misoc/src/lm32/lm32_blocktask.c +++ b/arch/misoc/src/lm32/lm32_blocktask.c @@ -64,7 +64,7 @@ * the ready to run list must be stopped. Save its context * and move it to the inactive list specified by task_state. * - * Inputs: + * Input Parameters: * tcb: Refers to a task in the ready-to-run list (normally * the task at the head of the list). It most be * stopped, its context saved and moved into one of the diff --git a/arch/misoc/src/lm32/lm32_createstack.c b/arch/misoc/src/lm32/lm32_createstack.c index 31c7f24226..a9aa3143a1 100644 --- a/arch/misoc/src/lm32/lm32_createstack.c +++ b/arch/misoc/src/lm32/lm32_createstack.c @@ -99,7 +99,7 @@ * - adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The initial value of * the stack pointer. * - * Inputs: + * Input Parameters: * - tcb: The TCB of new task * - stack_size: The requested stack size. At least this much * must be allocated. diff --git a/arch/misoc/src/lm32/lm32_releasestack.c b/arch/misoc/src/lm32/lm32_releasestack.c index fa88500bf9..63f4ab8f99 100644 --- a/arch/misoc/src/lm32/lm32_releasestack.c +++ b/arch/misoc/src/lm32/lm32_releasestack.c @@ -59,7 +59,7 @@ * A task has been stopped. Free all stack related resources retained in * the defunct TCB. * - * Input Parmeters + * Input Parameters: * - dtcb: The TCB containing information about the stack to be released * - ttype: The thread type. This may be one of following (defined in * include/nuttx/sched.h): diff --git a/arch/misoc/src/lm32/lm32_reprioritizertr.c b/arch/misoc/src/lm32/lm32_reprioritizertr.c index e6b4261101..735b69ced7 100644 --- a/arch/misoc/src/lm32/lm32_reprioritizertr.c +++ b/arch/misoc/src/lm32/lm32_reprioritizertr.c @@ -70,7 +70,7 @@ * the priority of the current, running task and it now has the * priority. * - * Inputs: + * Input Parameters: * tcb: The TCB of the task that has been reprioritized * priority: The new task priority * diff --git a/arch/misoc/src/lm32/lm32_stackframe.c b/arch/misoc/src/lm32/lm32_stackframe.c index 981c655f81..0791201b4e 100644 --- a/arch/misoc/src/lm32/lm32_stackframe.c +++ b/arch/misoc/src/lm32/lm32_stackframe.c @@ -94,7 +94,7 @@ * been removed from the stack. This will still be the initial value * of the stack pointer when the task is started. * - * Inputs: + * Input Parameters: * - tcb: The TCB of new task * - frame_size: The size of the stack frame to allocate. * diff --git a/arch/misoc/src/lm32/lm32_unblocktask.c b/arch/misoc/src/lm32/lm32_unblocktask.c index 74b1d92472..8dedd52993 100644 --- a/arch/misoc/src/lm32/lm32_unblocktask.c +++ b/arch/misoc/src/lm32/lm32_unblocktask.c @@ -64,7 +64,7 @@ * but has been prepped to execute. Move the TCB to the * ready-to-run list, restore its context, and start execution. * - * Inputs: + * Input Parameters: * tcb: Refers to the tcb to be unblocked. This tcb is * in one of the waiting tasks lists. It must be moved to * the ready-to-run list and, if it is the highest priority diff --git a/arch/renesas/src/common/up_blocktask.c b/arch/renesas/src/common/up_blocktask.c index 9e8ba57db7..9ceda2e1e2 100644 --- a/arch/renesas/src/common/up_blocktask.c +++ b/arch/renesas/src/common/up_blocktask.c @@ -61,7 +61,7 @@ * the ready to run list must be stopped. Save its context * and move it to the inactive list specified by task_state. * - * Inputs: + * Input Parameters: * tcb: Refers to a task in the ready-to-run list (normally * the task at the head of the list). It most be * stopped, its context saved and moved into one of the diff --git a/arch/renesas/src/common/up_createstack.c b/arch/renesas/src/common/up_createstack.c index 1bbf3cc8e0..f4461a08b3 100644 --- a/arch/renesas/src/common/up_createstack.c +++ b/arch/renesas/src/common/up_createstack.c @@ -78,7 +78,7 @@ * - adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The initial value of * the stack pointer. * - * Inputs: + * Input Parameters: * - tcb: The TCB of new task * - stack_size: The requested stack size. At least this much * must be allocated. diff --git a/arch/renesas/src/common/up_releasestack.c b/arch/renesas/src/common/up_releasestack.c index e2b5948b14..5b309bde16 100644 --- a/arch/renesas/src/common/up_releasestack.c +++ b/arch/renesas/src/common/up_releasestack.c @@ -66,7 +66,7 @@ * A task has been stopped. Free all stack related resources retained in * the defunct TCB. * - * Input Parmeters + * Input Parameters: * - dtcb: The TCB containing information about the stack to be released * - ttype: The thread type. This may be one of following (defined in * include/nuttx/sched.h): diff --git a/arch/renesas/src/common/up_reprioritizertr.c b/arch/renesas/src/common/up_reprioritizertr.c index c476dbad37..2733ecb8d9 100644 --- a/arch/renesas/src/common/up_reprioritizertr.c +++ b/arch/renesas/src/common/up_reprioritizertr.c @@ -68,7 +68,7 @@ * the priority of the current, running task and it now has the * priority. * - * Inputs: + * Input Parameters: * tcb: The TCB of the task that has been reprioritized * priority: The new task priority * diff --git a/arch/renesas/src/common/up_stackframe.c b/arch/renesas/src/common/up_stackframe.c index 811fcd4aad..d3512ec9c9 100644 --- a/arch/renesas/src/common/up_stackframe.c +++ b/arch/renesas/src/common/up_stackframe.c @@ -96,7 +96,7 @@ * been removed from the stack. This will still be the initial value * of the stack pointer when the task is started. * - * Inputs: + * Input Parameters: * - tcb: The TCB of new task * - frame_size: The size of the stack frame to allocate. * diff --git a/arch/renesas/src/common/up_unblocktask.c b/arch/renesas/src/common/up_unblocktask.c index de3008f98a..30a9b4af9c 100644 --- a/arch/renesas/src/common/up_unblocktask.c +++ b/arch/renesas/src/common/up_unblocktask.c @@ -61,7 +61,7 @@ * but has been prepped to execute. Move the TCB to the * ready-to-run list, restore its context, and start execution. * - * Inputs: + * Input Parameters: * tcb: Refers to the tcb to be unblocked. This tcb is * in one of the waiting tasks lists. It must be moved to * the ready-to-run list and, if it is the highest priority diff --git a/arch/renesas/src/common/up_usestack.c b/arch/renesas/src/common/up_usestack.c index de4c4aca95..9fce7d5965 100644 --- a/arch/renesas/src/common/up_usestack.c +++ b/arch/renesas/src/common/up_usestack.c @@ -78,7 +78,7 @@ * - adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The * initial value of the stack pointer. * - * Inputs: + * Input Parameters: * - tcb: The TCB of new task * - stack_size: The allocated stack size. * diff --git a/arch/risc-v/src/common/up_createstack.c b/arch/risc-v/src/common/up_createstack.c index 494d54e4ab..1861707685 100644 --- a/arch/risc-v/src/common/up_createstack.c +++ b/arch/risc-v/src/common/up_createstack.c @@ -99,7 +99,7 @@ * - adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The initial value of * the stack pointer. * - * Inputs: + * Input Parameters: * - tcb: The TCB of new task * - stack_size: The requested stack size. At least this much * must be allocated. diff --git a/arch/risc-v/src/common/up_releasestack.c b/arch/risc-v/src/common/up_releasestack.c index 15301c49d2..dac7cea0d6 100644 --- a/arch/risc-v/src/common/up_releasestack.c +++ b/arch/risc-v/src/common/up_releasestack.c @@ -66,7 +66,7 @@ * A task has been stopped. Free all stack related resources retained in * the defunct TCB. * - * Input Parmeters + * Input Parameters: * - dtcb: The TCB containing information about the stack to be released * - ttype: The thread type. This may be one of following (defined in * include/nuttx/sched.h): diff --git a/arch/risc-v/src/common/up_stackframe.c b/arch/risc-v/src/common/up_stackframe.c index b3cb9801d4..be7b797d2c 100644 --- a/arch/risc-v/src/common/up_stackframe.c +++ b/arch/risc-v/src/common/up_stackframe.c @@ -100,7 +100,7 @@ * been removed from the stack. This will still be the initial value * of the stack pointer when the task is started. * - * Inputs: + * Input Parameters: * - tcb: The TCB of new task * - frame_size: The size of the stack frame to allocate. * diff --git a/arch/risc-v/src/common/up_usestack.c b/arch/risc-v/src/common/up_usestack.c index 605bb79b04..49333a5a12 100644 --- a/arch/risc-v/src/common/up_usestack.c +++ b/arch/risc-v/src/common/up_usestack.c @@ -98,7 +98,7 @@ * - adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The * initial value of the stack pointer. * - * Inputs: + * Input Parameters: * - tcb: The TCB of new task * - stack_size: The allocated stack size. * diff --git a/arch/risc-v/src/nr5m100/nr5_timer.h b/arch/risc-v/src/nr5m100/nr5_timer.h index 2a6d15c3e3..5994df9bee 100644 --- a/arch/risc-v/src/nr5m100/nr5_timer.h +++ b/arch/risc-v/src/nr5m100/nr5_timer.h @@ -148,7 +148,7 @@ int nr5_timer_deinit(FAR struct nr5_timer_dev_s *dev); * devpath - The full path to the timer device. This should be of the form /dev/timer0 * timer - the timer number. * - * Returned Values: + * Returned Value: * Zero (OK) is returned on success; A negated errno value is returned * to indicate the nature of any failure. * diff --git a/arch/risc-v/src/rv32im/up_blocktask.c b/arch/risc-v/src/rv32im/up_blocktask.c index 530797da2b..0ac7327e12 100644 --- a/arch/risc-v/src/rv32im/up_blocktask.c +++ b/arch/risc-v/src/rv32im/up_blocktask.c @@ -63,7 +63,7 @@ * the ready to run list must be stopped. Save its context * and move it to the inactive list specified by task_state. * - * Inputs: + * Input Parameters: * tcb: Refers to a task in the ready-to-run list (normally * the task at the head of the list). It most be * stopped, its context saved and moved into one of the diff --git a/arch/risc-v/src/rv32im/up_reprioritizertr.c b/arch/risc-v/src/rv32im/up_reprioritizertr.c index 26ed4ab2d1..e286d5026e 100644 --- a/arch/risc-v/src/rv32im/up_reprioritizertr.c +++ b/arch/risc-v/src/rv32im/up_reprioritizertr.c @@ -70,7 +70,7 @@ * the priority of the current, running task and it now has the * priority. * - * Inputs: + * Input Parameters: * tcb: The TCB of the task that has been reprioritized * priority: The new task priority * diff --git a/arch/risc-v/src/rv32im/up_unblocktask.c b/arch/risc-v/src/rv32im/up_unblocktask.c index 1b7350e05b..3bb71380dd 100644 --- a/arch/risc-v/src/rv32im/up_unblocktask.c +++ b/arch/risc-v/src/rv32im/up_unblocktask.c @@ -63,7 +63,7 @@ * but has been prepped to execute. Move the TCB to the * ready-to-run list, restore its context, and start execution. * - * Inputs: + * Input Parameters: * tcb: Refers to the tcb to be unblocked. This tcb is * in one of the waiting tasks lists. It must be moved to * the ready-to-run list and, if it is the highest priority diff --git a/arch/risc-v/src/rv32im/up_vfork.c b/arch/risc-v/src/rv32im/up_vfork.c index f2f5332bec..d38d29c158 100644 --- a/arch/risc-v/src/rv32im/up_vfork.c +++ b/arch/risc-v/src/rv32im/up_vfork.c @@ -100,10 +100,10 @@ * * task_vforkabort() may be called if an error occurs between steps 3 and 6. * - * Input Paremeters: + * Input Parameters: * context - Caller context information saved by vfork() * - * Return: + * Returned Value: * Upon successful completion, vfork() returns 0 to the child process and * returns the process ID of the child process to the parent process. * Otherwise, -1 is returned to the parent, no child process is created, diff --git a/arch/sim/src/up_blocktask.c b/arch/sim/src/up_blocktask.c index 27223b19c3..86a46453ec 100644 --- a/arch/sim/src/up_blocktask.c +++ b/arch/sim/src/up_blocktask.c @@ -61,7 +61,7 @@ * the ready to run list must be stopped. Save its context * and move it to the inactive list specified by task_state. * - * Inputs: + * Input Parameters: * tcb: Refers to a task in the ready-to-run list (normally * the task at the head of the list). It most be * stopped, its context saved and moved into one of the diff --git a/arch/sim/src/up_cpuidlestack.c b/arch/sim/src/up_cpuidlestack.c index c11d14e4a9..4a237c1b6b 100644 --- a/arch/sim/src/up_cpuidlestack.c +++ b/arch/sim/src/up_cpuidlestack.c @@ -85,7 +85,7 @@ * - adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The initial value of * the stack pointer. * - * Inputs: + * Input Parameters: * - cpu: CPU index that indicates which CPU the IDLE task is * being created for. * - tcb: The TCB of new CPU IDLE task diff --git a/arch/sim/src/up_createstack.c b/arch/sim/src/up_createstack.c index 96a4097a23..2d511ba6c5 100644 --- a/arch/sim/src/up_createstack.c +++ b/arch/sim/src/up_createstack.c @@ -84,7 +84,7 @@ * - adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The initial value of * the stack pointer. * - * Inputs: + * Input Parameters: * - tcb: The TCB of new task * - stack_size: The requested stack size. At least this much * must be allocated. diff --git a/arch/sim/src/up_framebuffer.c b/arch/sim/src/up_framebuffer.c index 195eadd6a4..8e374a2781 100644 --- a/arch/sim/src/up_framebuffer.c +++ b/arch/sim/src/up_framebuffer.c @@ -356,7 +356,7 @@ static int up_setcursor(FAR struct fb_vtable_s *vtable, * Description: * Initialize the framebuffer video hardware associated with the display. * - * Input parameters: + * Input Parameters: * display - In the case of hardware with multiple displays, this * specifies the display. Normally this is zero. * @@ -384,7 +384,7 @@ int up_fbinitialize(int display) * Return a a reference to the framebuffer object for the specified video * plane of the specified plane. Many OSDs support multiple planes of video. * - * Input parameters: + * Input Parameters: * display - In the case of hardware with multiple displays, this * specifies the display. Normally this is zero. * vplane - Identifies the plane being queried. diff --git a/arch/sim/src/up_qspiflash.c b/arch/sim/src/up_qspiflash.c index c94986b3d3..f01002d7fe 100644 --- a/arch/sim/src/up_qspiflash.c +++ b/arch/sim/src/up_qspiflash.c @@ -577,7 +577,7 @@ static int qspiflash_command(FAR struct qspi_dev_s *dev, FAR struct qspi_cmdinfo * Description: * Initialize the selected SPI port * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has multiple SPI interfaces) * * Returned Value: diff --git a/arch/sim/src/up_releasestack.c b/arch/sim/src/up_releasestack.c index e62cf2adf8..87a3026126 100644 --- a/arch/sim/src/up_releasestack.c +++ b/arch/sim/src/up_releasestack.c @@ -57,7 +57,7 @@ * A task has been stopped. Free all stack related resources retained in * the defunct TCB. * - * Input Parmeters + * Input Parameters: * - dtcb: The TCB containing information about the stack to be released * - ttype: The thread type. This may be one of following (defined in * include/nuttx/sched.h): diff --git a/arch/sim/src/up_reprioritizertr.c b/arch/sim/src/up_reprioritizertr.c index 048c311559..36e3423047 100644 --- a/arch/sim/src/up_reprioritizertr.c +++ b/arch/sim/src/up_reprioritizertr.c @@ -68,7 +68,7 @@ * the priority of the current, running task and it now has the * priority. * - * Inputs: + * Input Parameters: * tcb: The TCB of the task that has been reprioritized * priority: The new task priority * diff --git a/arch/sim/src/up_spiflash.c b/arch/sim/src/up_spiflash.c index 677bdafd96..a75cb82948 100644 --- a/arch/sim/src/up_spiflash.c +++ b/arch/sim/src/up_spiflash.c @@ -897,7 +897,7 @@ static uint16_t spiflash_readword(FAR struct sim_spiflashdev_s *priv) * Description: * Initialize the selected SPI port * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has multiple SPI interfaces) * * Returned Value: diff --git a/arch/sim/src/up_stackframe.c b/arch/sim/src/up_stackframe.c index 3e5b8a089d..624520dc20 100644 --- a/arch/sim/src/up_stackframe.c +++ b/arch/sim/src/up_stackframe.c @@ -90,7 +90,7 @@ * been removed from the stack. This will still be the initial value * of the stack pointer when the task is started. * - * Inputs: + * Input Parameters: * - tcb: The TCB of new task * - frame_size: The size of the stack frame to allocate. * diff --git a/arch/sim/src/up_unblocktask.c b/arch/sim/src/up_unblocktask.c index 5217efeb8f..03e8e847f9 100644 --- a/arch/sim/src/up_unblocktask.c +++ b/arch/sim/src/up_unblocktask.c @@ -60,7 +60,7 @@ * but has been prepped to execute. Move the TCB to the * ready-to-run list, restore its context, and start execution. * - * Inputs: + * Input Parameters: * tcb: Refers to the tcb to be unblocked. This tcb is * in one of the waiting tasks lists. It must be moved to * the ready-to-run list and, if it is the highest priority diff --git a/arch/sim/src/up_usestack.c b/arch/sim/src/up_usestack.c index 3b428d8222..f31ed5aae3 100644 --- a/arch/sim/src/up_usestack.c +++ b/arch/sim/src/up_usestack.c @@ -85,7 +85,7 @@ * - adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The * initial value of the stack pointer. * - * Inputs: + * Input Parameters: * - tcb: The TCB of new task * - stack_size: The allocated stack size. * diff --git a/arch/x86/src/common/up_blocktask.c b/arch/x86/src/common/up_blocktask.c index e5a4845e24..34f7f9fa26 100644 --- a/arch/x86/src/common/up_blocktask.c +++ b/arch/x86/src/common/up_blocktask.c @@ -62,7 +62,7 @@ * be stopped. Save its context and move it to the inactive list specified * by task_state. * - * Inputs: + * Input Parameters: * tcb: Refers to a task in the ready-to-run list (normally the task at the * head of the list). It most be stopped, its context saved and moved * into one of the waiting task lists. It it was the task at the head diff --git a/arch/x86/src/common/up_reprioritizertr.c b/arch/x86/src/common/up_reprioritizertr.c index 110d26a671..75428b84c9 100644 --- a/arch/x86/src/common/up_reprioritizertr.c +++ b/arch/x86/src/common/up_reprioritizertr.c @@ -68,7 +68,7 @@ * the priority of the current, running task and it now has the * priority. * - * Inputs: + * Input Parameters: * tcb: The TCB of the task that has been reprioritized * priority: The new task priority * diff --git a/arch/x86/src/common/up_unblocktask.c b/arch/x86/src/common/up_unblocktask.c index 706d36808c..8b3b4b3f24 100644 --- a/arch/x86/src/common/up_unblocktask.c +++ b/arch/x86/src/common/up_unblocktask.c @@ -61,7 +61,7 @@ * execute. Move the TCB to the ready-to-run list, restore its context, * and start execution. * - * Inputs: + * Input Parameters: * tcb: Refers to the tcb to be unblocked. This tcb is in one of the * waiting tasks lists. It must be moved to the ready-to-run list and, * if it is the highest priority ready to run task, executed. diff --git a/arch/x86/src/i486/up_createstack.c b/arch/x86/src/i486/up_createstack.c index f51d6f2ca2..8173457e80 100644 --- a/arch/x86/src/i486/up_createstack.c +++ b/arch/x86/src/i486/up_createstack.c @@ -80,7 +80,7 @@ * - adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The initial value of * the stack pointer. * - * Inputs: + * Input Parameters: * - tcb: The TCB of new task * - stack_size: The requested stack size. At least this much * must be allocated. diff --git a/arch/x86/src/i486/up_releasestack.c b/arch/x86/src/i486/up_releasestack.c index 0f23cd3fb7..e83434024e 100644 --- a/arch/x86/src/i486/up_releasestack.c +++ b/arch/x86/src/i486/up_releasestack.c @@ -66,7 +66,7 @@ * A task has been stopped. Free all stack related resources retained in * the defunct TCB. * - * Input Parmeters + * Input Parameters: * - dtcb: The TCB containing information about the stack to be released * - ttype: The thread type. This may be one of following (defined in * include/nuttx/sched.h): diff --git a/arch/x86/src/i486/up_stackframe.c b/arch/x86/src/i486/up_stackframe.c index fab05bff9c..62bd968a0f 100644 --- a/arch/x86/src/i486/up_stackframe.c +++ b/arch/x86/src/i486/up_stackframe.c @@ -99,7 +99,7 @@ * been removed from the stack. This will still be the initial value * of the stack pointer when the task is started. * - * Inputs: + * Input Parameters: * - tcb: The TCB of new task * - frame_size: The size of the stack frame to allocate. * diff --git a/arch/x86/src/i486/up_usestack.c b/arch/x86/src/i486/up_usestack.c index b2005fe2de..59221bedd6 100644 --- a/arch/x86/src/i486/up_usestack.c +++ b/arch/x86/src/i486/up_usestack.c @@ -78,7 +78,7 @@ * - adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The * initial value of the stack pointer. * - * Inputs: + * Input Parameters: * - tcb: The TCB of new task * - stack_size: The allocated stack size. * diff --git a/arch/x86/src/qemu/qemu.h b/arch/x86/src/qemu/qemu.h index 561c68da44..80eceb18b3 100644 --- a/arch/x86/src/qemu/qemu.h +++ b/arch/x86/src/qemu/qemu.h @@ -201,7 +201,7 @@ int i486_dumpgpio(uint16_t pinset, const char *msg); * Description: * Initialize the selected SPI port * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has multiple SPI interfaces) * * Returned Value: diff --git a/arch/x86/src/qemu/qemu_vga.c b/arch/x86/src/qemu/qemu_vga.c index 1513339332..f29b74abc4 100644 --- a/arch/x86/src/qemu/qemu_vga.c +++ b/arch/x86/src/qemu/qemu_vga.c @@ -183,7 +183,8 @@ static const struct file_operations g_vgaops = * you'll need to switch planes to access the whole screen but * that allows you using any resolution, up to 400x600 * - * Returns 0=ok, -n=fail + * Returned Value: + * 0=ok, -n=fail */ static int init_graph_vga(int width, int height,int chain4) diff --git a/arch/xtensa/src/common/xtensa_assert.c b/arch/xtensa/src/common/xtensa_assert.c index 24b7fd7e23..e290be637f 100644 --- a/arch/xtensa/src/common/xtensa_assert.c +++ b/arch/xtensa/src/common/xtensa_assert.c @@ -180,7 +180,7 @@ void up_assert(const uint8_t *filename, int lineno) * - Co-processor exception * - High priority level2-6 Exception. * - * Input parameters: + * Input Parameters: * xcptcode - Identifies the unhandled exception (see include/esp32/irq.h) * regs - The register save are at the time of the interrupt. * @@ -280,7 +280,7 @@ void xtensa_panic(int xptcode, uint32_t *regs) * cause varies 32..39. * 40..63 Reserved * - * Input parameters: + * Input Parameters: * exccause - Identifies the EXCCAUSE of the user exception * regs - The register save are at the time of the interrupt. * diff --git a/arch/xtensa/src/common/xtensa_blocktask.c b/arch/xtensa/src/common/xtensa_blocktask.c index fb1c0f910b..592da9a3f7 100644 --- a/arch/xtensa/src/common/xtensa_blocktask.c +++ b/arch/xtensa/src/common/xtensa_blocktask.c @@ -63,7 +63,7 @@ * the ready to run list must be stopped. Save its context * and move it to the inactive list specified by task_state. * - * Inputs: + * Input Parameters: * tcb: Refers to a task in the ready-to-run list (normally * the task at the head of the list). It most be * stopped, its context saved and moved into one of the diff --git a/arch/xtensa/src/common/xtensa_checkstack.c b/arch/xtensa/src/common/xtensa_checkstack.c index 4853513905..bcfbece0d4 100644 --- a/arch/xtensa/src/common/xtensa_checkstack.c +++ b/arch/xtensa/src/common/xtensa_checkstack.c @@ -72,7 +72,7 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size); * alloc - Allocation base address of the stack * size - The size of the stack in bytes * - * Returned value: + * Returned Value: * The estimated amount of stack space used. * ****************************************************************************/ @@ -174,7 +174,7 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size) * Input Parameters: * None * - * Returned value: + * Returned Value: * The estimated amount of stack space used. * ****************************************************************************/ diff --git a/arch/xtensa/src/common/xtensa_createstack.c b/arch/xtensa/src/common/xtensa_createstack.c index 68308fb527..1632ac445f 100644 --- a/arch/xtensa/src/common/xtensa_createstack.c +++ b/arch/xtensa/src/common/xtensa_createstack.c @@ -91,7 +91,7 @@ * - adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The initial value of * the stack pointer. * - * Inputs: + * Input Parameters: * - tcb: The TCB of new task * - stack_size: The requested stack size. At least this much * must be allocated. diff --git a/arch/xtensa/src/common/xtensa_releasestack.c b/arch/xtensa/src/common/xtensa_releasestack.c index 94bb2d8cd8..738da79284 100644 --- a/arch/xtensa/src/common/xtensa_releasestack.c +++ b/arch/xtensa/src/common/xtensa_releasestack.c @@ -58,7 +58,7 @@ * A task has been stopped. Free all stack related resources retained in * the defunct TCB. * - * Input Parmeters + * Input Parameters: * - dtcb: The TCB containing information about the stack to be released * - ttype: The thread type. This may be one of following (defined in * include/nuttx/sched.h): diff --git a/arch/xtensa/src/common/xtensa_reprioritizertr.c b/arch/xtensa/src/common/xtensa_reprioritizertr.c index 0226d18f72..617bb50c61 100644 --- a/arch/xtensa/src/common/xtensa_reprioritizertr.c +++ b/arch/xtensa/src/common/xtensa_reprioritizertr.c @@ -70,7 +70,7 @@ * the priority of the current, running task and it now has the * priority. * - * Inputs: + * Input Parameters: * tcb: The TCB of the task that has been reprioritized * priority: The new task priority * diff --git a/arch/xtensa/src/common/xtensa_stackframe.c b/arch/xtensa/src/common/xtensa_stackframe.c index 388238d8de..884225d69a 100644 --- a/arch/xtensa/src/common/xtensa_stackframe.c +++ b/arch/xtensa/src/common/xtensa_stackframe.c @@ -92,7 +92,7 @@ * been removed from the stack. This will still be the initial value * of the stack pointer when the task is started. * - * Inputs: + * Input Parameters: * - tcb: The TCB of new task * - frame_size: The size of the stack frame to allocate. * diff --git a/arch/xtensa/src/common/xtensa_unblocktask.c b/arch/xtensa/src/common/xtensa_unblocktask.c index 40ecf73c56..e7fb168ba7 100644 --- a/arch/xtensa/src/common/xtensa_unblocktask.c +++ b/arch/xtensa/src/common/xtensa_unblocktask.c @@ -63,7 +63,7 @@ * but has been prepped to execute. Move the TCB to the * ready-to-run list, restore its context, and start execution. * - * Inputs: + * Input Parameters: * tcb: Refers to the tcb to be unblocked. This tcb is * in one of the waiting tasks lists. It must be moved to * the ready-to-run list and, if it is the highest priority diff --git a/arch/xtensa/src/common/xtensa_usestack.c b/arch/xtensa/src/common/xtensa_usestack.c index 0b5db031e9..4faff7341b 100644 --- a/arch/xtensa/src/common/xtensa_usestack.c +++ b/arch/xtensa/src/common/xtensa_usestack.c @@ -90,7 +90,7 @@ * - adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The * initial value of the stack pointer. * - * Inputs: + * Input Parameters: * - tcb: The TCB of new task * - stack_size: The allocated stack size. * diff --git a/arch/xtensa/src/esp32/esp32_cpuidlestack.c b/arch/xtensa/src/esp32/esp32_cpuidlestack.c index ea475b79b3..8239acb96d 100644 --- a/arch/xtensa/src/esp32/esp32_cpuidlestack.c +++ b/arch/xtensa/src/esp32/esp32_cpuidlestack.c @@ -83,7 +83,7 @@ uint32_t g_cpu1_idlestack[CPU1_IDLETHREAD_STACKWORDS] * - adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The initial value of * the stack pointer. * - * Inputs: + * Input Parameters: * - cpu: CPU index that indicates which CPU the IDLE task is * being created for. * - tcb: The TCB of new CPU IDLE task diff --git a/arch/z16/src/common/up_blocktask.c b/arch/z16/src/common/up_blocktask.c index 8328086de6..0893c933e6 100644 --- a/arch/z16/src/common/up_blocktask.c +++ b/arch/z16/src/common/up_blocktask.c @@ -61,7 +61,7 @@ * the ready to run list must be stopped. Save its context * and move it to the inactive list specified by task_state. * - * Inputs: + * Input Parameters: * tcb: Refers to a task in the ready-to-run list (normally * the task at the head of the list). It most be * stopped, its context saved and moved into one of the diff --git a/arch/z16/src/common/up_createstack.c b/arch/z16/src/common/up_createstack.c index 2c35e68aef..0bab2d3ab3 100644 --- a/arch/z16/src/common/up_createstack.c +++ b/arch/z16/src/common/up_createstack.c @@ -79,7 +79,7 @@ * - adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The initial value of * the stack pointer. * - * Inputs: + * Input Parameters: * - tcb: The TCB of new task * - stack_size: The requested stack size. At least this much * must be allocated. diff --git a/arch/z16/src/common/up_releasestack.c b/arch/z16/src/common/up_releasestack.c index e0f4c4b27f..8d0698ecfd 100644 --- a/arch/z16/src/common/up_releasestack.c +++ b/arch/z16/src/common/up_releasestack.c @@ -66,7 +66,7 @@ * A task has been stopped. Free all stack related resources retained in * the defunct TCB. * - * Input Parmeters + * Input Parameters: * - dtcb: The TCB containing information about the stack to be released * - ttype: The thread type. This may be one of following (defined in * include/nuttx/sched.h): diff --git a/arch/z16/src/common/up_reprioritizertr.c b/arch/z16/src/common/up_reprioritizertr.c index d4fde47f31..588ec4d68f 100644 --- a/arch/z16/src/common/up_reprioritizertr.c +++ b/arch/z16/src/common/up_reprioritizertr.c @@ -69,7 +69,7 @@ * the priority of the current, running task and it now has the * priority. * - * Inputs: + * Input Parameters: * tcb: The TCB of the task that has been reprioritized * priority: The new task priority * diff --git a/arch/z16/src/common/up_stackframe.c b/arch/z16/src/common/up_stackframe.c index 6a2fe6d347..1bed013d99 100644 --- a/arch/z16/src/common/up_stackframe.c +++ b/arch/z16/src/common/up_stackframe.c @@ -97,7 +97,7 @@ * been removed from the stack. This will still be the initial value * of the stack pointer when the task is started. * - * Inputs: + * Input Parameters: * - tcb: The TCB of new task * - frame_size: The size of the stack frame to allocate. * diff --git a/arch/z16/src/common/up_unblocktask.c b/arch/z16/src/common/up_unblocktask.c index d9de4e43b9..2b09dbc301 100644 --- a/arch/z16/src/common/up_unblocktask.c +++ b/arch/z16/src/common/up_unblocktask.c @@ -62,7 +62,7 @@ * but has been prepped to execute. Move the TCB to the * ready-to-run list, restore its context, and start execution. * - * Inputs: + * Input Parameters: * tcb: Refers to the tcb to be unblocked. This tcb is * in one of the waiting tasks lists. It must be moved to * the ready-to-run list and, if it is the highest priority diff --git a/arch/z16/src/common/up_usestack.c b/arch/z16/src/common/up_usestack.c index d65609a67d..044ecdc347 100644 --- a/arch/z16/src/common/up_usestack.c +++ b/arch/z16/src/common/up_usestack.c @@ -78,7 +78,7 @@ * - adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The * initial value of the stack pointer. * - * Inputs: + * Input Parameters: * - tcb: The TCB of new task * - stack_size: The allocated stack size. * diff --git a/arch/z16/src/z16f/z16f_espi.c b/arch/z16/src/z16f/z16f_espi.c index da5b88611e..2a590d9613 100644 --- a/arch/z16/src/z16f/z16f_espi.c +++ b/arch/z16/src/z16f/z16f_espi.c @@ -788,7 +788,7 @@ static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, * Description: * Initialize the selected SPI port * - * Input Parameter: + * Input Parameters: * port - Identifies the "logical" SPI port. Must be zero in this case. * * Returned Value: diff --git a/arch/z16/src/z16f/z16f_lowuart.S b/arch/z16/src/z16f/z16f_lowuart.S index ef7c31a6ca..0a893d7585 100644 --- a/arch/z16/src/z16f/z16f_lowuart.S +++ b/arch/z16/src/z16f/z16f_lowuart.S @@ -191,7 +191,7 @@ _up_lowputc: * Parameters: * r1 = character * - * Return: + * Returned Value: * None * * Modifies r0 @@ -230,7 +230,7 @@ _z16f_xmitc1: * Parmeters: * None * - * Return + * Returned Value: * R0 = Character read * *************************************************************************/ diff --git a/arch/z80/src/common/up_blocktask.c b/arch/z80/src/common/up_blocktask.c index a4aa7b8ed5..6910c87b08 100644 --- a/arch/z80/src/common/up_blocktask.c +++ b/arch/z80/src/common/up_blocktask.c @@ -63,7 +63,7 @@ * the ready to run list must be stopped. Save its context * and move it to the inactive list specified by task_state. * - * Inputs: + * Input Parameters: * tcb: Refers to a task in the ready-to-run list (normally * the task at the head of the list). It most be * stopped, its context saved and moved into one of the diff --git a/arch/z80/src/common/up_createstack.c b/arch/z80/src/common/up_createstack.c index a0a2bc2507..388cfb184d 100644 --- a/arch/z80/src/common/up_createstack.c +++ b/arch/z80/src/common/up_createstack.c @@ -78,7 +78,7 @@ * - adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The initial value of * the stack pointer. * - * Inputs: + * Input Parameters: * - tcb: The TCB of new task * - stack_size: The requested stack size. At least this much * must be allocated. diff --git a/arch/z80/src/common/up_releasestack.c b/arch/z80/src/common/up_releasestack.c index 31237a3ee6..5862240d1f 100644 --- a/arch/z80/src/common/up_releasestack.c +++ b/arch/z80/src/common/up_releasestack.c @@ -66,7 +66,7 @@ * A task has been stopped. Free all stack related resources retained in * the defunct TCB. * - * Input Parmeters + * Input Parameters: * - dtcb: The TCB containing information about the stack to be released * - ttype: The thread type. This may be one of following (defined in * include/nuttx/sched.h): diff --git a/arch/z80/src/common/up_reprioritizertr.c b/arch/z80/src/common/up_reprioritizertr.c index 04675918fd..118ed179c5 100644 --- a/arch/z80/src/common/up_reprioritizertr.c +++ b/arch/z80/src/common/up_reprioritizertr.c @@ -71,7 +71,7 @@ * the priority of the current, running task and it now has the * priority. * - * Inputs: + * Input Parameters: * tcb: The TCB of the task that has been reprioritized * priority: The new task priority * diff --git a/arch/z80/src/common/up_stackframe.c b/arch/z80/src/common/up_stackframe.c index 8f4a0f1806..60ad0851ce 100644 --- a/arch/z80/src/common/up_stackframe.c +++ b/arch/z80/src/common/up_stackframe.c @@ -88,7 +88,7 @@ * been removed from the stack. This will still be the initial value * of the stack pointer when the task is started. * - * Inputs: + * Input Parameters: * - tcb: The TCB of new task * - frame_size: The size of the stack frame to allocate. * diff --git a/arch/z80/src/common/up_unblocktask.c b/arch/z80/src/common/up_unblocktask.c index a27a8e1ddd..66f7337dc6 100644 --- a/arch/z80/src/common/up_unblocktask.c +++ b/arch/z80/src/common/up_unblocktask.c @@ -64,7 +64,7 @@ * but has been prepped to execute. Move the TCB to the * ready-to-run list, restore its context, and start execution. * - * Inputs: + * Input Parameters: * tcb: Refers to the tcb to be unblocked. This tcb is * in one of the waiting tasks lists. It must be moved to * the ready-to-run list and, if it is the highest priority diff --git a/arch/z80/src/common/up_usestack.c b/arch/z80/src/common/up_usestack.c index dd82424d33..7c75a14419 100644 --- a/arch/z80/src/common/up_usestack.c +++ b/arch/z80/src/common/up_usestack.c @@ -77,7 +77,7 @@ * - adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The * initial value of the stack pointer. * - * Inputs: + * Input Parameters: * - tcb: The TCB of new task * - stack_size: The allocated stack size. * diff --git a/arch/z80/src/ez80/ez80_i2c.c b/arch/z80/src/ez80/ez80_i2c.c index 6413a39d4b..a7b7403e67 100644 --- a/arch/z80/src/ez80/ez80_i2c.c +++ b/arch/z80/src/ez80/ez80_i2c.c @@ -929,7 +929,7 @@ static int ez80_i2c_transfer(FAR struct i2c_master_s *dev, * instances of the interface, each of which may be set up with a * different frequency and slave address. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple I2C interfaces) * * Returned Value: diff --git a/arch/z80/src/ez80/ez80_spi.c b/arch/z80/src/ez80/ez80_spi.c index d7f14c7e01..5f337d441a 100644 --- a/arch/z80/src/ez80/ez80_spi.c +++ b/arch/z80/src/ez80/ez80_spi.c @@ -438,7 +438,7 @@ static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t bu * required. Theregore, all GPIO chip management is deferred to board- * specific logic. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple SPI interfaces) * * Returned Value: diff --git a/arch/z80/src/ez80/ez80f91_i2c.h b/arch/z80/src/ez80/ez80f91_i2c.h index b59d4ffc7b..a296eeab70 100644 --- a/arch/z80/src/ez80/ez80f91_i2c.h +++ b/arch/z80/src/ez80/ez80f91_i2c.h @@ -150,7 +150,7 @@ extern "C" * instances of the interface, each of which may be set up with a * different frequency and slave address. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has multiple I2C interfaces) * * Returned Value: @@ -166,7 +166,7 @@ FAR struct i2c_master_s *ez80_i2cbus_initialize(int port); * Description: * De-initialize the selected I2C port, and power down the device. * - * Input Parameter: + * Input Parameters: * Device structure as returned by the ez80_i2cbus_initialize() * * Returned Value: diff --git a/arch/z80/src/ez80/ez80f91_spi.h b/arch/z80/src/ez80/ez80f91_spi.h index fe7c34bb7e..0c49cad1d7 100644 --- a/arch/z80/src/ez80/ez80f91_spi.h +++ b/arch/z80/src/ez80/ez80f91_spi.h @@ -114,7 +114,7 @@ extern "C" * required. Theregore, all GPIO chip management is deferred to board- * specific logic. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple SPI interfaces) * * Returned Value: diff --git a/arch/z80/src/z8/z8_i2c.c b/arch/z80/src/z8/z8_i2c.c index 465debc403..599e6adb32 100644 --- a/arch/z80/src/z8/z8_i2c.c +++ b/arch/z80/src/z8/z8_i2c.c @@ -638,7 +638,7 @@ static int z8_i2c_reset(FAR struct i2c_master_s * dev) * instances of the interface, each of which may be set up with a * different frequency and slave address. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple I2C interfaces) * * Returned Value: diff --git a/audio/audio.c b/audio/audio.c index e4acb10b89..6149eb592b 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -680,7 +680,7 @@ static int audio_ioctl(FAR struct file *filep, int cmd, unsigned long arg) * to enqueue additional buffers and "wake them up" for further * processing. * - * Input parameters: + * Input Parameters: * handle - This is the handle that was provided to the lower-half * start() method. * apb - A pointer to the previsously enqueued ap_buffer_s @@ -767,7 +767,7 @@ static inline void audio_complete(FAR struct audio_upperhalf_s *upper, * Provides a callback interface for lower-half drivers to call to the * upper-half for buffer dequeueing, error reporting, etc. * - * Input parameters: + * Input Parameters: * priv - Private context data owned by the upper-half * reason - The reason code for the callback * apb - A pointer to the previsously enqueued ap_buffer_s @@ -854,7 +854,7 @@ static void audio_callback(FAR void *handle, uint16_t reason, * When this function is called, the "lower half" driver should be in the * reset state (as if the shutdown() method had already been called). * - * Input parameters: + * Input Parameters: * path - The full path to the driver to be registers in the NuttX pseudo- * filesystem. The recommended convention is to name Audio drivers * based on the function they provide, such as "/dev/pcm0", "/dev/mp31", diff --git a/binfmt/binfmt.h b/binfmt/binfmt.h index cfde554d4e..84775cfbd9 100644 --- a/binfmt/binfmt.h +++ b/binfmt/binfmt.h @@ -78,7 +78,7 @@ EXTERN FAR struct binfmt_s *g_binfmts; * Description: * Dump the contents of struct binary_s. * - * Input Parameter: + * Input Parameters: * bin - Load structure * * Returned Value: @@ -101,7 +101,7 @@ int dump_module(FAR const struct binary_s *bin); * address environment of the new process address environment. So we * do not have any real option other than to copy the callers argv[] list. * - * Input Parameter: + * Input Parameters: * bin - Load structure * argv - Argument list * @@ -118,7 +118,7 @@ int binfmt_copyargv(FAR struct binary_s *bin, FAR char * const *argv); * Description: * Release the copied argv[] list. * - * Input Parameter: + * Input Parameters: * bin - Load structure * * Returned Value: diff --git a/binfmt/binfmt_copyargv.c b/binfmt/binfmt_copyargv.c index f0a594f5a6..c3f3dbcc08 100644 --- a/binfmt/binfmt_copyargv.c +++ b/binfmt/binfmt_copyargv.c @@ -72,7 +72,7 @@ * address environment of the new process address environment. So we * do not have any real option other than to copy the callers argv[] list. * - * Input Parameter: + * Input Parameters: * bin - Load structure * argv - Argument list * @@ -167,7 +167,7 @@ int binfmt_copyargv(FAR struct binary_s *bin, FAR char * const *argv) * Description: * Release the copied argv[] list. * - * Input Parameter: + * Input Parameters: * binp - Load structure * * Returned Value: diff --git a/binfmt/binfmt_schedunload.c b/binfmt/binfmt_schedunload.c index e7b981d2fe..1996acd107 100644 --- a/binfmt/binfmt_schedunload.c +++ b/binfmt/binfmt_schedunload.c @@ -74,7 +74,7 @@ FAR struct binary_s *g_unloadhead; * * This function will add one structure to the linked list * - * Input Parameter: + * Input Parameters: * pid - The task ID of the child task * bin - This structure must have been allocated with kmm_malloc() and must * persist until the task unloads @@ -117,7 +117,7 @@ static void unload_list_add(pid_t pid, FAR struct binary_s *bin) * * This function will remove one structure to the linked list * - * Input Parameter: + * Input Parameters: * pid - The task ID of the child task * * Returned Value: @@ -184,7 +184,7 @@ static FAR struct binary_s *unload_list_remove(pid_t pid) * bin was allocated with kmm_malloc() or friends and will also automatically * free the structure with kmm_free() when the task exists. * - * Input Parameter: + * Input Parameters: * pid - The ID of the task that just exited * arg - A reference to the load structure cast to FAR void * * @@ -243,7 +243,7 @@ static void unload_callback(int signo, siginfo_t *info, void *ucontext) * or friends. It will also automatically free the structure with kmm_free() * after unloading the module. * - * Input Parameter: + * Input Parameters: * pid - The task ID of the child task * bin - This structure must have been allocated with kmm_malloc() and must * persist until the task unloads diff --git a/configs/cloudctrl/src/stm32_usb.c b/configs/cloudctrl/src/stm32_usb.c index 7d7ea1732f..bf13400a5b 100644 --- a/configs/cloudctrl/src/stm32_usb.c +++ b/configs/cloudctrl/src/stm32_usb.c @@ -273,11 +273,11 @@ void stm32_usbhost_vbusdrive(int iface, bool enable) * Setup to receive an interrupt-level callback if an overcurrent condition is * detected. * - * Input Parameter: + * Input Parameters: * handler - New overcurrent interrupt handler * arg - The argument provided for the interrupt handler * - * Returned value: + * Returned Value: * Zero (OK) is returned on success. Otherwise, a negated errno value is returned * to indicate the nature of the failure. * diff --git a/configs/dk-tm4c129x/include/board.h b/configs/dk-tm4c129x/include/board.h index 5279f43cf3..c52a8f3b3e 100644 --- a/configs/dk-tm4c129x/include/board.h +++ b/configs/dk-tm4c129x/include/board.h @@ -255,7 +255,7 @@ * Description: * Initialize and register the TMP-100 Temperature Sensor driver. * - * Input parameters: + * Input Parameters: * devpath - The full path to the driver to register. E.g., "/dev/temp0" * * Returned Value: diff --git a/configs/dk-tm4c129x/src/tm4c_tmp100.c b/configs/dk-tm4c129x/src/tm4c_tmp100.c index 29ab1a9aeb..0238c62bb5 100644 --- a/configs/dk-tm4c129x/src/tm4c_tmp100.c +++ b/configs/dk-tm4c129x/src/tm4c_tmp100.c @@ -68,7 +68,7 @@ * Description: * Initialize and register the LM-75 Temperature Sensor driver. * - * Input parameters: + * Input Parameters: * devpath - The full path to the driver to register. E.g., "/dev/temp0" * * Returned Value: diff --git a/configs/ea3131/src/lpc31_usbhost.c b/configs/ea3131/src/lpc31_usbhost.c index 81c8cfa866..eee4f004de 100644 --- a/configs/ea3131/src/lpc31_usbhost.c +++ b/configs/ea3131/src/lpc31_usbhost.c @@ -286,11 +286,11 @@ void lpc31_usbhost_vbusdrive(int rhport, bool enable) * Setup to receive an interrupt-level callback if an overcurrent condition is * detected. * - * Input parameter: + * Input Parameters: * handler - New overcurrent interrupt handler * arg - The argument that will accompany the interrupt * - * Returned value: + * Returned Value: * Zero (OK) returned on success; a negated errno value is returned on failure. * ************************************************************************************/ diff --git a/configs/freedom-kl25z/src/kl_cc3000.c b/configs/freedom-kl25z/src/kl_cc3000.c index e233a64d06..c446ff870b 100644 --- a/configs/freedom-kl25z/src/kl_cc3000.c +++ b/configs/freedom-kl25z/src/kl_cc3000.c @@ -334,7 +334,7 @@ int wireless_archinitialize(size_t max_rx_size) * Warning: This function must be called before ANY other wlan driver * function * - * Input Parmeters: + * Input Parameters: * sWlanCB Asynchronous events callback. * 0 no event call back. * - Call back parameters: diff --git a/configs/freedom-kl25z/src/kl_spi.c b/configs/freedom-kl25z/src/kl_spi.c index e952963d1b..566af53909 100644 --- a/configs/freedom-kl25z/src/kl_spi.c +++ b/configs/freedom-kl25z/src/kl_spi.c @@ -133,7 +133,7 @@ void weak_function kl_spidev_initialize(void) * devid - Identifies the (logical) device * selected - TRUE:Select the device, FALSE:De-select the device * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -182,7 +182,7 @@ void kl_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, * Input Parameters: * devid - Identifies the (logical) device * - * Returned Values: + * Returned Value: * Bit-encoded SPI status (see include/nuttx/spi/spi.h. * ****************************************************************************/ @@ -213,7 +213,7 @@ uint8_t kl_spi1status(FAR struct spi_dev_s *dev, uint32_t devid) * devid - Identifies the (logical) device * cmd - Determines where command or data should be selected. * - * Returned Values: + * Returned Value: * Bit-encoded SPI status (see include/nuttx/spi/spi.h. * ****************************************************************************/ diff --git a/configs/freedom-kl26z/src/kl_spi.c b/configs/freedom-kl26z/src/kl_spi.c index 4c94db9fa3..01cb52fc91 100644 --- a/configs/freedom-kl26z/src/kl_spi.c +++ b/configs/freedom-kl26z/src/kl_spi.c @@ -124,7 +124,7 @@ void weak_function kl_spidev_initialize(void) * devid - Identifies the (logical) device * selected - TRUE:Select the device, FALSE:De-select the device * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -156,7 +156,7 @@ void kl_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, * Input Parameters: * devid - Identifies the (logical) device * - * Returned Values: + * Returned Value: * Bit-encoded SPI status (see include/nuttx/spi/spi.h. * ****************************************************************************/ @@ -187,7 +187,7 @@ uint8_t kl_spi1status(FAR struct spi_dev_s *dev, uint32_t devid) * devid - Identifies the (logical) device * cmd - Determines where command or data should be selected. * - * Returned Values: + * Returned Value: * Bit-encoded SPI status (see include/nuttx/spi/spi.h. * ****************************************************************************/ diff --git a/configs/indium-f7/src/stm32_usb.c b/configs/indium-f7/src/stm32_usb.c index 63d3d5530b..9089232cec 100644 --- a/configs/indium-f7/src/stm32_usb.c +++ b/configs/indium-f7/src/stm32_usb.c @@ -295,11 +295,11 @@ void stm32_usbhost_vbusdrive(int iface, bool enable) * Setup to receive an interrupt-level callback if an overcurrent condition is * detected. * - * Input Parameter: + * Input Parameters: * handler - New overcurrent interrupt handler * arg - The argument provided for the interrupt handler * - * Returned value: + * Returned Value: * Zero (OK) is returned on success. Otherwise, a negated errno value is returned * to indicate the nature of the failure. * diff --git a/configs/mcu123-lpc214x/src/lpc2148_spi1.c b/configs/mcu123-lpc214x/src/lpc2148_spi1.c index a5001a5a0c..8a4675fc9c 100644 --- a/configs/mcu123-lpc214x/src/lpc2148_spi1.c +++ b/configs/mcu123-lpc214x/src/lpc2148_spi1.c @@ -525,7 +525,7 @@ static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t nw * Description: * Initialize the selected SPI port * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple SPI interfaces) * * Returned Value: diff --git a/configs/mikroe-stm32f4/src/stm32_pm.c b/configs/mikroe-stm32f4/src/stm32_pm.c index c5f89f50ab..4ff3d14bad 100644 --- a/configs/mikroe-stm32f4/src/stm32_pm.c +++ b/configs/mikroe-stm32f4/src/stm32_pm.c @@ -78,10 +78,10 @@ * *before* any other device drivers are initialized (since they may * attempt to register with the power management subsystem). * - * Input parameters: + * Input Parameters: * None. * - * Returned value: + * Returned Value: * None. * ****************************************************************************/ diff --git a/configs/mikroe-stm32f4/src/stm32_usb.c b/configs/mikroe-stm32f4/src/stm32_usb.c index f6114e62b7..e242c69060 100644 --- a/configs/mikroe-stm32f4/src/stm32_usb.c +++ b/configs/mikroe-stm32f4/src/stm32_usb.c @@ -272,11 +272,11 @@ void stm32_usbhost_vbusdrive(int iface, bool enable) * Setup to receive an interrupt-level callback if an overcurrent condition is * detected. * - * Input Parameter: + * Input Parameters: * handler - New overcurrent interrupt handler * arg - The argument provided for the interrupt handler * - * Returned value: + * Returned Value: * Zero (OK) is returned on success. Otherwise, a negated errno value is returned * to indicate the nature of the failure. * diff --git a/configs/nucleo-144/src/stm32_usb.c b/configs/nucleo-144/src/stm32_usb.c index 00fdaa9415..82118d87fa 100644 --- a/configs/nucleo-144/src/stm32_usb.c +++ b/configs/nucleo-144/src/stm32_usb.c @@ -294,11 +294,11 @@ void stm32_usbhost_vbusdrive(int iface, bool enable) * Setup to receive an interrupt-level callback if an overcurrent condition is * detected. * - * Input Parameter: + * Input Parameters: * handler - New overcurrent interrupt handler * arg - The argument provided for the interrupt handler * - * Returned value: + * Returned Value: * Zero (OK) is returned on success. Otherwise, a negated errno value is returned * to indicate the nature of the failure. * diff --git a/configs/nucleo-f303re/src/nucleo-f303re.h b/configs/nucleo-f303re/src/nucleo-f303re.h index e11495f5f1..f5ee979d7a 100644 --- a/configs/nucleo-f303re/src/nucleo-f303re.h +++ b/configs/nucleo-f303re/src/nucleo-f303re.h @@ -145,7 +145,7 @@ void weak_function stm32_spidev_initialize(void); * devpath - The full path to the timer device. This should be of the form /dev/timer0 * timer - The timer's number. * - * Returned Values: + * Returned Value: * Zero (OK) is returned on success; A negated errno value is returned * to indicate the nature of any failure. * diff --git a/configs/nucleo-f303re/src/stm32_timer.c b/configs/nucleo-f303re/src/stm32_timer.c index fd82bb6d4f..a13edd2943 100644 --- a/configs/nucleo-f303re/src/stm32_timer.c +++ b/configs/nucleo-f303re/src/stm32_timer.c @@ -68,7 +68,7 @@ * form /dev/timer0 * timer - The timer's number. * - * Returned Values: + * Returned Value: * Zero (OK) is returned on success; A negated errno value is returned * to indicate the nature of any failure. * diff --git a/configs/nucleo-f334r8/src/nucleo-f334r8.h b/configs/nucleo-f334r8/src/nucleo-f334r8.h index 4b2929f8aa..463f20cb24 100644 --- a/configs/nucleo-f334r8/src/nucleo-f334r8.h +++ b/configs/nucleo-f334r8/src/nucleo-f334r8.h @@ -132,7 +132,7 @@ void weak_function stm32_spidev_initialize(void); * devpath - The full path to the timer device. This should be of the form /dev/timer0 * timer - The timer's number. * - * Returned Values: + * Returned Value: * Zero (OK) is returned on success; A negated errno value is returned * to indicate the nature of any failure. * diff --git a/configs/nucleo-l432kc/src/stm32_timer.c b/configs/nucleo-l432kc/src/stm32_timer.c index 8750ba76b9..f7183936d6 100644 --- a/configs/nucleo-l432kc/src/stm32_timer.c +++ b/configs/nucleo-l432kc/src/stm32_timer.c @@ -68,7 +68,7 @@ * form /dev/timer0 * timer - The timer's number. * - * Returned Values: + * Returned Value: * Zero (OK) is returned on success; A negated errno value is returned * to indicate the nature of any failure. * diff --git a/configs/nucleo-l476rg/src/stm32_timer.c b/configs/nucleo-l476rg/src/stm32_timer.c index 2d6f83835e..9f578b5bc6 100644 --- a/configs/nucleo-l476rg/src/stm32_timer.c +++ b/configs/nucleo-l476rg/src/stm32_timer.c @@ -68,7 +68,7 @@ * form /dev/timer0 * timer - The timer's number. * - * Returned Values: + * Returned Value: * Zero (OK) is returned on success; A negated errno value is returned * to indicate the nature of any failure. * diff --git a/configs/nucleo-l496zg/src/stm32_usb.c b/configs/nucleo-l496zg/src/stm32_usb.c index 50ecd74de4..a5a0937b05 100644 --- a/configs/nucleo-l496zg/src/stm32_usb.c +++ b/configs/nucleo-l496zg/src/stm32_usb.c @@ -294,11 +294,11 @@ void stm32_usbhost_vbusdrive(int iface, bool enable) * Setup to receive an interrupt-level callback if an overcurrent condition is * detected. * - * Input Parameter: + * Input Parameters: * handler - New overcurrent interrupt handler * arg - The argument provided for the interrupt handler * - * Returned value: + * Returned Value: * Zero (OK) is returned on success. Otherwise, a negated errno value is returned * to indicate the nature of the failure. * diff --git a/configs/olimex-lpc-h3131/include/board.h b/configs/olimex-lpc-h3131/include/board.h index a411461668..2b9ace582b 100644 --- a/configs/olimex-lpc-h3131/include/board.h +++ b/configs/olimex-lpc-h3131/include/board.h @@ -174,11 +174,11 @@ extern "C" * Setup to receive an interrupt-level callback if an overcurrent condition is * detected. * - * Input parameter: + * Input Parameters: * handler - New overcurrent interrupt handler * arg - The argument that will accompany the interrupt * - * Returned value: + * Returned Value: * Zero (OK) returned on success; a negated errno value is returned on failure. * ************************************************************************************/ diff --git a/configs/olimex-lpc-h3131/src/lpc31_usbhost.c b/configs/olimex-lpc-h3131/src/lpc31_usbhost.c index 37c08d5c43..f267b235e7 100644 --- a/configs/olimex-lpc-h3131/src/lpc31_usbhost.c +++ b/configs/olimex-lpc-h3131/src/lpc31_usbhost.c @@ -293,11 +293,11 @@ void lpc31_usbhost_vbusdrive(int rhport, bool enable) * Setup to receive an interrupt-level callback if an overcurrent condition is * detected. * - * Input parameter: + * Input Parameters: * handler - New overcurrent interrupt handler * arg - The argument that will accompany the interrupt * - * Returned value: + * Returned Value: * Zero (OK) returned on success; a negated errno value is returned on failure. * ************************************************************************************/ diff --git a/configs/olimex-stm32-e407/src/stm32_usb.c b/configs/olimex-stm32-e407/src/stm32_usb.c index fc0b45a4db..5e28e17faa 100644 --- a/configs/olimex-stm32-e407/src/stm32_usb.c +++ b/configs/olimex-stm32-e407/src/stm32_usb.c @@ -301,11 +301,11 @@ void stm32_usbhost_vbusdrive(int iface, bool enable) * Setup to receive an interrupt-level callback if an overcurrent condition is * detected. * - * Input Parameter: + * Input Parameters: * handler - New overcurrent interrupt handler * arg - The argument provided for the interrupt handler * - * Returned value: + * Returned Value: * Zero (OK) is returned on success. Otherwise, a negated errno value is returned * to indicate the nature of the failure. * diff --git a/configs/olimex-stm32-h407/src/stm32_usb.c b/configs/olimex-stm32-h407/src/stm32_usb.c index 6c2cf52e5d..584e8c0a4e 100644 --- a/configs/olimex-stm32-h407/src/stm32_usb.c +++ b/configs/olimex-stm32-h407/src/stm32_usb.c @@ -283,7 +283,7 @@ void stm32_usbhost_vbusdrive(int iface, bool enable) * handler - New overcurrent interrupt handler * arg - The argument provided for the interrupt handler * - * Returned value: + * Returned Value: * Zero (OK) is returned on success. Otherwise, a negated errno value is returned * to indicate the nature of the failure. * diff --git a/configs/olimex-stm32-p207/src/stm32_usb.c b/configs/olimex-stm32-p207/src/stm32_usb.c index da898fd74d..8195a326d2 100644 --- a/configs/olimex-stm32-p207/src/stm32_usb.c +++ b/configs/olimex-stm32-p207/src/stm32_usb.c @@ -237,11 +237,11 @@ int stm32_usbhost_initialize(void) * Setup to receive an interrupt-level callback if an overcurrent condition is * detected. * - * Input Parameter: + * Input Parameters: * handler - New overcurrent interrupt handler * arg - The argument provided for the interrupt handler * - * Returned value: + * Returned Value: * Zero (OK) is returned on success. Otherwise, a negated errno value is returned * to indicate the nature of the failure. * diff --git a/configs/olimex-stm32-p407/src/stm32_usb.c b/configs/olimex-stm32-p407/src/stm32_usb.c index 2f0c652f0a..428b44af62 100644 --- a/configs/olimex-stm32-p407/src/stm32_usb.c +++ b/configs/olimex-stm32-p407/src/stm32_usb.c @@ -300,11 +300,11 @@ void stm32_usbhost_vbusdrive(int iface, bool enable) * Setup to receive an interrupt-level callback if an overcurrent condition is * detected. * - * Input Parameter: + * Input Parameters: * handler - New overcurrent interrupt handler * arg - The argument provided for the interrupt handler * - * Returned value: + * Returned Value: * Zero (OK) is returned on success. Otherwise, a negated errno value is returned * to indicate the nature of the failure. * diff --git a/configs/olimex-strp711/src/str71_spi.c b/configs/olimex-strp711/src/str71_spi.c index 1c18a4e553..f73dc744d5 100644 --- a/configs/olimex-strp711/src/str71_spi.c +++ b/configs/olimex-strp711/src/str71_spi.c @@ -952,7 +952,7 @@ static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t bu * Initialize the selected SPI port. This function could get called * multiple times for each STR7 devices that needs an SPI reference. * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple SPI interfaces) * * Returned Value: diff --git a/configs/olimexino-stm32/src/olimexino-stm32.h b/configs/olimexino-stm32/src/olimexino-stm32.h index 987c55c00f..c3383eb8a2 100644 --- a/configs/olimexino-stm32/src/olimexino-stm32.h +++ b/configs/olimexino-stm32/src/olimexino-stm32.h @@ -163,7 +163,7 @@ void stm32_usbinitialize(void); * Description: * Called to setup set a call back for USB power state changes. * - * Inputs: + * Input Parameters: * pwr_changed_handler: An interrupt handler that will be called on VBUS power * state changes. * diff --git a/configs/olimexino-stm32/src/stm32_usbdev.c b/configs/olimexino-stm32/src/stm32_usbdev.c index 148ae44312..a2814fc361 100644 --- a/configs/olimexino-stm32/src/stm32_usbdev.c +++ b/configs/olimexino-stm32/src/stm32_usbdev.c @@ -69,7 +69,7 @@ * Name: stm32_usb_set_pwr_callback() * * Description: - * Inputs: + * Input Parameters: * pwr_changed_handler: An interrupt handler that will be called on VBUS power * state changes. * diff --git a/configs/photon/src/photon.h b/configs/photon/src/photon.h index f98c223341..5b2412f7e0 100644 --- a/configs/photon/src/photon.h +++ b/configs/photon/src/photon.h @@ -120,7 +120,7 @@ void weak_function stm32_spidev_initialize(void); * Description: * Perform architecture-specific initialization of the Watchdog hardware. * - * Input parameters: + * Input Parameters: * None * * Returned Value: @@ -138,7 +138,7 @@ int photon_watchdog_initialize(void); * Description: * Initialize wlan hardware and driver for Photon board. * - * Input parameters: + * Input Parameters: * None * * Returned Value: diff --git a/configs/sam3u-ek/src/sam_spi.c b/configs/sam3u-ek/src/sam_spi.c index a6a08e7090..7813f8da7a 100644 --- a/configs/sam3u-ek/src/sam_spi.c +++ b/configs/sam3u-ek/src/sam_spi.c @@ -133,7 +133,7 @@ void weak_function sam_spidev_initialize(void) * devid - Identifies the (logical) device * selected - TRUE:Select the device, FALSE:De-select the device * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -165,7 +165,7 @@ void sam_spi0select(uint32_t devid, bool selected) * Input Parameters: * devid - Identifies the (logical) device * - * Returned Values: + * Returned Value: * Bit-encoded SPI status (see include/nuttx/spi/spi.h. * ****************************************************************************/ diff --git a/configs/sam4e-ek/src/sam_spi.c b/configs/sam4e-ek/src/sam_spi.c index 340210ec8c..715f97ce73 100644 --- a/configs/sam4e-ek/src/sam_spi.c +++ b/configs/sam4e-ek/src/sam_spi.c @@ -135,7 +135,7 @@ void weak_function sam_spidev_initialize(void) * devid - Identifies the (logical) device * selected - TRUE:Select the device, FALSE:De-select the device * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -180,7 +180,7 @@ void sam_spi0select(uint32_t devid, bool selected) * Input Parameters: * devid - Identifies the (logical) device * - * Returned Values: + * Returned Value: * Bit-encoded SPI status (see include/nuttx/spi/spi.h. * ****************************************************************************/ diff --git a/configs/sam4l-xplained/src/sam_spi.c b/configs/sam4l-xplained/src/sam_spi.c index a6eeee18a2..70787cc011 100644 --- a/configs/sam4l-xplained/src/sam_spi.c +++ b/configs/sam4l-xplained/src/sam_spi.c @@ -135,7 +135,7 @@ void weak_function sam_spidev_initialize(void) * devid - Identifies the (logical) device * selected - TRUE:Select the device, FALSE:De-select the device * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -178,7 +178,7 @@ void sam_spi0select(uint32_t devid, bool selected) * Input Parameters: * devid - Identifies the (logical) device * - * Returned Values: + * Returned Value: * Bit-encoded SPI status (see include/nuttx/spi/spi.h. * ****************************************************************************/ @@ -225,7 +225,7 @@ uint8_t sam_spi0status(FAR struct spi_dev_s *dev, uint32_t devid) * dev - SPI device info * devid - Identifies the (logical) device * - * Returned Values: + * Returned Value: * Zero on success; a negated errno on failure. * ****************************************************************************/ diff --git a/configs/sam4s-xplained-pro/src/sam4s-xplained-pro.h b/configs/sam4s-xplained-pro/src/sam4s-xplained-pro.h index a20eb969de..e6baf02f1d 100644 --- a/configs/sam4s-xplained-pro/src/sam4s-xplained-pro.h +++ b/configs/sam4s-xplained-pro/src/sam4s-xplained-pro.h @@ -221,7 +221,7 @@ bool sam_writeprotected(int slotno); * Description: * Perform architecture-specific initialization of the Watchdog hardware. * - * Input parameters: + * Input Parameters: * None * * Returned Value: diff --git a/configs/sama5d3-xplained/src/sam_nandflash.c b/configs/sama5d3-xplained/src/sam_nandflash.c index 69157cc3fa..f53fa352d9 100644 --- a/configs/sama5d3-xplained/src/sam_nandflash.c +++ b/configs/sama5d3-xplained/src/sam_nandflash.c @@ -91,7 +91,7 @@ * cs - Chip select number (in the event that multiple NAND devices * are connected on-board). * - * Returned Values: + * Returned Value: * OK if the HSMC was successfully configured for this CS. A negated * errno value is returned on a failure. This would fail with -ENODEV, * for example, if the board does not support NAND FLASH on the requested diff --git a/configs/sama5d3-xplained/src/sam_spi.c b/configs/sama5d3-xplained/src/sam_spi.c index a4e1b3d95d..ce4bfb6403 100644 --- a/configs/sama5d3-xplained/src/sam_spi.c +++ b/configs/sama5d3-xplained/src/sam_spi.c @@ -134,7 +134,7 @@ void weak_function sam_spidev_initialize(void) * devid - Identifies the (logical) device * selected - TRUE:Select the device, FALSE:De-select the device * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -168,7 +168,7 @@ void sam_spi1select(uint32_t devid, bool selected) * Input Parameters: * devid - Identifies the (logical) device * - * Returned Values: + * Returned Value: * Bit-encoded SPI status (see include/nuttx/spi/spi.h. * ****************************************************************************/ diff --git a/configs/sama5d3-xplained/src/sam_usb.c b/configs/sama5d3-xplained/src/sam_usb.c index 3189e94774..8abe5f5493 100644 --- a/configs/sama5d3-xplained/src/sam_usb.c +++ b/configs/sama5d3-xplained/src/sam_usb.c @@ -487,10 +487,10 @@ void sam_usbhost_vbusdrive(int rhport, bool enable) * REVISIT: Since this is a common signal, we will need to come up with some way * to inform both EHCI and OHCI drivers when this error occurs. * - * Input Parameter: + * Input Parameters: * handler - New overcurrent interrupt handler * - * Returned value: + * Returned Value: * Old overcurrent interrupt handler * ************************************************************************************/ diff --git a/configs/sama5d3x-ek/src/sam_nandflash.c b/configs/sama5d3x-ek/src/sam_nandflash.c index 50c327e9f3..e212a7f274 100644 --- a/configs/sama5d3x-ek/src/sam_nandflash.c +++ b/configs/sama5d3x-ek/src/sam_nandflash.c @@ -91,7 +91,7 @@ * cs - Chip select number (in the event that multiple NAND devices * are connected on-board). * - * Returned Values: + * Returned Value: * OK if the HSMC was successfully configured for this CS. A negated * errno value is returned on a failure. This would fail with -ENODEV, * for example, if the board does not support NAND FLASH on the requested diff --git a/configs/sama5d3x-ek/src/sam_spi.c b/configs/sama5d3x-ek/src/sam_spi.c index c9827f9a77..be4c0e322b 100644 --- a/configs/sama5d3x-ek/src/sam_spi.c +++ b/configs/sama5d3x-ek/src/sam_spi.c @@ -134,7 +134,7 @@ void weak_function sam_spidev_initialize(void) * devid - Identifies the (logical) device * selected - TRUE:Select the device, FALSE:De-select the device * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -168,7 +168,7 @@ void sam_spi1select(uint32_t devid, bool selected) * Input Parameters: * devid - Identifies the (logical) device * - * Returned Values: + * Returned Value: * Bit-encoded SPI status (see include/nuttx/spi/spi.h. * ****************************************************************************/ diff --git a/configs/sama5d3x-ek/src/sam_usb.c b/configs/sama5d3x-ek/src/sam_usb.c index 4607f641fe..614b6c31e2 100644 --- a/configs/sama5d3x-ek/src/sam_usb.c +++ b/configs/sama5d3x-ek/src/sam_usb.c @@ -479,10 +479,10 @@ void sam_usbhost_vbusdrive(int rhport, bool enable) * REVISIT: Since this is a common signal, we will need to come up with some way * to inform both EHCI and OHCI drivers when this error occurs. * - * Input Parameter: + * Input Parameters: * handler - New overcurrent interrupt handler * - * Returned value: + * Returned Value: * Old overcurrent interrupt handler * ************************************************************************************/ diff --git a/configs/sama5d4-ek/src/sam_nandflash.c b/configs/sama5d4-ek/src/sam_nandflash.c index 6a5c90db28..467ac8b106 100644 --- a/configs/sama5d4-ek/src/sam_nandflash.c +++ b/configs/sama5d4-ek/src/sam_nandflash.c @@ -91,7 +91,7 @@ * cs - Chip select number (in the event that multiple NAND devices * are connected on-board). * - * Returned Values: + * Returned Value: * OK if the HSMC was successfully configured for this CS. A negated * errno value is returned on a failure. This would fail with -ENODEV, * for example, if the board does not support NAND FLASH on the requested diff --git a/configs/sama5d4-ek/src/sam_spi.c b/configs/sama5d4-ek/src/sam_spi.c index 7534e373b1..611378c462 100644 --- a/configs/sama5d4-ek/src/sam_spi.c +++ b/configs/sama5d4-ek/src/sam_spi.c @@ -134,7 +134,7 @@ void weak_function sam_spidev_initialize(void) * devid - Identifies the (logical) device * selected - TRUE:Select the device, FALSE:De-select the device * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -168,7 +168,7 @@ void sam_spi1select(uint32_t devid, bool selected) * Input Parameters: * devid - Identifies the (logical) device * - * Returned Values: + * Returned Value: * Bit-encoded SPI status (see include/nuttx/spi/spi.h. * ****************************************************************************/ diff --git a/configs/sama5d4-ek/src/sam_usb.c b/configs/sama5d4-ek/src/sam_usb.c index d6923ea70a..081197a7fa 100644 --- a/configs/sama5d4-ek/src/sam_usb.c +++ b/configs/sama5d4-ek/src/sam_usb.c @@ -483,7 +483,7 @@ void sam_usbhost_vbusdrive(int rhport, bool enable) * Input Parameters: * handler - New over-current interrupt handler * - * Returned value: + * Returned Value: * Old over-current interrupt handler * ************************************************************************************/ diff --git a/configs/samd20-xplained/src/sam_spi.c b/configs/samd20-xplained/src/sam_spi.c index 2367243fe5..0a15fa4d35 100644 --- a/configs/samd20-xplained/src/sam_spi.c +++ b/configs/samd20-xplained/src/sam_spi.c @@ -142,7 +142,7 @@ void weak_function sam_spidev_initialize(void) * devid - Identifies the (logical) device * selected - TRUE:Select the device, FALSE:De-select the device * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -241,7 +241,7 @@ void sam_spi5select(FAR struct spi_dev_s *dev, uint32_t devid, * dev - SPI device info * devid - Identifies the (logical) device * - * Returned Values: + * Returned Value: * Bit-encoded SPI status (see include/nuttx/spi/spi.h. * ****************************************************************************/ @@ -340,7 +340,7 @@ uint8_t sam_spi5status(FAR struct spi_dev_s *dev, uint32_t devid) * dev - SPI device info * devid - Identifies the (logical) device * - * Returned Values: + * Returned Value: * Zero on success; a negated errno on failure. * ****************************************************************************/ diff --git a/configs/samd21-xplained/src/sam_spi.c b/configs/samd21-xplained/src/sam_spi.c index 32dbdb62bb..624fc59bba 100644 --- a/configs/samd21-xplained/src/sam_spi.c +++ b/configs/samd21-xplained/src/sam_spi.c @@ -142,7 +142,7 @@ void weak_function sam_spidev_initialize(void) * devid - Identifies the (logical) device * selected - TRUE:Select the device, FALSE:De-select the device * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -241,7 +241,7 @@ void sam_spi5select(FAR struct spi_dev_s *dev, uint32_t devid, * dev - SPI device info * devid - Identifies the (logical) device * - * Returned Values: + * Returned Value: * Bit-encoded SPI status (see include/nuttx/spi/spi.h. * ****************************************************************************/ @@ -340,7 +340,7 @@ uint8_t sam_spi5status(FAR struct spi_dev_s *dev, uint32_t devid) * dev - SPI device info * devid - Identifies the (logical) device * - * Returned Values: + * Returned Value: * Zero on success; a negated errno on failure. * ****************************************************************************/ diff --git a/configs/same70-xplained/src/sam_spi.c b/configs/same70-xplained/src/sam_spi.c index a9095c462d..57bde8904d 100644 --- a/configs/same70-xplained/src/sam_spi.c +++ b/configs/same70-xplained/src/sam_spi.c @@ -146,7 +146,7 @@ void sam_spidev_initialize(void) * devid - Identifies the (logical) device * selected - TRUE:Select the device, FALSE:De-select the device * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -204,7 +204,7 @@ void sam_spi1select(uint32_t devid, bool selected) * Input Parameters: * devid - Identifies the (logical) device * - * Returned Values: + * Returned Value: * Bit-encoded SPI status (see include/nuttx/spi/spi.h. * ****************************************************************************/ diff --git a/configs/saml21-xplained/src/sam_spi.c b/configs/saml21-xplained/src/sam_spi.c index 576444508d..ff654a2d30 100644 --- a/configs/saml21-xplained/src/sam_spi.c +++ b/configs/saml21-xplained/src/sam_spi.c @@ -142,7 +142,7 @@ void weak_function sam_spidev_initialize(void) * devid - Identifies the (logical) device * selected - TRUE:Select the device, FALSE:De-select the device * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -241,7 +241,7 @@ void sam_spi5select(FAR struct spi_dev_s *dev, uint32_t devid, * dev - SPI device info * devid - Identifies the (logical) device * - * Returned Values: + * Returned Value: * Bit-encoded SPI status (see include/nuttx/spi/spi.h. * ****************************************************************************/ @@ -340,7 +340,7 @@ uint8_t sam_spi5status(FAR struct spi_dev_s *dev, uint32_t devid) * dev - SPI device info * devid - Identifies the (logical) device * - * Returned Values: + * Returned Value: * Zero on success; a negated errno on failure. * ****************************************************************************/ diff --git a/configs/samv71-xult/src/sam_spi.c b/configs/samv71-xult/src/sam_spi.c index 563c03965c..e7e2271f9f 100644 --- a/configs/samv71-xult/src/sam_spi.c +++ b/configs/samv71-xult/src/sam_spi.c @@ -151,7 +151,7 @@ void sam_spidev_initialize(void) * devid - Identifies the (logical) device * selected - TRUE:Select the device, FALSE:De-select the device * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -197,7 +197,7 @@ void sam_spi1select(uint32_t devid, bool selected) * Input Parameters: * devid - Identifies the (logical) device * - * Returned Values: + * Returned Value: * Bit-encoded SPI status (see include/nuttx/spi/spi.h. * ****************************************************************************/ diff --git a/configs/shenzhou/src/stm32_usb.c b/configs/shenzhou/src/stm32_usb.c index 91bbe8d846..a45f43a83f 100644 --- a/configs/shenzhou/src/stm32_usb.c +++ b/configs/shenzhou/src/stm32_usb.c @@ -272,11 +272,11 @@ void stm32_usbhost_vbusdrive(int iface, bool enable) * Setup to receive an interrupt-level callback if an overcurrent condition is * detected. * - * Input Parameter: + * Input Parameters: * handler - New overcurrent interrupt handler * arg - The argument provided for the interrupt handler * - * Returned value: + * Returned Value: * Zero (OK) is returned on success. Otherwise, a negated errno value is returned * to indicate the nature of the failure. * diff --git a/configs/spark/src/stm32_cc3000.c b/configs/spark/src/stm32_cc3000.c index 92d255d6d9..8cda9fb602 100644 --- a/configs/spark/src/stm32_cc3000.c +++ b/configs/spark/src/stm32_cc3000.c @@ -327,7 +327,7 @@ int wireless_archinitialize(size_t max_rx_size) * Warning: This function must be called before ANY other wlan driver * function * - * Input Parmeters: + * Input Parameters: * sWlanCB Asynchronous events callback. * 0 no event call back. * - Call back parameters: diff --git a/configs/stm3210e-eval/include/board.h b/configs/stm3210e-eval/include/board.h index f76389222b..d03816b439 100644 --- a/configs/stm3210e-eval/include/board.h +++ b/configs/stm3210e-eval/include/board.h @@ -261,7 +261,7 @@ void stm3210e_lcdclear(uint16_t color); * Description: * Initialize and register the LM-75 Temperature Sensor driver. * - * Input parameters: + * Input Parameters: * devpath - The full path to the driver to register. E.g., "/dev/temp0" * * Returned Value: @@ -279,7 +279,7 @@ int stm32_lm75initialize(FAR const char *devpath); * Description: * Attach the LM-75 interrupt handler * - * Input parameters: + * Input Parameters: * irqhandler - the LM-75 interrupt handler * arg - The argument that will accompany the interrupt * diff --git a/configs/stm3210e-eval/src/stm32_lm75.c b/configs/stm3210e-eval/src/stm32_lm75.c index a083b78383..52b04c495b 100644 --- a/configs/stm3210e-eval/src/stm32_lm75.c +++ b/configs/stm3210e-eval/src/stm32_lm75.c @@ -60,7 +60,7 @@ * Description: * Initialize and register the LM-75 Temperature Sensor driver. * - * Input parameters: + * Input Parameters: * devpath - The full path to the driver to register. E.g., "/dev/temp0" * * Returned Value: @@ -104,7 +104,7 @@ int stm32_lm75initialize(FAR const char *devpath) * Description: * Attach the LM-75 interrupt handler * - * Input parameters: + * Input Parameters: * irqhandler - the LM-75 interrupt handler * arg - The argument that will accompany the interrupt * diff --git a/configs/stm3210e-eval/src/stm32_pm.c b/configs/stm3210e-eval/src/stm32_pm.c index 1da3078a9c..7c7b13f4b9 100644 --- a/configs/stm3210e-eval/src/stm32_pm.c +++ b/configs/stm3210e-eval/src/stm32_pm.c @@ -78,10 +78,10 @@ * *before* any other device drivers are initialized (since they may * attempt to register with the power management subsystem). * - * Input parameters: + * Input Parameters: * None. * - * Returned value: + * Returned Value: * None. * ****************************************************************************/ diff --git a/configs/stm3220g-eval/src/stm32_usb.c b/configs/stm3220g-eval/src/stm32_usb.c index 328aad2471..71474fa5ce 100644 --- a/configs/stm3220g-eval/src/stm32_usb.c +++ b/configs/stm3220g-eval/src/stm32_usb.c @@ -272,11 +272,11 @@ void stm32_usbhost_vbusdrive(int iface, bool enable) * Setup to receive an interrupt-level callback if an overcurrent condition is * detected. * - * Input Parameter: + * Input Parameters: * handler - New overcurrent interrupt handler * arg - The argument provided for the interrupt handler * - * Returned value: + * Returned Value: * Zero (OK) is returned on success. Otherwise, a negated errno value is returned * to indicate the nature of the failure. * diff --git a/configs/stm3240g-eval/src/stm32_usb.c b/configs/stm3240g-eval/src/stm32_usb.c index e89cf8116f..eb1e60d951 100644 --- a/configs/stm3240g-eval/src/stm32_usb.c +++ b/configs/stm3240g-eval/src/stm32_usb.c @@ -272,11 +272,11 @@ void stm32_usbhost_vbusdrive(int iface, bool enable) * Setup to receive an interrupt-level callback if an overcurrent condition is * detected. * - * Input Parameter: + * Input Parameters: * handler - New overcurrent interrupt handler * arg - The argument provided for the interrupt handler * - * Returned value: + * Returned Value: * Zero (OK) is returned on success. Otherwise, a negated errno value is returned * to indicate the nature of the failure. * diff --git a/configs/stm32butterfly2/src/stm32_boot.c b/configs/stm32butterfly2/src/stm32_boot.c index f42e7a7fd7..928b558633 100644 --- a/configs/stm32butterfly2/src/stm32_boot.c +++ b/configs/stm32butterfly2/src/stm32_boot.c @@ -66,7 +66,7 @@ void stm32_boardinitialize(void) * Description: * Initializes upper half drivers with board specific settings * - * Returned value: + * Returned Value: * 0 on sucess or errno value of failed init function. ****************************************************************************/ diff --git a/configs/stm32butterfly2/src/stm32_leds.c b/configs/stm32butterfly2/src/stm32_leds.c index dae6352fa7..4fced6d597 100644 --- a/configs/stm32butterfly2/src/stm32_leds.c +++ b/configs/stm32butterfly2/src/stm32_leds.c @@ -130,7 +130,7 @@ void stm32_led_initialize(void) * Description: * Drives board leds when specific RTOS state led occurs. * - * Input parameters: + * Input Parameters: * led - This is actually an RTOS state not led number of anything like that ****************************************************************************/ @@ -173,7 +173,7 @@ void board_autoled_on(int led) * Description: * Drives board leds when specific RTOS state led ends * - * Input parameters: + * Input Parameters: * led - This is actually an RTOS state not led number of anything like that ****************************************************************************/ @@ -225,7 +225,7 @@ void board_userled_initialize(void) * Description: * Sets led to ledon state. * - * Input parameters: + * Input Parameters: * led - Led to be set, indexed from 0 * ledon - new state for the led. ****************************************************************************/ @@ -251,7 +251,7 @@ void board_userled(int led, bool ledon) * Description: * Sets whole ledset to given state. * - * Input parameters: + * Input Parameters: * ledset - Led bits to be set on or off ****************************************************************************/ diff --git a/configs/stm32f103-minimum/src/stm32_apa102.c b/configs/stm32f103-minimum/src/stm32_apa102.c index 32717b212b..88c5a5ae49 100644 --- a/configs/stm32f103-minimum/src/stm32_apa102.c +++ b/configs/stm32f103-minimum/src/stm32_apa102.c @@ -68,7 +68,7 @@ * Description: * Initialize and register the APA102 LED Strip driver. * - * Input parameters: + * Input Parameters: * devpath - The full path to the driver to register. E.g., "/dev/leddrv0" * * Returned Value: diff --git a/configs/stm32f103-minimum/src/stm32_apds9960.c b/configs/stm32f103-minimum/src/stm32_apds9960.c index 14045df518..614cbcf45d 100644 --- a/configs/stm32f103-minimum/src/stm32_apds9960.c +++ b/configs/stm32f103-minimum/src/stm32_apds9960.c @@ -136,7 +136,7 @@ static int apds9960_irq_attach(FAR struct apds9960_config_s *state, xcpt_t isr, * Description: * Initialize and register the APDS9960 gesture sensor. * - * Input parameters: + * Input Parameters: * devpath - The full path to the driver to register. E.g., "/dev/gest0" * * Returned Value: diff --git a/configs/stm32f103-minimum/src/stm32_lm75.c b/configs/stm32f103-minimum/src/stm32_lm75.c index 7cd9b2422e..75e193354f 100644 --- a/configs/stm32f103-minimum/src/stm32_lm75.c +++ b/configs/stm32f103-minimum/src/stm32_lm75.c @@ -60,7 +60,7 @@ * Description: * Initialize and register the LM-75 Temperature Sensor driver. * - * Input parameters: + * Input Parameters: * devpath - The full path to the driver to register. E.g., "/dev/temp0" * * Returned Value: @@ -104,7 +104,7 @@ int stm32_lm75initialize(FAR const char *devpath) * Description: * Attach the LM-75 interrupt handler * - * Input parameters: + * Input Parameters: * irqhandler - the LM-75 interrupt handler * arg - The argument that will accompany the interrupt * diff --git a/configs/stm32f103-minimum/src/stm32_mcp2515.c b/configs/stm32f103-minimum/src/stm32_mcp2515.c index 739cfe884a..a7794603fd 100644 --- a/configs/stm32f103-minimum/src/stm32_mcp2515.c +++ b/configs/stm32f103-minimum/src/stm32_mcp2515.c @@ -173,7 +173,7 @@ static int mcp2515_attach(FAR struct mcp2515_config_s *state, * Description: * Initialize and register the MCP2515 RFID driver. * - * Input parameters: + * Input Parameters: * devpath - The full path to the driver to register. E.g., "/dev/rfid0" * * Returned Value: diff --git a/configs/stm32f103-minimum/src/stm32_mfrc522.c b/configs/stm32f103-minimum/src/stm32_mfrc522.c index 441bc5a6fa..5fc1db4b4b 100644 --- a/configs/stm32f103-minimum/src/stm32_mfrc522.c +++ b/configs/stm32f103-minimum/src/stm32_mfrc522.c @@ -67,7 +67,7 @@ * Description: * Initialize and register the MFRC522 RFID driver. * - * Input parameters: + * Input Parameters: * devpath - The full path to the driver to register. E.g., "/dev/rfid0" * * Returned Value: diff --git a/configs/stm32f103-minimum/src/stm32_nrf24l01.c b/configs/stm32f103-minimum/src/stm32_nrf24l01.c index 6edecba0e0..34bf775091 100644 --- a/configs/stm32f103-minimum/src/stm32_nrf24l01.c +++ b/configs/stm32f103-minimum/src/stm32_nrf24l01.c @@ -105,7 +105,7 @@ static void stm32tiny_wl_chip_enable(bool enable) * Description: * Initialize the NRF24L01 wireless module * - * Input Parmeters: + * Input Parameters: * None * * Returned Value: diff --git a/configs/stm32f103-minimum/src/stm32_veml6070.c b/configs/stm32f103-minimum/src/stm32_veml6070.c index 5e8765e9e7..8a84517f2f 100644 --- a/configs/stm32f103-minimum/src/stm32_veml6070.c +++ b/configs/stm32f103-minimum/src/stm32_veml6070.c @@ -67,7 +67,7 @@ * Description: * Initialize and register the VEML6070 UV-A Light sensor. * - * Input parameters: + * Input Parameters: * devpath - The full path to the driver to register. E.g., "/dev/uvlight0" * * Returned Value: diff --git a/configs/stm32f103-minimum/src/stm32f103_minimum.h b/configs/stm32f103-minimum/src/stm32f103_minimum.h index f3159c7eac..18b6a5e41b 100644 --- a/configs/stm32f103-minimum/src/stm32f103_minimum.h +++ b/configs/stm32f103-minimum/src/stm32f103_minimum.h @@ -402,7 +402,7 @@ int stm32_pwm_setup(void); * Description: * Initialize the NRF24L01 wireless module * - * Input Parmeters: + * Input Parameters: * None * * Returned Value: diff --git a/configs/stm32f334-disco/src/stm32f334-disco.h b/configs/stm32f334-disco/src/stm32f334-disco.h index 904c8acc10..085d5abe14 100644 --- a/configs/stm32f334-disco/src/stm32f334-disco.h +++ b/configs/stm32f334-disco/src/stm32f334-disco.h @@ -113,7 +113,7 @@ void weak_function stm32_spidev_initialize(void); * devpath - The full path to the timer device. This should be of the form /dev/timer0 * timer - The timer's number. * - * Returned Values: + * Returned Value: * Zero (OK) is returned on success; A negated errno value is returned * to indicate the nature of any failure. * diff --git a/configs/stm32f411e-disco/src/stm32_usb.c b/configs/stm32f411e-disco/src/stm32_usb.c index 223fb94932..2e2861a4cf 100644 --- a/configs/stm32f411e-disco/src/stm32_usb.c +++ b/configs/stm32f411e-disco/src/stm32_usb.c @@ -312,11 +312,11 @@ void stm32_usbhost_vbusdrive(int iface, bool enable) * Setup to receive an interrupt-level callback if an overcurrent condition is * detected. * - * Input Parameter: + * Input Parameters: * handler - New overcurrent interrupt handler * arg - The argument provided for the interrupt handler * - * Returned value: + * Returned Value: * Zero (OK) is returned on success. Otherwise, a negated errno value is returned * to indicate the nature of the failure. * diff --git a/configs/stm32f429i-disco/src/stm32_l3gd20.c b/configs/stm32f429i-disco/src/stm32_l3gd20.c index 7a8c449c62..1dcd99c1b3 100644 --- a/configs/stm32f429i-disco/src/stm32_l3gd20.c +++ b/configs/stm32f429i-disco/src/stm32_l3gd20.c @@ -100,7 +100,7 @@ static int l3gd20_attach(FAR struct l3gd20_config_s *cfg, xcpt_t irq) * Description: * Initialize and register the L3GD20 3 axis gyroscope sensor driver. * - * Input parameters: + * Input Parameters: * devpath - The full path to the driver to register. E.g., "/dev/gyro0" * * Returned Value: diff --git a/configs/stm32f429i-disco/src/stm32_lcd.c b/configs/stm32f429i-disco/src/stm32_lcd.c index ab4d43ae38..e327c53b5f 100644 --- a/configs/stm32f429i-disco/src/stm32_lcd.c +++ b/configs/stm32f429i-disco/src/stm32_lcd.c @@ -420,7 +420,7 @@ static int stm32_ili9341_initialize(void) * * Parameter: * - * Return: + * Returned Value: * ************************************************************************************/ @@ -444,7 +444,7 @@ void board_lcd_uninitialize(void) * Parameter: * lcddev - Number of the LDC Device. * - * Return: + * Returned Value: * Reference to the LCD object if exist otherwise NULL * ************************************************************************************/ @@ -469,7 +469,7 @@ FAR struct lcd_dev_s *board_lcd_getdev(int lcddev) * * Parameter: * - * Return: + * Returned Value: * On success - Ok * On error - Error Code * @@ -515,7 +515,7 @@ int board_lcd_initialize(void) * Description: * Initialize the framebuffer video hardware associated with the display. * - * Input parameters: + * Input Parameters: * display - In the case of hardware with multiple displays, this * specifies the display. Normally this is zero. * @@ -555,7 +555,7 @@ int up_fbinitialize(int display) * Return a a reference to the framebuffer object for the specified video * plane of the specified plane. Many OSDs support multiple planes of video. * - * Input parameters: + * Input Parameters: * display - In the case of hardware with multiple displays, this * specifies the display. Normally this is zero. * vplane - Identifies the plane being queried. diff --git a/configs/stm32f429i-disco/src/stm32_spi.c b/configs/stm32f429i-disco/src/stm32_spi.c index 16a23cc564..3aaecc60d1 100644 --- a/configs/stm32f429i-disco/src/stm32_spi.c +++ b/configs/stm32f429i-disco/src/stm32_spi.c @@ -279,7 +279,7 @@ int stm32_spi5cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) * device after the first initializing and should be used by each driver who * shares the spi5 bus. * - * Input Parameter: + * Input Parameters: * * Returned Value: * Valid SPI device structure reference on success; a NULL on failure diff --git a/configs/stm32f429i-disco/src/stm32_usb.c b/configs/stm32f429i-disco/src/stm32_usb.c index 3d597eff7c..b178650480 100644 --- a/configs/stm32f429i-disco/src/stm32_usb.c +++ b/configs/stm32f429i-disco/src/stm32_usb.c @@ -282,7 +282,7 @@ void stm32_usbhost_vbusdrive(int iface, bool enable) * handler - New overcurrent interrupt handler * arg - The argument provided for the interrupt handler * - * Returned value: + * Returned Value: * Zero (OK) is returned on success. Otherwise, a negated errno value is returned * to indicate the nature of the failure. * diff --git a/configs/stm32f429i-disco/src/stm32f429i-disco.h b/configs/stm32f429i-disco/src/stm32f429i-disco.h index d324060876..18063a5391 100644 --- a/configs/stm32f429i-disco/src/stm32f429i-disco.h +++ b/configs/stm32f429i-disco/src/stm32f429i-disco.h @@ -361,7 +361,7 @@ FAR struct ili9341_lcd_s *stm32_ili93414ws_initialize(void); * the initialized state of the spi device after the first initializing * and should be used by each driver who shares the spi5 bus. * - * Input Parameter: + * Input Parameters: * None * * Returned Value: @@ -379,7 +379,7 @@ FAR struct spi_dev_s *stm32_spi5initialize(void); * Description: * Initialize and register the L3GD20 3 axis gyroscope sensor driver. * - * Input parameters: + * Input Parameters: * devpath - The full path to the driver to register. E.g., "/dev/gyro0" * * Returned Value: diff --git a/configs/stm32f4discovery/src/stm32_bh1750fvi.c b/configs/stm32f4discovery/src/stm32_bh1750fvi.c index 8ac3fe6846..2012762d17 100644 --- a/configs/stm32f4discovery/src/stm32_bh1750fvi.c +++ b/configs/stm32f4discovery/src/stm32_bh1750fvi.c @@ -67,7 +67,7 @@ * Description: * Initialize and register the MPL115A Pressure Sensor driver. * - * Input parameters: + * Input Parameters: * devpath - The full path to the driver to register. E.g., "/dev/light0" * * Returned Value: diff --git a/configs/stm32f4discovery/src/stm32_bmp180.c b/configs/stm32f4discovery/src/stm32_bmp180.c index b7ea5f568d..41553e1af7 100644 --- a/configs/stm32f4discovery/src/stm32_bmp180.c +++ b/configs/stm32f4discovery/src/stm32_bmp180.c @@ -67,7 +67,7 @@ * Description: * Initialize and register the MPL115A Pressure Sensor driver. * - * Input parameters: + * Input Parameters: * devpath - The full path to the driver to register. E.g., "/dev/press0" * * Returned Value: diff --git a/configs/stm32f4discovery/src/stm32_lis3dsh.c b/configs/stm32f4discovery/src/stm32_lis3dsh.c index b48a5614fa..600621786f 100644 --- a/configs/stm32f4discovery/src/stm32_lis3dsh.c +++ b/configs/stm32f4discovery/src/stm32_lis3dsh.c @@ -68,7 +68,7 @@ * Attach the lis3dsh interrupt handler to PE0/EXT0 on the STM32F4 as wired * on STM32F4Discovery * - * Input parameters: + * Input Parameters: * *config - The lis3dsh instance configuration data containing the IRQ number, * device ID and interrupt handler * interrupt_handler - The interrupt handler to attach @@ -98,7 +98,7 @@ int attach_disc_lis3dsh(FAR struct lis3dsh_config_s *config, xcpt_t interrupt_ha * Description: * Initialize and register the LIS3DSH 3-axis accelerometer. * - * Input parameters: + * Input Parameters: * devpath - The full path to the driver to register. E.g., "/dev/acc0" * * Returned Value: diff --git a/configs/stm32f4discovery/src/stm32_max31855.c b/configs/stm32f4discovery/src/stm32_max31855.c index 2a03d70d7f..388fcf585d 100644 --- a/configs/stm32f4discovery/src/stm32_max31855.c +++ b/configs/stm32f4discovery/src/stm32_max31855.c @@ -67,7 +67,7 @@ * Description: * Initialize and register the MAX31855 Temperature Sensor driver. * - * Input parameters: + * Input Parameters: * devpath - The full path to the driver to register. E.g., "/dev/temp0" * * Returned Value: diff --git a/configs/stm32f4discovery/src/stm32_max6675.c b/configs/stm32f4discovery/src/stm32_max6675.c index 759565c6e2..d0360c5f33 100644 --- a/configs/stm32f4discovery/src/stm32_max6675.c +++ b/configs/stm32f4discovery/src/stm32_max6675.c @@ -67,7 +67,7 @@ * Description: * Initialize and register the MAX6675 Temperature Sensor driver. * - * Input parameters: + * Input Parameters: * devpath - The full path to the driver to register. E.g., "/dev/temp0" * * Returned Value: diff --git a/configs/stm32f4discovery/src/stm32_pm.c b/configs/stm32f4discovery/src/stm32_pm.c index c012e397c3..0bce85cc54 100644 --- a/configs/stm32f4discovery/src/stm32_pm.c +++ b/configs/stm32f4discovery/src/stm32_pm.c @@ -79,10 +79,10 @@ * *before* any other device drivers are initialized (since they may * attempt to register with the power management subsystem). * - * Input parameters: + * Input Parameters: * None. * - * Returned value: + * Returned Value: * None. * ****************************************************************************/ diff --git a/configs/stm32f4discovery/src/stm32_timer.c b/configs/stm32f4discovery/src/stm32_timer.c index 326f2f25c0..3586a181aa 100644 --- a/configs/stm32f4discovery/src/stm32_timer.c +++ b/configs/stm32f4discovery/src/stm32_timer.c @@ -67,7 +67,7 @@ * devpath - The full path to the timer device. This should be of the form /dev/timer0 * timer - The timer's number. * - * Returned Values: + * Returned Value: * Zero (OK) is returned on success; A negated errno value is returned * to indicate the nature of any failure. * diff --git a/configs/stm32f4discovery/src/stm32_usb.c b/configs/stm32f4discovery/src/stm32_usb.c index 6386b566ac..e5fa78951e 100644 --- a/configs/stm32f4discovery/src/stm32_usb.c +++ b/configs/stm32f4discovery/src/stm32_usb.c @@ -312,11 +312,11 @@ void stm32_usbhost_vbusdrive(int iface, bool enable) * Setup to receive an interrupt-level callback if an overcurrent condition is * detected. * - * Input Parameter: + * Input Parameters: * handler - New overcurrent interrupt handler * arg - The argument provided for the interrupt handler * - * Returned value: + * Returned Value: * Zero (OK) is returned on success. Otherwise, a negated errno value is returned * to indicate the nature of the failure. * diff --git a/configs/stm32f4discovery/src/stm32f4discovery.h b/configs/stm32f4discovery/src/stm32f4discovery.h index 51936d9485..7a711fc3f1 100644 --- a/configs/stm32f4discovery/src/stm32f4discovery.h +++ b/configs/stm32f4discovery/src/stm32f4discovery.h @@ -750,7 +750,7 @@ int stm32_rgbled_setup(void); * form /dev/timer0 * timer - The timer's number. * - * Returned Values: + * Returned Value: * Zero (OK) is returned on success; A negated errno value is returned * to indicate the nature of any failure. * diff --git a/configs/stm32f746-ws/src/stm32_usb.c b/configs/stm32f746-ws/src/stm32_usb.c index 8fa3f1e827..46877033ba 100644 --- a/configs/stm32f746-ws/src/stm32_usb.c +++ b/configs/stm32f746-ws/src/stm32_usb.c @@ -304,11 +304,11 @@ void stm32_usbhost_vbusdrive(int iface, bool enable) * Setup to receive an interrupt-level callback if an overcurrent condition is * detected. * - * Input Parameter: + * Input Parameters: * handler - New overcurrent interrupt handler * arg - The argument provided for the interrupt handler * - * Returned value: + * Returned Value: * Zero (OK) is returned on success. Otherwise, a negated errno value is returned * to indicate the nature of the failure. * diff --git a/configs/stm32l476vg-disco/src/stm32_usb.c b/configs/stm32l476vg-disco/src/stm32_usb.c index a2c7ddadfa..60858f581a 100644 --- a/configs/stm32l476vg-disco/src/stm32_usb.c +++ b/configs/stm32l476vg-disco/src/stm32_usb.c @@ -301,10 +301,10 @@ void stm32l4_usbhost_vbusdrive(int iface, bool enable) * Setup to receive an interrupt-level callback if an over current condition is * detected. * - * Input Parameter: + * Input Parameters: * handler - New over current interrupt handler * - * Returned value: + * Returned Value: * Old over current interrupt handler * ************************************************************************************/ diff --git a/configs/teensy-lc/src/kl_spi.c b/configs/teensy-lc/src/kl_spi.c index efd1c96ce3..17193881f4 100644 --- a/configs/teensy-lc/src/kl_spi.c +++ b/configs/teensy-lc/src/kl_spi.c @@ -124,7 +124,7 @@ void weak_function kl_spidev_initialize(void) * devid - Identifies the (logical) device * selected - TRUE:Select the device, FALSE:De-select the device * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -156,7 +156,7 @@ void kl_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, * Input Parameters: * devid - Identifies the (logical) device * - * Returned Values: + * Returned Value: * Bit-encoded SPI status (see include/nuttx/spi/spi.h. * ****************************************************************************/ @@ -187,7 +187,7 @@ uint8_t kl_spi1status(FAR struct spi_dev_s *dev, uint32_t devid) * devid - Identifies the (logical) device * cmd - Determines where command or data should be selected. * - * Returned Values: + * Returned Value: * Bit-encoded SPI status (see include/nuttx/spi/spi.h. * ****************************************************************************/ diff --git a/configs/u-blox-c027/src/lpc17_ubxmdm.c b/configs/u-blox-c027/src/lpc17_ubxmdm.c index bd165b96d2..2e333a8fcb 100644 --- a/configs/u-blox-c027/src/lpc17_ubxmdm.c +++ b/configs/u-blox-c027/src/lpc17_ubxmdm.c @@ -281,7 +281,7 @@ static int lpc17_ioctl(FAR struct ubxmdm_lower* lower, * Input Parameters: * usb_used - enables the USB sense pin if 'true' * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ diff --git a/configs/viewtool-stm32f107/src/stm32_mpl115a.c b/configs/viewtool-stm32f107/src/stm32_mpl115a.c index c6a1b9e634..2e78e2e5ac 100644 --- a/configs/viewtool-stm32f107/src/stm32_mpl115a.c +++ b/configs/viewtool-stm32f107/src/stm32_mpl115a.c @@ -67,7 +67,7 @@ * Description: * Initialize and register the MPL115A Pressure Sensor driver. * - * Input parameters: + * Input Parameters: * devpath - The full path to the driver to register. E.g., "/dev/press0" * * Returned Value: diff --git a/configs/viewtool-stm32f107/src/viewtool_stm32f107.h b/configs/viewtool-stm32f107/src/viewtool_stm32f107.h index 8a196108c5..7aaa0f0114 100644 --- a/configs/viewtool-stm32f107/src/viewtool_stm32f107.h +++ b/configs/viewtool-stm32f107/src/viewtool_stm32f107.h @@ -407,7 +407,7 @@ int stm32_can_setup(void); * Description: * Initialize and register the MPL115A Pressure Sensor driver. * - * Input parameters: + * Input Parameters: * devpath - The full path to the driver to register. E.g., "/dev/press0" * * Returned Value: diff --git a/configs/zp214xpa/src/lpc2148_spi1.c b/configs/zp214xpa/src/lpc2148_spi1.c index a7b479082b..f9c1cc2693 100644 --- a/configs/zp214xpa/src/lpc2148_spi1.c +++ b/configs/zp214xpa/src/lpc2148_spi1.c @@ -569,7 +569,7 @@ static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t nw * Description: * Initialize the selected SPI port * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has mutiple SPI interfaces) * * Returned Value: diff --git a/crypto/aes.c b/crypto/aes.c index e7c638f718..3927a28360 100644 --- a/crypto/aes.c +++ b/crypto/aes.c @@ -555,7 +555,7 @@ static void aes_decr(FAR uint8_t *state, FAR const uint8_t *expanded_key) * key AES128 key of size 16 bytes * state 16 bytes of plain text and cipher text * - * Returned Value + * Returned Value: * None * ****************************************************************************/ @@ -580,7 +580,7 @@ void aes_encrypt(FAR uint8_t *state, FAR const uint8_t *key) * key AES128 key of size 16 bytes * state 16 bytes of plain text and cipher text * - * Returned Value + * Returned Value: * None * ****************************************************************************/ diff --git a/drivers/analog/ad5410.c b/drivers/analog/ad5410.c index 679edf2c5f..ab8609480e 100644 --- a/drivers/analog/ad5410.c +++ b/drivers/analog/ad5410.c @@ -270,7 +270,7 @@ static int dac_ioctl(FAR struct dac_dev_s *dev, int cmd, unsigned long arg) * Description: * Initialize the selected DAC port * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has multiple DAC interfaces) * * Returned Value: diff --git a/drivers/analog/ads1255.c b/drivers/analog/ads1255.c index 408dd92a29..460f35e380 100644 --- a/drivers/analog/ads1255.c +++ b/drivers/analog/ads1255.c @@ -502,7 +502,7 @@ static int adc_interrupt(int irq, void *context, FAR void *arg) * Description: * Initialize the selected adc port * - * Input Parameter: + * Input Parameters: * Port number (for hardware that has multiple adc interfaces) * * Returned Value: diff --git a/drivers/analog/dac.c b/drivers/analog/dac.c index 7e028e26f5..bfc2468463 100644 --- a/drivers/analog/dac.c +++ b/drivers/analog/dac.c @@ -465,7 +465,7 @@ static int dac_ioctl(FAR struct file *filep, int cmd, unsigned long arg) * Description: * Called from the DAC interrupt handler at the completion of a send operation. * - * Return: + * Returned Value: * OK on success; a negated errno on failure. * ************************************************************************************/ diff --git a/drivers/audio/tone.c b/drivers/audio/tone.c index bc5e5740c1..d0dfb4d33b 100644 --- a/drivers/audio/tone.c +++ b/drivers/audio/tone.c @@ -922,7 +922,7 @@ static ssize_t tone_write(FAR struct file *filep, FAR const char *buffer, * be used by application code. * * - * Input parameters: + * Input Parameters: * path - The full path to the driver to be registers in the NuttX pseudo- * filesystem. The recommended convention is to name of PWM driver * as "/dev/tone0". diff --git a/drivers/can/can.c b/drivers/can/can.c index 7a590d5a73..6232f70ee8 100644 --- a/drivers/can/can.c +++ b/drivers/can/can.c @@ -239,7 +239,7 @@ static void can_pollnotify(FAR struct can_dev_s *dev, pollevent_t eventset) * standard CAN. In CAN FD mode, the values 9 to 15 are encoded to values * in the range 12 to 64. * - * Input Parameter: + * Input Parameters: * dlc - the DLC value to convert to a byte count * * Returned Value: @@ -288,7 +288,7 @@ static uint8_t can_dlc2bytes(uint8_t dlc) * standard CAN. In CAN FD mode, the values 9 to 15 are encoded to values * in the range 12 to 64. * - * Input Parameter: + * Input Parameters: * nbytes - the byte count to convert to a DLC value * * Returned Value: diff --git a/drivers/can/mcp2515.c b/drivers/can/mcp2515.c index 3b68c4d43b..b8ce91bfeb 100644 --- a/drivers/can/mcp2515.c +++ b/drivers/can/mcp2515.c @@ -2369,7 +2369,7 @@ static int mcp2515_interrupt(FAR struct mcp2515_config_s *config, FAR void *arg) * Description: * MCP2515 hardware initialization * - * Input Parameter: + * Input Parameters: * priv - A pointer to the private data structure for this MCP2515 peripheral * * Returned Value: @@ -2483,7 +2483,7 @@ static int mcp2515_hw_initialize(struct mcp2515_can_s *priv) * Description: * Initialize the selected MCP2515 CAN Bus Controller over SPI * - * Input Parameter: + * Input Parameters: * config - The configuration structure passed by the board. * * Returned Value: @@ -2554,7 +2554,7 @@ FAR struct mcp2515_can_s *mcp2515_instantiate(FAR struct mcp2515_config_s *confi * Description: * Initialize the selected MCP2515 CAN Bus Controller over SPI * - * Input Parameter: + * Input Parameters: * config - The configuration structure passed by the board. * * Returned Value: diff --git a/drivers/contactless/pn532.c b/drivers/contactless/pn532.c index 6f1d8fb531..b62e5fa9f2 100644 --- a/drivers/contactless/pn532.c +++ b/drivers/contactless/pn532.c @@ -927,8 +927,8 @@ static int _close(FAR struct file *filep) * Description: * This routine is called when the device is read. * - * Returns TAG id as string to buffer. - * or -EIO if no TAG found + * Returned Value: + * TAG id as string to buffer or -EIO if no TAG found * ****************************************************************************/ diff --git a/drivers/input/ajoystick.c b/drivers/input/ajoystick.c index bed67d1890..233807ddd0 100644 --- a/drivers/input/ajoystick.c +++ b/drivers/input/ajoystick.c @@ -842,7 +842,7 @@ errout_with_dusem: * lower - An instance of the platform-specific analog joystick lower * half driver. * - * Returned Values: + * Returned Value: * Zero (OK) is returned on success. Otherwise a negated errno value is * returned to indicate the nature of the failure. * diff --git a/drivers/input/button_upper.c b/drivers/input/button_upper.c index c172ecfa1d..b60e77f60d 100644 --- a/drivers/input/button_upper.c +++ b/drivers/input/button_upper.c @@ -823,7 +823,7 @@ errout_with_dusem: * minor device number. * lower - An instance of the platform-specific button lower half driver. * - * Returned Values: + * Returned Value: * Zero (OK) is returned on success. Otherwise a negated errno value is * returned to indicate the nature of the failure. * diff --git a/drivers/input/djoystick.c b/drivers/input/djoystick.c index 6ada3f76e1..3854e22c93 100644 --- a/drivers/input/djoystick.c +++ b/drivers/input/djoystick.c @@ -837,7 +837,7 @@ errout_with_dusem: * lower - An instance of the platform-specific discrete joystick lower * half driver. * - * Returned Values: + * Returned Value: * Zero (OK) is returned on success. Otherwise a negated errno value is * returned to indicate the nature of the failure. * diff --git a/drivers/input/nunchuck.c b/drivers/input/nunchuck.c index ccd591802a..b1b2df93f3 100644 --- a/drivers/input/nunchuck.c +++ b/drivers/input/nunchuck.c @@ -567,7 +567,7 @@ static int nunchuck_ioctl(FAR struct file *filep, int cmd, unsigned long arg) * minor device number. * i2c - An instance of the platform-specific I2C connected to Nunchuck. * - * Returned Values: + * Returned Value: * Zero (OK) is returned on success. Otherwise a negated errno value is * returned to indicate the nature of the failure. * diff --git a/drivers/lcd/ili9341.c b/drivers/lcd/ili9341.c index ad31db450e..b55404fb2c 100644 --- a/drivers/lcd/ili9341.c +++ b/drivers/lcd/ili9341.c @@ -532,7 +532,7 @@ static struct ili9341_dev_s g_lcddev[CONFIG_LCD_ILI9341_NINTERFACES] = * Parameters: * dev - Reference to private driver structure * - * Return Value: + * Returned Value: * * Horicontal resolution * @@ -560,7 +560,7 @@ static inline uint16_t ili9341_getxres(FAR struct ili9341_dev_s *dev) * Parameter: * dev - Reference to private driver structure * - * Return Value: + * Returned Value: * * Vertical resolution * diff --git a/drivers/lcd/lcd_framebuffer.c b/drivers/lcd/lcd_framebuffer.c index 369d774a21..db9c27ffaa 100644 --- a/drivers/lcd/lcd_framebuffer.c +++ b/drivers/lcd/lcd_framebuffer.c @@ -451,7 +451,7 @@ static int lcdfb_setcursor(FAR struct fb_vtable_s *vtable, * Description: * Initialize the framebuffer video hardware associated with the display. * - * Input parameters: + * Input Parameters: * display - In the case of hardware with multiple displays, this * specifies the display. Normally this is zero. * @@ -598,7 +598,7 @@ errout_with_state: * Return a a reference to the framebuffer object for the specified video * plane of the specified plane. Many OSDs support multiple planes of video. * - * Input parameters: + * Input Parameters: * display - In the case of hardware with multiple displays, this * specifies the display. Normally this is zero. * vplane - Identifies the plane being queried. diff --git a/drivers/leds/rgbled.c b/drivers/leds/rgbled.c index 0ba2229bdb..1bb4e89f72 100644 --- a/drivers/leds/rgbled.c +++ b/drivers/leds/rgbled.c @@ -420,7 +420,7 @@ static ssize_t rgbled_write(FAR struct file *filep, FAR const char *buffer, * be used by application code. * * - * Input parameters: + * Input Parameters: * path - The full path to the driver to be registers in the NuttX pseudo- * filesystem. The recommended convention is to name all PWM drivers * as "/dev/rgdbled0", "/dev/rgbled1", etc. where the driver path diff --git a/drivers/leds/userled_upper.c b/drivers/leds/userled_upper.c index f851f33cce..ef414cda81 100644 --- a/drivers/leds/userled_upper.c +++ b/drivers/leds/userled_upper.c @@ -527,7 +527,7 @@ static int userled_ioctl(FAR struct file *filep, int cmd, unsigned long arg) * minor device number. * lower - An instance of the platform-specific LED lower half driver. * - * Returned Values: + * Returned Value: * Zero (OK) is returned on success. Otherwise a negated errno value is * returned to indicate the nature of the failure. * diff --git a/drivers/mtd/hamming.c b/drivers/mtd/hamming.c index 95d192db11..7628e9d4d0 100644 --- a/drivers/mtd/hamming.c +++ b/drivers/mtd/hamming.c @@ -65,7 +65,7 @@ * Input Parameters: * bytes - The byte to use. * - * Returned Values: + * Returned Value: * Returns the number of bits set to '1' in the given byte. * ****************************************************************************/ @@ -95,7 +95,7 @@ static unsigned int hamming_bitsinbyte(uint8_t byte) * Input Parameters: * code - Hamming code * - * Returned Values: + * Returned Value: * Returns the number of bits set to '1' in the given hamming code. * ****************************************************************************/ @@ -117,7 +117,7 @@ static uint8_t hamming_bitsincode256(FAR uint8_t *code) * data - Data buffer to calculate code * code - Pointer to a buffer where the code should be stored * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -272,7 +272,7 @@ static void hamming_compute256(FAR const uint8_t *data, FAR uint8_t *code) * data - Data buffer to check * original - Hamming code to use for verifying the data * - * Returned Values: + * Returned Value: * Zero on success, otherwise returns a HAMMING_ERROR_ code. * ****************************************************************************/ @@ -372,7 +372,7 @@ static int hamming_verify256(FAR uint8_t *data, FAR const uint8_t *original) * size - Data size in bytes * code - Codes buffer * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -408,7 +408,7 @@ void hamming_compute256x(FAR const uint8_t *data, size_t size, uint8_t *code) * size - Size of the data in bytes * code - Original codes * - * Returned Values: + * Returned Value: * Return 0 if the data is correct, HAMMING_ERROR_SINGLEBIT if one or more * block(s) have had a single bit corrected, or either HAMMING_ERROR_ECC * or HAMMING_ERROR_MULTIPLEBITS. diff --git a/drivers/mtd/mtd_config.c b/drivers/mtd/mtd_config.c index 9a0d4077c1..32a2a72e59 100644 --- a/drivers/mtd/mtd_config.c +++ b/drivers/mtd/mtd_config.c @@ -336,7 +336,7 @@ errout: * * Locates the first config entry, even if it is empty. * - * Returns: + * Returned Value: * offset to the start of the entry. * ****************************************************************************/ @@ -435,7 +435,7 @@ static int mtdconfig_findfirstentry(FAR struct mtdconfig_struct_s *dev, * * Locates the next config entry starting at offset, even if it is empty. * - * Returns: + * Returned Value: * offset to the start of the next entry. * ****************************************************************************/ @@ -562,7 +562,7 @@ read_next: * method of consolidation is used when only a single erase * block is available in the partition. * - * Returns: + * Returned Value: * offset to the next available entry (after consolidation).. * ****************************************************************************/ @@ -719,7 +719,7 @@ errout: * erased block. It erases all blocks to the end of the * partition as it goes. * - * Returns: + * Returned Value: * offset to the next available entry (after consolidation).. * ****************************************************************************/ diff --git a/drivers/mtd/mtd_nand.c b/drivers/mtd/mtd_nand.c index 8394af67de..09586f7e1c 100644 --- a/drivers/mtd/mtd_nand.c +++ b/drivers/mtd/mtd_nand.c @@ -372,7 +372,7 @@ static uint32_t nand_chipid(struct nand_raw_s *raw) * block Number of block to erase * scrub True: Erase bad blocks * - * Returned Value + * Returned Value: * OK on success; a negated errno value on failure. * ****************************************************************************/ @@ -438,13 +438,13 @@ static int nand_eraseblock(FAR struct nand_dev_s *nand, off_t block, * Reads the data area (only) of a page of a NAND FLASH into the * provided buffer. * - * Input parameters: + * Input Parameters: * nand - Upper-half, NAND FLASH interface * block - Number of the block where the page to read resides. * page - Number of the page to read inside the given block. * data - Buffer where the data area will be stored. * - * Returned value. + * Returned Value: * OK is returned in success; a negated errno value is returned on failure. * ****************************************************************************/ @@ -493,13 +493,13 @@ static int nand_readpage(FAR struct nand_dev_s *nand, off_t block, * Writes the data area (only) of a page into NAND FLASH from the * provided buffer. * - * Input parameters: + * Input Parameters: * nand - Upper-half, NAND FLASH interface * block - Number of the block where the page to read resides. * page - Number of the page to read inside the given block. * data - Buffer where the data area will be stored. * - * Returned value. + * Returned Value: * OK is returned in success; a negated errno value is returned on failure. * ****************************************************************************/ @@ -836,7 +836,7 @@ static int nand_ioctl(struct mtd_dev_s *dev, int cmd, unsigned long arg) * Description: * Probe and initialize NAND. * - * Input parameters: + * Input Parameters: * raw - Lower-half, raw NAND FLASH interface * cmdaddr - NAND command address base * addraddr - NAND address address base @@ -844,7 +844,7 @@ static int nand_ioctl(struct mtd_dev_s *dev, int cmd, unsigned long arg) * model - A pointer to the model data (probably in the raw MTD * driver instance. * - * Returned value. + * Returned Value: * A non-NULL MTD driver intstance is returned on success. NULL is * returned on any failaure. * diff --git a/drivers/mtd/mtd_nandecc.c b/drivers/mtd/mtd_nandecc.c index e22bc23175..47fb3b31be 100644 --- a/drivers/mtd/mtd_nandecc.c +++ b/drivers/mtd/mtd_nandecc.c @@ -75,14 +75,14 @@ * the spare area. If a buffer pointer is NULL, then the corresponding area * is not saved. * - * Input parameters: + * Input Parameters: * nand - Upper-half, NAND FLASH interface * block - Number of the block where the page to read resides. * page - Number of the page to read inside the given block. * data - Buffer where the data area will be stored. * spare - Buffer where the spare area will be stored. * - * Returned value. + * Returned Value: * OK is returned in success; a negated errno value is returned on failure. * ****************************************************************************/ @@ -166,14 +166,14 @@ int nandecc_readpage(FAR struct nand_dev_s *nand, off_t block, * If no spare buffer is provided, the spare area is still written with the * ECC information calculated on the data buffer. * - * Input parameters: + * Input Parameters: * nand - Upper-half, NAND FLASH interface * block - Number of the block where the page to write resides. * page - Number of the page to write inside the given block. * data - Buffer containing the data to be writting * spare - Buffer containing the spare data to be written. * - * Returned value. + * Returned Value: * OK is returned in success; a negated errno value is returned on failure. * ****************************************************************************/ diff --git a/drivers/mtd/mtd_nandmodel.c b/drivers/mtd/mtd_nandmodel.c index cd3c324c9c..2b9c09472b 100644 --- a/drivers/mtd/mtd_nandmodel.c +++ b/drivers/mtd/mtd_nandmodel.c @@ -76,7 +76,7 @@ * chipid Identifier returned by the Nand(id1|(id2<<8)|(id3<<16)|(id4<<24)). * model nand_model_s instance to update with the model parameters. * - * Returned Values: + * Returned Value: * OK is returned on success; -ENODEV is returned on failure. * ****************************************************************************/ @@ -186,7 +186,7 @@ int nandmodel_find(FAR const struct nand_model_s *modeltab, size_t size, * page Stores the first accessed page number inside the first block. * offset Stores the byte offset inside the first accessed page. * - * Returned Values: + * Returned Value: * OK on success; -EPIPE on failure. * ****************************************************************************/ @@ -252,7 +252,7 @@ int nandmodel_translate(FAR const struct nand_model_s *model, off_t address, * Input Parameters: * model Pointer to a nand_model_s instance. * - * Returned Values: + * Returned Value: * size of spare area in bytes * ****************************************************************************/ diff --git a/drivers/mtd/mtd_nandscheme.c b/drivers/mtd/mtd_nandscheme.c index cf0557f22a..17269bb09d 100644 --- a/drivers/mtd/mtd_nandscheme.c +++ b/drivers/mtd/mtd_nandscheme.c @@ -182,7 +182,7 @@ const struct nand_scheme_s g_nand_sparescheme4096 = * spare Spare area buffer. * marker Pointer to the variable to store the bad block marker. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -206,7 +206,7 @@ void nandscheme_readbadblockmarker(FAR const struct nand_scheme_s *scheme, * spare Spare area buffer. * marker Bad block marker to write. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -228,7 +228,7 @@ void nandscheme_writebadblockmarker(FAR const struct nand_scheme_s *scheme, * spare Spare area buffer. * ecc ECC buffer. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -255,7 +255,7 @@ void nandscheme_readecc(FAR const struct nand_scheme_s *scheme, * spare Spare area buffer. * ecc ECC buffer. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -285,7 +285,7 @@ void nandscheme_writeecc(FAR const struct nand_scheme_s *scheme, * size Number of extra bytes to read. * offset Index where to read the first extra byte. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -318,7 +318,7 @@ void nandscheme_readextra(FAR const struct nand_scheme_s *scheme, * size Number of extra bytes to write. * offset Index where to write the first extra byte. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -349,7 +349,7 @@ void nandscheme_writeextra(FAR const struct nand_scheme_s *scheme, * size Number of extra bytes to write. * offset Index where to write the first extra byte. * - * Returned Values: + * Returned Value: * OK on success; a negated errno value on failure. * ****************************************************************************/ diff --git a/drivers/mtd/mtd_partition.c b/drivers/mtd/mtd_partition.c index f8438cdd97..54c88e9816 100644 --- a/drivers/mtd/mtd_partition.c +++ b/drivers/mtd/mtd_partition.c @@ -767,7 +767,7 @@ static int part_procfs_stat(const char *relpath, struct stat *buf) * partitions, that mutual exclusion would be provided by the file system * above the FLASH driver. * - * Input parameters: + * Input Parameters: * mtd - The MTD device to be partitioned * firstblock - The offset in bytes to the first block * nblocks - The number of blocks in the partition diff --git a/drivers/net/telnet.c b/drivers/net/telnet.c index 6c849826ef..db5419125d 100644 --- a/drivers/net/telnet.c +++ b/drivers/net/telnet.c @@ -690,7 +690,7 @@ static ssize_t telnet_read(FAR struct file *filep, FAR char *buffer, size_t len) } while (ret == 0); - /* Return: + /* Returned Value: * * ret > 0: The number of characters copied into the user buffer by * telnet_receive(). @@ -783,7 +783,7 @@ static ssize_t telnet_write(FAR struct file *filep, FAR const char *buffer, size * session - On input, contains the socket descriptor that represents the * new telnet connection. On output, it holds the path to the new Telnet driver. * - * Return: + * Returned Value: * Zero (OK) on success; a negated errno value on failure. * ****************************************************************************/ @@ -978,7 +978,7 @@ static int common_ioctl(FAR struct file *filep, int cmd, unsigned long arg) * Parameters: * None * - * Return: + * Returned Value: * Zero (OK) on success; a negated errno value on failure. * ****************************************************************************/ diff --git a/drivers/pipes/fifo.c b/drivers/pipes/fifo.c index 43afa5556f..6a8905a6a2 100644 --- a/drivers/pipes/fifo.c +++ b/drivers/pipes/fifo.c @@ -97,13 +97,13 @@ static const struct file_operations fifo_fops = * the NuttX FIFOs are based in in-memory, circular buffers, the ability * to control the size of those buffers is critical for system tuning. * - * Inputs: + * Input Parameters: * pathname - The full path to the FIFO instance to attach to or to create * (if not already created). * mode - Ignored for now * bufsize - The size of the in-memory, circular buffer in bytes. * - * Return: + * Returned Value: * 0 is returned on success; otherwise, -1 is returned with errno set * appropriately. * diff --git a/drivers/pipes/pipe.c b/drivers/pipes/pipe.c index b32ef965e9..f3a98e6351 100644 --- a/drivers/pipes/pipe.c +++ b/drivers/pipes/pipe.c @@ -177,12 +177,12 @@ static int pipe_close(FAR struct file *filep) * the NuttX FIFOs are based in in-memory, circular buffers, the ability * to control the size of those buffers is critical for system tuning. * - * Inputs: + * Input Parameters: * fd[2] - The user provided array in which to catch the pipe file * descriptors * bufsize - The size of the in-memory, circular buffer in bytes. * - * Return: + * Returned Value: * 0 is returned on success; otherwise, -1 is returned with errno set * appropriately. * diff --git a/drivers/power/battery_charger.c b/drivers/power/battery_charger.c index 0bacbd90e3..5467f49093 100644 --- a/drivers/power/battery_charger.c +++ b/drivers/power/battery_charger.c @@ -270,12 +270,12 @@ static int bat_charger_ioctl(FAR struct file *filep, int cmd, * Register a lower half battery driver with the common, upper-half * battery driver. * - * Input parameters: + * Input Parameters: * devpath - The location in the pseudo-filesystem to create the driver. * Recommended standard is "/dev/bat0", "/dev/bat1", etc. * dev - An instance of the battery state structure . * - * Returned value: + * Returned Value: * Zero on success or a negated errno value on failure. * ****************************************************************************/ diff --git a/drivers/power/battery_gauge.c b/drivers/power/battery_gauge.c index ab97489188..9936147be1 100644 --- a/drivers/power/battery_gauge.c +++ b/drivers/power/battery_gauge.c @@ -233,12 +233,12 @@ static int bat_gauge_ioctl(FAR struct file *filep, int cmd, unsigned long arg) * Register a lower half battery driver with the common, upper-half * battery driver. * - * Input parameters: + * Input Parameters: * devpath - The location in the pseudo-filesystem to create the driver. * Recommended standard is "/dev/bat0", "/dev/bat1", etc. * dev - An instance of the battery state structure . * - * Returned value: + * Returned Value: * Zero on success or a negated errno value on failure. * ****************************************************************************/ diff --git a/drivers/power/pm_initialize.c b/drivers/power/pm_initialize.c index 83b67645f7..bb777f9865 100644 --- a/drivers/power/pm_initialize.c +++ b/drivers/power/pm_initialize.c @@ -70,10 +70,10 @@ struct pm_global_s g_pmglobals; * other device drivers are initialize (since they may attempt to register * with the power management subsystem). * - * Input parameters: + * Input Parameters: * None. * - * Returned value: + * Returned Value: * None. * ****************************************************************************/ diff --git a/drivers/power/pm_register.c b/drivers/power/pm_register.c index b33dab6962..0604631358 100644 --- a/drivers/power/pm_register.c +++ b/drivers/power/pm_register.c @@ -59,11 +59,11 @@ * This function is called by a device driver in order to register to * receive power management event callbacks. * - * Input parameters: + * Input Parameters: * callbacks - An instance of struct pm_callback_s providing the driver * callback functions. * - * Returned value: + * Returned Value: * Zero (OK) on success; otherwise a negater errno value is returned. * ****************************************************************************/ diff --git a/drivers/pwm.c b/drivers/pwm.c index 44d644cc64..085c3065e9 100644 --- a/drivers/pwm.c +++ b/drivers/pwm.c @@ -568,7 +568,7 @@ static int pwm_ioctl(FAR struct file *filep, int cmd, unsigned long arg) * When this function is called, the "lower half" driver should be in the * reset state (as if the shutdown() method had already been called). * - * Input parameters: + * Input Parameters: * path - The full path to the driver to be registered in the NuttX pseudo- * filesystem. The recommended convention is to name all PWM drivers * as "/dev/pwm0", "/dev/pwm1", etc. where the driver path differs only @@ -641,7 +641,7 @@ int pwm_register(FAR const char *path, FAR struct pwm_lowerhalf_s *dev) * interface using the handle that was previously passed to the * start() method * - * Input parameters: + * Input Parameters: * handle - This is the handle that was provided to the lower-half * start() method. * diff --git a/drivers/ramdisk.c b/drivers/ramdisk.c index b31e1f0dd9..842c36cd9d 100644 --- a/drivers/ramdisk.c +++ b/drivers/ramdisk.c @@ -428,14 +428,14 @@ static int rd_unlink(FAR struct inode *inode) * Description: * Non-standard function to register a ramdisk or a romdisk * - * Input Parmeters: + * Input Parameters: * minor: Selects suffix of device named /dev/ramN, N={1,2,3...} * nsectors: Number of sectors on device * sectize: The size of one sector * rdflags: See RDFLAG_* definitions * buffer: RAM disk backup memory * - * Returned Valued: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ diff --git a/drivers/syslog/syslog_emergstream.c b/drivers/syslog/syslog_emergstream.c index 8347c15a8e..e7aef97e23 100644 --- a/drivers/syslog/syslog_emergstream.c +++ b/drivers/syslog/syslog_emergstream.c @@ -97,7 +97,7 @@ static void emergstream_putc(FAR struct lib_outstream_s *this, int ch) * Initializes a stream for use with the configured emergency syslog * interface. Only accessible from with the OS SYSLOG logic. * - * Input parameters: + * Input Parameters: * stream - User allocated, uninitialized instance of struct * lib_outstream_s to be initialized. * diff --git a/drivers/syslog/syslog_stream.c b/drivers/syslog/syslog_stream.c index a71bd933d7..e3e2b1b57d 100644 --- a/drivers/syslog/syslog_stream.c +++ b/drivers/syslog/syslog_stream.c @@ -199,7 +199,7 @@ static void syslogstream_putc(FAR struct lib_outstream_s *this, int ch) * Initializes a stream for use with the configured syslog interface. * Only accessible from with the OS SYSLOG logic. * - * Input parameters: + * Input Parameters: * stream - User allocated, uninitialized instance of struct * lib_lowoutstream_s to be initialized. * @@ -245,7 +245,7 @@ void syslogstream_create(FAR struct lib_syslogstream_s *stream) * Description: * Free resources held by the syslog stream. * - * Input parameters: + * Input Parameters: * stream - User allocated, uninitialized instance of struct * lib_lowoutstream_s to be initialized. * diff --git a/drivers/timers/rtc.c b/drivers/timers/rtc.c index f38979ee50..380bb35419 100644 --- a/drivers/timers/rtc.c +++ b/drivers/timers/rtc.c @@ -784,7 +784,7 @@ static int rtc_unlink(FAR struct inode *inode) * provided to this function. The resulting RTC driver will be registered * at /dev/rtcN where N is the minor number provided to this function. * - * Input parameters: + * Input Parameters: * minor - The minor number of the RTC device. The N in /dev/rtcN * lower - The lower half driver instance. * diff --git a/drivers/timers/timer.c b/drivers/timers/timer.c index d760a2c4c6..6bb4edeb19 100644 --- a/drivers/timers/timer.c +++ b/drivers/timers/timer.c @@ -431,7 +431,7 @@ static int timer_ioctl(FAR struct file *filep, int cmd, unsigned long arg) * When this function is called, the "lower half" driver should be in the * disabled state (as if the stop() method had already been called). * - * Input parameters: + * Input Parameters: * dev path - The full path to the driver to be registers in the NuttX * pseudo-filesystem. The recommended convention is to name all timer * drivers as "/dev/tc0", "/dev/tc1", etc. where the driver @@ -508,7 +508,7 @@ errout: * This function can be called to disable and unregister the timer * device driver. * - * Input parameters: + * Input Parameters: * handle - This is the handle that was returned by timer_register() * * Returned Value: @@ -552,7 +552,7 @@ void timer_unregister(FAR void *handle) * to handle timer expirations. This is a strictly OS internal interface * and may NOT be used by appliction code. * - * Input parameters: + * Input Parameters: * handle - This is the handle that was returned by timer_register() * callback - The new timer interrupt callback * arg - Argument to be provided with the callback diff --git a/drivers/timers/watchdog.c b/drivers/timers/watchdog.c index 06208e49dd..a1a29fbaf4 100644 --- a/drivers/timers/watchdog.c +++ b/drivers/timers/watchdog.c @@ -439,7 +439,7 @@ static int wdog_ioctl(FAR struct file *filep, int cmd, unsigned long arg) * When this function is called, the "lower half" driver should be in the * disabled state (as if the stop() method had already been called). * - * Input parameters: + * Input Parameters: * dev path - The full path to the driver to be registers in the NuttX * pseudo-filesystem. The recommended convention is to name all watchdog * drivers as "/dev/watchdog0", "/dev/watchdog1", etc. where the driver @@ -518,7 +518,7 @@ errout: * This function can be called to disable and unregister the watchdog * device driver. * - * Input parameters: + * Input Parameters: * handle - This is the handle that was returned by watchdog_register() * * Returned Value: diff --git a/drivers/usbdev/cdcacm.c b/drivers/usbdev/cdcacm.c index 7593156a91..4cd4256f16 100644 --- a/drivers/usbdev/cdcacm.c +++ b/drivers/usbdev/cdcacm.c @@ -2638,7 +2638,7 @@ static void cdcuart_rxint(FAR struct uart_dev_s *dev, bool enable) * Return true if UART activated RX flow control to block more incoming * data * - * Input parameters: + * Input Parameters: * dev - UART device instance * nbuffered - the number of characters currently buffered * (if CONFIG_SERIAL_IFLOWCONTROL_WATERMARKS is @@ -2869,7 +2869,7 @@ static bool cdcuart_txempty(FAR struct uart_dev_s *dev) * Register USB serial port (and USB serial console if so configured) and * return the class object. * - * Input Parameter: + * Input Parameters: * minor - Device minor number. E.g., minor 0 would correspond to * /dev/ttyACM0. * classdev - The location to return the CDC serial class' device @@ -3004,7 +3004,7 @@ errout_with_class: * Description: * Register USB serial port (and USB serial console if so configured). * - * Input Parameter: + * Input Parameters: * minor - Device minor number. E.g., minor 0 would correspond to * /dev/ttyACM0. * handle - An optional opaque reference to the CDC/ACM class object that diff --git a/drivers/usbdev/composite.c b/drivers/usbdev/composite.c index 17204d7f81..6800cd95db 100644 --- a/drivers/usbdev/composite.c +++ b/drivers/usbdev/composite.c @@ -786,7 +786,7 @@ static void composite_resume(FAR struct usbdevclass_driver_s *driver, * board-specific implementations in order to obtain the class objects for * each of the members of the composite. * - * Input Parameter: + * Input Parameters: * None * * Returned Value: diff --git a/drivers/usbdev/rndis.c b/drivers/usbdev/rndis.c index 3e1baf2e08..bc70bc1036 100644 --- a/drivers/usbdev/rndis.c +++ b/drivers/usbdev/rndis.c @@ -775,7 +775,7 @@ static void rndis_giverxreq(FAR struct rndis_dev_s *priv) * priv: pointer to RNDIS device driver structure * req: the request whose buffer we should fill * - * Returned value: + * Returned Value: * The total length of the request data * * Assumptions: diff --git a/drivers/usbdev/usbmsc.c b/drivers/usbdev/usbmsc.c index 7fdfcbfc88..14b735301f 100644 --- a/drivers/usbdev/usbmsc.c +++ b/drivers/usbdev/usbmsc.c @@ -1231,7 +1231,7 @@ void usbmsc_rdcomplete(FAR struct usbdev_ep_s *ep, * In all cases, the success reponse is a zero-length packet; the failure * response is an EP0 stall. * - * Input parameters: + * Input Parameters: * priv - Private state structure for this USB storage instance * stall - true is the action failed and a stall is required * diff --git a/drivers/usbdev/usbmsc.h b/drivers/usbdev/usbmsc.h index 79d26778e8..d0d93d3489 100644 --- a/drivers/usbdev/usbmsc.h +++ b/drivers/usbdev/usbmsc.h @@ -679,7 +679,7 @@ void usbmsc_rdcomplete(FAR struct usbdev_ep_s *ep, * In all cases, the success reponse is a zero-length packet; the failure * response is an EP0 stall. * - * Input parameters: + * Input Parameters: * priv - Private state structure for this USB storage instance * stall - true is the action failed and a stall is required * diff --git a/drivers/usbdev/usbmsc_scsi.c b/drivers/usbdev/usbmsc_scsi.c index 8b20a008c4..369d926be1 100644 --- a/drivers/usbdev/usbmsc_scsi.c +++ b/drivers/usbdev/usbmsc_scsi.c @@ -1636,7 +1636,7 @@ static int inline usbmsc_setupcmd(FAR struct usbmsc_dev_s *priv, * Called from the worker thread in the USBMSC_STATE_IDLE state. Checks * for the receipt of a bulk CBW. * - * Returned value: + * Returned Value: * If no new, valid CBW is available, this function returns a negated errno. * Otherwise, when a new CBW is successfully parsed, this function sets * priv->thstate to USBMSC_STATE_CMDPARSE and returns OK. @@ -1781,7 +1781,7 @@ static int usbmsc_idlestate(FAR struct usbmsc_dev_s *priv) * This state is entered when usbmsc_idlestate obtains a valid CBW * containing SCSI commands. This function processes those SCSI commands. * - * Returned value: + * Returned Value: * If no write request is available or certain other errors occur, this * function returns a negated errno and stays in the USBMSC_STATE_CMDPARSE * state. Otherwise, when the new CBW is successfully process, this @@ -2097,7 +2097,7 @@ static int usbmsc_cmdparsestate(FAR struct usbmsc_dev_s *priv) * of the USBMSC_STATE_CMDPARSE state that handles extended SCSI read * command handling. * - * Returned value: + * Returned Value: * If no USBDEV write request is available or certain other errors occur, this * function returns a negated errno and stays in the USBMSC_STATE_CMDREAD * state. Otherwise, when the new SCSI read command is fully processed, @@ -2244,7 +2244,7 @@ static int usbmsc_cmdreadstate(FAR struct usbmsc_dev_s *priv) * of the USBMSC_STATE_CMDPARSE state that handles extended SCSI write * command handling. * - * Returned value: + * Returned Value: * If no USBDEV write request is available or certain other errors occur, this * function returns a negated errno and stays in the USBMSC_STATE_CMDWRITE * state. Otherwise, when the new SCSI write command is fully processed, @@ -2384,7 +2384,7 @@ errout: * The USBMSC_STATE_CMDFINISH state is entered when processing of a * command has finished but before status has been returned. * - * Returned value: + * Returned Value: * If no USBDEV write request is available or certain other errors occur, this * function returns a negated errno and stays in the USBMSC_STATE_CMDFINISH * state. Otherwise, when the command is fully processed, this function @@ -2527,7 +2527,7 @@ static int usbmsc_cmdfinishstate(FAR struct usbmsc_dev_s *priv) * That state is after a CBW has been fully processed. This function sends * the concluding CSW. * - * Returned value: + * Returned Value: * If no write request is available or certain other errors occur, this * function returns a negated errno and stays in the USBMSC_STATE_CMDSTATUS * state. Otherwise, when the SCSI statis is successfully returned, this diff --git a/drivers/usbhost/hid_parser.c b/drivers/usbhost/hid_parser.c index 59198faa93..88a167beac 100644 --- a/drivers/usbhost/hid_parser.c +++ b/drivers/usbhost/hid_parser.c @@ -398,7 +398,7 @@ int hid_parsereport(FAR const uint8_t *report, int rptlen, * report. If the given item does not exist in the report, the function * does not modify the report item's data. * - * Input Parameters + * Input Parameters: * report Buffer containing an IN or FEATURE report from an attached * device. * item Pointer to the report item of interest in a struct hid_rptinfo_s @@ -500,7 +500,7 @@ void hid_putitem(FAR uint8_t *report, struct hid_rptitem_s *item) * Description: * Retrieves the size of a given HID report in bytes from it's Report ID. * - * InputParameters: + * Input Parameters: * rptinfo Pointer to a struct hid_rptinfo_s instance containing the parser output. * id Report ID of the report whose size is to be retrieved. * rpttype Type of the report whose size is to be determined, a valued from the diff --git a/drivers/usbhost/usbhost_cdcacm.c b/drivers/usbhost/usbhost_cdcacm.c index 250e561e23..7353af369e 100644 --- a/drivers/usbhost/usbhost_cdcacm.c +++ b/drivers/usbhost/usbhost_cdcacm.c @@ -2623,7 +2623,7 @@ static bool usbhost_rxavailable(FAR struct uart_dev_s *uartdev) * Return true if UART activated RX flow control to block more incoming * data * - * Input parameters: + * Input Parameters: * uartdev - UART device instance * nbuffered - the number of characters currently buffered * (if CONFIG_SERIAL_IFLOWCONTROL_WATERMARKS is diff --git a/drivers/usbhost/usbhost_enumerate.c b/drivers/usbhost/usbhost_enumerate.c index a6cbddc9ed..cb45a191da 100644 --- a/drivers/usbhost/usbhost_enumerate.c +++ b/drivers/usbhost/usbhost_enumerate.c @@ -280,7 +280,7 @@ static inline int usbhost_classbind(FAR struct usbhost_hubport_s *hport, * and bound to the hub port, the allocated class instance is returned * into this caller-provided memory location. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * diff --git a/drivers/usbhost/usbhost_findclass.c b/drivers/usbhost/usbhost_findclass.c index 7ae1cad4dc..f92534fd1f 100644 --- a/drivers/usbhost/usbhost_findclass.c +++ b/drivers/usbhost/usbhost_findclass.c @@ -64,7 +64,7 @@ * classid - ID info for the class under consideration. * devid - ID info reported by the device. * - * Returned Values: + * Returned Value: * TRUE - the class will support this device. * ****************************************************************************/ @@ -127,7 +127,7 @@ static bool usbhost_idmatch(const struct usbhost_id_s *classid, * Input Parameters: * id - Identifies the USB device class that has connect to the USB host. * - * Returned Values: + * Returned Value: * On success this function will return a non-NULL instance of struct * usbhost_registry_s. NULL will be returned on failure. This function * can only fail if (1) id is NULL, or (2) no USB host class is registered diff --git a/drivers/usbhost/usbhost_hidkbd.c b/drivers/usbhost/usbhost_hidkbd.c index e3a9f19207..3a0e07afaf 100644 --- a/drivers/usbhost/usbhost_hidkbd.c +++ b/drivers/usbhost/usbhost_hidkbd.c @@ -653,7 +653,7 @@ static void usbhost_pollnotify(FAR struct usbhost_state_s *priv) * Input Parameters: * None * - * Returned Values: + * Returned Value: * On success, this function will return a non-NULL instance of struct * usbhost_class_s. NULL is returned on failure; this function will * will fail only if there are insufficient resources to create another @@ -680,7 +680,7 @@ static inline FAR struct usbhost_state_s *usbhost_allocclass(void) * Input Parameters: * usbclass - A reference to the class instance to be freed. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -753,7 +753,7 @@ static inline void usbhost_mkdevname(FAR struct usbhost_state_s *priv, char *dev * Input Parameters: * arg - A reference to the class instance to be destroyed. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -824,7 +824,7 @@ static void usbhost_destroy(FAR void *arg) * priv - Driver internal state * keycode - The value to add to the user buffer * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -880,7 +880,7 @@ static void usbhost_putbuffer(FAR struct usbhost_state_s *priv, * stream - The struct lib_outstream_s reference * ch - The character to add to the user buffer * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -908,7 +908,7 @@ static void usbhost_putstream(FAR struct lib_outstream_s *stream, int ch) * scancode - Scan code to be mapped. * modifier - Ctrl,Alt,Shift,GUI modifier bits * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -950,7 +950,7 @@ static inline uint8_t usbhost_mapscancode(uint8_t scancode, uint8_t modifier) * scancode - Scan code to be mapped. * modifier - Ctrl, Alt, Shift, GUI modifier bits * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -999,7 +999,7 @@ static inline void usbhost_encodescancode(FAR struct usbhost_state_s *priv, * Input Parameters: * arg - A reference to the class instance to be destroyed. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -1326,7 +1326,7 @@ static int usbhost_kbdpoll(int argc, char *argv[]) * descriptor. * desclen - The length in bytes of the configuration descriptor. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -1578,7 +1578,7 @@ static inline int usbhost_cfgdesc(FAR struct usbhost_state_s *priv, * Input Parameters: * priv - A reference to the class instance. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -1669,7 +1669,7 @@ errout: * Input Parameters: * val - A pointer to the first byte of the little endian value. * - * Returned Values: + * Returned Value: * A uint16_t representing the whole 16-bit integer value * ****************************************************************************/ @@ -1689,7 +1689,7 @@ static inline uint16_t usbhost_getle16(const uint8_t *val) * dest - A pointer to the first byte to save the little endian value. * val - The 16-bit value to be saved. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -1710,7 +1710,7 @@ static void usbhost_putle16(uint8_t *dest, uint16_t val) * dest - A pointer to the first byte to save the big endian value. * val - The 32-bit value to be saved. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -1732,7 +1732,7 @@ static inline uint32_t usbhost_getle32(const uint8_t *val) * dest - A pointer to the first byte to save the little endian value. * val - The 32-bit value to be saved. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -1756,7 +1756,7 @@ static void usbhost_putle32(uint8_t *dest, uint32_t val) * Input Parameters: * priv - A reference to the class instance. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On failure, an negated errno value * is returned to indicate the nature of the failure. * @@ -1782,7 +1782,7 @@ static inline int usbhost_tdalloc(FAR struct usbhost_state_s *priv) * Input Parameters: * priv - A reference to the class instance. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On failure, an negated errno value * is returned to indicate the nature of the failure. * @@ -1827,7 +1827,7 @@ static inline int usbhost_tdfree(FAR struct usbhost_state_s *priv) * id - In the case where the device supports multiple base classes, * subclasses, or protocols, this specifies which to configure for. * - * Returned Values: + * Returned Value: * On success, this function will return a non-NULL instance of struct * usbhost_class_s that can be used by the USB host driver to communicate * with the USB host class. NULL is returned on failure; this function @@ -1912,7 +1912,7 @@ static FAR struct usbhost_class_s * * descriptor. * desclen - The length in bytes of the configuration descriptor. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -1981,7 +1981,7 @@ static int usbhost_connect(FAR struct usbhost_class_s *usbclass, * usbclass - The USB host class entry previously obtained from a call to * create(). * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value * is returned indicating the nature of the failure * @@ -2424,7 +2424,7 @@ errout: * Input Parameters: * None * - * Returned Values: + * Returned Value: * On success this function will return zero (OK); A negated errno value * will be returned on failure. * diff --git a/drivers/usbhost/usbhost_hidmouse.c b/drivers/usbhost/usbhost_hidmouse.c index 944b939f89..4648c3bdb3 100644 --- a/drivers/usbhost/usbhost_hidmouse.c +++ b/drivers/usbhost/usbhost_hidmouse.c @@ -513,7 +513,7 @@ static void usbhost_pollnotify(FAR struct usbhost_state_s *priv) * Input Parameters: * None * - * Returned Values: + * Returned Value: * On success, this function will return a non-NULL instance of struct * usbhost_class_s. NULL is returned on failure; this function will * will fail only if there are insufficient resources to create another @@ -540,7 +540,7 @@ static inline FAR struct usbhost_state_s *usbhost_allocclass(void) * Input Parameters: * usbclass - A reference to the class instance to be freed. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -614,7 +614,7 @@ static inline void usbhost_mkdevname(FAR struct usbhost_state_s *priv, * Input Parameters: * arg - A reference to the class instance to be destroyed. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -676,7 +676,7 @@ static void usbhost_destroy(FAR void *arg) * Description: * Wake any threads waiting for mouse data * - * Input Paramters: + * Input Parameters: * priv - A reference to the mouse state structure. * * Returned Value: @@ -1038,7 +1038,7 @@ static bool usbhost_threshold(FAR struct usbhost_state_s *priv) * Input Parameters: * arg - A reference to the class instance to be destroyed. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -1448,7 +1448,7 @@ errout: * descriptor. * desclen - The length in bytes of the configuration descriptor. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -1648,7 +1648,7 @@ static inline int usbhost_cfgdesc(FAR struct usbhost_state_s *priv, * Input Parameters: * priv - A reference to the class instance. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -1739,7 +1739,7 @@ errout: * Input Parameters: * val - A pointer to the first byte of the little endian value. * - * Returned Values: + * Returned Value: * A uint16_t representing the whole 16-bit integer value * ****************************************************************************/ @@ -1759,7 +1759,7 @@ static inline uint16_t usbhost_getle16(const uint8_t *val) * dest - A pointer to the first byte to save the little endian value. * val - The 16-bit value to be saved. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -1780,7 +1780,7 @@ static void usbhost_putle16(uint8_t *dest, uint16_t val) * dest - A pointer to the first byte to save the big endian value. * val - The 32-bit value to be saved. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -1802,7 +1802,7 @@ static inline uint32_t usbhost_getle32(const uint8_t *val) * dest - A pointer to the first byte to save the little endian value. * val - The 32-bit value to be saved. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -1826,7 +1826,7 @@ static void usbhost_putle32(uint8_t *dest, uint32_t val) * Input Parameters: * priv - A reference to the class instance. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On failure, an negated errno value * is returned to indicate the nature of the failure. * @@ -1852,7 +1852,7 @@ static inline int usbhost_tdalloc(FAR struct usbhost_state_s *priv) * Input Parameters: * priv - A reference to the class instance. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On failure, an negated errno value * is returned to indicate the nature of the failure. * @@ -1896,7 +1896,7 @@ static inline int usbhost_tdfree(FAR struct usbhost_state_s *priv) * id - In the case where the device supports multiple base classes, * subclasses, or protocols, this specifies which to configure for. * - * Returned Values: + * Returned Value: * On success, this function will return a non-NULL instance of struct * usbhost_class_s that can be used by the USB host driver to communicate * with the USB host class. NULL is returned on failure; this function @@ -1982,7 +1982,7 @@ static FAR struct usbhost_class_s * * descriptor. * desclen - The length in bytes of the configuration descriptor. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -2050,7 +2050,7 @@ static int usbhost_connect(FAR struct usbhost_class_s *usbclass, * usbclass - The USB host class entry previously obtained from a call to * create(). * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value * is returned indicating the nature of the failure * @@ -2553,7 +2553,7 @@ errout: * Input Parameters: * None * - * Returned Values: + * Returned Value: * On success this function will return zero (OK); A negated errno value * will be returned on failure. * diff --git a/drivers/usbhost/usbhost_hub.c b/drivers/usbhost/usbhost_hub.c index 58d7c64a2d..b3fecd6617 100644 --- a/drivers/usbhost/usbhost_hub.c +++ b/drivers/usbhost/usbhost_hub.c @@ -222,7 +222,7 @@ static struct usbhost_registry_s g_hub = * Input Parameters: * hport - A reference to the hub port instance to be freed. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -264,7 +264,7 @@ static void usbhost_hport_deactivate(FAR struct usbhost_hubport_s *hport) * Input Parameters: * hport - The hub port to be activated. * - * Returned Values: + * Returned Value: * Zero (OK) is returned on success; a negated errno value is returned * on any failure. * @@ -308,7 +308,7 @@ static int usbhost_hport_activate(FAR struct usbhost_hubport_s *hport) * descriptor. * desclen - The length in bytes of the configuration descriptor. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value * is returned indicating the nature of the failure * @@ -496,7 +496,7 @@ static inline int usbhost_cfgdesc(FAR struct usbhost_class_s *hubclass, * Input Parameters: * hubclass - The USB host class instance. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value * is returned indicating the nature of the failure * @@ -598,7 +598,7 @@ static inline int usbhost_hubdesc(FAR struct usbhost_class_s *hubclass) * hport - The port on the parent hub where the this hub is connected. * on - True: enable power; false: Disable power * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -661,7 +661,7 @@ static int usbhost_hubpwr(FAR struct usbhost_hubpriv_s *priv, * Input Parameters: * xfer - The USB host class instance. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value * is returned indicating the nature of the failure * @@ -1010,7 +1010,7 @@ static void usbhost_hub_event(FAR void *arg) * class - The USB host class entry previously obtained from a call to * create(). * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value * is returned indicating the nature of the failure * @@ -1112,7 +1112,7 @@ static void usbhost_disconnect_event(FAR void *arg) * Input Parameters: * val - A pointer to the first byte of the little endian value. * - * Returned Values: + * Returned Value: * A uint16_t representing the whole 16-bit integer value * ****************************************************************************/ @@ -1132,7 +1132,7 @@ static inline uint16_t usbhost_getle16(const uint8_t *val) * dest - A pointer to the first byte to save the little endian value. * val - The 16-bit value to be saved. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -1154,7 +1154,7 @@ static void usbhost_putle16(uint8_t *dest, uint16_t val) * nbytes - The number of bytes actually transferred (or a negated errno * value; * - * Returned Values: + * Returned Value: * None * * Assumptions: @@ -1244,7 +1244,7 @@ static void usbhost_callback(FAR void *arg, ssize_t nbytes) * id - In the case where the device supports multiple base classes, * subclasses, or protocols, this specifies which to configure for. * - * Returned Values: + * Returned Value: * On success, this function will return a non-NULL instance of struct * usbhost_class_s that can be used by the USB host driver to communicate * with the USB host class. NULL is returned on failure; this function @@ -1351,7 +1351,7 @@ errout_with_hub: * descriptor. * desclen - The length in bytes of the configuration descriptor. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -1439,7 +1439,7 @@ static int usbhost_connect(FAR struct usbhost_class_s *hubclass, * class - The USB host class entry previously obtained from a call to * create(). * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value * is returned indicating the nature of the failure * @@ -1497,7 +1497,7 @@ static int usbhost_disconnected(struct usbhost_class_s *hubclass) * Input Parameters: * None * - * Returned Values: + * Returned Value: * On success this function will return zero (OK); A negated errno value * will be returned on failure. * diff --git a/drivers/usbhost/usbhost_registerclass.c b/drivers/usbhost/usbhost_registerclass.c index a795b88d02..8cd52dd02d 100644 --- a/drivers/usbhost/usbhost_registerclass.c +++ b/drivers/usbhost/usbhost_registerclass.c @@ -86,7 +86,7 @@ * usbclass - An write-able instance of struct usbhost_registry_s that * will be maintained in a registry. * - * Returned Values: + * Returned Value: * On success, this function will return zero (OK). Otherwise, a negated * errno value is returned. * diff --git a/drivers/usbhost/usbhost_skeleton.c b/drivers/usbhost/usbhost_skeleton.c index 651f99fb52..c79d2498ae 100644 --- a/drivers/usbhost/usbhost_skeleton.c +++ b/drivers/usbhost/usbhost_skeleton.c @@ -242,7 +242,7 @@ static void usbhost_takesem(sem_t *sem) * Input Parameters: * None * - * Returned Values: + * Returned Value: * On success, this function will return a non-NULL instance of struct * usbhost_class_s. NULL is returned on failure; this function will * will fail only if there are insufficient resources to create another @@ -269,7 +269,7 @@ static inline FAR struct usbhost_state_s *usbhost_allocclass(void) * Input Parameters: * usbclass - A reference to the class instance to be freed. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -345,7 +345,7 @@ static inline void usbhost_mkdevname(FAR struct usbhost_state_s *priv, * Input Parameters: * arg - A reference to the class instance to be destroyed. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -409,7 +409,7 @@ static void usbhost_destroy(FAR void *arg) * descriptor. * desclen - The length in bytes of the configuration descriptor. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -623,7 +623,7 @@ static inline int usbhost_cfgdesc(FAR struct usbhost_state_s *priv, * Input Parameters: * priv - A reference to the class instance. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -700,7 +700,7 @@ static inline int usbhost_devinit(FAR struct usbhost_state_s *priv) * Input Parameters: * val - A pointer to the first byte of the little endian value. * - * Returned Values: + * Returned Value: * A uint16_t representing the whole 16-bit integer value * ****************************************************************************/ @@ -720,7 +720,7 @@ static inline uint16_t usbhost_getle16(const uint8_t *val) * dest - A pointer to the first byte to save the little endian value. * val - The 16-bit value to be saved. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -741,7 +741,7 @@ static void usbhost_putle16(uint8_t *dest, uint16_t val) * dest - A pointer to the first byte to save the big endian value. * val - The 32-bit value to be saved. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -763,7 +763,7 @@ static inline uint32_t usbhost_getle32(const uint8_t *val) * dest - A pointer to the first byte to save the little endian value. * val - The 32-bit value to be saved. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -785,7 +785,7 @@ static void usbhost_putle32(uint8_t *dest, uint32_t val) * Input Parameters: * priv - A reference to the class instance. * - * Returned Values: + * Returned Value: * On sucess, zero (OK) is returned. On failure, an negated errno value * is returned to indicate the nature of the failure. * @@ -811,7 +811,7 @@ static inline int usbhost_talloc(FAR struct usbhost_state_s *priv) * Input Parameters: * priv - A reference to the class instance. * - * Returned Values: + * Returned Value: * On sucess, zero (OK) is returned. On failure, an negated errno value * is returned to indicate the nature of the failure. * @@ -855,7 +855,7 @@ static inline int usbhost_tfree(FAR struct usbhost_state_s *priv) * id - In the case where the device supports multiple base classes, * subclasses, or protocols, this specifies which to configure for. * - * Returned Values: + * Returned Value: * On success, this function will return a non-NULL instance of struct * usbhost_class_s that can be used by the USB host driver to communicate * with the USB host class. NULL is returned on failure; this function @@ -930,7 +930,7 @@ static FAR struct usbhost_class_s *usbhost_create(FAR struct usbhost_hubport_s * * descriptor. * desclen - The length in bytes of the configuration descriptor. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -989,7 +989,7 @@ static int usbhost_connect(FAR struct usbhost_class_s *usbclass, * usbclass - The USB host class entry previously obtained from a call to * create(). * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value * is returned indicating the nature of the failure * @@ -1061,7 +1061,7 @@ static int usbhost_disconnected(struct usbhost_class_s *usbclass) * Input Parameters: * None * - * Returned Values: + * Returned Value: * On success this function will return zero (OK); A negated errno value * will be returned on failure. * diff --git a/drivers/usbhost/usbhost_storage.c b/drivers/usbhost/usbhost_storage.c index f78a58ce54..89ff54cac7 100644 --- a/drivers/usbhost/usbhost_storage.c +++ b/drivers/usbhost/usbhost_storage.c @@ -357,7 +357,7 @@ static void usbhost_takesem(sem_t *sem) * Input Parameters: * None * - * Returned Values: + * Returned Value: * On success, this function will return a non-NULL instance of struct * usbhost_class_s. NULL is returned on failure; this function will * will fail only if there are insufficient resources to create another @@ -411,7 +411,7 @@ static inline FAR struct usbhost_state_s *usbhost_allocclass(void) * Input Parameters: * usbclass - A reference to the class instance to be freed. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -502,7 +502,7 @@ static inline void usbhost_mkdevname(FAR struct usbhost_state_s *priv, char *dev * Input Parameters: * cbw/csw - A reference to the CBW/CSW to dump. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -548,7 +548,7 @@ static void usbhost_dumpcsw(FAR struct usbmsc_csw_s *csw) * Input Parameters: * cbw - A reference to allocated and initialized CBW to be built. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -674,7 +674,7 @@ usbhost_writecbw(size_t startsector, uint16_t blocksize, * Input Parameters: * priv - A reference to the class instance. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -912,7 +912,7 @@ static inline int usbhost_inquiry(FAR struct usbhost_state_s *priv) * Input Parameters: * arg - A reference to the class instance to be destroyed. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -986,7 +986,7 @@ static void usbhost_destroy(FAR void *arg) * descriptor. * desclen - The length in bytes of the configuration descriptor. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -1209,7 +1209,7 @@ static inline int usbhost_cfgdesc(FAR struct usbhost_state_s *priv, * Input Parameters: * priv - A reference to the class instance. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -1400,7 +1400,7 @@ static inline int usbhost_initvolume(FAR struct usbhost_state_s *priv) * Input Parameters: * val - A pointer to the first byte of the little endian value. * - * Returned Values: + * Returned Value: * A uint16_t representing the whole 16-bit integer value * ****************************************************************************/ @@ -1419,7 +1419,7 @@ static inline uint16_t usbhost_getle16(const uint8_t *val) * Input Parameters: * val - A pointer to the first byte of the big endian value. * - * Returned Values: + * Returned Value: * A uint16_t representing the whole 16-bit integer value * ****************************************************************************/ @@ -1439,7 +1439,7 @@ static inline uint16_t usbhost_getbe16(const uint8_t *val) * dest - A pointer to the first byte to save the little endian value. * val - The 16-bit value to be saved. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -1460,7 +1460,7 @@ static void usbhost_putle16(uint8_t *dest, uint16_t val) * dest - A pointer to the first byte to save the big endian value. * val - The 16-bit value to be saved. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -1481,7 +1481,7 @@ static void usbhost_putbe16(uint8_t *dest, uint16_t val) * dest - A pointer to the first byte to save the big endian value. * val - The 32-bit value to be saved. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -1503,7 +1503,7 @@ static inline uint32_t usbhost_getle32(const uint8_t *val) * dest - A pointer to the first byte to save the big endian value. * val - The 32-bit value to be saved. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -1525,7 +1525,7 @@ static inline uint32_t usbhost_getbe32(const uint8_t *val) * dest - A pointer to the first byte to save the little endian value. * val - The 32-bit value to be saved. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -1548,7 +1548,7 @@ static void usbhost_putle32(uint8_t *dest, uint32_t val) * dest - A pointer to the first byte to save the big endian value. * val - The 32-bit value to be saved. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -1570,7 +1570,7 @@ static void usbhost_putbe32(uint8_t *dest, uint32_t val) * Input Parameters: * priv - A reference to the class instance. * - * Returned Values: + * Returned Value: * On sucess, zero (OK) is returned. On failure, an negated errno value * is returned to indicate the nature of the failure. * @@ -1596,7 +1596,7 @@ static inline int usbhost_talloc(FAR struct usbhost_state_s *priv) * Input Parameters: * priv - A reference to the class instance. * - * Returned Values: + * Returned Value: * On sucess, zero (OK) is returned. On failure, an negated errno value * is returned to indicate the nature of the failure. * @@ -1630,7 +1630,7 @@ static inline int usbhost_tfree(FAR struct usbhost_state_s *priv) * Input Parameters: * priv - A reference to the class instance. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -1669,7 +1669,7 @@ static FAR struct usbmsc_cbw_s *usbhost_cbwalloc(FAR struct usbhost_state_s *pri * id - In the case where the device supports multiple base classes, * subclasses, or protocols, this specifies which to configure for. * - * Returned Values: + * Returned Value: * On success, this function will return a non-NULL instance of struct * usbhost_class_s that can be used by the USB host driver to communicate * with the USB host class. NULL is returned on failure; this function @@ -1748,7 +1748,7 @@ usbhost_create(FAR struct usbhost_hubport_s *hport, * descriptor. * desclen - The length in bytes of the configuration descriptor. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -1807,7 +1807,7 @@ static int usbhost_connect(FAR struct usbhost_class_s *usbclass, * usbclass - The USB host class entry previously obtained from a call to * create(). * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value * is returned indicating the nature of the failure * @@ -2286,7 +2286,7 @@ static int usbhost_ioctl(FAR struct inode *inode, int cmd, unsigned long arg) * Input Parameters: * None * - * Returned Values: + * Returned Value: * On success this function will return zero (OK); A negated errno value * will be returned on failure. * diff --git a/drivers/usbhost/usbhost_xboxcontroller.c b/drivers/usbhost/usbhost_xboxcontroller.c index 3ba40c204f..91b0b5093c 100644 --- a/drivers/usbhost/usbhost_xboxcontroller.c +++ b/drivers/usbhost/usbhost_xboxcontroller.c @@ -365,7 +365,7 @@ static void usbhost_takesem(sem_t *sem) * Input Parameters: * None * - * Returned Values: + * Returned Value: * On success, this function will return a non-NULL instance of struct * usbhost_class_s. NULL is returned on failure; this function will * will fail only if there are insufficient resources to create another @@ -392,7 +392,7 @@ static inline FAR struct usbhost_state_s *usbhost_allocclass(void) * Input Parameters: * usbclass - A reference to the class instance to be freed. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -468,7 +468,7 @@ static inline void usbhost_mkdevname(FAR struct usbhost_state_s *priv, * Input Parameters: * arg - A reference to the class instance to be destroyed. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -534,7 +534,7 @@ static void usbhost_destroy(FAR void *arg) * Description: * Wake any threads waiting for controller data * - * Input Paramters: + * Input Parameters: * priv - A reference to the controller state structure. * * Returned Value: @@ -586,7 +586,7 @@ static void usbhost_notify(FAR struct usbhost_state_s *priv) * Input Parameters: * arg - A reference to the class instance to be destroyed. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -1060,7 +1060,7 @@ errout: * descriptor. * desclen - The length in bytes of the configuration descriptor. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -1291,7 +1291,7 @@ static inline int usbhost_cfgdesc(FAR struct usbhost_state_s *priv, * Input Parameters: * priv - A reference to the class instance. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -1384,7 +1384,7 @@ errout: * Input Parameters: * val - A pointer to the first byte of the little endian value. * - * Returned Values: + * Returned Value: * A uint16_t representing the whole 16-bit integer value * ****************************************************************************/ @@ -1404,7 +1404,7 @@ static inline uint16_t usbhost_getle16(const uint8_t *val) * dest - A pointer to the first byte to save the little endian value. * val - The 16-bit value to be saved. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -1425,7 +1425,7 @@ static void usbhost_putle16(uint8_t *dest, uint16_t val) * dest - A pointer to the first byte to save the big endian value. * val - The 32-bit value to be saved. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -1447,7 +1447,7 @@ static inline uint32_t usbhost_getle32(const uint8_t *val) * dest - A pointer to the first byte to save the little endian value. * val - The 32-bit value to be saved. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -1471,7 +1471,7 @@ static void usbhost_putle32(uint8_t *dest, uint32_t val) * Input Parameters: * priv - A reference to the class instance. * - * Returned Values: + * Returned Value: * On sucess, zero (OK) is returned. On failure, an negated errno value * is returned to indicate the nature of the failure. * @@ -1497,7 +1497,7 @@ static inline int usbhost_talloc(FAR struct usbhost_state_s *priv) * Input Parameters: * priv - A reference to the class instance. * - * Returned Values: + * Returned Value: * On sucess, zero (OK) is returned. On failure, an negated errno value * is returned to indicate the nature of the failure. * @@ -1541,7 +1541,7 @@ static inline int usbhost_tfree(FAR struct usbhost_state_s *priv) * id - In the case where the device supports multiple base classes, * subclasses, or protocols, this specifies which to configure for. * - * Returned Values: + * Returned Value: * On success, this function will return a non-NULL instance of struct * usbhost_class_s that can be used by the USB host driver to communicate * with the USB host class. NULL is returned on failure; this function @@ -1624,7 +1624,7 @@ static FAR struct usbhost_class_s *usbhost_create(FAR struct usbhost_hubport_s * * descriptor. * desclen - The length in bytes of the configuration descriptor. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -1683,7 +1683,7 @@ static int usbhost_connect(FAR struct usbhost_class_s *usbclass, * usbclass - The USB host class entry previously obtained from a call to * create(). * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value * is returned indicating the nature of the failure * @@ -2208,7 +2208,7 @@ errout: * Input Parameters: * None * - * Returned Values: + * Returned Value: * On success this function will return zero (OK); A negated errno value * will be returned on failure. * diff --git a/drivers/usbmonitor/usbmonitor.c b/drivers/usbmonitor/usbmonitor.c index e3ccb1e821..548c39b749 100644 --- a/drivers/usbmonitor/usbmonitor.c +++ b/drivers/usbmonitor/usbmonitor.c @@ -197,7 +197,7 @@ static int usbmonitor_daemon(int argc, char **argv) * Input Parameters: * None * - * Returned values: + * Returned Value: * Zero (OK) is returned on success; a negated errno value is return on * any failure. * @@ -259,7 +259,7 @@ int usbmonitor_start(void) * Input Parameters: * None * - * Returned values: + * Returned Value: * Zero (OK) is returned on success; a negated errno value is return on * any failure. * diff --git a/drivers/wireless/cc1101.c b/drivers/wireless/cc1101.c index 9c008f798d..e31a6e2a1d 100644 --- a/drivers/wireless/cc1101.c +++ b/drivers/wireless/cc1101.c @@ -326,7 +326,7 @@ void cc1101_access_end(FAR struct cc1101_dev_s *dev) /* CC1101 Access with Range Check * - * Input Paramters: + * Input Parameters: * dev CC1101 Private Structure * addr CC1101 Address * buf Pointer to buffer, either for read or write access diff --git a/drivers/wireless/cc3000/wlan.c b/drivers/wireless/cc3000/wlan.c index c77488bcf4..2e23343935 100644 --- a/drivers/wireless/cc3000/wlan.c +++ b/drivers/wireless/cc3000/wlan.c @@ -1216,7 +1216,7 @@ long wlan_smart_config_set_prefix(FAR char *cNewPrefix) * Input Parameters: * key AES128 key of size 16 bytes * - * Returned Value + * Returned Value: * On success 0, error otherwise. * ****************************************************************************/ @@ -1242,7 +1242,7 @@ signed long aes_read_key(uint8_t *key) * Input Parameters: * key AES128 key of size 16 bytes * - * Returned Value + * Returned Value: * On success 0, error otherwise. * ****************************************************************************/ diff --git a/drivers/wireless/ieee802154/xbee/xbee.c b/drivers/wireless/ieee802154/xbee/xbee.c index c0a7fd0ca0..3cd82479df 100644 --- a/drivers/wireless/ieee802154/xbee/xbee.c +++ b/drivers/wireless/ieee802154/xbee/xbee.c @@ -386,7 +386,7 @@ static void xbee_attnworker(FAR void *arg) * datalen - The size of the data section of the frame. This is the value * included as the second and third byte of the frame. * - * Returns: + * Returned Value: * true - Frame type is known and length is logical * false - Frame type is unknown or length is invalid for frame type * @@ -453,7 +453,7 @@ static bool xbee_validate_apiframe(uint8_t frametype, uint16_t datalen) * frame - pointer to the frame data * framelen - size of the overall frame. NOT the data length field * - * Returns: + * Returned Value: * true - Checksum is valid * false - Checksum is invalid * diff --git a/drivers/wireless/ieee802154/xbee/xbee_netdev.c b/drivers/wireless/ieee802154/xbee/xbee_netdev.c index 1c0c682057..ea7db25986 100644 --- a/drivers/wireless/ieee802154/xbee/xbee_netdev.c +++ b/drivers/wireless/ieee802154/xbee/xbee_netdev.c @@ -665,7 +665,7 @@ static void xbeenet_txpoll_expiry(int argc, wdparm_t arg, ...) * Description: * Get the extended address of the PAN coordinator. * - * Input parameters: + * Input Parameters: * radio - Reference to a radio network driver state instance. * eaddr - The location in which to return the extended address. * @@ -702,7 +702,7 @@ static int xbeenet_coord_eaddr(FAR struct radio_driver_s *radio, * Description: * Get the short address of the PAN coordinator. * - * Input parameters: + * Input Parameters: * radio - Reference to a radio network driver state instance. * saddr - The location in which to return the short address. * @@ -1168,7 +1168,7 @@ static int xbeenet_ioctl(FAR struct net_driver_s *dev, int cmd, * Description * Calculate the MAC header length given the frame meta-data. * - * Input parameters: + * Input Parameters: * netdev - The network device that will mediate the MAC interface * meta - Obfuscated metadata structure needed to create the radio * MAC header @@ -1200,7 +1200,7 @@ static int xbeenet_get_mhrlen(FAR struct radio_driver_s *netdev, * Description: * Requests the transfer of a list of frames to the XBee MAC. * - * Input parameters: + * Input Parameters: * netdev - The networkd device that will mediate the MAC interface * meta - Obfuscated metadata structure needed to create the radio * MAC header @@ -1272,7 +1272,7 @@ static int xbeenet_req_data(FAR struct radio_driver_s *netdev, * run time. This information is provided to the 6LoWPAN network via the * following structure. * - * Input parameters: + * Input Parameters: * netdev - The network device to be queried * properties - Location where radio properities will be returned. * @@ -1349,7 +1349,7 @@ static int xbeenet_properties(FAR struct radio_driver_s *netdev, * Input Parameters: * mac - Pointer to the mac layer struct to be registered. * - * Returned Values: + * Returned Value: * Zero (OK) is returned on success. Otherwise a negated errno value is * returned to indicate the nature of the failure. * diff --git a/drivers/wireless/spirit/drivers/spirit_netdev.c b/drivers/wireless/spirit/drivers/spirit_netdev.c index e951f3fe0a..4a9ef1e54e 100644 --- a/drivers/wireless/spirit/drivers/spirit_netdev.c +++ b/drivers/wireless/spirit/drivers/spirit_netdev.c @@ -2262,7 +2262,7 @@ static int spirit_ioctl(FAR struct net_driver_s *dev, int cmd, * Description: * Calculate the MAC header length given the frame meta-data. * - * Input parameters: + * Input Parameters: * netdev - The network device that will mediate the MAC interface * meta - Obfuscated metadata structure needed to create the radio * MAC header @@ -2294,7 +2294,7 @@ static int spirit_get_mhrlen(FAR struct radio_driver_s *netdev, * indirectly as a consequence of a TX poll that generates a series of * 6LoWPAN radio packets. * - * Input parameters: + * Input Parameters: * netdev - The network device that will mediate the MAC interface * meta - Obfuscated metadata structure needed to create the radio * MAC header @@ -2407,7 +2407,7 @@ static int spirit_req_data(FAR struct radio_driver_s *netdev, * run time. This information is provided to the 6LoWPAN network via the * following structure. * - * Input parameters: + * Input Parameters: * netdev - The network device to be queried * properties - Location where radio properities will be returned. * diff --git a/drivers/wireless/spirit/include/spirit_general.h b/drivers/wireless/spirit/include/spirit_general.h index 204b3dfcee..aa0b7f4c6d 100644 --- a/drivers/wireless/spirit/include/spirit_general.h +++ b/drivers/wireless/spirit/include/spirit_general.h @@ -128,7 +128,7 @@ enum spirit_version_e * * Description: * - * Input parameters: + * Input Parameters: * * Returned Value: * diff --git a/drivers/wireless/spirit/include/spirit_spi.h b/drivers/wireless/spirit/include/spirit_spi.h index 7cc891d603..6fbdff33d8 100644 --- a/drivers/wireless/spirit/include/spirit_spi.h +++ b/drivers/wireless/spirit/include/spirit_spi.h @@ -86,7 +86,7 @@ struct spi_dev_s; /* Forward reference */ * Description: * Read single or multiple SPIRIT1 register * - * Input parameters: + * Input Parameters: * regaddr: Base register's address to be read * buffer: Pointer to the buffer of registers' values to be read * buflen: Number of register values to be read @@ -106,7 +106,7 @@ int spirit_reg_read(FAR struct spirit_library_s *spirit, uint8_t regaddr, * Description: * Read single or multiple SPIRIT1 register. * - * Input parameters: + * Input Parameters: * spirit - Reference to an instance of the driver state stucture. * regaddr - Base register's address to write * buffer - Pointer to the buffer of register values to write @@ -129,7 +129,7 @@ int spirit_reg_write(FAR struct spirit_library_s *spirit, uint8_t regaddr, * atomic only in the sense that other accesses to the SPI bus are * prohibited throughout the operation. * - * Input parameters: + * Input Parameters: * spirit - Reference to an instance of the driver state stucture. * regaddr - Base register's address to write * clrbits - Bits to clear in the register @@ -150,7 +150,7 @@ int spirit_reg_modify(FAR struct spirit_library_s *spirit, uint8_t regaddr, * Description: * Send a command * - * Input parameters: + * Input Parameters: * spirit - Reference to an instance of the driver state stucture. * cmd - Command code to be sent * @@ -168,7 +168,7 @@ int spirit_command(FAR struct spirit_library_s *spirit, uint8_t cmd); * Description: * Read data from RX FIFO * - * Input parameters: + * Input Parameters: * spirit - Reference to an instance of the driver state stucture. * buffer - Pointer to the buffer of data values to write * buflen - Number of bytes to be written @@ -188,7 +188,7 @@ int spirit_fifo_read(FAR struct spirit_library_s *spirit, FAR uint8_t *buffer, * Description: * Write data into TX FIFO. * - * Input parameters: + * Input Parameters: * spirit - Reference to an instance of the driver state stucture. * buffer - Pointer to the buffer of data values to write * buflen - Number of data values to be written. diff --git a/drivers/wireless/spirit/lib/spirit_spi.c b/drivers/wireless/spirit/lib/spirit_spi.c index 752dc78650..3433dfcafe 100644 --- a/drivers/wireless/spirit/lib/spirit_spi.c +++ b/drivers/wireless/spirit/lib/spirit_spi.c @@ -254,7 +254,7 @@ static void spirit_unlock(FAR struct spi_dev_s *spi) * Description: * Read single or multiple SPIRIT1 register * - * Input parameters: + * Input Parameters: * * regaddr: Base register's address to be read * buffer: Pointer to the buffer of registers' values to be read @@ -309,7 +309,7 @@ int spirit_reg_read(FAR struct spirit_library_s *spirit, uint8_t regaddr, * Description: * Read single or multiple SPIRIT1 register. * - * Input parameters: + * Input Parameters: * spirit - Reference to an instance of the driver state stucture. * regaddr - Base register's address to write * buffer - Pointer to the buffer of register values to write @@ -363,7 +363,7 @@ int spirit_reg_write(FAR struct spirit_library_s *spirit, uint8_t regaddr, * Description: * Perform atomic read/modify/write on a single SPIRIT1 register. * - * Input parameters: + * Input Parameters: * spirit - Reference to an instance of the driver state stucture. * regaddr - Base register's address to write * clrbits - Bits to clear in the register @@ -442,7 +442,7 @@ int spirit_reg_modify(FAR struct spirit_library_s *spirit, uint8_t regaddr, * Description: * Send a command * - * Input parameters: + * Input Parameters: * spirit - Reference to an instance of the driver state stucture. * cmd - Command code to be sent * @@ -489,7 +489,7 @@ int spirit_command(FAR struct spirit_library_s *spirit, uint8_t cmd) * Description: * Read data from RX FIFO * - * Input parameters: + * Input Parameters: * spirit - Reference to an instance of the driver state stucture. * buffer - Pointer to the buffer of data values to write * buflen - Number of bytes to be written @@ -543,7 +543,7 @@ int spirit_fifo_read(FAR struct spirit_library_s *spirit, FAR uint8_t *buffer, * Description: * Write data into TX FIFO. * - * Input parameters: + * Input Parameters: * spirit - Reference to an instance of the driver state stucture. * buffer - Pointer to the buffer of data values to write * buflen - Number of data values to be written. diff --git a/fs/dirent/fs_closedir.c b/fs/dirent/fs_closedir.c index 6b74bbdf19..5ab991c309 100644 --- a/fs/dirent/fs_closedir.c +++ b/fs/dirent/fs_closedir.c @@ -64,10 +64,10 @@ * 'dirp'. The directory stream descriptor 'dirp' is not available after * this call. * - * Inputs: + * Input Parameters: * dirp -- An instance of type DIR created by a previous call to opendir(); * - * Return: + * Returned Value: * The closedir() function returns 0 on success. On error, -1 is * returned, and errno is set appropriately. * diff --git a/fs/dirent/fs_opendir.c b/fs/dirent/fs_opendir.c index 43b62b9c87..e8bedefff7 100644 --- a/fs/dirent/fs_opendir.c +++ b/fs/dirent/fs_opendir.c @@ -61,12 +61,12 @@ * Description: * Handle the case where the inode to be opened is within a mountpoint. * - * Inputs: + * Input Parameters: * inode -- the inode of the mountpoint to open * relpath -- the relative path within the mountpoint to open * dir -- the dirent structure to be initialized * - * Return: + * Returned Value: * On success, OK is returned; Otherwise, a positive errno is returned. * ****************************************************************************/ @@ -127,11 +127,11 @@ static inline int open_mountpoint(FAR struct inode *inode, * Handle the case where the inode to be opened is within the top-level * pseudo-file system. * - * Inputs: + * Input Parameters: * inode -- the inode of the mountpoint to open * dir -- the dirent structure to be initialized * - * Return: + * Returned Value: * None * ****************************************************************************/ @@ -164,10 +164,10 @@ static void open_pseudodir(FAR struct inode *inode, FAR struct fs_dirent_s *dir) * and, therefore, it must be a directory node. But is has no children * to be enumerated either. * - * Inputs: + * Input Parameters: * dir -- the dirent structure to be initialized * - * Return: + * Returned Value: * None * ****************************************************************************/ @@ -204,10 +204,10 @@ static inline void open_emptydir(FAR struct fs_dirent_s *dir) * directory name, and returns a pointer to the directory stream. The * stream is positioned at the first entry in the directory. * - * Inputs: + * Input Parameters: * path -- the directory to open * - * Return: + * Returned Value: * The opendir() function returns a pointer to the directory stream. On * error, NULL is returned, and errno is set appropriately. * diff --git a/fs/dirent/fs_readdir.c b/fs/dirent/fs_readdir.c index 93b2f654fd..f7cc4a69e6 100644 --- a/fs/dirent/fs_readdir.c +++ b/fs/dirent/fs_readdir.c @@ -153,10 +153,10 @@ static inline int readpseudodir(struct fs_dirent_s *idir) * to by dir. It returns NULL on reaching the end-of-file or if an error * occurred. * - * Inputs: + * Input Parameters: * dirp -- An instance of type DIR created by a previous call to opendir(); * - * Return: + * Returned Value: * The readdir() function returns a pointer to a dirent structure, or NULL * if an error occurs or end-of-file is reached. On error, errno is set * appropriately. diff --git a/fs/dirent/fs_rewinddir.c b/fs/dirent/fs_rewinddir.c index 7ad252d8aa..6450a5859f 100644 --- a/fs/dirent/fs_rewinddir.c +++ b/fs/dirent/fs_rewinddir.c @@ -93,11 +93,11 @@ static inline void rewindpseudodir(struct fs_dirent_s *idir) * The rewinddir() function resets the position of the * directory stream dir to the beginning of the directory. * - * Inputs: + * Input Parameters: * dirp -- An instance of type DIR created by a previous * call to opendir(); * - * Return: + * Returned Value: * None * ****************************************************************************/ diff --git a/fs/dirent/fs_seekdir.c b/fs/dirent/fs_seekdir.c index 761dba33cd..896658b690 100644 --- a/fs/dirent/fs_seekdir.c +++ b/fs/dirent/fs_seekdir.c @@ -188,12 +188,12 @@ static inline void seekmountptdir(struct fs_dirent_s *idir, off_t offset) * which the next readdir() call will start. seekdir() should be used with * an offset returned by telldir(). * - * Inputs: + * Input Parameters: * dirp -- An instance of type DIR created by a previous * call to opendir(); * offset -- offset to seek to * - * Return: + * Returned Value: * None * ****************************************************************************/ diff --git a/fs/driver/driver.h b/fs/driver/driver.h index bbe605602e..dd15fb33bb 100644 --- a/fs/driver/driver.h +++ b/fs/driver/driver.h @@ -69,13 +69,13 @@ extern "C" * Description: * Return the inode of the block driver specified by 'pathname' * - * Inputs: + * Input Parameters: * pathname - the full path to the block driver to be located * mountflags - if MS_RDONLY is not set, then driver must support write * operations (see include/sys/mount.h) * ppinode - address of the location to return the inode reference * - * Return: + * Returned Value: * Returns zero on success or a negated errno on failure: * * EINVAL - pathname or pinode is NULL @@ -98,7 +98,7 @@ int find_blockdriver(FAR const char *pathname, int mountflags, * Create a temporary char driver using drivers/bch to mediate character * oriented accessed to the block driver. * - * Input parameters: + * Input Parameters: * blkdev - The path to the block driver * oflags - Character driver open flags * diff --git a/fs/driver/fs_blockproxy.c b/fs/driver/fs_blockproxy.c index 1f15370bcd..74d9b75c89 100644 --- a/fs/driver/fs_blockproxy.c +++ b/fs/driver/fs_blockproxy.c @@ -77,7 +77,7 @@ static sem_t g_devno_sem = SEM_INITIALIZER(1); * psuedo-file system. We cannot use mktemp for this because it will * attempt to open() the file. * - * Input parameters: + * Input Parameters: * None * * Returned Value: @@ -146,7 +146,7 @@ static FAR char *unique_chardev(void) * Create a temporary char driver using drivers/bch to mediate character * oriented accessed to the block driver. * - * Input parameters: + * Input Parameters: * blkdev - The path to the block driver * oflags - Character driver open flags * diff --git a/fs/driver/fs_closeblockdriver.c b/fs/driver/fs_closeblockdriver.c index 7c9c60244d..9ce13df6fd 100644 --- a/fs/driver/fs_closeblockdriver.c +++ b/fs/driver/fs_closeblockdriver.c @@ -55,10 +55,10 @@ * Description: * Call the close method and release the inode * - * Inputs: + * Input Parameters: * inode - reference to the inode of a block driver opened by open_blockdriver * - * Return: + * Returned Value: * Returns zero on success or a negated errno on failure: * * EINVAL - inode is NULL diff --git a/fs/driver/fs_findblockdriver.c b/fs/driver/fs_findblockdriver.c index 0615a474b2..f85bff032f 100644 --- a/fs/driver/fs_findblockdriver.c +++ b/fs/driver/fs_findblockdriver.c @@ -61,13 +61,13 @@ * Description: * Return the inode of the block driver specified by 'pathname' * - * Inputs: + * Input Parameters: * pathname - the full path to the block driver to be located * mountflags - if MS_RDONLY is not set, then driver must support write * operations (see include/sys/mount.h) * ppinode - address of the location to return the inode reference * - * Return: + * Returned Value: * Returns zero on success or a negated errno on failure: * * EINVAL - pathname or pinode is NULL diff --git a/fs/driver/fs_openblockdriver.c b/fs/driver/fs_openblockdriver.c index 9a42020bf7..e88d05d752 100644 --- a/fs/driver/fs_openblockdriver.c +++ b/fs/driver/fs_openblockdriver.c @@ -56,13 +56,13 @@ * Description: * Return the inode of the block driver specified by 'pathname' * - * Inputs: + * Input Parameters: * pathname - the full path to the block driver to be opened * mountflags - if MS_RDONLY is not set, then driver must support write * operations (see include/sys/mount.h) * ppinode - address of the location to return the inode reference * - * Return: + * Returned Value: * Returns zero on success or a negated errno on failure: * * EINVAL - pathname or pinode is NULL diff --git a/fs/driver/fs_registerblockdriver.c b/fs/driver/fs_registerblockdriver.c index 6909619071..f1da64c9f1 100644 --- a/fs/driver/fs_registerblockdriver.c +++ b/fs/driver/fs_registerblockdriver.c @@ -58,7 +58,7 @@ * Description: * Register a block driver inode the pseudo file system. * - * Input parameters: + * Input Parameters: * path - The path to the inode to create * bops - The block driver operations structure * mode - inmode priviledges (not used) diff --git a/fs/driver/fs_registerdriver.c b/fs/driver/fs_registerdriver.c index 501bf93f66..85f32e48a9 100644 --- a/fs/driver/fs_registerdriver.c +++ b/fs/driver/fs_registerdriver.c @@ -56,7 +56,7 @@ * Description: * Register a character driver inode the pseudo file system. * - * Input parameters: + * Input Parameters: * path - The path to the inode to create * fops - The file operations structure * mode - inmode priviledges (not used) diff --git a/fs/fat/fs_fat32dirent.c b/fs/fat/fs_fat32dirent.c index 7ea497b62a..bc2f79801f 100644 --- a/fs/fat/fs_fat32dirent.c +++ b/fs/fat/fs_fat32dirent.c @@ -213,7 +213,7 @@ static uint8_t fat_lfnchecksum(const uint8_t *sfname) * code pages". The logic below does not, at present, support any other * character sets. * - * Returned value: + * Returned Value: * OK - The path refers to a valid 8.3 FAT file name and has been properly * converted and stored in dirinfo. * <0 - Otherwise an negated error is returned meaning that the string is @@ -468,7 +468,7 @@ errout: * 2. '.' (dot) can occur more than once in a filename. Extension is * the substring after the last dot. * - * Returned value: + * Returned Value: * OK - The path refers to a valid long file name and has been properly * stored in dirinfo. * <0 - Otherwise an negated error is returned meaning that the string is @@ -562,7 +562,7 @@ errout: * * This function is called only from fat_putlfname() * - * Returned value: + * Returned Value: * OK - The alias was created correctly. * <0 - Otherwise an negated error is returned. * @@ -767,7 +767,7 @@ static inline int fat_createalias(struct fat_dirinfo_s *dirinfo) * NOTE: This function does not restore the directory entry that was in the * sector cache * - * Returned value: + * Returned Value: * OK - The alias is unique. * <0 - Otherwise an negated error is returned. * @@ -807,7 +807,7 @@ static inline int fat_findalias(struct fat_mountpt_s *fs, * sector cache * * information upon return. - * Returned value: + * Returned Value: * OK - The alias is unique. * <0 - Otherwise an negated error is returned. * diff --git a/fs/fat/fs_fat32util.c b/fs/fat/fs_fat32util.c index cdbfc2d4cb..47a12574fa 100644 --- a/fs/fat/fs_fat32util.c +++ b/fs/fat/fs_fat32util.c @@ -813,7 +813,8 @@ off_t fat_cluster2sector(FAR struct fat_mountpt_s *fs, uint32_t cluster) * Description: * Get the next cluster start from the FAT. * - * Return: <0: error, 0:cluster unassigned, >=0: start sector of cluster + * Returned Value: + * <0: error, 0:cluster unassigned, >=0: start sector of cluster * ****************************************************************************/ @@ -1161,7 +1162,7 @@ int fat_removechain(struct fat_mountpt_s *fs, uint32_t cluster) * Add a new cluster to the chain following cluster (if cluster is non- * NULL). if cluster is zero, then a new chain is created. * - * Return: + * Returned Value: * <0:error, 0: no free cluster, >=2: new cluster number * ****************************************************************************/ diff --git a/fs/inode/fs_inodereserve.c b/fs/inode/fs_inodereserve.c index 1c08b05567..f1b0bc685f 100644 --- a/fs/inode/fs_inodereserve.c +++ b/fs/inode/fs_inodereserve.c @@ -144,7 +144,7 @@ static void inode_insert(FAR struct inode *node, * Reserve an (initialized) inode the pseudo file system. The initial * reference count on the new inode is zero. * - * Input parameters: + * Input Parameters: * path - The path to the inode to create * inode - The location to return the inode pointer * diff --git a/fs/inode/inode.h b/fs/inode/inode.h index 71b1af8e92..ae1ef0ce48 100644 --- a/fs/inode/inode.h +++ b/fs/inode/inode.h @@ -293,7 +293,7 @@ const char *inode_nextname(FAR const char *name); * * NOTE: Caller must hold the inode semaphore * - * Input parameters: + * Input Parameters: * path - The path to the inode to create * inode - The location to return the inode pointer * diff --git a/fs/mount/fs_mount.c b/fs/mount/fs_mount.c index 62a982b40e..404b700fce 100644 --- a/fs/mount/fs_mount.c +++ b/fs/mount/fs_mount.c @@ -214,7 +214,7 @@ mount_findfs(FAR const struct fsmap_t *fstab, FAR const char *filesystemtype) * mount() attaches the filesystem specified by the 'source' block device * name into the root file system at the path specified by 'target.' * - * Return: + * Returned Value: * Zero is returned on success; -1 is returned on an error and errno is * set appropriately: * diff --git a/fs/mount/fs_umount2.c b/fs/mount/fs_umount2.c index e342ae2e16..598cb7b196 100644 --- a/fs/mount/fs_umount2.c +++ b/fs/mount/fs_umount2.c @@ -59,7 +59,7 @@ * umount() detaches the filesystem mounted at the path specified by * 'target.' * - * Return: + * Returned Value: * Zero is returned on success; -1 is returned on an error and errno is * set appropriately: * diff --git a/fs/mqueue/mq_close.c b/fs/mqueue/mq_close.c index 4578c1cc08..adbe025350 100644 --- a/fs/mqueue/mq_close.c +++ b/fs/mqueue/mq_close.c @@ -67,7 +67,7 @@ * mqdes - Message queue descriptor. * group - Group that has the open descriptor. * - * Return Value: + * Returned Value: * Zero (OK) if the message queue is closed successfully. Otherwise, a * negated errno value is returned. * @@ -125,7 +125,7 @@ int nxmq_close_group(mqd_t mqdes, FAR struct task_group_s *group) * Parameters: * mqdes - Message queue descriptor. * - * Return Value: + * Returned Value: * 0 (OK) if the message queue is closed successfully, * otherwise, -1 (ERROR). * @@ -176,7 +176,7 @@ int mq_close(mqd_t mqdes) * Parameters: * inode - The message queue inode * - * Return Value: + * Returned Value: * None * ****************************************************************************/ diff --git a/fs/mqueue/mq_open.c b/fs/mqueue/mq_open.c index 5c372a50d5..2f9a338fda 100644 --- a/fs/mqueue/mq_open.c +++ b/fs/mqueue/mq_open.c @@ -79,7 +79,7 @@ * created to determine the maximum number of * messages that may be placed in the message queue. * - * Return Value: + * Returned Value: * A message queue descriptor or (mqd_t)-1 (ERROR) * * Assumptions: diff --git a/fs/mqueue/mq_unlink.c b/fs/mqueue/mq_unlink.c index 9705a0ef8b..7610eee43c 100644 --- a/fs/mqueue/mq_unlink.c +++ b/fs/mqueue/mq_unlink.c @@ -66,7 +66,7 @@ * Parameters: * mq_name - Name of the message queue * - * Return Value: + * Returned Value: * None * * Assumptions: diff --git a/fs/mqueue/mqueue.h b/fs/mqueue/mqueue.h index 4edc08ece1..b8cdb36d20 100644 --- a/fs/mqueue/mqueue.h +++ b/fs/mqueue/mqueue.h @@ -80,7 +80,7 @@ extern "C" * Parameters: * inode - The message queue inode * - * Return Value: + * Returned Value: * None * ****************************************************************************/ diff --git a/fs/nfs/nfs_util.c b/fs/nfs/nfs_util.c index 8a6967cbbe..7170970892 100644 --- a/fs/nfs/nfs_util.c +++ b/fs/nfs/nfs_util.c @@ -194,7 +194,7 @@ int nfs_checkmount(struct nfsmount *nmp) * Perform the NFS request. On successful receipt, it verifies the NFS level of the * returned values. * - * Return Value: + * Returned Value: * Zero on success; a positive errno value on failure. * ****************************************************************************/ @@ -380,7 +380,7 @@ int nfs_lookup(struct nfsmount *nmp, FAR const char *filename, * Given a path to something that may or may not be in the file system, * return the handle of the directory entry of the requested object. * - * Return Value: + * Returned Value: * Zero on success; a positive errno value on failure. * ****************************************************************************/ @@ -488,7 +488,7 @@ int nfs_findnode(struct nfsmount *nmp, FAR const char *relpath, * return the handle of the entry of the directory containing the requested * object. * - * Return Value: + * Returned Value: * Zero on success; a positive errno value on failure. * ****************************************************************************/ @@ -577,7 +577,7 @@ int nfs_finddir(struct nfsmount *nmp, FAR const char *relpath, * Desciption: * Update file attributes on write or after the file is modified. * - * Return Value: + * Returned Value: * None. * ****************************************************************************/ diff --git a/fs/nxffs/nxffs.h b/fs/nxffs/nxffs.h index bc979a3050..c6ae19bed1 100644 --- a/fs/nxffs/nxffs.h +++ b/fs/nxffs/nxffs.h @@ -386,7 +386,7 @@ int nxffs_limits(FAR struct nxffs_volume_s *volume); * Input Parameters: * val - A pointer to the first byte of the little endian value. * - * Returned Values: + * Returned Value: * A uint16_t representing the whole 16-bit integer value * * Defined in nxffs_util.c @@ -405,7 +405,7 @@ uint16_t nxffs_rdle16(FAR const uint8_t *val); * dest - A pointer to the first byte to save the little endian value. * val - The 16-bit value to be saved. * - * Returned Values: + * Returned Value: * None * * Defined in nxffs_util.c @@ -423,7 +423,7 @@ void nxffs_wrle16(uint8_t *dest, uint16_t val); * Input Parameters: * val - A pointer to the first byte of the little endian value. * - * Returned Values: + * Returned Value: * A uint32_t representing the whole 32-bit integer value * * Defined in nxffs_util.c @@ -461,7 +461,7 @@ void nxffs_wrle32(uint8_t *dest, uint32_t val); * buffer - Address of the start of the memory to check. * buflen - The number of bytes to check. * - * Returned Values: + * Returned Value: * The number of erased bytes found at the beginning of the memory region. * * Defined in nxffs_util.c @@ -581,7 +581,7 @@ int nxffs_getc(FAR struct nxffs_volume_s *volume, uint16_t reserve); * caller may call kmm_free upon return of this function if necessary to * free the entry container. * - * Input parameters: + * Input Parameters: * entry - The entry to be freed. * * Returned Value: @@ -679,7 +679,7 @@ off_t nxffs_inodeend(FAR struct nxffs_volume_s *volume, * volume - Describes the NXFFS volume * block - The (logical) block number to load and verify. * - * Returned Values: + * Returned Value: * OK (zero( is returned on success. Otherwise, a negated errno value is * returned indicating the nature of the failure: * @@ -836,7 +836,7 @@ FAR struct nxffs_wrfile_s *nxffs_findwriter(FAR struct nxffs_volume_s *volume); * Note that in either case, the inode name has already been written to * FLASH. * - * Input parameters + * Input Parameters: * volume - Describes the NXFFS volume * entry - Describes the inode header to write * @@ -858,7 +858,7 @@ int nxffs_wrinode(FAR struct nxffs_volume_s *volume, * The packing logic has moved an inode. Check if any open files are using * this inode and, if so, move the data in the open file structure as well. * - * Input parameters + * Input Parameters: * volume - Describes the NXFFS volume * entry - Describes the new inode entry * @@ -877,7 +877,7 @@ int nxffs_updateinode(FAR struct nxffs_volume_s *volume, * Description: * Zero-extend a file. * - * Input parameters + * Input Parameters: * volume - Describes the NXFFS volume * entry - Describes the new inode entry * length - The new, extended length of the file @@ -1074,7 +1074,7 @@ int nxffs_rminode(FAR struct nxffs_volume_s *volume, FAR const char *name); * Input Parameters: * volume - The volume to be packed. * - * Returned Values: + * Returned Value: * Zero on success; Otherwise, a negated errno value is returned to * indicate the nature of the failure. * diff --git a/fs/nxffs/nxffs_block.c b/fs/nxffs/nxffs_block.c index c1cad2afe4..06d5174949 100644 --- a/fs/nxffs/nxffs_block.c +++ b/fs/nxffs/nxffs_block.c @@ -66,7 +66,7 @@ * volume - Describes the NXFFS volume * block - The (logical) block number to load and verify. * - * Returned Values: + * Returned Value: * OK (zero( is returned on success. Otherwise, a negated errno value is * returned indicating the nature of the failure: * diff --git a/fs/nxffs/nxffs_inode.c b/fs/nxffs/nxffs_inode.c index 2240c18313..e3c52421a3 100644 --- a/fs/nxffs/nxffs_inode.c +++ b/fs/nxffs/nxffs_inode.c @@ -213,7 +213,7 @@ errout: * caller may call kmm_free upon return of this function if necessary to * free the entry container. * - * Input parameters: + * Input Parameters: * entry - The entry to be freed. * * Returned Value: diff --git a/fs/nxffs/nxffs_open.c b/fs/nxffs/nxffs_open.c index f5a65e10d2..8276a399a6 100644 --- a/fs/nxffs/nxffs_open.c +++ b/fs/nxffs/nxffs_open.c @@ -855,7 +855,7 @@ static inline void nxffs_freeofile(FAR struct nxffs_volume_s *volume, * file was open for writing, and finally, * 3. Write the new file inode. * - * Input parameters + * Input Parameters: * volume - Describes the NXFFS volume * wrfile - Describes the state of the open file * @@ -1200,7 +1200,7 @@ errout: * Note that in either case, the inode name has already been written to * FLASH. * - * Input parameters + * Input Parameters: * volume - Describes the NXFFS volume * entry - Describes the inode header to write * @@ -1283,7 +1283,7 @@ errout: * The packing logic has moved an inode. Check if any open files are using * this inode and, if so, move the data in the open file structure as well. * - * Input parameters + * Input Parameters: * volume - Describes the NXFFS volume * entry - Describes the new inode entry * diff --git a/fs/nxffs/nxffs_pack.c b/fs/nxffs/nxffs_pack.c index 134ee430a6..0c6819a465 100644 --- a/fs/nxffs/nxffs_pack.c +++ b/fs/nxffs/nxffs_pack.c @@ -164,7 +164,7 @@ static off_t nxffs_packtell(FAR struct nxffs_volume_s *volume, * Input Parameters: * pack - The volume packing state structure. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -191,7 +191,7 @@ static inline bool nxffs_packvalid(FAR struct nxffs_pack_s *pack) * volume - The volume to be packed. * pack - The volume packing state structure. * - * Returned Values: + * Returned Value: * The offset to the data area on the first valid block. Zero is return * if there are no valid blocks or if there are no valid inode headers * after the first valid block. @@ -261,7 +261,7 @@ static inline off_t nxffs_mediacheck(FAR struct nxffs_volume_s *volume, * -- then no packing can be performed. In this case, then the free * flash offset is returned through this location. * - * Returned Values: + * Returned Value: * Zero on success; Otherwise, a negated errno value is returned to * indicate the nature of the failure. If -ENOSPC is returned then the * free FLASH offset is also returned. @@ -398,7 +398,7 @@ static inline int nxffs_startpos(FAR struct nxffs_volume_s *volume, * offset - FLASH offset to the data block header (will be zero for zero- * files. * - * Returned Values: + * Returned Value: * Zero on success; Otherwise, a negated errno value is returned to * indicate the nature of the failure. * @@ -441,7 +441,7 @@ static int nxffs_srcsetup(FAR struct nxffs_volume_s *volume, * volume - The volume to be packed * pack - The volume packing state structure. * - * Returned Values: + * Returned Value: * Zero on success; Otherwise, a negated errno value is returned to * indicate the nature of the failure. * @@ -618,7 +618,7 @@ errout: * volume - The volume to be packed * pack - The volume packing state structure. * - * Returned Values: + * Returned Value: * Zero on success; Otherwise, a negated errno value is returned to * indicate the nature of the failure (not used). * @@ -727,7 +727,7 @@ static int nxffs_wrinodehdr(FAR struct nxffs_volume_s *volume, * volume - The volume to be packed * pack - The volume packing state structure. * - * Returned Values: + * Returned Value: * Zero on success; Otherwise, a negated errno value is returned to * indicate the nature of the failure. * @@ -782,7 +782,7 @@ static void nxffs_wrdathdr(FAR struct nxffs_volume_s *volume, * volume - The volume to be packed * pack - The volume packing state structure. * - * Returned Values: + * Returned Value: * None. * ****************************************************************************/ @@ -830,7 +830,7 @@ static void nxffs_packtransfer(FAR struct nxffs_volume_s *volume, * volume - The volume to be packed * pack - The volume packing state structure. * - * Returned Values: + * Returned Value: * Zero on success; Otherwise, a negated errno value is returned to * indicate the nature of the failure. * @@ -872,7 +872,7 @@ static int nxffs_endsrcblock(FAR struct nxffs_volume_s *volume, * volume - The volume to be packed * pack - The volume packing state structure. * - * Returned Values: + * Returned Value: * Zero on success; Otherwise, a negated errno value is returned to * indicate the nature of the failure. * @@ -1057,7 +1057,7 @@ static inline int nxffs_packblock(FAR struct nxffs_volume_s *volume, * volume - The volume to be packed * pack - The volume packing state structure. * - * Returned Values: + * Returned Value: * If there is an active writer of the volume, its open file instance is * returned. NULL is returned otherwise. * @@ -1125,7 +1125,7 @@ nxffs_setupwriter(FAR struct nxffs_volume_s *volume, * volume - The volume to be packed * pack - The volume packing state structure. * - * Returned Values: + * Returned Value: * Zero on success; Otherwise, a negated errno value is returned to * indicate the nature of the failure. * @@ -1257,7 +1257,7 @@ static inline int nxffs_packwriter(FAR struct nxffs_volume_s *volume, * Input Parameters: * volume - The volume to be packed. * - * Returned Values: + * Returned Value: * Zero on success; Otherwise, a negated errno value is returned to * indicate the nature of the failure. * diff --git a/fs/nxffs/nxffs_util.c b/fs/nxffs/nxffs_util.c index ac51140fa3..7893798ade 100644 --- a/fs/nxffs/nxffs_util.c +++ b/fs/nxffs/nxffs_util.c @@ -143,7 +143,7 @@ void nxffs_wrle32(uint8_t *dest, uint32_t val) * buffer - Address of the start of the memory to check. * buflen - The number of bytes to check. * - * Returned Values: + * Returned Value: * The number of erased bytes found at the beginning of the memory region. * ****************************************************************************/ diff --git a/fs/nxffs/nxffs_write.c b/fs/nxffs/nxffs_write.c index 1fd761e440..c788947d83 100644 --- a/fs/nxffs/nxffs_write.c +++ b/fs/nxffs/nxffs_write.c @@ -633,7 +633,7 @@ errout: * Description: * Zero-extend a file. * - * Input parameters + * Input Parameters: * volume - Describes the NXFFS volume * entry - Describes the new inode entry * length - The new, extended length of the file diff --git a/fs/semaphore/sem_close.c b/fs/semaphore/sem_close.c index ffe687bec8..bd5ab99205 100644 --- a/fs/semaphore/sem_close.c +++ b/fs/semaphore/sem_close.c @@ -71,7 +71,7 @@ * Parameters: * sem - semaphore descriptor * - * Return Value: + * Returned Value: * 0 (OK), or -1 (ERROR) if unsuccessful. * * Assumptions: diff --git a/fs/semaphore/sem_open.c b/fs/semaphore/sem_open.c index 4bc91daeb0..c09f962798 100644 --- a/fs/semaphore/sem_open.c +++ b/fs/semaphore/sem_open.c @@ -93,7 +93,7 @@ * initial values of the semaphore must be less than or equal to * SEM_VALUE_MAX. * - * Return Value: + * Returned Value: * A pointer to sem_t or SEM_FAILED if unsuccessful. * * Assumptions: diff --git a/fs/semaphore/sem_unlink.c b/fs/semaphore/sem_unlink.c index ca73a80041..647e3cba5c 100644 --- a/fs/semaphore/sem_unlink.c +++ b/fs/semaphore/sem_unlink.c @@ -70,7 +70,7 @@ * Parameters: * name - Semaphore name * - * Return Value: + * Returned Value: * 0 (OK), or -1 (ERROR) if unsuccessful. * * Assumptions: diff --git a/fs/unionfs/fs_unionfs.c b/fs/unionfs/fs_unionfs.c index 0c61c2e7a0..27bd733e6e 100644 --- a/fs/unionfs/fs_unionfs.c +++ b/fs/unionfs/fs_unionfs.c @@ -2617,7 +2617,7 @@ errout_with_search: * file system appear a some path below the unionfs mountpoint, * mountpt - The full path to the mountpoint for the union file system * - * Returned value: + * Returned Value: * Zero (OK) is returned if the union file system was correctly created and * mounted. On any failure, a negated error value will be returned to * indicate the nature of the failure. diff --git a/fs/vfs/fs_fstatfs.c b/fs/vfs/fs_fstatfs.c index 80c0d1d7dd..7e4ddb3879 100644 --- a/fs/vfs/fs_fstatfs.c +++ b/fs/vfs/fs_fstatfs.c @@ -54,7 +54,8 @@ /**************************************************************************** * Name: fstatfs * - * Return: Zero on success; -1 on failure with errno set: + * Returned Value: + * Zero on success; -1 on failure with errno set: * * EACCES Search permission is denied for one of the directories in the * path prefix of path. diff --git a/fs/vfs/fs_ioctl.c b/fs/vfs/fs_ioctl.c index a68dc43ce5..3127647869 100644 --- a/fs/vfs/fs_ioctl.c +++ b/fs/vfs/fs_ioctl.c @@ -68,7 +68,7 @@ * req The ioctl command * arg The argument of the ioctl cmd * - * Return: + * Returned Value: * Returns a non-negative number on success; A negated errno value is * returned on any failure (see comments ioctl() for a list of appropriate * errno values). @@ -114,7 +114,7 @@ int file_ioctl(FAR struct file *filep, int req, unsigned long arg) * req The ioctl command * arg The argument of the ioctl cmd * - * Return: + * Returned Value: * >=0 on success (positive non-zero values are cmd-specific) * -1 on failure with errno set properly: * diff --git a/fs/vfs/fs_lseek.c b/fs/vfs/fs_lseek.c index 6827d931d1..fcdbb85664 100644 --- a/fs/vfs/fs_lseek.c +++ b/fs/vfs/fs_lseek.c @@ -65,7 +65,7 @@ * offset Defines the offset to position to * whence Defines how to use offset * - * Return: + * Returned Value: * The resulting offset on success. A negated errno value is returned on * any failure (see lseek comments). * @@ -146,7 +146,7 @@ off_t file_seek(FAR struct file *filep, off_t offset, int whence) * offset Defines the offset to position to * whence Defines how to use offset * - * Return: + * Returned Value: * The resulting offset on success. -1 on failure withi errno set properly: * * EBADF fd is not an open file descriptor. diff --git a/fs/vfs/fs_poll.c b/fs/vfs/fs_poll.c index 825f8d16d8..d6b32974b4 100644 --- a/fs/vfs/fs_poll.c +++ b/fs/vfs/fs_poll.c @@ -357,14 +357,14 @@ int fdesc_poll(int fd, FAR struct pollfd *fds, bool setup) * occurred for any of the file descriptors, then poll() blocks until * one of the events occurs. * - * Inputs: + * Input Parameters: * fds - List of structures describing file descriptors to be monitored * nfds - The number of entries in the list * timeout - Specifies an upper limit on the time for which poll() will * block in milliseconds. A negative value of timeout means an infinite * timeout. * - * Return: + * Returned Value: * On success, the number of structures that have non-zero revents fields. * A value of 0 indicates that the call timed out and no file descriptors * were ready. On error, -1 is returned, and errno is set appropriately: diff --git a/fs/vfs/fs_pread.c b/fs/vfs/fs_pread.c index 782c7448fb..9c7eb79461 100644 --- a/fs/vfs/fs_pread.c +++ b/fs/vfs/fs_pread.c @@ -129,7 +129,7 @@ ssize_t file_pread(FAR struct file *filep, FAR void *buf, size_t nbytes, * nbytes The maximum size of the user-provided buffer * offset The file offset * - * Return: + * Returned Value: * The positive non-zero number of bytes read on success, 0 on if an * end-of-file condition, or -1 on failure with errno set appropriately. * See read() return values diff --git a/fs/vfs/fs_pwrite.c b/fs/vfs/fs_pwrite.c index 1a67d915f8..698b6d9eb8 100644 --- a/fs/vfs/fs_pwrite.c +++ b/fs/vfs/fs_pwrite.c @@ -126,7 +126,7 @@ ssize_t file_pwrite(FAR struct file *filep, FAR const void *buf, * buf Data to write * nbytes Length of data to write * - * Return: + * Returned Value: * The positive non-zero number of bytes read on success, 0 on if an * end-of-file condition, or -1 on failure with errno set appropriately. * See write() return values diff --git a/fs/vfs/fs_select.c b/fs/vfs/fs_select.c index b3ba38bf42..e7fb11cc4f 100644 --- a/fs/vfs/fs_select.c +++ b/fs/vfs/fs_select.c @@ -84,7 +84,7 @@ * is more wasteful of resources and poll() is the recommended API to be * used. * - * Input parameters: + * Input Parameters: * nfds - the maximum fd number (+1) of any descriptor in any of the * three sets. * readfds - the set of descriptions to monitor for read-ready events @@ -93,7 +93,7 @@ * timeout - Return at this time if none of these events of interest * occur. * - * Return: + * Returned Value: * 0: Timer expired * >0: The number of bits set in the three sets of descriptors * -1: An error occurred (errno will be set appropriately) diff --git a/fs/vfs/fs_sendfile.c b/fs/vfs/fs_sendfile.c index a71dbcdf9b..b1ef4ffb2a 100644 --- a/fs/vfs/fs_sendfile.c +++ b/fs/vfs/fs_sendfile.c @@ -74,7 +74,7 @@ * different semantics and prototypes. sendfile() should not be used * in portable programs. * - * Input Parmeters: + * Input Parameters: * infd - A file (or socket) descriptor opened for reading * outfd - A descriptor opened for writing. * offset - If 'offset' is not NULL, then it points to a variable diff --git a/fs/vfs/fs_statfs.c b/fs/vfs/fs_statfs.c index 0f33c10aba..4a8f6af7e1 100644 --- a/fs/vfs/fs_statfs.c +++ b/fs/vfs/fs_statfs.c @@ -70,7 +70,8 @@ static int statpseudofs(FAR struct inode *inode, FAR struct statfs *buf) /**************************************************************************** * Name: statfs * - * Return: Zero on success; -1 on failure with errno set: + * Returned Value: + * Zero on success; -1 on failure with errno set: * * EACCES Search permission is denied for one of the directories in the * path prefix of path. diff --git a/graphics/nxbe/nxbe.h b/graphics/nxbe/nxbe.h index 5b0743c0d8..2f9ce9a3f8 100644 --- a/graphics/nxbe/nxbe.h +++ b/graphics/nxbe/nxbe.h @@ -198,7 +198,7 @@ int nxbe_configure(FAR NX_DRIVERTYPE *dev, FAR struct nxbe_state_s *be); * Input Parameters: * wnd - The window to be closed (and deallocated) * - * Return: + * Returned Value: * None * ****************************************************************************/ @@ -261,7 +261,7 @@ void nxbe_lower(FAR struct nxbe_window_s *wnd); * pos - The pixel location to be set * col - The color to use in the set * - * Return: + * Returned Value: * None * ****************************************************************************/ @@ -281,7 +281,7 @@ void nxbe_setpixel(FAR struct nxbe_window_s *wnd, * rect - The location to be filled * col - The color to use in the fill * - * Return: + * Returned Value: * None * ****************************************************************************/ @@ -302,7 +302,7 @@ void nxbe_fill(FAR struct nxbe_window_s *wnd, * rect - The location to be filled * col - The color to use in the fill * - * Return: + * Returned Value: * None * ****************************************************************************/ @@ -328,7 +328,7 @@ void nxbe_filltrapezoid(FAR struct nxbe_window_s *wnd, * dest - The location to copy the memory region * deststride - The width, in bytes, of the dest memory * - * Return: + * Returned Value: * None * ****************************************************************************/ @@ -349,7 +349,7 @@ void nxbe_getrectangle(FAR struct nxbe_window_s *wnd, * rect - Describes the rectangular region to move * offset - The offset to move the region * - * Return: + * Returned Value: * None * ****************************************************************************/ @@ -375,7 +375,7 @@ void nxbe_move(FAR struct nxbe_window_s *wnd, * may lie outside of the display. * stride - The width of the full source image in pixels. * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/graphics/nxbe/nxbe_bitmap.c b/graphics/nxbe/nxbe_bitmap.c index 61a380ca10..772b08e46a 100644 --- a/graphics/nxbe/nxbe_bitmap.c +++ b/graphics/nxbe/nxbe_bitmap.c @@ -109,7 +109,7 @@ static void nxs_clipcopy(FAR struct nxbe_clipops_s *cops, * may lie outside of the display. * stride - The width of the full source image in pixels. * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/graphics/nxbe/nxbe_closewindow.c b/graphics/nxbe/nxbe_closewindow.c index 44520da22c..cec2c5ae9e 100644 --- a/graphics/nxbe/nxbe_closewindow.c +++ b/graphics/nxbe/nxbe_closewindow.c @@ -61,7 +61,7 @@ * wnd - The window to be closed (and deallocated using the user-space * allocator) * - * Return: + * Returned Value: * None * ****************************************************************************/ diff --git a/graphics/nxbe/nxbe_fill.c b/graphics/nxbe/nxbe_fill.c index e2b45fbc96..48567ccdcf 100644 --- a/graphics/nxbe/nxbe_fill.c +++ b/graphics/nxbe/nxbe_fill.c @@ -99,7 +99,7 @@ static void nxbe_clipfill(FAR struct nxbe_clipops_s *cops, * rect - The location to be filled * col - The color to use in the fill * - * Return: + * Returned Value: * None * ****************************************************************************/ diff --git a/graphics/nxbe/nxbe_filltrapezoid.c b/graphics/nxbe/nxbe_filltrapezoid.c index 1936a6c4d6..51fde5728b 100644 --- a/graphics/nxbe/nxbe_filltrapezoid.c +++ b/graphics/nxbe/nxbe_filltrapezoid.c @@ -123,7 +123,7 @@ static void nxbe_clipfilltrapezoid(FAR struct nxbe_clipops_s *cops, * rect - The location to be filled (in relative window coordinates) * col - The color to use in the fill * - * Return: + * Returned Value: * None * ****************************************************************************/ diff --git a/graphics/nxbe/nxbe_getrectangle.c b/graphics/nxbe/nxbe_getrectangle.c index 2e707a816c..72073537e6 100644 --- a/graphics/nxbe/nxbe_getrectangle.c +++ b/graphics/nxbe/nxbe_getrectangle.c @@ -76,7 +76,7 @@ struct nxbe_fill_s * dest - The location to copy the memory region * deststride - The width, in bytes, of the dest memory * - * Return: + * Returned Value: * None * ****************************************************************************/ diff --git a/graphics/nxbe/nxbe_move.c b/graphics/nxbe/nxbe_move.c index e2eee9f01b..747b4e5a76 100644 --- a/graphics/nxbe/nxbe_move.c +++ b/graphics/nxbe/nxbe_move.c @@ -197,7 +197,7 @@ static void nxbe_clipmovedest(FAR struct nxbe_clipops_s *cops, * rect - Describes the rectangular region to move * offset - The offset to move the region * - * Return: + * Returned Value: * None * ****************************************************************************/ diff --git a/graphics/nxbe/nxbe_setpixel.c b/graphics/nxbe/nxbe_setpixel.c index 574a4ee3de..409b11c442 100644 --- a/graphics/nxbe/nxbe_setpixel.c +++ b/graphics/nxbe/nxbe_setpixel.c @@ -99,7 +99,7 @@ static void nxbe_clipfill(FAR struct nxbe_clipops_s *cops, * rect - The location to be filled * col - The color to use in the fill * - * Return: + * Returned Value: * None * ****************************************************************************/ diff --git a/graphics/nxmu/nxfe.h b/graphics/nxmu/nxfe.h index 62ae235fed..c1e02b769d 100644 --- a/graphics/nxmu/nxfe.h +++ b/graphics/nxmu/nxfe.h @@ -106,7 +106,7 @@ extern "C" * msg - A pointer to the message to send * msglen - The length of the message in bytes. * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -125,7 +125,7 @@ int nxmu_sendclient(FAR struct nxfe_conn_s *conn, * msg - A pointer to the message to send * msglen - The length of the message in bytes. * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -143,7 +143,7 @@ int nxmu_sendclientwindow(FAR struct nxbe_window_s *wnd, FAR const void *msg, * be - The back-end status structure * wnd - The pre-allocated window structure to be initialized [IN/OUT] * - * Return: + * Returned Value: * None * ****************************************************************************/ @@ -164,7 +164,7 @@ void nxmu_openwindow(FAR struct nxbe_state_s *be, * cb - Callbacks used to process window events * arg - User provided argument (see nx_openwindow, nx_constructwindow) * - * Return: + * Returned Value: * None * ****************************************************************************/ @@ -184,7 +184,7 @@ void nxmu_requestbkgd(FAR struct nxfe_conn_s *conn, * Input Parameters: * fe - The front-end state structure * - * Return: + * Returned Value: * None * ****************************************************************************/ diff --git a/graphics/nxmu/nxmu_openwindow.c b/graphics/nxmu/nxmu_openwindow.c index 01ed612a5b..0d05ac3700 100644 --- a/graphics/nxmu/nxmu_openwindow.c +++ b/graphics/nxmu/nxmu_openwindow.c @@ -76,7 +76,7 @@ * be - The back-end status structure * wnd - The pre-allocated window structure to be initialized [IN/OUT] * - * Return: + * Returned Value: * None * ****************************************************************************/ diff --git a/graphics/nxmu/nxmu_releasebkgd.c b/graphics/nxmu/nxmu_releasebkgd.c index 7f8d293507..35c6593072 100644 --- a/graphics/nxmu/nxmu_releasebkgd.c +++ b/graphics/nxmu/nxmu_releasebkgd.c @@ -79,7 +79,7 @@ * Input Parameters: * fe - The front-end state structure * - * Return: + * Returned Value: * None * ****************************************************************************/ diff --git a/graphics/nxmu/nxmu_requestbkgd.c b/graphics/nxmu/nxmu_requestbkgd.c index 72485b6aaa..fa12750fee 100644 --- a/graphics/nxmu/nxmu_requestbkgd.c +++ b/graphics/nxmu/nxmu_requestbkgd.c @@ -63,7 +63,7 @@ * cb - Callbacks used to process window events * arg - User provided argument (see nx_openwindow, nx_constructwindow) * - * Return: + * Returned Value: * None * ****************************************************************************/ diff --git a/graphics/nxmu/nxmu_sendclient.c b/graphics/nxmu/nxmu_sendclient.c index a26a6d3e96..21588fbbd2 100644 --- a/graphics/nxmu/nxmu_sendclient.c +++ b/graphics/nxmu/nxmu_sendclient.c @@ -62,7 +62,7 @@ * msg - A pointer to the message to send * msglen - The length of the message in bytes. * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/graphics/nxmu/nxmu_sendclientwindow.c b/graphics/nxmu/nxmu_sendclientwindow.c index e8ce5276a1..32d42a3d48 100644 --- a/graphics/nxmu/nxmu_sendclientwindow.c +++ b/graphics/nxmu/nxmu_sendclientwindow.c @@ -80,7 +80,7 @@ * msg - A pointer to the message to send * msglen - The length of the message in bytes. * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/graphics/nxmu/nxmu_server.c b/graphics/nxmu/nxmu_server.c index a2a2999abd..5593c57dd6 100644 --- a/graphics/nxmu/nxmu_server.c +++ b/graphics/nxmu/nxmu_server.c @@ -270,7 +270,7 @@ static inline int nxmu_setup(FAR const char *mqname, FAR NX_DRIVERTYPE *dev, * mqname - The name for the server incoming message queue * dev - Vtable "object" of the framebuffer/LCD "driver" to use * - * Return: + * Returned Value: * This function usually does not return. If it does return, it will * return ERROR and errno will be set appropriately. * diff --git a/graphics/nxterm/nx_register.c b/graphics/nxterm/nx_register.c index 3da6fd8a65..8c1e0a8018 100644 --- a/graphics/nxterm/nx_register.c +++ b/graphics/nxterm/nx_register.c @@ -90,7 +90,7 @@ static const struct nxterm_operations_s g_nxops = * rect - The location to be filled * color - The color to use in the fill * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -114,7 +114,7 @@ static int nxterm_fill(FAR struct nxterm_state_s *priv, * offset - The offset to move the region. The rectangular region will be * moved so that the origin is translated by this amount. * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -146,7 +146,7 @@ static int nxterm_move(FAR struct nxterm_state_s *priv, * may lie outside of the display. * stride - The width of the full source image in bytes. * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -177,7 +177,7 @@ static int nxterm_bitmap(FAR struct nxterm_state_s *priv, * wndo - Describes the window and font to be used * minor - The device minor number * - * Return: + * Returned Value: * A non-NULL handle is returned on success. * ****************************************************************************/ diff --git a/graphics/nxterm/nxtk_register.c b/graphics/nxterm/nxtk_register.c index ae4e861246..d89f31cd3f 100644 --- a/graphics/nxterm/nxtk_register.c +++ b/graphics/nxterm/nxtk_register.c @@ -90,7 +90,7 @@ static const struct nxterm_operations_s g_nxtkops = * rect - The location to be filled * color - The color to use in the fill * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -114,7 +114,7 @@ static int nxtkcon_fill(FAR struct nxterm_state_s *priv, * offset - The offset to move the region. The rectangular region will be * moved so that the origin is translated by this amount. * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -146,7 +146,7 @@ static int nxtkcon_move(FAR struct nxterm_state_s *priv, * may lie outside of the display. * stride - The width of the full source image in bytes. * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -177,7 +177,7 @@ static int nxtkcon_bitmap(FAR struct nxterm_state_s *priv, * wndo - Describes the window and font to be used * minor - The device minor number * - * Return: + * Returned Value: * A non-NULL handle is returned on success. * ****************************************************************************/ diff --git a/graphics/nxterm/nxtool_register.c b/graphics/nxterm/nxtool_register.c index 2a9de5d559..04849692f3 100644 --- a/graphics/nxterm/nxtool_register.c +++ b/graphics/nxterm/nxtool_register.c @@ -90,7 +90,7 @@ static const struct nxterm_operations_s g_nxtoolops = * rect - The location to be filled * color - The color to use in the fill * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -114,7 +114,7 @@ static int nxtool_fill(FAR struct nxterm_state_s *priv, * offset - The offset to move the region. The rectangular region will be * moved so that the origin is translated by this amount. * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -146,7 +146,7 @@ static int nxtool_move(FAR struct nxterm_state_s *priv, * may lie outside of the display. * stride - The width of the full source image in bytes. * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -179,7 +179,7 @@ static int nxtool_bitmap(FAR struct nxterm_state_s *priv, * wndo - Describes the window and font to be used * minor - The device minor number * - * Return: + * Returned Value: * A non-NULL handle is returned on success. * ****************************************************************************/ diff --git a/graphics/vnc/server/vnc_fbdev.c b/graphics/vnc/server/vnc_fbdev.c index e599599654..47badee8f0 100644 --- a/graphics/vnc/server/vnc_fbdev.c +++ b/graphics/vnc/server/vnc_fbdev.c @@ -412,7 +412,7 @@ static int up_setcursor(FAR struct fb_vtable_s *vtable, * Description: * Start the VNC server. * - * Input parameters: + * Input Parameters: * display - In the case of hardware with multiple displays, this * specifies the display. Normally this is zero. * @@ -470,7 +470,7 @@ static int vnc_start_server(int display) * Description: * Wait for the server to be started. * - * Input parameters: + * Input Parameters: * display - In the case of hardware with multiple displays, this * specifies the display. Normally this is zero. * @@ -525,7 +525,7 @@ static inline int vnc_wait_start(int display) * Wait for the server to be connected to the VNC client. We can do * nothing until that connection is established. * - * Input parameters: + * Input Parameters: * display - In the case of hardware with multiple displays, this * specifies the display. Normally this is zero. * @@ -612,7 +612,7 @@ static inline int vnc_wait_connect(int display) * Description: * Initialize the framebuffer video hardware associated with the display. * - * Input parameters: + * Input Parameters: * display - In the case of hardware with multiple displays, this * specifies the display. Normally this is zero. * @@ -746,7 +746,7 @@ int vnc_fbinitialize(int display, vnc_kbdout_t kbdout, * Return a a reference to the framebuffer object for the specified video * plane of the specified plane. Many OSDs support multiple planes of video. * - * Input parameters: + * Input Parameters: * display - In the case of hardware with multiple displays, this * specifies the display. Normally this is zero. * vplane - Identifies the plane being queried. diff --git a/include/hex2bin.h b/include/hex2bin.h index 3217c54560..3ee8e42dd4 100644 --- a/include/hex2bin.h +++ b/include/hex2bin.h @@ -133,7 +133,7 @@ extern "C" * swap - Controls byte ordering. See enum hex2bin_swap_e for * description of the values. * - * Returned Value + * Returned Value: * Zero (OK) is returned on success; a negated errno value is returned on * failure. * @@ -163,7 +163,7 @@ int hex2bin(FAR struct lib_instream_s *instream, * swap - Controls byte ordering. See enum hex2bin_swap_e for * description of the values. * - * Returned Value + * Returned Value: * Zero (OK) is returned on success; a negated errno value is returned on * failure. * @@ -190,7 +190,7 @@ int hex2mem(int fd, uint32_t baseaddr, uint32_t endpaddr, * swap - Controls byte ordering. See enum hex2bin_swap_e for * description of the values. * - * Returned Value + * Returned Value: * Zero (OK) is returned on success; a negated errno value is returned on * failure. * @@ -208,7 +208,7 @@ int fhex2mem(FAR FILE *instream, uint32_t baseaddr, uint32_t endpaddr, * Input Parameters: * Standard task inputs * - * Returned Value + * Returned Value: * EXIT_SUCESS on success; EXIT_FAILURE on failure * ****************************************************************************/ @@ -226,7 +226,7 @@ int hex2bin_main(int argc, char **argv); * Input Parameters: * Standard task inputs * - * Returned Value + * Returned Value: * EXIT_SUCESS on success; EXIT_FAILURE on failure * ****************************************************************************/ diff --git a/include/nuttx/analog/adc.h b/include/nuttx/analog/adc.h index 524773e729..7ce2577fe4 100644 --- a/include/nuttx/analog/adc.h +++ b/include/nuttx/analog/adc.h @@ -227,7 +227,7 @@ extern "C" * driver with the "upper half" ADC device and registers that device so that can * be used by application code. * - * Input parameters: + * Input Parameters: * path - The full path to the driver to be registers in the NuttX pseudo- * filesystem. The recommended convention is to name all PWM drivers * as "/dev/adc", "/dev/adc1", etc. where the driver path differs only diff --git a/include/nuttx/analog/dac.h b/include/nuttx/analog/dac.h index 93f1282ef5..5f9fce131c 100644 --- a/include/nuttx/analog/dac.h +++ b/include/nuttx/analog/dac.h @@ -190,7 +190,7 @@ int dac_register(FAR const char *path, FAR struct dac_dev_s *dev); * Input Parameters: * dev - An instance of the device-specific DAC interface * - * Return: + * Returned Value: * OK on success; a negated errno on failure. * ************************************************************************************/ diff --git a/include/nuttx/arch.h b/include/nuttx/arch.h index 6bbdf758b4..9e52a6b019 100644 --- a/include/nuttx/arch.h +++ b/include/nuttx/arch.h @@ -247,7 +247,7 @@ void up_initial_state(FAR struct tcb_s *tcb); * - adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The initial value of * the stack pointer. * - * Inputs: + * Input Parameters: * - tcb: The TCB of new task * - stack_size: The requested stack size. At least this much * must be allocated. @@ -289,7 +289,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype); * - adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The * initial value of the stack pointer. * - * Inputs: + * Input Parameters: * - tcb: The TCB of new task * - stack: The new stack to be used. * - stack_size: The allocated stack size. @@ -324,7 +324,7 @@ int up_use_stack(FAR struct tcb_s *tcb, FAR void *stack, size_t stack_size); * been removed from the stack. This will still be the initial value * of the stack pointer when the task is started. * - * Inputs: + * Input Parameters: * - tcb: The TCB of new task * - frame_size: The size of the stack frame to allocate. * @@ -344,7 +344,7 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size); * A task has been stopped. Free all stack related resources retained in * the defunct TCB. * - * Input Parmeters + * Input Parameters: * - dtcb: The TCB containing information about the stack to be released * - ttype: The thread type. This may be one of following (defined in * include/nuttx/sched.h): @@ -382,7 +382,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype); * logic. Interrupts will always be disabled when this * function is called. * - * Inputs: + * Input Parameters: * tcb: Refers to the tcb to be unblocked. This tcb is * in one of the waiting tasks lists. It must be moved to * the ready-to-run list and, if it is the highest priority @@ -404,7 +404,7 @@ void up_unblock_task(FAR struct tcb_s *tcb); * logic. Interrupts will always be disabled when this * function is called. * - * Inputs: + * Input Parameters: * tcb: Refers to a task in the ready-to-run list (normally * the task at the head of the list). It most be * stopped, its context saved and moved into one of the @@ -455,7 +455,7 @@ void up_release_pending(void); * logic. Interrupts will always be disabled when this * function is called. * - * Inputs: + * Input Parameters: * tcb: The TCB of the task that has been reprioritized * priority: The new task priority * @@ -601,12 +601,12 @@ void up_pthread_start(pthread_startroutine_t entrypt, pthread_addr_t arg) * function is the user-space, signal handler trampoline function. It is * called from up_signal_dispatch() in user-mode. * - * Inputs: + * Input Parameters: * sighand - The address user-space signal handling function * signo, info, and ucontext - Standard arguments to be passed to the * signal handling function. * - * Return: + * Returned Value: * None. This function does not return in the normal sense. It returns * via an architecture specific system call made by up_signal_handler() * (see below). However, this will look like a normal return by the @@ -628,12 +628,12 @@ void up_signal_dispatch(_sa_sigaction_t sighand, int signo, * must be provided by architecture-specific logic. It is called from * up_signal_dispatch() in user-mode. * - * Inputs: + * Input Parameters: * sighand - The address user-space signal handling function * signo, info, and ucontext - Standard arguments to be passed to the * signal handling function. * - * Return: + * Returned Value: * None. This function does not return in the normal sense. It returns * via an architecture specific system call. * @@ -1741,7 +1741,7 @@ int up_cpu_index(void); * - adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The initial value of * the stack pointer. * - * Inputs: + * Input Parameters: * - cpu: CPU index that indicates which CPU the IDLE task is * being created for. * - tcb: The TCB of new CPU IDLE task @@ -2015,10 +2015,10 @@ void sched_alarm_expiration(FAR const struct timespec *ts); * Description: * Collect data that can be used for CPU load measurements. * - * Inputs: + * Input Parameters: * None * - * Return Value: + * Returned Value: * None * * Assumptions/Limitations: @@ -2054,7 +2054,7 @@ void irq_dispatch(int irq, FAR void *context); * Input Parameters: * None * - * Returned value: + * Returned Value: * The estimated amount of stack space used. * ****************************************************************************/ diff --git a/include/nuttx/audio/audio.h b/include/nuttx/audio/audio.h index 1bdb9fe7ef..1395873622 100644 --- a/include/nuttx/audio/audio.h +++ b/include/nuttx/audio/audio.h @@ -670,7 +670,7 @@ extern "C" * When this function is called, the "lower half" driver should be in the * reset state (as if the shutdown() method had already been called). * - * Input parameters: + * Input Parameters: * name - The name of the audio device. This name will be used to generate * a full path to the driver in the format "/dev/audio/[name]" in the NuttX * filesystem (i.e. the path "/dev/audio" will be prepended to the supplied @@ -695,7 +695,7 @@ int audio_register(FAR const char *name, FAR struct audio_lowerhalf_s *dev); * Allocated an AP Buffer and prepares it for use. This allocates a dynamically * allocated buffer that has no special DMA capabilities. * - * Input parameters: + * Input Parameters: * bufdesc: Pointer to a buffer descriptor * * Returned Value: diff --git a/include/nuttx/audio/tone.h b/include/nuttx/audio/tone.h index e9a9c0059a..f5087ae743 100644 --- a/include/nuttx/audio/tone.h +++ b/include/nuttx/audio/tone.h @@ -71,7 +71,7 @@ extern "C" * be used by application code. * * - * Input parameters: + * Input Parameters: * path - The full path to the driver to be registers in the NuttX pseudo- * filesystem. The recommended convention is to name all PWM drivers * as "/dev/tone0", "/dev/tone1", etc. where the driver path diff --git a/include/nuttx/binfmt/binfmt.h b/include/nuttx/binfmt/binfmt.h index 4ca74f5a01..ab238a2d6c 100644 --- a/include/nuttx/binfmt/binfmt.h +++ b/include/nuttx/binfmt/binfmt.h @@ -271,7 +271,7 @@ int exec_module(FAR const struct binary_s *bin); * or friends. It will also automatically free the structure with * kmm_free() after unloading the module. * - * Input Parameter: + * Input Parameters: * pid - The task ID of the child task * bin - This structure must have been allocated with kmm_malloc() and must * persist until the task unloads diff --git a/include/nuttx/binfmt/builtin.h b/include/nuttx/binfmt/builtin.h index 6f4a87be24..bb4594bb9a 100644 --- a/include/nuttx/binfmt/builtin.h +++ b/include/nuttx/binfmt/builtin.h @@ -117,7 +117,7 @@ void builtin_uninitialize(void); * Description: * Checks for availabiliy of application registerred during compile time. * - * Input Parameter: + * Input Parameters: * filename - Name of the linked-in binary to be started. * * Returned Value: @@ -136,7 +136,7 @@ int builtin_isavail(FAR const char *appname); * Returns pointer to a name of built-in application pointed by the * index. * - * Input Parameter: + * Input Parameters: * index, from 0 and on ... * * Returned Value: @@ -158,7 +158,7 @@ FAR const char *builtin_getname(int index); * If support for builtin functions is enabled in the NuttX configuration, * then this function must be provided by the application code. * - * Input Parameter: + * Input Parameters: * index, from 0 and on... * * Returned Value: diff --git a/include/nuttx/cancelpt.h b/include/nuttx/cancelpt.h index 87b560fd92..10cd20bfaf 100644 --- a/include/nuttx/cancelpt.h +++ b/include/nuttx/cancelpt.h @@ -103,7 +103,7 @@ extern "C" * Input Parameters: * None * - * Returned Value + * Returned Value: * true is returned if a cancellation is pending but cannot be performed * now due to the nesting level. * @@ -133,7 +133,7 @@ bool enter_cancellation_point(void); * Input Parameters: * None * - * Returned Value + * Returned Value: * None * ****************************************************************************/ @@ -157,7 +157,7 @@ void leave_cancellation_point(void); * Input Parameters: * None * - * Returned Value + * Returned Value: * true is returned if a cancellation is pending but cannot be performed * now due to the nesting level. * diff --git a/include/nuttx/clock.h b/include/nuttx/clock.h index d05d49a50e..0892615e3c 100644 --- a/include/nuttx/clock.h +++ b/include/nuttx/clock.h @@ -272,7 +272,7 @@ EXTERN volatile systime_t g_system_timer; * Parameters: * None * - * Return Value: + * Returned Value: * None * * Assumptions: @@ -302,7 +302,7 @@ void clock_synchronize(void); * Parameters: * diff: amount of time system-time is adjusted forward with RTC * - * Return Value: + * Returned Value: * None * * Assumptions: @@ -329,7 +329,7 @@ void clock_resynchronize(FAR struct timespec *rtc_diff); * Parameters: * None * - * Return Value: + * Returned Value: * The current value of the system timer counter * * Assumptions: @@ -350,7 +350,7 @@ systime_t clock_systimer(void); * Parameters: * ts - Location to return the time * - * Return Value: + * Returned Value: * Current version always returns OK * * Assumptions: @@ -369,7 +369,7 @@ int clock_systimespec(FAR struct timespec *ts); * pid - The task ID of the thread of interest. pid == 0 is the IDLE thread. * cpuload - The location to return the CPU load * - * Return Value: + * Returned Value: * OK (0) on success; a negated errno value on failure. The only reason * that this function can fail is if 'pid' no longer refers to a valid * thread. diff --git a/include/nuttx/crypto/aes.h b/include/nuttx/crypto/aes.h index 5c4d3e8050..af97032e50 100644 --- a/include/nuttx/crypto/aes.h +++ b/include/nuttx/crypto/aes.h @@ -75,7 +75,7 @@ extern "C" * key AES128 key of size 16 bytes * state 16 bytes of plain text and cipher text * - * Returned Value + * Returned Value: * None * ****************************************************************************/ @@ -94,7 +94,7 @@ void aes_encrypt(FAR uint8_t *state, FAR const uint8_t *key); * key AES128 key of size 16 bytes * state 16 bytes of plain text and cipher text * - * Returned Value + * Returned Value: * None * ****************************************************************************/ diff --git a/include/nuttx/drivers/drivers.h b/include/nuttx/drivers/drivers.h index 612434d15b..b2f1bbf79e 100644 --- a/include/nuttx/drivers/drivers.h +++ b/include/nuttx/drivers/drivers.h @@ -227,12 +227,12 @@ ssize_t bchlib_write(FAR void *handle, FAR const char *buffer, size_t offset, * the NuttX FIFOs are based in in-memory, circular buffers, the ability * to control the size of those buffers is critical for system tuning. * - * Inputs: + * Input Parameters: * fd[2] - The user provided array in which to catch the pipe file * descriptors * bufsize - The size of the in-memory, circular buffer in bytes. * - * Return: + * Returned Value: * 0 is returned on success; otherwise, -1 is returned with errno set * appropriately. * @@ -264,13 +264,13 @@ int pipe2(int fd[2], size_t bufsize); * the NuttX FIFOs are based in in-memory, circular buffers, the ability * to control the size of those buffers is critical for system tuning. * - * Inputs: + * Input Parameters: * pathname - The full path to the FIFO instance to attach to or to create * (if not already created). * mode - Ignored for now * bufsize - The size of the in-memory, circular buffer in bytes. * - * Return: + * Returned Value: * 0 is returned on success; otherwise, -1 is returned with errno set * appropriately. * diff --git a/include/nuttx/drivers/pwm.h b/include/nuttx/drivers/pwm.h index eddea5804e..2d0a5d2c7d 100644 --- a/include/nuttx/drivers/pwm.h +++ b/include/nuttx/drivers/pwm.h @@ -260,7 +260,7 @@ extern "C" * When this function is called, the "lower half" driver should be in the * reset state (as if the shutdown() method had already been called). * - * Input parameters: + * Input Parameters: * path - The full path to the driver to be registers in the NuttX pseudo- * filesystem. The recommended convention is to name all PWM drivers * as "/dev/pwm0", "/dev/pwm1", etc. where the driver path differs only @@ -301,7 +301,7 @@ int pwm_register(FAR const char *path, FAR struct pwm_lowerhalf_s *dev); * interface using the handle that was previously passed to the * start() method * - * Input parameters: + * Input Parameters: * handle - This is the handle that was provided to the lower-half * start() method. * diff --git a/include/nuttx/drivers/ramdisk.h b/include/nuttx/drivers/ramdisk.h index 27cfb4e992..86bb5f4eff 100644 --- a/include/nuttx/drivers/ramdisk.h +++ b/include/nuttx/drivers/ramdisk.h @@ -79,14 +79,14 @@ extern "C" * Description: * Non-standard function to register a ramdisk or a romdisk * - * Input Parmeters: + * Input Parameters: * minor: Selects suffix of device named /dev/ramN, N={1,2,3...} * nsectors: Number of sectors on device * sectize: The size of one sector * rdflags: See RDFLAG_* definitions * buffer: RAM disk backup memory * - * Returned Valued: + * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ diff --git a/include/nuttx/fs/fs.h b/include/nuttx/fs/fs.h index bb3b989ab4..424b8b4477 100644 --- a/include/nuttx/fs/fs.h +++ b/include/nuttx/fs/fs.h @@ -496,7 +496,7 @@ void fs_initialize(void); * Description: * Register a character driver inode the pseudo file system. * - * Input parameters: + * Input Parameters: * path - The path to the inode to create * fops - The file operations structure * mode - inmode privileges (not used) @@ -523,7 +523,7 @@ int register_driver(FAR const char *path, * Description: * Register a block driver inode the pseudo file system. * - * Input parameters: + * Input Parameters: * path - The path to the inode to create * bops - The block driver operations structure * mode - inmode privileges (not used) @@ -1051,7 +1051,7 @@ int file_truncate(FAR struct file *filep, off_t length); * req The ioctl command * arg The argument of the ioctl cmd * - * Return: + * Returned Value: * Returns a non-negative number on success; A negated errno value is * returned on any failure (see comments ioctl() for a list of appropriate * errno values). diff --git a/include/nuttx/fs/unionfs.h b/include/nuttx/fs/unionfs.h index 35815de8c3..485197e129 100644 --- a/include/nuttx/fs/unionfs.h +++ b/include/nuttx/fs/unionfs.h @@ -83,7 +83,7 @@ extern "C" * file system appear a some path below the unionfs mountpoint, * mountpt - The full path to the mountpoint for the union file system * - * Returned value: + * Returned Value: * Zero (OK) is returned if the union file system was correctly created and * mounted. On any failure, a negated error value will be returned to * indicate the nature of the failure. diff --git a/include/nuttx/fs/userfs.h b/include/nuttx/fs/userfs.h index 29ad9d3d91..a1b96938ee 100644 --- a/include/nuttx/fs/userfs.h +++ b/include/nuttx/fs/userfs.h @@ -549,7 +549,7 @@ extern "C" * NOTE: This is an OS internal function that should not be called from * appliation logic. * - * Input parameters: + * Input Parameters: * None * * Returned Value: @@ -584,7 +584,7 @@ int userfs_register(void); * NOTE: This is a user function that is implemented as part of the * NuttX C library and is intended to be called by appliation logic. * - * Input parameters: + * Input Parameters: * mountpt - Mountpoint path * userops - The caller operations that implement the file system * interface. diff --git a/include/nuttx/input/ajoystick.h b/include/nuttx/input/ajoystick.h index 7cc7d384b0..9e7d6a0cd0 100644 --- a/include/nuttx/input/ajoystick.h +++ b/include/nuttx/input/ajoystick.h @@ -283,7 +283,7 @@ extern "C" * lower - An instance of the platform-specific analog joystick lower * half driver. * - * Returned Values: + * Returned Value: * Zero (OK) is returned on success. Otherwise a negated errno value is * returned to indicate the nature of the failure. * diff --git a/include/nuttx/input/buttons.h b/include/nuttx/input/buttons.h index dbaaec45e1..601979b462 100644 --- a/include/nuttx/input/buttons.h +++ b/include/nuttx/input/buttons.h @@ -191,7 +191,7 @@ extern "C" * minor device number. * lower - An instance of the platform-specific button lower half driver. * - * Returned Values: + * Returned Value: * Zero (OK) is returned on success. Otherwise a negated errno value is * returned to indicate the nature of the failure. * diff --git a/include/nuttx/input/djoystick.h b/include/nuttx/input/djoystick.h index 3f0f1e0aa9..21def3909b 100644 --- a/include/nuttx/input/djoystick.h +++ b/include/nuttx/input/djoystick.h @@ -260,7 +260,7 @@ extern "C" * lower - An instance of the platform-specific discrete joystick lower * half driver. * - * Returned Values: + * Returned Value: * Zero (OK) is returned on success. Otherwise a negated errno value is * returned to indicate the nature of the failure. * diff --git a/include/nuttx/input/nunchuck.h b/include/nuttx/input/nunchuck.h index 844b66abc2..cc0a3b8fca 100644 --- a/include/nuttx/input/nunchuck.h +++ b/include/nuttx/input/nunchuck.h @@ -169,7 +169,7 @@ extern "C" * minor device number. * i2c - An instance of the platform-specific I2C connected to Nunchuck. * - * Returned Values: + * Returned Value: * Zero (OK) is returned on success. Otherwise a negated errno value is * returned to indicate the nature of the failure. * diff --git a/include/nuttx/kthread.h b/include/nuttx/kthread.h index 254ce87098..c9f2ffaf70 100644 --- a/include/nuttx/kthread.h +++ b/include/nuttx/kthread.h @@ -97,7 +97,7 @@ extern "C" * should be terminated with a NULL argv[] value. If no * parameters are required, argv may be NULL. * - * Return Value: + * Returned Value: * Returns the positive, non-zero process ID of the new task or a negated * errno value to indicate the nature of any failure. If memory is * insufficient or the task cannot be created -ENOMEM will be returned. @@ -126,7 +126,7 @@ int nxtask_create(FAR const char *name, int priority, * should be terminated with a NULL argv[] value. If no * parameters are required, argv may be NULL. * - * Return Value: + * Returned Value: * Returns the positive, non-zero process ID of the new task or a negated * errno value to indicate the nature of any failure. If memory is * insufficient or the task cannot be created -ENOMEM will be returned. diff --git a/include/nuttx/leds/rgbled.h b/include/nuttx/leds/rgbled.h index 554f0719ff..4fb192dc33 100644 --- a/include/nuttx/leds/rgbled.h +++ b/include/nuttx/leds/rgbled.h @@ -71,7 +71,7 @@ extern "C" * be used by application code. * * - * Input parameters: + * Input Parameters: * path - The full path to the driver to be registers in the NuttX pseudo- * filesystem. The recommended convention is to name all PWM drivers * as "/dev/rgdbled0", "/dev/rgbled1", etc. where the driver path diff --git a/include/nuttx/leds/userled.h b/include/nuttx/leds/userled.h index 0b9f8b0e25..f0a027808a 100644 --- a/include/nuttx/leds/userled.h +++ b/include/nuttx/leds/userled.h @@ -170,7 +170,7 @@ extern "C" * minor device number. * lower - An instance of the platform-specific LED lower half driver. * - * Returned Values: + * Returned Value: * Zero (OK) is returned on success. Otherwise a negated errno value is * returned to indicate the nature of the failure. * diff --git a/include/nuttx/mqueue.h b/include/nuttx/mqueue.h index b7276a6ff5..9c6a650c28 100644 --- a/include/nuttx/mqueue.h +++ b/include/nuttx/mqueue.h @@ -306,7 +306,7 @@ ssize_t nxmq_timedreceive(mqd_t mqdes, FAR char *msg, size_t msglen, * closed so that no thread will attempt access it while it is being * deleted. * - * Inputs: + * Input Parameters: * msgq - Named essage queue to be freed * * Returned Value: diff --git a/include/nuttx/mtd/configdata.h b/include/nuttx/mtd/configdata.h index 65965c6195..1dff77f0f2 100644 --- a/include/nuttx/mtd/configdata.h +++ b/include/nuttx/mtd/configdata.h @@ -117,7 +117,7 @@ extern "C" * When this function is called, the MTD device pass in should already * be initialized appropriately to access the physical device or partition. * - * Input parameters: + * Input Parameters: * mtd - Pointer to the MTD device to bind with the /dev/config device * * Returned Value: diff --git a/include/nuttx/mtd/hamming.h b/include/nuttx/mtd/hamming.h index 99358e10dc..706cb125f1 100644 --- a/include/nuttx/mtd/hamming.h +++ b/include/nuttx/mtd/hamming.h @@ -108,7 +108,7 @@ extern "C" * size - Data size in bytes * code - Codes buffer * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -127,7 +127,7 @@ void hamming_compute256x(FAR const uint8_t *data, size_t size, uint8_t *code); * size - Size of the data in bytes * code - Original codes * - * Returned Values: + * Returned Value: * Return 0 if the data is correct, HAMMING_ERROR_SINGLEBIT if one or more * block(s) have had a single bit corrected, or either HAMMING_ERROR_ECC * or HAMMING_ERROR_MULTIPLEBITS. diff --git a/include/nuttx/mtd/mtd.h b/include/nuttx/mtd/mtd.h index e834469866..f201e9ebbd 100644 --- a/include/nuttx/mtd/mtd.h +++ b/include/nuttx/mtd/mtd.h @@ -243,7 +243,7 @@ extern "C" * partitions, that mutual exclusion would be provided by the file system * above the FLASH driver. * - * Input parameters: + * Input Parameters: * mtd - The MTD device to be partitioned * firstblock - The offset in bytes to the first block * nblocks - The number of blocks in the partition diff --git a/include/nuttx/mtd/nand.h b/include/nuttx/mtd/nand.h index b19c6cb79a..ab3b73771f 100644 --- a/include/nuttx/mtd/nand.h +++ b/include/nuttx/mtd/nand.h @@ -99,10 +99,10 @@ extern "C" * Description: * Probe and initialize NAND. * - * Input parameters: + * Input Parameters: * raw - Lower-half, raw NAND FLASH interface * - * Returned value. + * Returned Value: * A non-NULL MTD driver intstance is returned on success. NULL is * returned on any failaure. * diff --git a/include/nuttx/mtd/nand_ecc.h b/include/nuttx/mtd/nand_ecc.h index 7e94d4c373..a86b0f2aab 100644 --- a/include/nuttx/mtd/nand_ecc.h +++ b/include/nuttx/mtd/nand_ecc.h @@ -86,14 +86,14 @@ extern "C" * the spare area. If a buffer pointer is NULL, then the corresponding area * is not saved. * - * Input parameters: + * Input Parameters: * nand - Upper-half, NAND FLASH interface * block - Number of the block where the page to read resides. * page - Number of the page to read inside the given block. * data - Buffer where the data area will be stored. * spare - Buffer where the spare area will be stored. * - * Returned value. + * Returned Value: * OK is returned in success; a negated errno value is returned on failure. * ****************************************************************************/ @@ -111,14 +111,14 @@ int nandecc_readpage(FAR struct nand_dev_s *nand, off_t block, * If no spare buffer is provided, the spare area is still written with the * ECC information calculated on the data buffer. * - * Input parameters: + * Input Parameters: * nand - Upper-half, NAND FLASH interface * block - Number of the block where the page to write resides. * page - Number of the page to write inside the given block. * data - Buffer containing the data to be writting * spare - Buffer containing the spare data to be written. * - * Returned value. + * Returned Value: * OK is returned in success; a negated errno value is returned on failure. * ****************************************************************************/ diff --git a/include/nuttx/mtd/nand_model.h b/include/nuttx/mtd/nand_model.h index bd1363cfdd..0012e339bf 100644 --- a/include/nuttx/mtd/nand_model.h +++ b/include/nuttx/mtd/nand_model.h @@ -127,7 +127,7 @@ EXTERN const struct nand_model_s g_nandmodels[NAND_NMODELS]; * chipid Identifier returned by the Nand(id1|(id2<<8)|(id3<<16)|(id4<<24)). * model nand_model_s instance to update with the model parameters. * - * Returned Values: + * Returned Value: * OK is returned on success; -ENODEV is returned on failure. * ****************************************************************************/ @@ -151,7 +151,7 @@ int nandmodel_find(FAR const struct nand_model_s *modeltab, size_t size, * page Stores the first accessed page number inside the first block. * offset Stores the byte offset inside the first accessed page. * - * Returned Values: + * Returned Value: * OK on success; -EPIPE on failure. * ****************************************************************************/ @@ -170,7 +170,7 @@ int nandmodel_translate(FAR const struct nand_model_s *model, off_t address, * Input Parameters: * model Pointer to a nand_model_s instance. * - * Returned Values: + * Returned Value: * Spare placement scheme * ****************************************************************************/ @@ -186,7 +186,7 @@ int nandmodel_translate(FAR const struct nand_model_s *model, off_t address, * Input Parameters: * model Pointer to a nand_model_s instance. * - * Returned Values: + * Returned Value: * Device ID * ****************************************************************************/ @@ -202,7 +202,7 @@ int nandmodel_translate(FAR const struct nand_model_s *model, off_t address, * Input Parameters: * model Pointer to a nand_model_s instance. * - * Returned Values: + * Returned Value: * Number of blocks in the device * ****************************************************************************/ @@ -220,7 +220,7 @@ int nandmodel_translate(FAR const struct nand_model_s *model, off_t address, * Input Parameters: * model Pointer to a nand_model_s instance. * - * Returned Values: + * Returned Value: * Size of the device in bytes * ****************************************************************************/ @@ -237,7 +237,7 @@ int nandmodel_translate(FAR const struct nand_model_s *model, off_t address, * Input Parameters: * model Pointer to a nand_model_s instance. * - * Returned Values: + * Returned Value: * size of the device in MB. * ****************************************************************************/ @@ -253,7 +253,7 @@ int nandmodel_translate(FAR const struct nand_model_s *model, off_t address, * Input Parameters: * model Pointer to a nand_model_s instance. * - * Returned Values: + * Returned Value: * Block size in pages * ****************************************************************************/ @@ -270,7 +270,7 @@ int nandmodel_translate(FAR const struct nand_model_s *model, off_t address, * Input Parameters: * model Pointer to a nand_model_s instance. * - * Returned Values: + * Returned Value: * Number of pages in the device * ****************************************************************************/ @@ -288,7 +288,7 @@ int nandmodel_translate(FAR const struct nand_model_s *model, off_t address, * Input Parameters: * model Pointer to a nand_model_s instance. * - * Returned Values: + * Returned Value: * Block size in bytes * ****************************************************************************/ @@ -304,7 +304,7 @@ int nandmodel_translate(FAR const struct nand_model_s *model, off_t address, * Input Parameters: * model Pointer to a nand_model_s instance. * - * Returned Values: + * Returned Value: * Size of data area in bytes * ****************************************************************************/ @@ -320,7 +320,7 @@ int nandmodel_translate(FAR const struct nand_model_s *model, off_t address, * Input Parameters: * model Pointer to a nand_model_s instance. * - * Returned Values: + * Returned Value: * size of spare area in bytes * ****************************************************************************/ @@ -336,7 +336,7 @@ unsigned int nandmodel_getsparesize(FAR const struct nand_model_s *model); * Input Parameters: * model Pointer to a nand_model_s instance. * - * Returned Values: + * Returned Value: * data width * ****************************************************************************/ @@ -354,7 +354,7 @@ unsigned int nandmodel_getsparesize(FAR const struct nand_model_s *model); * Input Parameters: * model Pointer to a nand_model_s instance. * - * Returned Values: + * Returned Value: * Returns true if the given NAND FLASH model uses the "small blocks/pages" * command set; otherwise returns false. * @@ -372,7 +372,7 @@ unsigned int nandmodel_getsparesize(FAR const struct nand_model_s *model); * Input Parameters: * model Pointer to a nand_model_s instance. * - * Returned Values: + * Returned Value: * Returns true if the device supports the copy-back operation. Otherwise * returns false. * diff --git a/include/nuttx/mtd/nand_raw.h b/include/nuttx/mtd/nand_raw.h index f2edd3821e..44cc069000 100644 --- a/include/nuttx/mtd/nand_raw.h +++ b/include/nuttx/mtd/nand_raw.h @@ -128,11 +128,11 @@ * Description: * Erases the specified block of the device. * - * Input parameters: + * Input Parameters: * raw - Lower-half, raw NAND FLASH interface * block - Number of the physical block to erase. * - * Returned value. + * Returned Value: * OK is returned in succes; a negated errno value is returned on failure. * ****************************************************************************/ @@ -146,14 +146,14 @@ * Reads the data and/or the spare areas of a page of a NAND FLASH into the * provided buffers. This is a raw read of the flash contents. * - * Input parameters: + * Input Parameters: * raw - Lower-half, raw NAND FLASH interface * block - Number of the block where the page to read resides. * page - Number of the page to read inside the given block. * data - Buffer where the data area will be stored. * spare - Buffer where the spare area will be stored. * - * Returned value. + * Returned Value: * OK is returned in succes; a negated errno value is returned on failure. * ****************************************************************************/ @@ -167,14 +167,14 @@ * Writes the data and/or the spare area of a page on a NAND FLASH chip. * This is a raw write of the flash contents. * - * Input parameters: + * Input Parameters: * raw - Lower-half, raw NAND FLASH interface * block - Number of the block where the page to write resides. * page - Number of the page to write inside the given block. * data - Buffer containing the data to be writting * spare - Buffer containing the spare data to be written. * - * Returned value. + * Returned Value: * OK is returned in succes; a negated errno value is returned on failure. * ****************************************************************************/ @@ -189,14 +189,14 @@ * provided buffers. Hardware ECC checking will be performed if so * configured. * - * Input parameters: + * Input Parameters: * raw - Lower-half, raw NAND FLASH interface * block - Number of the block where the page to read resides. * page - Number of the page to read inside the given block. * data - Buffer where the data area will be stored. * spare - Buffer where the spare area will be stored. * - * Returned value. + * Returned Value: * OK is returned in succes; a negated errno value is returned on failure. * ****************************************************************************/ @@ -214,14 +214,14 @@ * Writes the data and/or the spare area of a page on a NAND FLASH chip. * Hardware ECC checking will be performed if so configured. * - * Input parameters: + * Input Parameters: * raw - Lower-half, raw NAND FLASH interface * block - Number of the block where the page to write resides. * page - Number of the page to write inside the given block. * data - Buffer containing the data to be writting * spare - Buffer containing the spare data to be written. * - * Returned value. + * Returned Value: * OK is returned in succes; a negated errno value is returned on failure. * ****************************************************************************/ diff --git a/include/nuttx/mtd/nand_scheme.h b/include/nuttx/mtd/nand_scheme.h index acc4b56f11..a30caae165 100644 --- a/include/nuttx/mtd/nand_scheme.h +++ b/include/nuttx/mtd/nand_scheme.h @@ -109,7 +109,7 @@ EXTERN const struct nand_scheme_s g_nand_sparescheme4096; * spare Spare area buffer. * marker Pointer to the variable to store the bad block marker. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -130,7 +130,7 @@ void nandscheme_readbadblockmarker(FAR const struct nand_scheme_s *scheme, * spare Spare area buffer. * marker Bad block marker to write. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -150,7 +150,7 @@ void nandscheme_writebadblockmarker(FAR const struct nand_scheme_s *scheme, * Input Parameters: * scheme Pointer to a nand_scheme_s instance. * - * Returned Values: + * Returned Value: * Offset in the spare area to the first ECC byte * ****************************************************************************/ @@ -166,7 +166,7 @@ void nandscheme_writebadblockmarker(FAR const struct nand_scheme_s *scheme, * Input Parameters: * scheme Pointer to a nand_scheme_s instance. * - * Returned Values: + * Returned Value: * Size of the ECC information in the spare area. * ****************************************************************************/ @@ -184,7 +184,7 @@ void nandscheme_writebadblockmarker(FAR const struct nand_scheme_s *scheme, * spare Spare area buffer. * ecc ECC buffer. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -203,7 +203,7 @@ void nandscheme_readecc(FAR const struct nand_scheme_s *scheme, * spare Spare area buffer. * ecc ECC buffer. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -223,7 +223,7 @@ void nandscheme_writeecc(FAR const struct nand_scheme_s *scheme, * Input Parameters: * scheme Pointer to a nand_scheme_s instance. * - * Returned Values: + * Returned Value: * Offset in the spare area to the first extra byte * ****************************************************************************/ @@ -239,7 +239,7 @@ void nandscheme_writeecc(FAR const struct nand_scheme_s *scheme, * Input Parameters: * scheme Pointer to a nand_scheme_s instance. * - * Returned Values: + * Returned Value: * Size of the extra information in the spare area. * ****************************************************************************/ @@ -260,7 +260,7 @@ void nandscheme_writeecc(FAR const struct nand_scheme_s *scheme, * size Number of extra bytes to read. * offset Index where to read the first extra byte. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -283,7 +283,7 @@ void nandscheme_readextra(FAR const struct nand_scheme_s *scheme, * size Number of extra bytes to write. * offset Index where to write the first extra byte. * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -305,7 +305,7 @@ void nandscheme_writeextra(FAR const struct nand_scheme_s *scheme, * size Number of extra bytes to write. * offset Index where to write the first extra byte. * - * Returned Values: + * Returned Value: * OK on success; a negated errno value on failure. * ****************************************************************************/ diff --git a/include/nuttx/net/ieee802154.h b/include/nuttx/net/ieee802154.h index 20ff457593..5f938f3290 100644 --- a/include/nuttx/net/ieee802154.h +++ b/include/nuttx/net/ieee802154.h @@ -71,7 +71,7 @@ * If there are multilple frames in the list, this metadata * must apply to all of the frames in the list. * - * Return: + * Returned Value: * OK The IEEE 802.15.4 has been processed and can be deleted * ERROR Hold the IEEE 802.15.4 and try again later. There is a listening * socket but no recv in place to catch the IEEE 802.15.4 yet. diff --git a/include/nuttx/net/net.h b/include/nuttx/net/net.h index 9e1eec09db..c24b4245e1 100644 --- a/include/nuttx/net/net.h +++ b/include/nuttx/net/net.h @@ -306,7 +306,7 @@ void net_initialize(void); * Input Parameters: * None * - * Returned value: + * Returned Value: * None * ****************************************************************************/ @@ -322,7 +322,7 @@ void net_lock(void); * Input Parameters: * None * - * Returned value: + * Returned Value: * None * ****************************************************************************/ @@ -340,7 +340,7 @@ void net_unlock(void); * sem - A reference to the semaphore to be taken. * abstime - The absolute time to wait until a timeout is declared. * - * Returned value: + * Returned Value: * Zero (OK) is returned on success; a negated errno value is returned on * any failure. * @@ -358,7 +358,7 @@ int net_timedwait(sem_t *sem, FAR const struct timespec *abstime); * Input Parameters: * sem - A reference to the semaphore to be taken. * - * Returned value: + * Returned Value: * Zero (OK) is returned on success; a negated errno value is returned on * any failure. * @@ -1037,7 +1037,7 @@ int psock_setsockopt(FAR struct socket *psock, int level, int option, * cmd The ioctl command * arg The argument of the ioctl cmd * - * Return: + * Returned Value: * A non-negative value is returned on success; a negated errno value is * returned on any failure to indicate the nature of the failure: * @@ -1070,7 +1070,7 @@ int psock_ioctl(FAR struct socket *psock, int cmd, unsigned long arg); * cmd The ioctl command * arg The argument of the ioctl cmd * - * Return: + * Returned Value: * A non-negative value is returned on success; a negated errno value is * returned on any failure to indicate the nature of the failure: * diff --git a/include/nuttx/net/pkt.h b/include/nuttx/net/pkt.h index 03e4a0d22a..fc2d9bd5a2 100644 --- a/include/nuttx/net/pkt.h +++ b/include/nuttx/net/pkt.h @@ -73,7 +73,7 @@ * Parameters: * dev - The device driver structure containing the received packet * - * Return: + * Returned Value: * OK The packet has been processed and can be deleted * ERROR There is a matching connection, but could not dispatch the packet * yet. Useful when a packet arrives before a recv call is in diff --git a/include/nuttx/net/radiodev.h b/include/nuttx/net/radiodev.h index 91cebd35b6..b2e95e7272 100644 --- a/include/nuttx/net/radiodev.h +++ b/include/nuttx/net/radiodev.h @@ -189,7 +189,7 @@ struct radio_driver_s * Description: * Calculate the MAC header length given the frame meta-data. * - * Input parameters: + * Input Parameters: * netdev - The networkd device that will mediate the MAC interface * meta - Obfuscated metadata structure needed to recreate the * radio MAC header @@ -209,7 +209,7 @@ struct radio_driver_s * Description: * Requests the transfer of a list of frames to the MAC. * - * Input parameters: + * Input Parameters: * netdev - The network device that will mediate the MAC interface * meta - Obfuscated metadata structure needed to create the radio * MAC header @@ -233,7 +233,7 @@ struct radio_driver_s * run time. This information is provided to the 6LoWPAN network via the * following structure. * - * Input parameters: + * Input Parameters: * netdev - The network device to be queried * properties - Location where radio properities will be returned. * diff --git a/include/nuttx/net/telnet.h b/include/nuttx/net/telnet.h index c7184c6d6b..16668f1d24 100644 --- a/include/nuttx/net/telnet.h +++ b/include/nuttx/net/telnet.h @@ -85,7 +85,7 @@ struct telnet_session_s * Parameters: * None * - * Return: + * Returned Value: * Zero (OK) on success; a negated errno value on failure. * ****************************************************************************/ diff --git a/include/nuttx/nx/nx.h b/include/nuttx/nx/nx.h index aec345ac60..4287497017 100644 --- a/include/nuttx/nx/nx.h +++ b/include/nuttx/nx/nx.h @@ -260,7 +260,7 @@ extern "C" * mqname - The name for the server incoming message queue * dev - Vtable "object" of the framebuffer "driver" to use * - * Return: + * Returned Value: * This function usually does not return. If it does return, it will * return ERROR and errno will be set appropriately. * @@ -315,7 +315,7 @@ int nx_start(void); * Input Parameters: * svrmqname - The name for the server incoming message queue * - * Return: + * Returned Value: * Success: A non-NULL handle used with subsequent NX accesses * Failure: NULL is returned and errno is set appropriately * @@ -334,7 +334,7 @@ NXHANDLE nx_connectinstance(FAR const char *svrmqname); * Input Parameters: * handle - the handle returned by nx_connect * - * Return: + * Returned Value: * None * ****************************************************************************/ @@ -358,7 +358,7 @@ void nx_disconnect(NXHANDLE handle); * Input Parameters: * handle - the handle returned by nx_connect * - * Return: + * Returned Value: * OK: No errors occurred. If CONFIG_NX_BLOCKING is defined, then * one or more server messages were processed. * ERROR: An error occurred and errno has been set appropriately. Of @@ -385,7 +385,7 @@ int nx_eventhandler(NXHANDLE handle); * Input Parameters: * handle - the handle returned by nx_connect * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -407,7 +407,7 @@ int nx_eventnotify(NXHANDLE handle, int signo); * cb - Callbacks used to process window events * arg - User provided value that will be returned with NX callbacks. * - * Return: + * Returned Value: * Success: A non-NULL handle used with subsequent NX accesses * Failure: NULL is returned and errno is set appropriately * @@ -425,7 +425,7 @@ NXWINDOW nx_openwindow(NXHANDLE handle, FAR const struct nx_callback_s *cb, * Input Parameters: * wnd - The window to be destroyed * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -456,7 +456,7 @@ int nx_closewindow(NXWINDOW hwnd); * arg - An argument that will accompany the block messages (This is arg2 * in the blocked callback). * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -497,7 +497,7 @@ int nx_block(NXWINDOW hwnd, FAR void *arg); * cb - Callbacks to use for processing background window events * arg - User provided value that will be returned with NX callbacks. * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -515,7 +515,7 @@ int nx_requestbkgd(NXHANDLE handle, FAR const struct nx_callback_s *cb, * Input Parameters: * hwnd - The handle returned (indirectly) by nx_requestbkgd * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -533,7 +533,7 @@ int nx_releasebkgd(NXWINDOW hwnd); * Input Parameters: * hwnd - The window handle * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -550,7 +550,7 @@ int nx_getposition(NXWINDOW hwnd); * hwnd - The window handle * pos - The new position of the window * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -567,7 +567,7 @@ int nx_setposition(NXWINDOW hwnd, FAR const struct nxgl_point_s *pos); * hwnd - The window handle * size - The new size of the window. * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -580,10 +580,10 @@ int nx_setsize(NXWINDOW hwnd, FAR const struct nxgl_size_s *size); * Description: * Bring the specified window to the top of the display. * - * Input parameters: + * Input Parameters: * hwnd - the window to be raised * - * Returned value: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -596,10 +596,10 @@ int nx_raise(NXWINDOW hwnd); * Description: * Lower the specified window to the bottom of the display. * - * Input parameters: + * Input Parameters: * hwnd - the window to be lowered * - * Returned value: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -618,7 +618,7 @@ int nx_lower(NXWINDOW hwnd); * pos - The pixel location to be set * col - The color to use in the set * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -637,7 +637,7 @@ int nx_setpixel(NXWINDOW hwnd, FAR const struct nxgl_point_s *pos, * rect - The location to be filled * color - The color to use in the fill * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -666,7 +666,7 @@ int nx_fill(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, * rect - The location to be filled * color - The color to use in the fill * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -687,7 +687,7 @@ int nx_getrectangle(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, * trap - The trapezoidal region to be filled * color - The color to use in the fill * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -712,7 +712,7 @@ int nx_filltrapezoid(NXWINDOW hwnd, FAR const struct nxgl_rect_s *clip, * caps - Draw a circular on the both ends of the line to support better * line joins * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -734,7 +734,7 @@ int nx_drawline(NXWINDOW hwnd, FAR struct nxgl_vector_s *vector, * width - The width of the line * color - The color to use to fill the line * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -755,7 +755,7 @@ int nx_drawcircle(NXWINDOW hwnd, FAR const struct nxgl_point_s *center, * radius - The radius of the circle in pixels. * color - The color to use to fill the circle * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -774,7 +774,7 @@ int nx_fillcircle(NXWINDOW hwnd, FAR const struct nxgl_point_s *center, * handle - The connection handle * color - The color to use in the background * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -793,7 +793,7 @@ int nx_setbgcolor(NXHANDLE handle, nxgl_mxpixel_t color[CONFIG_NX_NPLANES]); * offset - The offset to move the region. The rectangular region will be * moved so that the origin is translated by this amount. * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -819,7 +819,7 @@ int nx_move(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, * may lie outside of the display. * stride - The width of the full source image in bytes. * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -936,7 +936,7 @@ void nx_redrawreq(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect); * cb - Callbacks used to process window events * arg - User provided value that will be returned with NX callbacks. * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately. In the * case of ERROR, NX will have deallocated the pre-allocated window. * diff --git a/include/nuttx/nx/nxfonts.h b/include/nuttx/nx/nxfonts.h index 525a5f56a2..47e53aa2cf 100644 --- a/include/nuttx/nx/nxfonts.h +++ b/include/nuttx/nx/nxfonts.h @@ -603,7 +603,7 @@ int nxf_convert_32bpp(FAR uint32_t *dest, uint16_t height, * bpp - Bits per pixel * maxglyphs - Maximum number of glyphs permitted in the cache * - * Returned value: + * Returned Value: * On success a non-NULL handle is returned that then may sequently be * used with nxf_getglyph() to extract fonts from the font cache. NULL * returned on any failure with the errno value set to indicate the nature @@ -626,7 +626,7 @@ FCACHE nxf_cache_connect(enum nx_fontid_e fontid, * Input Parameters: * fhandle - A font cache handler previously returned by nxf_cache_connect(); * - * Returned value: + * Returned Value: * None * ****************************************************************************/ @@ -643,7 +643,7 @@ void nxf_cache_disconnect(FCACHE fhandle); * Input Parameters: * fhandle - A font cache handle previously returned by nxf_cache_connect(); * - * Returned value: + * Returned Value: * Zero (OK) is returned if the metrics were * * Returned Value: diff --git a/include/nuttx/nx/nxglib.h b/include/nuttx/nx/nxglib.h index e0d3f6b846..89530cac25 100644 --- a/include/nuttx/nx/nxglib.h +++ b/include/nuttx/nx/nxglib.h @@ -679,12 +679,12 @@ bool nxgl_colorcmp(const nxgl_mxpixel_t color1[CONFIG_NX_NPLANES], * this case, 3 trapezoids will be returned, but traps[1] will be * degenerate. * - * Input parameters: + * Input Parameters: * vector - A pointer to the vector described the line to be drawn. * traps - A pointer to a array of trapezoids (size 3). * rect - A pointer to a rectangle. * - * Returned value: + * Returned Value: * 0: Line successfully broken up into three trapezoids. Values in * traps[0], traps[1], and traps[2] are valid. * 1: Line successfully represented by one trapezoid. Value in traps[1] @@ -708,13 +708,13 @@ int nxgl_splitline(FAR struct nxgl_vector_s *vector, * circumference of the circle. These points may then be used by * nx_drawcircle() or related APIs to draw a circle outline. * - * Input parameters: + * Input Parameters: * center - A pointer to the point that is the center of the circle * radius - The radius of the circle in pixels. * circle - A pointer the first entry in an array of 16 points where the * circle points will be returned. * - * Returned value: + * Returned Value: * None * ****************************************************************************/ @@ -730,13 +730,13 @@ void nxgl_circlepts(FAR const struct nxgl_point_s *center, * Given a description of a a circle, return 8 trapezoids that can be * used to fill the circle by nx_fillcircle() and other interfaces. * - * Input parameters: + * Input Parameters: * center - A pointer to the point that is the center of the circle * radius - The radius of the circle in pixels. * circle - A pointer the first entry in an array of 8 trapezoids where * the circle description will be returned. * - * Returned value: + * Returned Value: * None * ****************************************************************************/ diff --git a/include/nuttx/nx/nxmu.h b/include/nuttx/nx/nxmu.h index fe8253bd74..fb6cd68d34 100644 --- a/include/nuttx/nx/nxmu.h +++ b/include/nuttx/nx/nxmu.h @@ -495,7 +495,7 @@ extern "C" * cb - Callbacks used to process window events * arg - User provided value that will be returned with NX callbacks. * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately. In the * case of ERROR, NX will have deallocated the pre-allocated window. * @@ -515,7 +515,7 @@ int nxfe_constructwindow(NXHANDLE handle, * Input Parameters: * sem - the semaphore to be taken. * - * Return: + * Returned Value: * None * ****************************************************************************/ @@ -533,7 +533,7 @@ void nxmu_semtake(sem_t *sem); * msg - A pointer to the message to send * msglen - The length of the message in bytes. * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -553,7 +553,7 @@ int nxmu_sendserver(FAR struct nxfe_conn_s *conn, * msg - A pointer to the message to send * msglen - The length of the message in bytes. * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/include/nuttx/nx/nxterm.h b/include/nuttx/nx/nxterm.h index 48347c1fad..dc11a9d106 100644 --- a/include/nuttx/nx/nxterm.h +++ b/include/nuttx/nx/nxterm.h @@ -229,7 +229,7 @@ extern "C" * nxtool_register() returns. * minor - The device minor number * - * Return: + * Returned Value: * A non-NULL handle is returned on success. * ****************************************************************************/ @@ -252,7 +252,7 @@ NXTERM nx_register(NXWINDOW hwnd, FAR struct nxterm_window_s *wndo, * nxtool_register() returns. * minor - The device minor number * - * Return: + * Returned Value: * A non-NULL handle is returned on success. * ****************************************************************************/ @@ -277,7 +277,7 @@ NXTERM nxtk_register(NXTKWINDOW hfwnd, FAR struct nxterm_window_s *wndo, * nxtool_register() returns. * minor - The device minor number * - * Return: + * Returned Value: * A non-NULL handle is returned on success. * ****************************************************************************/ diff --git a/include/nuttx/nx/nxtk.h b/include/nuttx/nx/nxtk.h index 6cd00f01b8..75b31c2164 100644 --- a/include/nuttx/nx/nxtk.h +++ b/include/nuttx/nx/nxtk.h @@ -125,7 +125,7 @@ extern "C" * cb - Callbacks used to process window events * arg - User provided value that will be returned with NXTK callbacks. * - * Return: + * Returned Value: * Success: A non-NULL handle used with subsequent NXTK window accesses * Failure: NULL is returned and errno is set appropriately * @@ -143,7 +143,7 @@ NXTKWINDOW nxtk_openwindow(NXHANDLE handle, * Input Parameters: * hfwnd - The handle returned by nxtk_openwindow * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -176,7 +176,7 @@ int nxtk_closewindow(NXTKWINDOW hfwnd); * arg - An argument that will accompany the block messages (This is arg2 * in the blocked callback). * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -194,7 +194,7 @@ int nxtk_block(NXTKWINDOW hfwnd, FAR void *arg); * Input Parameters: * hfwnd - The window handle returned by nxtk_openwindow. * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -213,7 +213,7 @@ int nxtk_getposition(NXTKWINDOW hfwnd); * hfwnd - The window handle returned by nxtk_openwindow * pos - The new position of the client sub-window * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -232,7 +232,7 @@ int nxtk_setposition(NXTKWINDOW hfwnd, FAR const struct nxgl_point_s *pos); * hfwnd - The window handle returned by nxtk_openwindow * size - The new size of the client sub-window. * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -246,11 +246,11 @@ int nxtk_setsize(NXTKWINDOW hfwnd, FAR const struct nxgl_size_s *size); * Bring the window containing the specified client sub-window to the top * of the display. * - * Input parameters: + * Input Parameters: * hfwnd - the window to be raised. This must have been previously created * by nxtk_openwindow(). * - * Returned value: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -264,11 +264,11 @@ int nxtk_raise(NXTKWINDOW hfwnd); * Lower the window containing the specified client sub-window to the * bottom of the display. * - * Input parameters: + * Input Parameters: * hfwnd - the window to be lowered. This must have been previously created * by nxtk_openwindow(). * - * Returned value: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -286,7 +286,7 @@ int nxtk_lower(NXTKWINDOW hfwnd); * rect - The location within the client window to be filled * color - The color to use in the fill * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -310,7 +310,7 @@ int nxtk_fillwindow(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect, * dest - The location to copy the memory region * deststride - The width, in bytes, of the dest memory * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -330,7 +330,7 @@ int nxtk_getwindow(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect, * trap - The trapezoidal region to be filled * color - The color to use in the fill * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -355,7 +355,7 @@ int nxtk_filltrapwindow(NXTKWINDOW hfwnd, * caps - Draw a circular cap the ends of the line to support better * line joins * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -377,7 +377,7 @@ int nxtk_drawlinewindow(NXTKWINDOW hfwnd, FAR struct nxgl_vector_s *vector, * width - The width of the line * color - The color to use to fill the line * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -399,7 +399,7 @@ int nxtk_drawcirclewindow(NXTKWINDOW hfwnd, * radius - The radius of the circle in pixels. * color - The color to use to fill the circle * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -423,7 +423,7 @@ int nxtk_fillcirclewindow(NXWINDOW hfwnd, * offset - The offset to move the region. The rectangular region will be * moved so that the origin is translated by this amount. * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -449,7 +449,7 @@ int nxtk_movewindow(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect, * origin may lie outside of the sub-window display. * stride - The width of the full source image in pixels. * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -471,7 +471,7 @@ int nxtk_bitmapwindow(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *dest, * cb - Callbacks used to process toolbar events * arg - User provided value that will be returned with toolbar callbacks. * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -488,7 +488,7 @@ int nxtk_opentoolbar(NXTKWINDOW hfwnd, nxgl_coord_t height, * Input Parameters: * hfwnd - The handle returned by nxtk_openwindow * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -511,7 +511,7 @@ int nxtk_closetoolbar(NXTKWINDOW hfwnd); * hfwnd - The handle returned by nxtk_openwindow * bounds - User provided location in which to return the bounding box. * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -529,7 +529,7 @@ int nxtk_toolbarbounds(NXTKWINDOW hfwnd, FAR struct nxgl_rect_s *bounds); * rect - The location within the toolbar window to be filled * color - The color to use in the fill * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -553,7 +553,7 @@ int nxtk_filltoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect, * dest - The location to copy the memory region * deststride - The width, in bytes, of the dest memory * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -573,7 +573,7 @@ int nxtk_gettoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect, * trap - The trapezoidal region to be filled * color - The color to use in the fill * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -599,7 +599,7 @@ int nxtk_filltraptoolbar(NXTKWINDOW hfwnd, * caps - Draw a circular cap on the ends of the line to support better * line joins * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -621,7 +621,7 @@ int nxtk_drawlinetoolbar(NXTKWINDOW hfwnd, FAR struct nxgl_vector_s *vector, * width - The width of the line * color - The color to use to fill the line * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -643,7 +643,7 @@ int nxtk_drawcircletoolbar(NXTKWINDOW hfwnd, * radius - The radius of the circle in pixels. * color - The color to use to fill the circle * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -668,7 +668,7 @@ int nxtk_fillcircletoolbar(NXWINDOW hfwnd, * offset - The offset to move the region. The rectangular region will be * moved so that the origin is translated by this amount. * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -693,7 +693,7 @@ int nxtk_movetoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect, * origin may lie outside of the sub-window display. * stride - The width of the full source image in bytes. * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/include/nuttx/power/battery_charger.h b/include/nuttx/power/battery_charger.h index 997e0fa5c3..e17618b293 100644 --- a/include/nuttx/power/battery_charger.h +++ b/include/nuttx/power/battery_charger.h @@ -196,12 +196,12 @@ extern "C" * Register a lower half battery driver with the common, upper-half * battery driver. * - * Input parameters: + * Input Parameters: * devpath - The location in the pseudo-filesystem to create the driver. * Recommended standard is "/dev/bat0", "/dev/bat1", etc. * dev - An instance of the battery state structure . * - * Returned value: + * Returned Value: * Zero on success or a negated errno value on failure. * ****************************************************************************/ diff --git a/include/nuttx/power/battery_gauge.h b/include/nuttx/power/battery_gauge.h index 24a8eb5055..d6bd280cf7 100644 --- a/include/nuttx/power/battery_gauge.h +++ b/include/nuttx/power/battery_gauge.h @@ -158,12 +158,12 @@ extern "C" * Register a lower half battery driver with the common, upper-half * battery driver. * - * Input parameters: + * Input Parameters: * devpath - The location in the pseudo-filesystem to create the driver. * Recommended standard is "/dev/bat0", "/dev/bat1", etc. * dev - An instance of the battery state structure . * - * Returned value: + * Returned Value: * Zero on success or a negated errno value on failure. * ****************************************************************************/ diff --git a/include/nuttx/power/pm.h b/include/nuttx/power/pm.h index 482131911f..92df1c7749 100644 --- a/include/nuttx/power/pm.h +++ b/include/nuttx/power/pm.h @@ -364,10 +364,10 @@ extern "C" * *before* any other device drivers are initialized (since they may * attempt to register with the power management subsystem). * - * Input parameters: + * Input Parameters: * None. * - * Returned value: + * Returned Value: * None. * ****************************************************************************/ @@ -381,11 +381,11 @@ void pm_initialize(void); * This function is called by a device driver in order to register to * receive power management event callbacks. * - * Input parameters: + * Input Parameters: * callbacks - An instance of struct pm_callback_s providing the driver * callback functions. * - * Returned value: + * Returned Value: * Zero (OK) on success; otherwise a negater errno value is returned. * ****************************************************************************/ diff --git a/include/nuttx/sched.h b/include/nuttx/sched.h index 3810962c8b..8f80165d76 100644 --- a/include/nuttx/sched.h +++ b/include/nuttx/sched.h @@ -823,12 +823,12 @@ FAR struct socketlist *sched_getsockets(void); * The start hook is useful, for example, for setting up automatic * configuration of C++ constructors. * - * Inputs: + * Input Parameters: * tcb - The new, unstarted task task that needs the start hook * starthook - The pointer to the start hook function * arg - The argument to pass to the start hook function. * - * Return: + * Returned Value: * None * ********************************************************************************/ @@ -923,14 +923,14 @@ void sched_suspend_scheduler(FAR struct tcb_s *tcb); * use by application logic. Applications should use the standard * sched_getparam(). * - * Inputs: + * Input Parameters: * pid - the task ID of the task. If pid is zero, the priority * of the calling task is returned. * param - A structure whose member sched_priority is the integer * priority. The task's priority is copied to the sched_priority * element of this structure. * - * Return Value: + * Returned Value: * 0 (OK) if successful, otherwise a negated errno value is returned to * indicate the nature of the failure.. * @@ -958,14 +958,14 @@ int nxsched_getparam (pid_t pid, FAR struct sched_param *param); * use by application logic. Applications should use the standard * sched_setparam(). * - * Inputs: + * Input Parameters: * pid - the task ID of the task to reprioritize. If pid is zero, the * priority of the calling task is changed. * param - A structure whose member sched_priority is the integer priority. * The range of valid priority numbers is from SCHED_PRIORITY_MIN * through SCHED_PRIORITY_MAX. * - * Return Value: + * Returned Value: * 0 (OK) if successful, otherwise a negated errno value is returned to * indicate the nature of the failure.. * @@ -995,11 +995,11 @@ int nxsched_setparam(pid_t pid, FAR const struct sched_param *param); * use by application logic. Applications should use the standard * sched_getscheduler(). * - * Inputs: + * Input Parameters: * pid - the task ID of the task to query. If pid is zero, the * calling task is queried. * - * Return Value: + * Returned Value: * On success, sched_getscheduler() returns the policy for the task * (either SCHED_FIFO or SCHED_RR). On error, a negated errno value * returned: @@ -1100,12 +1100,12 @@ int nxsched_getaffinity(pid_t pid, size_t cpusetsize, FAR cpu_set_t *mask); * is not intended for use by application logic. Applications should * use the standard sched_setparam(). * - * Inputs: + * Input Parameters: * pid - The ID of thread whose affinity set will be modified. * cpusetsize - Size of mask. MUST be sizeofcpu_set_t(). * mask - The location to return the thread's new affinity set. * - * Return Value: + * Returned Value: * Zero (OK) if successful. Otherwise, a negated errno value is returned: * * ESRCH The task whose ID is pid could not be found. diff --git a/include/nuttx/semaphore.h b/include/nuttx/semaphore.h index 6e525f6e1c..850e3c7718 100644 --- a/include/nuttx/semaphore.h +++ b/include/nuttx/semaphore.h @@ -159,7 +159,7 @@ extern "C" * pshared - Process sharing (not used) * value - Semaphore initialization value * - * Return Value: + * Returned Value: * This is an internal OS interface and should not be used by applications. * It follows the NuttX internal error return policy: Zero (OK) is * returned on success. A negated errno value is returned on failure. @@ -185,7 +185,7 @@ int nxsem_init(FAR sem_t *sem, int pshared, unsigned int value); * Parameters: * sem - Semaphore to be destroyed. * - * Return Value: + * Returned Value: * This is an internal OS interface and should not be used by applications. * It follows the NuttX internal error return policy: Zero (OK) is * returned on success. A negated errno value is returned on failure. @@ -211,7 +211,7 @@ int nxsem_destroy (FAR sem_t *sem); * Parameters: * sem - Semaphore descriptor. * - * Return Value: + * Returned Value: * This is an internal OS interface and should not be used by applications. * It follows the NuttX internal error return policy: Zero (OK) is * returned on success. A negated errno value is returned on failure. @@ -235,7 +235,7 @@ int nxsem_wait(FAR sem_t *sem); * Parameters: * sem - the semaphore descriptor * - * Return Value: + * Returned Value: * This is an internal OS interface and should not be used by applications. * It follows the NuttX internal error return policy: Zero (OK) is * returned on success. A negated errno value is returned on failure. @@ -276,7 +276,7 @@ int nxsem_trywait(FAR sem_t *sem); * sem - Semaphore object * abstime - The absolute time to wait until a timeout is declared. * - * Return Value: + * Returned Value: * This is an internal OS interface and should not be used by applications. * It follows the NuttX internal error return policy: Zero (OK) is * returned on success. A negated errno value is returned on failure. @@ -313,7 +313,7 @@ int nxsem_timedwait(FAR sem_t *sem, FAR const struct timespec *abstime); * posted. If ticks is zero, then this function is equivalent * to sem_trywait(). * - * Return Value: + * Returned Value: * This is an internal OS interface, not available to applications, and * hence follows the NuttX internal error return policy: Zero (OK) is * returned on success. A negated errno value is returned on failure. @@ -342,7 +342,7 @@ int nxsem_tickwait(FAR sem_t *sem, systime_t start, uint32_t delay); * Parameters: * sem - Semaphore descriptor * - * Return Value: + * Returned Value: * This is an internal OS interface and should not be used by applications. * It follows the NuttX internal error return policy: Zero (OK) is * returned on success. A negated errno value is returned on failure. @@ -373,7 +373,7 @@ int nxsem_post(FAR sem_t *sem); * sem - Semaphore descriptor * sval - Buffer by which the value is returned * - * Return Value: + * Returned Value: * This is an internal OS interface and should not be used by applications. * It follows the NuttX internal error return policy: Zero (OK) is * returned on success. A negated errno value is returned on failure. @@ -395,7 +395,7 @@ int nxsem_getvalue(FAR sem_t *sem, FAR int *sval); * sem - Semaphore descriptor to be reset * count - The requested semaphore count * - * Return Value: + * Returned Value: * This is an internal OS interface, not available to applications, and * hence follows the NuttX internal error return policy: Zero (OK) is * returned on success. A negated errno value is returned on failure. @@ -416,7 +416,7 @@ int nxsem_reset(FAR sem_t *sem, int16_t count); * protocol - The user provided location in which to store the protocol * value. * - * Return Value: + * Returned Value: * This is an internal OS interface and should not be used by applications. * It follows the NuttX internal error return policy: Zero (OK) is * returned on success. A negated errno value is returned on failure. @@ -437,7 +437,7 @@ int nxsem_reset(FAR sem_t *sem, int16_t count); * protocol - The user provided location in which to store the protocol * value. * - * Return Value: + * Returned Value: * This function is exposed as a non-standard application interface. It * returns zero (OK) if successful. Otherwise, -1 (ERROR) is returned and * the errno value is set appropriately. @@ -476,7 +476,7 @@ int sem_getprotocol(FAR sem_t *sem, FAR int *protocol); * modified * protocol - The new protocol to use * - * Return Value: + * Returned Value: * This is an internal OS interface and should not be used by applications. * It follows the NuttX internal error return policy: Zero (OK) is * returned on success. A negated errno value is returned on failure. @@ -515,7 +515,7 @@ int nxsem_setprotocol(FAR sem_t *sem, int protocol); * modified * protocol - The new protocol to use * - * Return Value: + * Returned Value: * This function is exposed as a non-standard application interface. It * returns zero (OK) if successful. Otherwise, -1 (ERROR) is returned and * the errno value is set appropriately. diff --git a/include/nuttx/signal.h b/include/nuttx/signal.h index 0c9e410712..51a5dbe0e5 100644 --- a/include/nuttx/signal.h +++ b/include/nuttx/signal.h @@ -127,7 +127,7 @@ struct timespec; /* Forward reference */ * set - Location of the new signal mask * oset - Location to store the old signal mask * - * Return Value: + * Returned Value: * This is an internal OS interface and should not be used by applications. * It follows the NuttX internal error return policy: Zero (OK) is * returned on success. A negated errno value is returned on failure. @@ -160,7 +160,7 @@ int nxsig_procmask(int how, FAR const sigset_t *set, FAR sigset_t *oset); * signo - Signal number * value - Value to pass to task with signal * - * Return Value: + * Returned Value: * This is an internal OS interface and should not be used by applications. * It follows the NuttX internal error return policy: Zero (OK) is * returned on success. A negated errno value is returned on failure. @@ -232,7 +232,7 @@ int nxsig_kill(pid_t pid, int signo); * set - The pending signal set * info - The returned value * - * Return Value: + * Returned Value: * This is an internal OS interface and should not be used by applications. * It follows the NuttX internal error return policy: Zero (OK) is * returned on success. A negated errno value is returned on failure. @@ -270,7 +270,7 @@ int nxsig_kill(pid_t pid, int signo); * info - The returned value (may be NULL). * timeout - The amount of time to wait (may be NULL) * - * Return Value: + * Returned Value: * This is an internal OS interface and should not be used by applications. * It follows the NuttX internal error return policy: Zero (OK) is * returned on success. A negated errno value is returned on failure. diff --git a/include/nuttx/streams.h b/include/nuttx/streams.h index ccb7054f7f..d615c85609 100644 --- a/include/nuttx/streams.h +++ b/include/nuttx/streams.h @@ -230,7 +230,7 @@ extern "C" * Seekable versions are defined in lib/stdio/lib_memsistream.c and * lib/stdio/lib_memsostream.c. * - * Input parameters: + * Input Parameters: * memstream - User allocated, uninitialized instance of struct * lib_meminstream_s to be initialized. * memstream - User allocated, uninitialized instance of struct @@ -259,7 +259,7 @@ void lib_memsostream(FAR struct lib_memsostream_s *outstream, * Initializes a stream for use with a FILE instance. * Defined in lib/stdio/lib_stdinstream.c and lib/stdio/lib_stdoutstream.c * - * Input parameters: + * Input Parameters: * instream - User allocated, uninitialized instance of struct * lib_stdinstream_s to be initialized. * outstream - User allocated, uninitialized instance of struct @@ -291,7 +291,7 @@ void lib_stdsostream(FAR struct lib_stdsostream_s *outstream, * Seekable versions are defined in lib/stdio/lib_rawsistream.c and * lib/stdio/lib_rawsostream.c * - * Input parameters: + * Input Parameters: * instream - User allocated, uninitialized instance of struct * lib_rawinstream_s to be initialized. * outstream - User allocated, uninitialized instance of struct @@ -316,7 +316,7 @@ void lib_rawsostream(FAR struct lib_rawsostream_s *outstream, int fd); * Initializes a stream for use with low-level, architecture-specific output. * Defined in ib/stdio/lib_lowoutstream.c * - * Input parameters: + * Input Parameters: * lowoutstream - User allocated, uninitialized instance of struct * lib_lowoutstream_s to be initialized. * @@ -342,7 +342,7 @@ void lib_lowoutstream(FAR struct lib_outstream_s *lowoutstream); * o The stream created by lib_nulloutstream will write all data to the * bit-bucket. Defined in lib/stdio/lib_nulloutstream.c * - * Input parameters: + * Input Parameters: * zeroinstream - User allocated, uninitialized instance of struct * lib_instream_s to be initialized. * nullinstream - User allocated, uninitialized instance of struct @@ -366,7 +366,7 @@ void lib_nulloutstream(FAR struct lib_outstream_s *nulloutstream); * Initializes a stream for use with the configured syslog interface. * Only accessible from with the OS SYSLOG logic. * - * Input parameters: + * Input Parameters: * stream - User allocated, uninitialized instance of struct * lib_lowoutstream_s to be initialized. * @@ -383,7 +383,7 @@ void syslogstream_create(FAR struct lib_syslogstream_s *stream); * Description: * Free resources held by the syslog stream. * - * Input parameters: + * Input Parameters: * stream - User allocated, uninitialized instance of struct * lib_lowoutstream_s to be initialized. * @@ -405,7 +405,7 @@ void syslogstream_destroy(FAR struct lib_syslogstream_s *stream); * Initializes a stream for use with the configured emergency syslog * interface. Only accessible from with the OS SYSLOG logic. * - * Input parameters: + * Input Parameters: * stream - User allocated, uninitialized instance of struct * lib_lowoutstream_s to be initialized. * @@ -423,7 +423,7 @@ void emergstream(FAR struct lib_outstream_s *stream); * lib_noflush() provides a common, dummy flush method for output streams * that are not flushable. * - * Return: + * Returned Value: * Always returns OK * ****************************************************************************/ @@ -438,7 +438,7 @@ int lib_noflush(FAR struct lib_outstream_s *stream); * streams that are not flushable. * is selected. * - * Return: + * Returned Value: * Always returns OK * ****************************************************************************/ diff --git a/include/nuttx/syslog/syslog.h b/include/nuttx/syslog/syslog.h index bce437d7a7..1ea41be2ef 100644 --- a/include/nuttx/syslog/syslog.h +++ b/include/nuttx/syslog/syslog.h @@ -149,7 +149,7 @@ extern "C" * Configure the SYSLOGging function to use the provided channel to * generate SYSLOG output. * - * Input buffer: + * Input Parameters: * channel - Provides the interface to the channel to be used. * * Returned Value: diff --git a/include/nuttx/time.h b/include/nuttx/time.h index 2a6c596978..ee4705ba30 100644 --- a/include/nuttx/time.h +++ b/include/nuttx/time.h @@ -111,7 +111,7 @@ int clock_daysbeforemonth(int month, bool leapyear); * month - The month of the year 1 - 12 * year - the year including the 1900 * - * Returned value: + * Returned Value: * Zero based day of the week 0-6, 0 = Sunday, 1 = Monday... 6 = Saturday * ****************************************************************************/ diff --git a/include/nuttx/timers/timer.h b/include/nuttx/timers/timer.h index ab78f5ea97..db59e81819 100644 --- a/include/nuttx/timers/timer.h +++ b/include/nuttx/timers/timer.h @@ -225,7 +225,7 @@ extern "C" * Rather it is called indirectly through the architecture-specific * initialization. * - * Input parameters: + * Input Parameters: * dev path - The full path to the driver to be registers in the NuttX * pseudo-filesystem. The recommended convention is to name all timer * drivers as "/dev/timer0", "/dev/timer1", etc. where the driver @@ -250,7 +250,7 @@ FAR void *timer_register(FAR const char *path, * This function can be called to disable and unregister the timer * device driver. * - * Input parameters: + * Input Parameters: * handle - This is the handle that was returned by timer_register() * * Returned Value: @@ -272,7 +272,7 @@ void timer_unregister(FAR void *handle); * to handle timer expirations. This is a strictly OS internal interface * and may NOT be used by appliction code. * - * Input parameters: + * Input Parameters: * handle - This is the handle that was returned by timer_register() * callback - The new timer interrupt callback * arg - Argument provided when the callback is called. diff --git a/include/nuttx/timers/watchdog.h b/include/nuttx/timers/watchdog.h index 9c7d9001fa..4759556e81 100644 --- a/include/nuttx/timers/watchdog.h +++ b/include/nuttx/timers/watchdog.h @@ -217,7 +217,7 @@ extern "C" * NOTE: This function would not be called by application code. Rather it is * called indirectly through the architecture-specific interfaces. * - * Input parameters: + * Input Parameters: * dev path - The full path to the driver to be registers in the NuttX * pseudo-filesystem. The recommended convention is to name all watchdog * drivers as "/dev/watchdog0", "/dev/watchdog1", etc. where the driver @@ -242,7 +242,7 @@ FAR void *watchdog_register(FAR const char *path, * This function can be called to disable and unregister the watchdog * device driver. * - * Input parameters: + * Input Parameters: * handle - This is the handle that was returned by watchdog_register() * * Returned Value: diff --git a/include/nuttx/usb/cdcacm.h b/include/nuttx/usb/cdcacm.h index d490adc098..24109a98a0 100644 --- a/include/nuttx/usb/cdcacm.h +++ b/include/nuttx/usb/cdcacm.h @@ -336,7 +336,7 @@ typedef FAR void (*cdcacm_callback_t)(enum cdcacm_event_e event); * Register USB serial port (and USB serial console if so configured) and * return the class object. * - * Input Parameter: + * Input Parameters: * minor - Device minor number. E.g., minor 0 would correspond to * /dev/ttyACM0. * classdev - The location to return the CDC serial class' device @@ -360,7 +360,7 @@ int cdcacm_classobject(int minor, FAR struct usbdev_devinfo_s *devinfo, * Description: * Register USB serial port (and USB serial console if so configured). * - * Input Parameter: + * Input Parameters: * minor - Device minor number. E.g., minor 0 would correspond to * /dev/ttyACM0. * handle - An optional opaque reference to the CDC/ACM class object that diff --git a/include/nuttx/usb/composite.h b/include/nuttx/usb/composite.h index 7d5f90c01d..38d0122fa4 100644 --- a/include/nuttx/usb/composite.h +++ b/include/nuttx/usb/composite.h @@ -88,7 +88,7 @@ extern "C" * board-specific implementations in order to obtain the class objects for * each of the members of the composite. * - * Input Parameter: + * Input Parameters: * None * * Returned Value: diff --git a/include/nuttx/usb/hid_parser.h b/include/nuttx/usb/hid_parser.h index 809a8fb0ca..08fd4b053c 100644 --- a/include/nuttx/usb/hid_parser.h +++ b/include/nuttx/usb/hid_parser.h @@ -227,7 +227,7 @@ struct hid_rptinfo_s * Input Parameters: * item Pointer to the current report item for user checking. * - * Returned value: + * Returned Value: * Boolean true if the item should be stored into the struct hid_rptinfo_s * structure, false if it should be ignored. */ @@ -283,7 +283,7 @@ int hid_parsereport(FAR const uint8_t *report, int rptlen, * report. If the given item does not exist in the report, the function * does not modify the report item's data. * - * Input Parameters + * Input Parameters: * report Buffer containing an IN or FEATURE report from an attached * device. * item Pointer to the report item of interest in a struct hid_rptinfo_s @@ -330,7 +330,7 @@ void hid_putitem(FAR uint8_t *report, FAR struct hid_rptitem_s *item); * Description: * Retrieves the size of a given HID report in bytes from it's Report ID. * - * InputParameters: + * Input Parameters: * rptinfo Pointer to a struct hid_rptinfo_s instance containing the parser * output. * id Report ID of the report whose size is to be retrieved. diff --git a/include/nuttx/usb/usbhost.h b/include/nuttx/usb/usbhost.h index 7f95b1d5b3..9dc98450da 100644 --- a/include/nuttx/usb/usbhost.h +++ b/include/nuttx/usb/usbhost.h @@ -91,7 +91,7 @@ * id - In the case where the device supports multiple base classes, subclasses, or * protocols, this specifies which to configure for. * - * Returned Values: + * Returned Value: * On success, this function will return a non-NULL instance of struct * usbhost_class_s that can be used by the USB host driver to communicate with the * USB host class. NULL is returned on failure; this function will fail only if @@ -121,7 +121,7 @@ * configdesc - A pointer to a uint8_t buffer container the configuration descriptor. * desclen - The length in bytes of the configuration descriptor. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -152,7 +152,7 @@ * Input Parameters: * devclass - The USB host class entry previously obtained from a call to create(). * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -175,7 +175,7 @@ * hport - The location to return the hub port descriptor that detected the * connection related event. * - * Returned Values: + * Returned Value: * Zero (OK) is returned on success when a device in connected or * disconnected. This function will not return until either (1) a device is * connected or disconnect to/from any hub port or until (2) some failure @@ -209,7 +209,7 @@ * hport - The descriptor of the hub port that has the newly connected * device. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -238,7 +238,7 @@ * mps (maxpacketsize) - The maximum number of bytes that can be sent to or * received from the endpoint in a single data packet * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -262,7 +262,7 @@ * devinfo - A pointer to memory provided by the caller in which to return the * device information. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -286,7 +286,7 @@ * ep - A memory location provided by the caller in which to receive the * allocated endpoint descriptor. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -308,7 +308,7 @@ * the class create() method. * ep - The endpoint to be freed. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -341,7 +341,7 @@ * maxlen - The address of a memory location provided by the caller in which to * return the maximum size of the allocated buffer memory. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -366,7 +366,7 @@ * the class create() method. * buffer - The address of the allocated buffer memory to be freed. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -395,7 +395,7 @@ * return the allocated buffer memory address. * buflen - The size of the buffer required. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -420,7 +420,7 @@ * the class create() method. * buffer - The address of the allocated buffer memory to be freed. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -456,7 +456,7 @@ * NOTE: On an IN transaction, req and buffer may refer to the same allocated * memory. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * @@ -489,7 +489,7 @@ * (IN endpoint). buffer must have been allocated using DRVR_ALLOC * buflen - The length of the data to be sent or received. * - * Returned Values: + * Returned Value: * On success, a non-negative value is returned that indicates the number * of bytes successfully transferred. On a failure, a negated errno value is * returned that indicates the nature of the failure: @@ -534,7 +534,7 @@ * arg - The arbitrary parameter that will be passed to the callback function * when the transfer completes. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure. * @@ -561,7 +561,7 @@ * ep - The IN or OUT endpoint descriptor for the device endpoint on which an * asynchronous transfer should be transferred. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure. * @@ -584,7 +584,7 @@ * related event * connected - True: device connected; false: device disconnected * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure. * @@ -611,7 +611,7 @@ * hport - The port from which the device is being disconnected. Might be a port * on a hub. * - * Returned Values: + * Returned Value: * None * * Assumptions: @@ -949,7 +949,7 @@ extern "C" * devclass - An write-able instance of struct usbhost_registry_s that will be * maintained in a registry. * - * Returned Values: + * Returned Value: * On success, this function will return zero (OK). Otherwise, a negated errno * value is returned. * @@ -969,7 +969,7 @@ int usbhost_registerclass(struct usbhost_registry_s *devclass); * Input Parameters: * id - Identifies the USB device class that has connect to the USB host. * - * Returned Values: + * Returned Value: * On success this function will return a non-NULL instance of struct * usbhost_registry_s. NULL will be returned on failure. This function can only * fail if (1) id is NULL, or (2) no USB host class is registered that matches the @@ -991,7 +991,7 @@ const struct usbhost_registry_s *usbhost_findclass(const struct usbhost_id_s *id * Input Parameters: * None * - * Returned Values: + * Returned Value: * On success this function will return zero (OK); A negated errno value * will be returned on failure. * @@ -1012,7 +1012,7 @@ int usbhost_hub_initialize(void); * Input Parameters: * None * - * Returned Values: + * Returned Value: * On success this function will return zero (OK); A negated errno value * will be returned on failure. * @@ -1054,7 +1054,7 @@ int usbhost_cdcacm_initialize(void); * Input Parameters: * None * - * Returned Values: + * Returned Value: * On success this function will return zero (OK); A negated errno value * will be returned on failure. * @@ -1075,7 +1075,7 @@ int usbhost_kbdinit(void); * Input Parameters: * None * - * Returned Values: + * Returned Value: * On success this function will return zero (OK); A negated errno value * will be returned on failure. * @@ -1096,7 +1096,7 @@ int usbhost_mouse_init(void); * Input Parameters: * None * - * Returned Values: + * Returned Value: * On success this function will return zero (OK); A negated errno value * will be returned on failure. * @@ -1116,7 +1116,7 @@ int usbhost_xboxcontroller_init(void); * Input Parameters: * None * - * Returned Values: + * Returned Value: * On success this function will return zero (OK); A negated errno value * will be returned on failure. * @@ -1147,7 +1147,7 @@ int usbhost_wlaninit(void); * and bound to the hub, the allocated class instance is returned into * this caller-provided memory location. * - * Returned Values: + * Returned Value: * On success, zero (OK) is returned. On a failure, a negated errno value is * returned indicating the nature of the failure * diff --git a/include/nuttx/usb/usbmonitor.h b/include/nuttx/usb/usbmonitor.h index d5be243e05..fe360c0cc2 100644 --- a/include/nuttx/usb/usbmonitor.h +++ b/include/nuttx/usb/usbmonitor.h @@ -72,7 +72,7 @@ extern "C" * Input Parameters: * None * - * Returned values: + * Returned Value: * Zero (OK) is returned on success; a negated errno value is return on * any failure. * diff --git a/include/nuttx/userspace.h b/include/nuttx/userspace.h index 6e1afc2aa1..b7bb1cf65c 100644 --- a/include/nuttx/userspace.h +++ b/include/nuttx/userspace.h @@ -157,11 +157,11 @@ extern "C" * This function is the user-space, task startup function. It is called * from up_task_start() in user-mode. * - * Inputs: + * Input Parameters: * entrypt - The user-space address of the task entry point * argc and argv - Standard arguments for the task entry point * - * Return: + * Returned Value: * None. This function does not return. * ****************************************************************************/ @@ -177,11 +177,11 @@ void task_startup(main_t entrypt, int argc, FAR char *argv[]) noreturn_function; * This function is the user-space, pthread startup function. It is called * from up_pthread_start() in user-mode. * - * Inputs: + * Input Parameters: * entrypt - The user-space address of the pthread entry point * arg - Standard argument for the pthread entry point * - * Return: + * Returned Value: * None. This function does not return. * ****************************************************************************/ diff --git a/include/nuttx/video/fb.h b/include/nuttx/video/fb.h index 4d6c7f1d49..83857ebc83 100644 --- a/include/nuttx/video/fb.h +++ b/include/nuttx/video/fb.h @@ -410,7 +410,7 @@ extern "C" * Description: * Initialize the framebuffer video hardware associated with the display. * - * Input parameters: + * Input Parameters: * display - In the case of hardware with multiple displays, this * specifies the display. Normally this is zero. * @@ -429,7 +429,7 @@ int up_fbinitialize(int display); * Return a a reference to the framebuffer object for the specified video * plane of the specified plane. Many OSDs support multiple planes of video. * - * Input parameters: + * Input Parameters: * display - In the case of hardware with multiple displays, this * specifies the display. Normally this is zero. * vplane - Identifies the plane being queried. diff --git a/include/nuttx/wdog.h b/include/nuttx/wdog.h index 720d2b961c..a57d50e6ae 100644 --- a/include/nuttx/wdog.h +++ b/include/nuttx/wdog.h @@ -176,7 +176,7 @@ extern "C" * Parameters: * None * - * Return Value: + * Returned Value: * Pointer to watchdog (i.e., the watchdog ID), or NULL if insufficient * watchdogs are available. * @@ -196,7 +196,7 @@ WDOG_ID wd_create(void); * wdog - The watchdog ID to delete. This is actually a pointer to a * watchdog structure. * - * Return Value: + * Returned Value: * Zero (OK) is returned on success; a negated errno value is return to * indicate the nature of any failure. * @@ -231,7 +231,7 @@ int wd_delete(WDOG_ID wdog); * wdentry - function to call on timeout * parm1..4 - parameters to pass to wdentry * - * Return Value: + * Returned Value: * Zero (OK) is returned on success; a negated errno value is return to * indicate the nature of any failure. * @@ -253,7 +253,7 @@ int wd_start(WDOG_ID wdog, int32_t delay, wdentry_t wdentry, int argc, ...); * Parameters: * wdog - ID of the watchdog to cancel. * - * Return Value: + * Returned Value: * Zero (OK) is returned on success; A negated errno value is returned to * indicate the nature of any failure. * @@ -271,7 +271,7 @@ int wd_cancel(WDOG_ID wdog); * Parameters: * wdog - watchdog ID * - * Return Value: + * Returned Value: * The time in system ticks remaining until the watchdog time expires. * Zero means either that wdog is not valid or that the wdog has already * expired. diff --git a/include/nuttx/wireless/cc3000/evnt_handler.h b/include/nuttx/wireless/cc3000/evnt_handler.h index fe5f4ecdad..a720a04de9 100644 --- a/include/nuttx/wireless/cc3000/evnt_handler.h +++ b/include/nuttx/wireless/cc3000/evnt_handler.h @@ -131,7 +131,7 @@ extern unsigned long socket_active_status; * from from information (in case of data received) * fromlen from information length (in case of data received) * - * Returned Values: + * Returned Value: * None * ****************************************************************************/ @@ -147,7 +147,7 @@ uint8_t *hci_event_handler(void *pRetParams, uint8_t *from, uint8_t *fromlen); * Input Parameters: * event_hdr event header * - * Returned Values: + * Returned Value: * 1 if event supported and handled; 0 if event is not supported * ****************************************************************************/ @@ -164,7 +164,7 @@ long hci_unsol_event_handler(char *event_hdr); * Input Parameters: * None * - * Returned Values: + * Returned Value: * ESUCCESS if successful, EFAIL if an error occurred * ****************************************************************************/ diff --git a/include/nuttx/wireless/cc3000/wlan.h b/include/nuttx/wireless/cc3000/wlan.h index b0a07c67d8..70f2601ab3 100644 --- a/include/nuttx/wireless/cc3000/wlan.h +++ b/include/nuttx/wireless/cc3000/wlan.h @@ -499,7 +499,7 @@ long wlan_smart_config_set_prefix(char* cNewPrefix); * Input Parameters: * key AES128 key of size 16 bytes * - * Returned Value + * Returned Value: * On success 0, error otherwise. * ****************************************************************************/ @@ -516,7 +516,7 @@ signed long aes_read_key(FAR uint8_t *key); * Input Parameters: * key AES128 key of size 16 bytes * - * Returned Value + * Returned Value: * On success 0, error otherwise. * ****************************************************************************/ diff --git a/include/nuttx/wireless/ieee802154/ieee802154_mac.h b/include/nuttx/wireless/ieee802154/ieee802154_mac.h index 1064763848..398134b696 100644 --- a/include/nuttx/wireless/ieee802154/ieee802154_mac.h +++ b/include/nuttx/wireless/ieee802154/ieee802154_mac.h @@ -1783,7 +1783,7 @@ MACHANDLE mac802154_create(FAR struct ieee802154_radio_s *radiodev); * minor - The device minor number. The IEEE802.15.4 MAC character device * will be registered as /dev/ieeeN where N is the minor number * - * Returned Values: + * Returned Value: * Zero (OK) is returned on success. Otherwise a negated errno value is * returned to indicate the nature of the failure. * @@ -1801,7 +1801,7 @@ int mac802154dev_register(MACHANDLE mac, int minor); * Input Parameters: * mac - Pointer to the mac layer struct to be registered. * - * Returned Values: + * Returned Value: * Zero (OK) is returned on success. Otherwise a negated errno value is * returned to indicate the nature of the failure. * @@ -1819,10 +1819,10 @@ int mac802154netdev_register(MACHANDLE mac); * be called early in the initialization sequence before any radios * begin operation. * - * Inputs: + * Input Parameters: * None * - * Return Value: + * Returned Value: * None * ****************************************************************************/ @@ -1845,10 +1845,10 @@ void ieee802154_primitivepool_initialize(void); * list. If that the list is empty, then the primitive structure will be * allocated from the dynamic memory pool. * - * Inputs: + * Input Parameters: * None * - * Return Value: + * Returned Value: * A reference to the allocated primitive structure. All user fields in this * structure have been zeroed. On a failure to allocate, NULL is * returned. @@ -1865,10 +1865,10 @@ FAR struct ieee802154_primitive_s *ieee802154_primitive_allocate(void); * the free pool if it was a pre-allocated primitive structure. If the primitive * was allocated dynamically it will be deallocated. * - * Inputs: + * Input Parameters: * prim - primitive structure to free * - * Return Value: + * Returned Value: * None * ****************************************************************************/ diff --git a/include/nuttx/wireless/nrf24l01.h b/include/nuttx/wireless/nrf24l01.h index 123eb93503..7cff670dc1 100644 --- a/include/nuttx/wireless/nrf24l01.h +++ b/include/nuttx/wireless/nrf24l01.h @@ -196,7 +196,7 @@ struct nrf24l01_config_s /************************************************************************************ * Register the nRF24L01+ device. * - * Input Parmeters: + * Input Parameters: * spi - SPI Device structure * cfg Board specific configuration info * @@ -214,7 +214,7 @@ int nrf24l01_register(FAR struct spi_dev_s *spi, FAR struct nrf24l01_config_s *c /************************************************************************************ * Initialize the nRF24L01+ chip to a default initial state. * - * Input Parmeters: + * Input Parameters: * dev Pointer to a registered nRF24L01 device structure * ************************************************************************************/ @@ -224,7 +224,7 @@ int nrf24l01_init(FAR struct nrf24l01_dev_s *dev); /************************************************************************************ * Set the default TX address. * - * Input Parmeters: + * Input Parameters: * dev Pointer to an nRF24L01 device structure * addr TX address (LSByte first) * @@ -238,7 +238,7 @@ int nrf24l01_settxaddr(FAR struct nrf24l01_dev_s *dev, FAR const uint8_t *addr); /************************************************************************************ * Get the default TX address. * - * Input Parmeters: + * Input Parameters: * dev Pointer to an nRF24L01 device structure * addr TX address (LSByte first) * @@ -252,7 +252,7 @@ int nrf24l01_gettxaddr(FAR struct nrf24l01_dev_s *dev, FAR uint8_t *addr); /************************************************************************************ * Configure auto-retransmit * - * Input Parmeters: + * Input Parameters: * dev Pointer to an nRF24L01 device structure * retrdelay Auto-retransmit delay * retrcount Auto-retransmit count (0 - 15) @@ -268,7 +268,7 @@ int nrf24l01_setretransmit(FAR struct nrf24l01_dev_s *dev, /************************************************************************************ * Configure a RX pipe. * - * Input Parmeters: + * Input Parameters: * dev Pointer to an nRF24L01 device structure * pipeno Pipe number to configure * pipecfg Pointer to configuration data @@ -284,7 +284,7 @@ int nrf24l01_setpipeconfig(FAR struct nrf24l01_dev_s *dev, unsigned int pipeno, /************************************************************************************ * Get pipe configuration. * - * Input Parmeters: + * Input Parameters: * dev Pointer to an nRF24L01 device structure * pipeno Pipe number to configure * pipecfg Pointer to configuration data used to store the config @@ -300,7 +300,7 @@ int nrf24l01_getpipeconfig(FAR struct nrf24l01_dev_s *dev, unsigned int pipeno, /************************************************************************************ * Enable a RX pipe. * - * Input Parmeters: + * Input Parameters: * dev Pointer to an nRF24L01 device structure * pipeno Pipe number * enable true to enable the pipe, false to disable it @@ -316,7 +316,7 @@ int nrf24l01_enablepipe(FAR struct nrf24l01_dev_s *dev, unsigned int pipeno, /************************************************************************************ * Configure RF. * - * Input Parmeters: + * Input Parameters: * dev Pointer to an nRF24L01 device structure * datarate Datarate * outpower Output power @@ -334,7 +334,7 @@ int nrf24l01_setuprf(FAR struct nrf24l01_dev_s *dev, nrf24l01_datarate_t datarat * * Note that hardware supports only -18, -12, -6 and 0 dBm values. * - * Input Parmeters: + * Input Parameters: * dev Pointer to an nRF24L01 device structure * outpower Output power (in dBm). * @@ -350,7 +350,7 @@ int nrf24l01_settxpower(FAR struct nrf24l01_dev_s *dev, int outpower); * * Note that hardware supports only -18, -12, -6 and 0 dBm values. * - * Input Parmeters: + * Input Parameters: * dev Pointer to an nRF24L01 device structure * * Returned Value: @@ -363,7 +363,7 @@ int nrf24l01_gettxpower(FAR struct nrf24l01_dev_s *dev); /************************************************************************************ * Set transmission data rate * - * Input Parmeters: + * Input Parameters: * dev Pointer to an nRF24L01 device structure * * Returned Value: @@ -377,7 +377,7 @@ int nrf24l01_setdatarate(FAR struct nrf24l01_dev_s *dev, /************************************************************************************ * Set radio frequency. * - * Input Parmeters: + * Input Parameters: * dev Pointer to an nRF24L01 device structure * freq New frequency value (in Mhz: 2400 to 2525) * @@ -391,7 +391,7 @@ int nrf24l01_setradiofreq(FAR struct nrf24l01_dev_s *dev, uint32_t freq); /************************************************************************************ * Get current radio frequency. * - * Input Parmeters: + * Input Parameters: * dev Pointer to an nRF24L01 device structure * * Returned Value: @@ -404,7 +404,7 @@ uint32_t nrf24l01_getradiofreq(FAR struct nrf24l01_dev_s *dev); /************************************************************************************ * Configure address length. * - * Input Parmeters: + * Input Parameters: * dev Pointer to an nRF24L01 device structure * width Address width to use (3-5) * @@ -418,7 +418,7 @@ int nrf24l01_setaddrwidth(FAR struct nrf24l01_dev_s *dev, uint32_t width); /************************************************************************************ * Change the current lifecycle state of the nRF24L01+ chip. * - * Input Parmeters: + * Input Parameters: * dev Pointer to an nRF24L01 device structure * state New state to put the nRF24L01 module into * @@ -429,7 +429,7 @@ int nrf24l01_changestate(FAR struct nrf24l01_dev_s *dev, nrf24l01_state_t state) /************************************************************************************ * Send data to the default address. * - * Input Parmeters: + * Input Parameters: * dev Pointer to an nRF24L01 device structure * data Pointer on the data buffer * datalen Length of the buffer (in bytes) @@ -444,7 +444,7 @@ int nrf24l01_send(FAR struct nrf24l01_dev_s *dev, FAR const uint8_t *data, /************************************************************************************ * Send data to the specified address. * - * Input Parmeters: + * Input Parameters: * dev Pointer to an nRF24L01 device structure * data Pointer on the data buffer * datalen Length of the buffer (in bytes) @@ -461,7 +461,7 @@ int nrf24l01_sendto(FAR struct nrf24l01_dev_s *dev, FAR const uint8_t *data, * Get the retransmits count of the last transmission. * This value is meaningful only if auto-acknowledge is enabled. * - * Input Parmeters: + * Input Parameters: * dev Pointer to an nRF24L01 device structure * * Returned Value: diff --git a/include/nuttx/wireless/pktradio.h b/include/nuttx/wireless/pktradio.h index d4f405b414..829de17909 100644 --- a/include/nuttx/wireless/pktradio.h +++ b/include/nuttx/wireless/pktradio.h @@ -181,10 +181,10 @@ struct pktradio_metadata_s * called. Therefore, it may be called during packet radio driver * initialization, even if there are multiple packet radio drivers. * - * Inputs: + * Input Parameters: * None * - * Return Value: + * Returned Value: * None * ****************************************************************************/ @@ -202,10 +202,10 @@ void pktradio_metadata_initialize(void); * list. If that the list is empty, then the meta-data structure will be * allocated from the dynamic memory pool. * - * Inputs: + * Input Parameters: * None * - * Return Value: + * Returned Value: * A reference to the allocated metadata structure. All user fields in this * structure have been zeroed. On a failure to allocate, NULL is * returned. @@ -223,10 +223,10 @@ FAR struct pktradio_metadata_s *pktradio_metadata_allocate(void); * structure. If the metadata structure was allocated dynamically it will * be deallocated. * - * Inputs: + * Input Parameters: * metadata - metadata structure to free * - * Return Value: + * Returned Value: * None * ****************************************************************************/ diff --git a/include/nuttx/wqueue.h b/include/nuttx/wqueue.h index b5ee23e022..8fe684a9a5 100644 --- a/include/nuttx/wqueue.h +++ b/include/nuttx/wqueue.h @@ -318,7 +318,7 @@ extern "C" * Description: * Start the user mode work queue. * - * Input parameters: + * Input Parameters: * None * * Returned Value: @@ -345,7 +345,7 @@ int work_usrstart(void); * previous work as been performed and removed from the queue, then any * pending work will be canceled and lost. * - * Input parameters: + * Input Parameters: * qid - The work queue ID * work - The work structure to queue * worker - The worker callback to be invoked. The callback will invoked @@ -371,7 +371,7 @@ int work_queue(int qid, FAR struct work_s *work, worker_t worker, * After work has been cancelled, it may be re-queue by calling work_queue() * again. * - * Input parameters: + * Input Parameters: * qid - The work queue ID * work - The previously queue work structure to cancel * @@ -393,7 +393,7 @@ int work_cancel(int qid, FAR struct work_s *work); * is used internally by the work logic but could also be used by the * user to force an immediate re-assessment of pending work. * - * Input parameters: + * Input Parameters: * qid - The work queue ID * * Returned Value: @@ -409,7 +409,7 @@ int work_signal(int qid); * Description: * Check if the work structure is available. * - * Input parameters: + * Input Parameters: * work - The work queue structure to check. * None * @@ -431,7 +431,7 @@ int work_signal(int qid); * Parameters: * reqprio - Requested minimum worker thread priority * - * Return Value: + * Returned Value: * None * ****************************************************************************/ @@ -453,7 +453,7 @@ void lpwork_boostpriority(uint8_t reqprio); * reqprio - Previously requested minimum worker thread priority to be * "unboosted" * - * Return Value: + * Returned Value: * None * ****************************************************************************/ diff --git a/include/sys/ioctl.h b/include/sys/ioctl.h index cc697c040a..d8da7a121b 100644 --- a/include/sys/ioctl.h +++ b/include/sys/ioctl.h @@ -110,7 +110,7 @@ extern "C" * arg The argument of the ioctl cmd, OR * ... A third argument of type unsigned long is still expected. * - * Return: + * Returned Value: * >=0 on success (positive non-zero values are cmd-specific) * -1 on failure with errno set properly: * diff --git a/include/sys/sendfile.h b/include/sys/sendfile.h index 22cb8271ef..c414532671 100644 --- a/include/sys/sendfile.h +++ b/include/sys/sendfile.h @@ -87,7 +87,7 @@ extern "C" * different semantics and prototypes. sendfile() should not be used * in portable programs. * - * Input Parmeters: + * Input Parameters: * infd - A file (or socket) descriptor opened for reading * outfd - A descriptor opened for writing. * offset - If 'offset' is not NULL, then it points to a variable diff --git a/include/sys/time.h b/include/sys/time.h index ece75bc10f..36ba9822be 100644 --- a/include/sys/time.h +++ b/include/sys/time.h @@ -160,7 +160,7 @@ extern "C" * tv - The location to return the current time * tz - Ignored * - * Returned value: + * Returned Value: * Zero (OK) on success; -1 is returned on failure with the errno variable * set appropriately. * @@ -183,7 +183,7 @@ int gettimeofday(FAR struct timeval *tv, FAR struct timezone *tz); * tv - The net to time to be set * tz - Ignored * - * Returned value: + * Returned Value: * Zero (OK) on success; -1 is returned on failure with the errno variable * set appropriately. * diff --git a/libc/dirent/lib_readdirr.c b/libc/dirent/lib_readdirr.c index ffbe91056a..d383651c63 100644 --- a/libc/dirent/lib_readdirr.c +++ b/libc/dirent/lib_readdirr.c @@ -62,7 +62,7 @@ * directory stream pointed to by dir. It returns NULL on * reaching the end-of-file or if an error occurred. * - * Inputs: + * Input Parameters: * dirp -- An instance of type DIR created by a previous * call to opendir(); * entry -- The storage pointed to by entry must be large @@ -73,7 +73,7 @@ * argument entry. Upon reaching the end of the directory * stream, this pointer shall have the value NULL. * - * Return: + * Returned Value: * If successful, the readdir_r() function return s zero; * otherwise, an error number is returned to indicate the * error. diff --git a/libc/dirent/lib_telldir.c b/libc/dirent/lib_telldir.c index f77a4a1c21..af12ff902b 100644 --- a/libc/dirent/lib_telldir.c +++ b/libc/dirent/lib_telldir.c @@ -61,11 +61,11 @@ * The telldir() function returns the current location * associated with the directory stream dirp. * - * Inputs: + * Input Parameters: * dirp -- An instance of type DIR created by a previous * call to opendir(); * - * Return: + * Returned Value: * On success, the telldir() function returns the current * location in the directory stream. On error, -1 is * returned, and errno is set appropriately. diff --git a/libc/hex2bin/lib_fhex2mem.c b/libc/hex2bin/lib_fhex2mem.c index 1967dd1ade..b6bc91aa9f 100644 --- a/libc/hex2bin/lib_fhex2mem.c +++ b/libc/hex2bin/lib_fhex2mem.c @@ -69,7 +69,7 @@ * swap - Controls byte ordering. See enum hex2bin_swap_e for * description of the values. * - * Returned Value + * Returned Value: * Zero (OK) is returned on success; a negated errno value is returned on * failure. * diff --git a/libc/hex2bin/lib_hex2bin.c b/libc/hex2bin/lib_hex2bin.c index 2dc5d32d97..3815eb0627 100644 --- a/libc/hex2bin/lib_hex2bin.c +++ b/libc/hex2bin/lib_hex2bin.c @@ -403,7 +403,7 @@ static inline void writedata(FAR struct lib_sostream_s *outstream, * swap - Controls byte ordering. See enum hex2bin_swap_e for * description of the values. * - * Returned Value + * Returned Value: * Zero (OK) is returned on success; a negated errno value is returned on * failure. * diff --git a/libc/hex2bin/lib_hex2mem.c b/libc/hex2bin/lib_hex2mem.c index 12c284cf54..24b25b011d 100644 --- a/libc/hex2bin/lib_hex2mem.c +++ b/libc/hex2bin/lib_hex2mem.c @@ -69,7 +69,7 @@ * swap - Controls byte ordering. See enum hex2bin_swap_e for * description of the values. * - * Returned Value + * Returned Value: * Zero (OK) is returned on success; a negated errno value is returned on * failure. * diff --git a/libc/inttypes/lib_strtoimax.c b/libc/inttypes/lib_strtoimax.c index 0acaca3155..d4eff8232f 100644 --- a/libc/inttypes/lib_strtoimax.c +++ b/libc/inttypes/lib_strtoimax.c @@ -64,7 +64,7 @@ * nptr to a intmax_t integer value according to the given base, which * must be between 2 and 36 inclusive, or be the special value 0. * - * Returns: + * Returned Value: * - The converted value, if the base and number are valid * - 0 if an error occurs, and set errno to: * * EINVAL if base < 2 or base > 36 diff --git a/libc/inttypes/lib_strtoumax.c b/libc/inttypes/lib_strtoumax.c index 9440908c93..90cf6005ff 100644 --- a/libc/inttypes/lib_strtoumax.c +++ b/libc/inttypes/lib_strtoumax.c @@ -57,7 +57,7 @@ * nptr to a long unsigned integer value according to the given base, which * must be between 2 and 36 inclusive, or be the special value 0. * - * Returns: + * Returned Value: * - The converted value, if the base and number are valid * - 0 if an error occurs, and set errno to: * * EINVAL if base < 2 or base > 36 diff --git a/libc/libgen/lib_basename.c b/libc/libgen/lib_basename.c index 18b2168fad..c837938209 100644 --- a/libc/libgen/lib_basename.c +++ b/libc/libgen/lib_basename.c @@ -73,7 +73,7 @@ static char g_retchar[2]; * Parameter: * path The null-terminated string referring to the path to be decomposed * - * Return: + * Returned Value: * On success the filename component of the path is returned. * ****************************************************************************/ diff --git a/libc/libgen/lib_dirname.c b/libc/libgen/lib_dirname.c index 0acd03c71f..ce260e2a4f 100644 --- a/libc/libgen/lib_dirname.c +++ b/libc/libgen/lib_dirname.c @@ -73,7 +73,7 @@ static char g_retchar[2]; * Parameter: * path The null-terminated string referring to the path to be decomposed * - * Return: + * Returned Value: * On success the directory component of the path is returned. * ****************************************************************************/ diff --git a/libc/misc/lib_ioctl.c b/libc/misc/lib_ioctl.c index 0e7ca015d3..f9acafba8a 100644 --- a/libc/misc/lib_ioctl.c +++ b/libc/misc/lib_ioctl.c @@ -65,7 +65,7 @@ * req The ioctl command * ... A third argument of type unsigned long is expected * - * Return: + * Returned Value: * >=0 on success (positive non-zero values are cmd-specific) * -1 on failure with errno set properly: * diff --git a/libc/misc/lib_mkfifo.c b/libc/misc/lib_mkfifo.c index deb919aad1..4bcd412096 100644 --- a/libc/misc/lib_mkfifo.c +++ b/libc/misc/lib_mkfifo.c @@ -68,12 +68,12 @@ * If all threads that write to the FIFO have closed, subsequent calls to * read() on the FIFO will return 0 (end-of-file). * - * Inputs: + * Input Parameters: * pathname - The full path to the FIFO instance to attach to or to create * (if not already created). * mode - Ignored for now * - * Return: + * Returned Value: * 0 is returned on success; otherwise, -1 is returned with errno set * appropriately. * diff --git a/libc/misc/lib_sendfile.c b/libc/misc/lib_sendfile.c index be6fa94c01..e3eaf54838 100644 --- a/libc/misc/lib_sendfile.c +++ b/libc/misc/lib_sendfile.c @@ -72,7 +72,7 @@ * different semantics and prototypes. sendfile() should not be used * in portable programs. * - * Input Parmeters: + * Input Parameters: * infd - A file (or socket) descriptor opened for reading * outfd - A descriptor opened for writing. * offset - If 'offset' is not NULL, then it points to a variable diff --git a/libc/net/lib_shutdown.c b/libc/net/lib_shutdown.c index a2c733dec2..b6cdaecdea 100644 --- a/libc/net/lib_shutdown.c +++ b/libc/net/lib_shutdown.c @@ -41,10 +41,6 @@ #ifdef CONFIG_NET -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -60,7 +56,7 @@ * The shutdown() function disables subsequent send and/or receive * operations on a socket, depending on the value of the how argument. * - * Input Paramteers: + * Input Parameters: * sockfd - Specifies the file descriptor of the socket. * how - Specifies the type of shutdown. The values are as follows: * diff --git a/libc/pthread/pthread_attr_destroy.c b/libc/pthread/pthread_attr_destroy.c index 16dd2cc50e..d91530841b 100644 --- a/libc/pthread/pthread_attr_destroy.c +++ b/libc/pthread/pthread_attr_destroy.c @@ -57,7 +57,7 @@ * Parameters: * attr * - * Return Value: + * Returned Value: * 0 meaning success * * Assumptions: diff --git a/libc/pthread/pthread_attr_getaffinity.c b/libc/pthread/pthread_attr_getaffinity.c index 1371ceff37..e74dafc553 100644 --- a/libc/pthread/pthread_attr_getaffinity.c +++ b/libc/pthread/pthread_attr_getaffinity.c @@ -56,7 +56,7 @@ * attr * cpuset * - * Return Value: + * Returned Value: * 0 if successful. Otherwise, an error code. * * Assumptions: diff --git a/libc/pthread/pthread_attr_getinheritsched.c b/libc/pthread/pthread_attr_getinheritsched.c index d8e6515fa8..546e52a652 100644 --- a/libc/pthread/pthread_attr_getinheritsched.c +++ b/libc/pthread/pthread_attr_getinheritsched.c @@ -60,7 +60,7 @@ * attr * inheritsched * - * Return Value: + * Returned Value: * 0 if successful. Otherwise, an error code. * * Assumptions: diff --git a/libc/pthread/pthread_attr_getschedparam.c b/libc/pthread/pthread_attr_getschedparam.c index 3de2a3b7a2..408fa93894 100644 --- a/libc/pthread/pthread_attr_getschedparam.c +++ b/libc/pthread/pthread_attr_getschedparam.c @@ -58,7 +58,7 @@ * attr * param * - * Return Value: + * Returned Value: * 0 if successful. Otherwise, an error code. * * Assumptions: diff --git a/libc/pthread/pthread_attr_getschedpolicy.c b/libc/pthread/pthread_attr_getschedpolicy.c index ca819b8ffa..f3c06455b4 100644 --- a/libc/pthread/pthread_attr_getschedpolicy.c +++ b/libc/pthread/pthread_attr_getschedpolicy.c @@ -57,7 +57,7 @@ * attr * policy * - * Return Value: + * Returned Value: * 0 if successful. Otherwise, an error code. * * Assumptions: diff --git a/libc/pthread/pthread_attr_getstacksize.c b/libc/pthread/pthread_attr_getstacksize.c index 858cf88c9d..ba64db6578 100644 --- a/libc/pthread/pthread_attr_getstacksize.c +++ b/libc/pthread/pthread_attr_getstacksize.c @@ -56,7 +56,7 @@ * attr * stacksize * - * Return Value: + * Returned Value: * 0 if successful. Otherwise, an error code. * * Assumptions: diff --git a/libc/pthread/pthread_attr_init.c b/libc/pthread/pthread_attr_init.c index 256be4b235..60af413b87 100644 --- a/libc/pthread/pthread_attr_init.c +++ b/libc/pthread/pthread_attr_init.c @@ -76,7 +76,7 @@ const pthread_attr_t g_default_pthread_attr = PTHREAD_ATTR_INITIALIZER; * Parameters: * attr * - * Return Value: + * Returned Value: * 0 on success, otherwise an error number * * Assumptions: diff --git a/libc/pthread/pthread_attr_setaffinity.c b/libc/pthread/pthread_attr_setaffinity.c index 83f8e337cf..ce2029f609 100644 --- a/libc/pthread/pthread_attr_setaffinity.c +++ b/libc/pthread/pthread_attr_setaffinity.c @@ -57,7 +57,7 @@ * attr * stacksize * - * Return Value: + * Returned Value: * 0 if successful. Otherwise, an error code. * * Assumptions: diff --git a/libc/pthread/pthread_attr_setinheritsched.c b/libc/pthread/pthread_attr_setinheritsched.c index 36b1d1dba1..c202c9dbab 100644 --- a/libc/pthread/pthread_attr_setinheritsched.c +++ b/libc/pthread/pthread_attr_setinheritsched.c @@ -61,7 +61,7 @@ * attr * policy * - * Return Value: + * Returned Value: * 0 if successful. Otherwise, an error code. * * Assumptions: diff --git a/libc/pthread/pthread_attr_setschedparam.c b/libc/pthread/pthread_attr_setschedparam.c index 812ebee859..c6972ced3f 100644 --- a/libc/pthread/pthread_attr_setschedparam.c +++ b/libc/pthread/pthread_attr_setschedparam.c @@ -58,7 +58,7 @@ * attr * param * - * Return Value: + * Returned Value: * 0 if successful. Otherwise, an error code. * * Assumptions: diff --git a/libc/pthread/pthread_attr_setschedpolicy.c b/libc/pthread/pthread_attr_setschedpolicy.c index 9d7ce10fff..724c442e06 100644 --- a/libc/pthread/pthread_attr_setschedpolicy.c +++ b/libc/pthread/pthread_attr_setschedpolicy.c @@ -59,7 +59,7 @@ * attr * policy * - * Return Value: + * Returned Value: * 0 if successful. Otherwise, an error code. * * Assumptions: diff --git a/libc/pthread/pthread_attr_setstacksize.c b/libc/pthread/pthread_attr_setstacksize.c index f69fc7df9c..6a0b8d4aeb 100644 --- a/libc/pthread/pthread_attr_setstacksize.c +++ b/libc/pthread/pthread_attr_setstacksize.c @@ -57,7 +57,7 @@ * attr * stacksize * - * Return Value: + * Returned Value: * 0 if successful. Otherwise, an error code. * * Assumptions: diff --git a/libc/pthread/pthread_barrierattr_destroy.c b/libc/pthread/pthread_barrierattr_destroy.c index 663f449981..ca7dcd9e64 100644 --- a/libc/pthread/pthread_barrierattr_destroy.c +++ b/libc/pthread/pthread_barrierattr_destroy.c @@ -59,7 +59,7 @@ * Parameters: * attr - barrier attributes to be destroyed. * - * Return Value: + * Returned Value: * 0 (OK) on success or EINVAL if attr is invalid. * * Assumptions: diff --git a/libc/pthread/pthread_barrierattr_getpshared.c b/libc/pthread/pthread_barrierattr_getpshared.c index 3964a801ca..2f4fd22533 100644 --- a/libc/pthread/pthread_barrierattr_getpshared.c +++ b/libc/pthread/pthread_barrierattr_getpshared.c @@ -58,7 +58,7 @@ * attr - barrier attributes to be queried. * pshared - the location to stored the current value of the pshared attribute. * - * Return Value: + * Returned Value: * 0 (OK) on success or EINVAL if either attr or pshared is invalid. * * Assumptions: diff --git a/libc/pthread/pthread_barrierattr_init.c b/libc/pthread/pthread_barrierattr_init.c index e8270f6b98..f2a5527da7 100644 --- a/libc/pthread/pthread_barrierattr_init.c +++ b/libc/pthread/pthread_barrierattr_init.c @@ -58,7 +58,7 @@ * Parameters: * attr - barrier attributes to be initialized. * - * Return Value: + * Returned Value: * 0 (OK) on success or EINVAL if attr is invalid. * * Assumptions: diff --git a/libc/pthread/pthread_barrierattr_setpshared.c b/libc/pthread/pthread_barrierattr_setpshared.c index 76109ac08c..b26ef1746e 100644 --- a/libc/pthread/pthread_barrierattr_setpshared.c +++ b/libc/pthread/pthread_barrierattr_setpshared.c @@ -87,7 +87,7 @@ * attr - barrier attributes to be modified. * pshared - the new value of the pshared attribute. * - * Return Value: + * Returned Value: * 0 (OK) on success or EINVAL if either attr is invalid or pshared is not one * of PTHREAD_PROCESS_SHARED or PTHREAD_PROCESS_PRIVATE. * diff --git a/libc/pthread/pthread_barrierdestroy.c b/libc/pthread/pthread_barrierdestroy.c index 3f74e06c49..19a007b02a 100644 --- a/libc/pthread/pthread_barrierdestroy.c +++ b/libc/pthread/pthread_barrierdestroy.c @@ -63,7 +63,7 @@ * Parameters: * barrier - barrier to be destroyed. * - * Return Value: + * Returned Value: * 0 (OK) on success or on of the following error numbers: * * EBUSY The implementation has detected an attempt to destroy a barrier diff --git a/libc/pthread/pthread_barrierinit.c b/libc/pthread/pthread_barrierinit.c index 6f8d427dfe..c9c60cefaa 100644 --- a/libc/pthread/pthread_barrierinit.c +++ b/libc/pthread/pthread_barrierinit.c @@ -69,7 +69,7 @@ * pthread_barrier_wait() before any of them successfully return from * the call. The value specified by count must be greater than zero. * - * Return Value: + * Returned Value: * 0 (OK) on success or on of the following error numbers: * * EAGAIN The system lacks the necessary resources to initialize another diff --git a/libc/pthread/pthread_barrierwait.c b/libc/pthread/pthread_barrierwait.c index 8ba29d1d94..ed51b62c01 100644 --- a/libc/pthread/pthread_barrierwait.c +++ b/libc/pthread/pthread_barrierwait.c @@ -86,7 +86,7 @@ * Parameters: * barrier - the barrier to wait on * - * Return Value: + * Returned Value: * 0 (OK) on success or EINVAL if the barrier is not valid. * * Assumptions: diff --git a/libc/pthread/pthread_condattr_destroy.c b/libc/pthread/pthread_condattr_destroy.c index 12bee245dc..2f97ffbd6f 100644 --- a/libc/pthread/pthread_condattr_destroy.c +++ b/libc/pthread/pthread_condattr_destroy.c @@ -56,7 +56,7 @@ * Parameters: * None * - * Return Value: + * Returned Value: * None * * Assumptions: diff --git a/libc/pthread/pthread_condattr_init.c b/libc/pthread/pthread_condattr_init.c index 8865868b81..9f23736233 100644 --- a/libc/pthread/pthread_condattr_init.c +++ b/libc/pthread/pthread_condattr_init.c @@ -56,7 +56,7 @@ * Parameters: * None * - * Return Value: + * Returned Value: * None * * Assumptions: diff --git a/libc/pthread/pthread_conddestroy.c b/libc/pthread/pthread_conddestroy.c index a691b60d7d..44e6e4cab5 100644 --- a/libc/pthread/pthread_conddestroy.c +++ b/libc/pthread/pthread_conddestroy.c @@ -56,7 +56,7 @@ * Parameters: * None * - * Return Value: + * Returned Value: * None * * Assumptions: diff --git a/libc/pthread/pthread_condinit.c b/libc/pthread/pthread_condinit.c index 81a31ea57f..d19601f196 100644 --- a/libc/pthread/pthread_condinit.c +++ b/libc/pthread/pthread_condinit.c @@ -59,7 +59,7 @@ * Parameters: * None * - * Return Value: + * Returned Value: * None * * Assumptions: diff --git a/libc/pthread/pthread_mutexattr_destroy.c b/libc/pthread/pthread_mutexattr_destroy.c index 01c8a6589a..f8fe9e057e 100644 --- a/libc/pthread/pthread_mutexattr_destroy.c +++ b/libc/pthread/pthread_mutexattr_destroy.c @@ -56,7 +56,7 @@ * Parameters: * attr * - * Return Value: + * Returned Value: * 0 if successful. Otherwise, an error code. * * Assumptions: diff --git a/libc/pthread/pthread_mutexattr_getprotocol.c b/libc/pthread/pthread_mutexattr_getprotocol.c index 7cc6065d36..b83e289f42 100644 --- a/libc/pthread/pthread_mutexattr_getprotocol.c +++ b/libc/pthread/pthread_mutexattr_getprotocol.c @@ -58,7 +58,7 @@ * protocol - The user provided location in which to store the protocol * value. * - * Return Value: + * Returned Value: * 0 if successful. Otherwise, an error code. * ****************************************************************************/ diff --git a/libc/pthread/pthread_mutexattr_getpshared.c b/libc/pthread/pthread_mutexattr_getpshared.c index 6d219fb085..ea398bed6c 100644 --- a/libc/pthread/pthread_mutexattr_getpshared.c +++ b/libc/pthread/pthread_mutexattr_getpshared.c @@ -57,7 +57,7 @@ * attr * pshared * - * Return Value: + * Returned Value: * 0 if successful. Otherwise, an error code. * * Assumptions: diff --git a/libc/pthread/pthread_mutexattr_getrobust.c b/libc/pthread/pthread_mutexattr_getrobust.c index 4db30f6b75..4bf88ff7ea 100644 --- a/libc/pthread/pthread_mutexattr_getrobust.c +++ b/libc/pthread/pthread_mutexattr_getrobust.c @@ -55,7 +55,7 @@ * attr - The mutex attributes to query * robust - Location to return the robustness indication * - * Return Value: + * Returned Value: * 0, if the robustness was successfully return in 'robust', or * EINVAL, if any NULL pointers provided. * diff --git a/libc/pthread/pthread_mutexattr_gettype.c b/libc/pthread/pthread_mutexattr_gettype.c index c45008f8d4..46e7076233 100644 --- a/libc/pthread/pthread_mutexattr_gettype.c +++ b/libc/pthread/pthread_mutexattr_gettype.c @@ -55,7 +55,7 @@ * attr - The mutex attributes to query * type - Location to return the mutex type * - * Return Value: + * Returned Value: * 0, if the mutex type was successfully return in 'type', or * EINVAL, if any NULL pointers provided. * diff --git a/libc/pthread/pthread_mutexattr_init.c b/libc/pthread/pthread_mutexattr_init.c index 6f24188152..c0441c7ed2 100644 --- a/libc/pthread/pthread_mutexattr_init.c +++ b/libc/pthread/pthread_mutexattr_init.c @@ -56,7 +56,7 @@ * Parameters: * attr * - * Return Value: + * Returned Value: * 0 if successful. Otherwise, an error code. * * Assumptions: diff --git a/libc/pthread/pthread_mutexattr_setprotocol.c b/libc/pthread/pthread_mutexattr_setprotocol.c index e2a8a45ac5..117c626248 100644 --- a/libc/pthread/pthread_mutexattr_setprotocol.c +++ b/libc/pthread/pthread_mutexattr_setprotocol.c @@ -58,7 +58,7 @@ * attr - A pointer to the mutex attributes to be modified * protocol - The new protocol to use * - * Return Value: + * Returned Value: * 0 if successful. Otherwise, an error code. * ****************************************************************************/ diff --git a/libc/pthread/pthread_mutexattr_setpshared.c b/libc/pthread/pthread_mutexattr_setpshared.c index 054c4db07e..575e38036e 100644 --- a/libc/pthread/pthread_mutexattr_setpshared.c +++ b/libc/pthread/pthread_mutexattr_setpshared.c @@ -57,7 +57,7 @@ * attr * pshared * - * Return Value: + * Returned Value: * 0 if successful. Otherwise, an error code. * * Assumptions: diff --git a/libc/pthread/pthread_mutexattr_setrobust.c b/libc/pthread/pthread_mutexattr_setrobust.c index aeb2714e93..6a231bd2ed 100644 --- a/libc/pthread/pthread_mutexattr_setrobust.c +++ b/libc/pthread/pthread_mutexattr_setrobust.c @@ -55,7 +55,7 @@ * attr - The mutex attributes in which to set the mutex type. * robust - The mutex type value to set. * - * Return Value: + * Returned Value: * 0, if the mutex robustness was successfully set in 'attr', or * EINVAL, if 'attr' is NULL or 'robust' unrecognized. * diff --git a/libc/pthread/pthread_mutexattr_settype.c b/libc/pthread/pthread_mutexattr_settype.c index 02e1832cd6..7c501b6221 100644 --- a/libc/pthread/pthread_mutexattr_settype.c +++ b/libc/pthread/pthread_mutexattr_settype.c @@ -55,7 +55,7 @@ * attr - The mutex attributes in which to set the mutex type. * type - The mutex type value to set. * - * Return Value: + * Returned Value: * 0, if the mutex type was successfully set in 'attr', or * EINVAL, if 'attr' is NULL or 'type' unrecognized. * diff --git a/libc/pthread/pthread_once.c b/libc/pthread/pthread_once.c index d73dde966f..2f067decbb 100644 --- a/libc/pthread/pthread_once.c +++ b/libc/pthread/pthread_once.c @@ -67,7 +67,7 @@ * PTHREAD_ONCE_INIT is defined in pthread.h * init_routine - The initialization routine that will be called once. * - * Return Value: + * Returned Value: * 0 (OK) on success or EINVAL if either once_control or init_routine are * invalid * diff --git a/libc/pthread/pthread_rwlock_rdlock.c b/libc/pthread/pthread_rwlock_rdlock.c index 4eadfedccb..1b23abcc92 100644 --- a/libc/pthread/pthread_rwlock_rdlock.c +++ b/libc/pthread/pthread_rwlock_rdlock.c @@ -93,7 +93,7 @@ static int tryrdlock(FAR pthread_rwlock_t *rw_lock) * Parameters: * None * - * Return Value: + * Returned Value: * None * * Assumptions: diff --git a/libc/pthread/pthread_rwlock_wrlock.c b/libc/pthread/pthread_rwlock_wrlock.c index c9f4f3a7c5..73b1ce2762 100644 --- a/libc/pthread/pthread_rwlock_wrlock.c +++ b/libc/pthread/pthread_rwlock_wrlock.c @@ -73,7 +73,7 @@ static void wrlock_cleanup(FAR void *arg) * Parameters: * None * - * Return Value: + * Returned Value: * None * * Assumptions: diff --git a/libc/pthread/pthread_startup.c b/libc/pthread/pthread_startup.c index 3d2b76ce8f..a1f8e64f5e 100644 --- a/libc/pthread/pthread_startup.c +++ b/libc/pthread/pthread_startup.c @@ -82,11 +82,11 @@ * This function is the user-space, pthread startup function. It is called * from up_pthread_start() in user-mode. * - * Inputs: + * Input Parameters: * entrypt - The user-space address of the pthread entry point * arg - Standard argument for the pthread entry point * - * Return: + * Returned Value: * None. This function does not return. * ****************************************************************************/ diff --git a/libc/pthread/pthread_yield.c b/libc/pthread/pthread_yield.c index 2af7ea2b93..78ee5a7bb7 100644 --- a/libc/pthread/pthread_yield.c +++ b/libc/pthread/pthread_yield.c @@ -54,7 +54,7 @@ * Parameters: * None * - * Return Value: + * Returned Value: * None * * Assumptions: diff --git a/libc/sched/sched_cpucount.c b/libc/sched/sched_cpucount.c index 6bdac11117..5f7f151ec0 100644 --- a/libc/sched/sched_cpucount.c +++ b/libc/sched/sched_cpucount.c @@ -54,10 +54,10 @@ * Return the number of bits set in the 'set'. This could be improved by * using CPU-specific bit counting instructions. * - * Inputs: + * Input Parameters: * set - The set of CPUs to be counted. * - * Return Value: + * Returned Value: * The number of CPUs in 'set' * ****************************************************************************/ diff --git a/libc/sched/sched_getprioritymax.c b/libc/sched/sched_getprioritymax.c index 03660cbb8d..4ca6bf6119 100644 --- a/libc/sched/sched_getprioritymax.c +++ b/libc/sched/sched_getprioritymax.c @@ -54,10 +54,10 @@ * This function returns the value of the highest possible * task priority for a specified scheduling policy. * - * Inputs: + * Input Parameters: * policy - Scheduling policy requested. * - * Return Value: + * Returned Value: * The maximum priority value or -1 (ERROR) * (errno is not set) * diff --git a/libc/sched/sched_getprioritymin.c b/libc/sched/sched_getprioritymin.c index 660677f8ca..4a39350107 100644 --- a/libc/sched/sched_getprioritymin.c +++ b/libc/sched/sched_getprioritymin.c @@ -54,10 +54,10 @@ * This function returns the value of the lowest possible * task priority for a specified scheduling policy. * - * Inputs: + * Input Parameters: * policy - Scheduling policy requested. * - * Return Value: + * Returned Value: * The minimum priority value or -1 (ERROR) * (errno is not set) * diff --git a/libc/sched/task_startup.c b/libc/sched/task_startup.c index c0895a16b8..2d14b47fa1 100644 --- a/libc/sched/task_startup.c +++ b/libc/sched/task_startup.c @@ -57,11 +57,11 @@ * This function is the user-space, task startup function. It is called * from up_task_start() in user-mode. * - * Inputs: + * Input Parameters: * entrypt - The user-space address of the task entry point * argc and argv - Standard arguments for the task entry point * - * Return: + * Returned Value: * None. This function does not return. * ****************************************************************************/ diff --git a/libc/semaphore/sem_getprotocol.c b/libc/semaphore/sem_getprotocol.c index 308f1ea520..436113b015 100644 --- a/libc/semaphore/sem_getprotocol.c +++ b/libc/semaphore/sem_getprotocol.c @@ -59,7 +59,7 @@ * protocol - The user provided location in which to store the protocol * value. * - * Return Value: + * Returned Value: * This function is exposed as a non-standard application interface. It * returns zero (OK) if successful. Otherwise, -1 (ERROR) is returned and * the errno value is set appropriately. diff --git a/libc/semaphore/sem_getvalue.c b/libc/semaphore/sem_getvalue.c index 120dae1372..d6da1ba4bf 100644 --- a/libc/semaphore/sem_getvalue.c +++ b/libc/semaphore/sem_getvalue.c @@ -68,7 +68,7 @@ * sem - Semaphore descriptor * sval - Buffer by which the value is returned * - * Return Value: + * Returned Value: * This is an internal OS interface and should not be used by applications. * It follows the NuttX internal error return policy: Zero (OK) is * returned on success. A negated errno value is returned on failure. diff --git a/libc/semaphore/sem_init.c b/libc/semaphore/sem_init.c index 99b77317f6..b26b0b5937 100644 --- a/libc/semaphore/sem_init.c +++ b/libc/semaphore/sem_init.c @@ -68,7 +68,7 @@ * pshared - Process sharing (not used) * value - Semaphore initialization value * - * Return Value: + * Returned Value: * This is an internal OS interface and should not be used by applications. * It follows the NuttX internal error return policy: Zero (OK) is * returned on success. A negated errno value is returned on failure. @@ -124,7 +124,7 @@ int nxsem_init(FAR sem_t *sem, int pshared, unsigned int value) * pshared - Process sharing (not used) * value - Semaphore initialization value * - * Return Value: + * Returned Value: * This returns zero (OK) if successful. Otherwise, -1 (ERROR) is * returned and the errno value is set appropriately. * diff --git a/libc/semaphore/sem_setprotocol.c b/libc/semaphore/sem_setprotocol.c index ac82cf719a..b64f466546 100644 --- a/libc/semaphore/sem_setprotocol.c +++ b/libc/semaphore/sem_setprotocol.c @@ -80,7 +80,7 @@ * modified * protocol - The new protocol to use * - * Return Value: + * Returned Value: * This function is exposed as a non-standard application interface. It * returns zero (OK) if successful. Otherwise, -1 (ERROR) is returned and * the errno value is set appropriately. @@ -138,7 +138,7 @@ int nxsem_setprotocol(FAR sem_t *sem, int protocol) * modified * protocol - The new protocol to use * - * Return Value: + * Returned Value: * This function is exposed as a non-standard application interface. It * returns zero (OK) if successful. Otherwise, -1 (ERROR) is returned and * the errno value is set appropriately. diff --git a/libc/signal/sig_addset.c b/libc/signal/sig_addset.c index 392be1ca69..6205ef98c6 100644 --- a/libc/signal/sig_addset.c +++ b/libc/signal/sig_addset.c @@ -55,7 +55,7 @@ * set - Signal set to add signal to * signo - Signal to add * - * Return Value: + * Returned Value: * 0 (OK), or -1 (ERROR) if the signal number is invalid. * * Assumptions: diff --git a/libc/signal/sig_delset.c b/libc/signal/sig_delset.c index 9c6c608a2d..c38685fd72 100644 --- a/libc/signal/sig_delset.c +++ b/libc/signal/sig_delset.c @@ -55,7 +55,7 @@ * set - Signal set to delete the signal from * signo - Signal to delete * - * Return Value: + * Returned Value: * 0 (OK), or -1 (ERROR) if the signal number is invalid. * * Assumptions: diff --git a/libc/signal/sig_emptyset.c b/libc/signal/sig_emptyset.c index 01b398ad08..7614e6ec6e 100644 --- a/libc/signal/sig_emptyset.c +++ b/libc/signal/sig_emptyset.c @@ -53,7 +53,7 @@ * Parameters: * set - Signal set to initialize * - * Return Value: + * Returned Value: * 0 (OK), or -1 (ERROR) if the signal set cannot be initialized. * * Assumptions: diff --git a/libc/signal/sig_fillset.c b/libc/signal/sig_fillset.c index 2586646e37..a9344abb10 100644 --- a/libc/signal/sig_fillset.c +++ b/libc/signal/sig_fillset.c @@ -53,7 +53,7 @@ * Parameters: * set - Signal set to initalize * - * Return Value: + * Returned Value: * 0 (OK), or -1 (ERROR) if the signal set cannot be initialized. * * Assumptions: diff --git a/libc/signal/sig_ismember.c b/libc/signal/sig_ismember.c index 2fbac5f6c8..5624174e0e 100644 --- a/libc/signal/sig_ismember.c +++ b/libc/signal/sig_ismember.c @@ -54,7 +54,7 @@ * set - Signal set to test * signo - Signal to test for * - * Return Value: + * Returned Value: * 1 (true), if the specified signal is a member of the set, * 0 (OK or FALSE), if it is not, or * -1 (ERROR) if the signal number is invalid. diff --git a/libc/stdio/lib_ferror.c b/libc/stdio/lib_ferror.c index 4d324c8081..3bec087b6d 100644 --- a/libc/stdio/lib_ferror.c +++ b/libc/stdio/lib_ferror.c @@ -57,7 +57,7 @@ * This function will test if the last operation resulted in an eror. This * is used to disambiguate EOF and error conditions. * - * Return Value: + * Returned Value: * A non-zero value is returned to indicate the error condition. * ****************************************************************************/ diff --git a/libc/stdio/lib_fflush.c b/libc/stdio/lib_fflush.c index dd3e178316..032ee023f4 100644 --- a/libc/stdio/lib_fflush.c +++ b/libc/stdio/lib_fflush.c @@ -62,7 +62,7 @@ * * If the stream argument is NULL, fflush() flushes all open output streams. * - * Return: + * Returned Value: * OK on success EOF on failure (with errno set appropriately) * ****************************************************************************/ diff --git a/libc/stdio/lib_freopen.c b/libc/stdio/lib_freopen.c index 0fffc1bd96..950be9ce05 100644 --- a/libc/stdio/lib_freopen.c +++ b/libc/stdio/lib_freopen.c @@ -70,7 +70,7 @@ * The error indicator and eof indicator are automatically cleared (as if * clearerr was called). * - * Input Paramters: + * Input Parameters: * path - If non-NULL, refers to the name of the file to be opened. * mode - String describing the new file access mode * stream - Pointer to the type FILE to be reopened. diff --git a/libc/stdio/lib_libfflush.c b/libc/stdio/lib_libfflush.c index 29a44cfe22..22482eb879 100644 --- a/libc/stdio/lib_libfflush.c +++ b/libc/stdio/lib_libfflush.c @@ -65,7 +65,7 @@ * stream - the stream to flush * bforce - flush must be complete. * - * Return: + * Returned Value: * A negated errno value on failure, otherwise the number of bytes remaining * in the buffer. * diff --git a/libc/stdio/lib_libnoflush.c b/libc/stdio/lib_libnoflush.c index f862cd6874..b7daabb2d7 100644 --- a/libc/stdio/lib_libnoflush.c +++ b/libc/stdio/lib_libnoflush.c @@ -60,7 +60,7 @@ * lib_noflush() provides a common, dummy flush method for output streams * that are not flushable. * - * Return: + * Returned Value: * Always returns OK * ****************************************************************************/ diff --git a/libc/stdio/lib_libsnoflush.c b/libc/stdio/lib_libsnoflush.c index 652b977cf6..8d95fad48c 100644 --- a/libc/stdio/lib_libsnoflush.c +++ b/libc/stdio/lib_libsnoflush.c @@ -59,7 +59,7 @@ * lib_snoflush() provides a common, dummy flush method for seekable output * streams that are not flushable. * - * Return: + * Returned Value: * Always returns OK * ****************************************************************************/ diff --git a/libc/stdio/lib_lowoutstream.c b/libc/stdio/lib_lowoutstream.c index 8447051d39..1896660d35 100644 --- a/libc/stdio/lib_lowoutstream.c +++ b/libc/stdio/lib_lowoutstream.c @@ -76,7 +76,7 @@ static void lowoutstream_putc(FAR struct lib_outstream_s *this, int ch) * Description: * Initializes a stream for use with low-level, architecture-specific I/O. * - * Input parameters: + * Input Parameters: * stream - User allocated, uninitialized instance of struct * lib_lowoutstream_s to be initialized. * diff --git a/libc/stdio/lib_meminstream.c b/libc/stdio/lib_meminstream.c index 0fdcd8f92f..ef888d9e7d 100644 --- a/libc/stdio/lib_meminstream.c +++ b/libc/stdio/lib_meminstream.c @@ -81,7 +81,7 @@ static int meminstream_getc(FAR struct lib_instream_s *this) * Description: * Initializes a stream for use with a fixed-size memory buffer. * - * Input parameters: + * Input Parameters: * instream - User allocated, uninitialized instance of struct * lib_meminstream_s to be initialized. * bufstart - Address of the beginning of the fixed-size memory buffer diff --git a/libc/stdio/lib_memoutstream.c b/libc/stdio/lib_memoutstream.c index 28137d07ed..80b8a36609 100644 --- a/libc/stdio/lib_memoutstream.c +++ b/libc/stdio/lib_memoutstream.c @@ -78,7 +78,7 @@ static void memoutstream_putc(FAR struct lib_outstream_s *this, int ch) * Description: * Initializes a stream for use with a fixed-size memory buffer. * - * Input parameters: + * Input Parameters: * outstream - User allocated, uninitialized instance of struct * lib_memoutstream_s to be initialized. * bufstart - Address of the beginning of the fixed-size memory buffer diff --git a/libc/stdio/lib_memsistream.c b/libc/stdio/lib_memsistream.c index af241b4c2e..1bfda9ea2f 100644 --- a/libc/stdio/lib_memsistream.c +++ b/libc/stdio/lib_memsistream.c @@ -125,7 +125,7 @@ static off_t memsistream_seek(FAR struct lib_sistream_s *this, off_t offset, * Description: * Initializes a stream for use with a fixed-size memory buffer. * - * Input parameters: + * Input Parameters: * instream - User allocated, uninitialized instance of struct * lib_memsistream_s to be initialized. * bufstart - Address of the beginning of the fixed-size memory buffer diff --git a/libc/stdio/lib_memsostream.c b/libc/stdio/lib_memsostream.c index 93c19facad..93536a3406 100644 --- a/libc/stdio/lib_memsostream.c +++ b/libc/stdio/lib_memsostream.c @@ -122,7 +122,7 @@ static off_t memsostream_seek(FAR struct lib_sostream_s *this, off_t offset, * Description: * Initializes a stream for use with a fixed-size memory buffer. * - * Input parameters: + * Input Parameters: * outstream - User allocated, uninitialized instance of struct * lib_memsostream_s to be initialized. * bufstart - Address of the beginning of the fixed-size memory buffer diff --git a/libc/stdio/lib_nullinstream.c b/libc/stdio/lib_nullinstream.c index 9ca50d6379..67d930b8d8 100644 --- a/libc/stdio/lib_nullinstream.c +++ b/libc/stdio/lib_nullinstream.c @@ -62,7 +62,7 @@ static int nullinstream_getc(FAR struct lib_instream_s *this) * Initializes a NULL stream. The initialized stream will will return only * EOF. * - * Input parameters: + * Input Parameters: * nullinstream - User allocated, uninitialized instance of struct * lib_instream_s to be initialized. * diff --git a/libc/stdio/lib_nulloutstream.c b/libc/stdio/lib_nulloutstream.c index 47f2acd58a..1f92028e3c 100644 --- a/libc/stdio/lib_nulloutstream.c +++ b/libc/stdio/lib_nulloutstream.c @@ -64,7 +64,7 @@ static void nulloutstream_putc(FAR struct lib_outstream_s *this, int ch) * Initializes a NULL streams. The initialized stream will write all data * to the bit-bucket. * - * Input parameters: + * Input Parameters: * nulloutstream - User allocated, uninitialized instance of struct * lib_outstream_s to be initialized. * diff --git a/libc/stdio/lib_rawinstream.c b/libc/stdio/lib_rawinstream.c index e37f3630fd..a0e4919c27 100644 --- a/libc/stdio/lib_rawinstream.c +++ b/libc/stdio/lib_rawinstream.c @@ -104,7 +104,7 @@ static off_t rawsistream_seek(FAR struct lib_sistream_s *this, off_t offset, * Description: * Initializes a stream for use with a file descriptor. * - * Input parameters: + * Input Parameters: * instream - User allocated, uninitialized instance of struct * lib_rawsistream_s to be initialized. * fd - User provided file/socket descriptor (must have been opened diff --git a/libc/stdio/lib_rawoutstream.c b/libc/stdio/lib_rawoutstream.c index 69155fc15c..20e19e44a5 100644 --- a/libc/stdio/lib_rawoutstream.c +++ b/libc/stdio/lib_rawoutstream.c @@ -111,7 +111,7 @@ static off_t rawsostream_seek(FAR struct lib_sostream_s *this, off_t offset, * Description: * Initializes a stream for use with a file descriptor. * - * Input parameters: + * Input Parameters: * outstream - User allocated, uninitialized instance of struct * lib_rawsostream_s to be initialized. * fd - User provided file/socket descriptor (must have been opened diff --git a/libc/stdio/lib_rawsistream.c b/libc/stdio/lib_rawsistream.c index d332728c07..3d8d4fd1fe 100644 --- a/libc/stdio/lib_rawsistream.c +++ b/libc/stdio/lib_rawsistream.c @@ -91,7 +91,7 @@ static int rawinstream_getc(FAR struct lib_instream_s *this) * Description: * Initializes a stream for use with a file descriptor. * - * Input parameters: + * Input Parameters: * instream - User allocated, uninitialized instance of struct * lib_rawinstream_s to be initialized. * fd - User provided file/socket descriptor (must have been opened diff --git a/libc/stdio/lib_rawsostream.c b/libc/stdio/lib_rawsostream.c index 1579e1db6d..4f05a0bf74 100644 --- a/libc/stdio/lib_rawsostream.c +++ b/libc/stdio/lib_rawsostream.c @@ -98,7 +98,7 @@ static void rawoutstream_putc(FAR struct lib_outstream_s *this, int ch) * Description: * Initializes a stream for use with a file descriptor. * - * Input parameters: + * Input Parameters: * outstream - User allocated, uninitialized instance of struct * lib_rawoutstream_s to be initialized. * fd - User provided file/socket descriptor (must have been opened diff --git a/libc/stdio/lib_remove.c b/libc/stdio/lib_remove.c index 3c2c8e6d3f..4e3e4765d5 100644 --- a/libc/stdio/lib_remove.c +++ b/libc/stdio/lib_remove.c @@ -53,7 +53,7 @@ * The remove() function causes the object denoted by path to be removed. * The function is equivalent to unlink() or rmdir(). * - * Input Parmeters: + * Input Parameters: * path - A pointer to a file or directory to be removed. * * Returned Value: diff --git a/libc/stdio/lib_stdinstream.c b/libc/stdio/lib_stdinstream.c index f1b5f3da99..da57759530 100644 --- a/libc/stdio/lib_stdinstream.c +++ b/libc/stdio/lib_stdinstream.c @@ -77,7 +77,7 @@ static int stdinstream_getc(FAR struct lib_instream_s *this) * Description: * Initializes a stream for use with a FILE instance. * - * Input parameters: + * Input Parameters: * instream - User allocated, uninitialized instance of struct * lib_stdinstream_s to be initialized. * stream - User provided stream instance (must have been opened for diff --git a/libc/stdio/lib_stdoutstream.c b/libc/stdio/lib_stdoutstream.c index 4c77c745fc..10fd58b4fb 100644 --- a/libc/stdio/lib_stdoutstream.c +++ b/libc/stdio/lib_stdoutstream.c @@ -102,7 +102,7 @@ static int stdoutstream_flush(FAR struct lib_outstream_s *this) * Description: * Initializes a stream for use with a FILE instance. * - * Input parameters: + * Input Parameters: * outstream - User allocated, uninitialized instance of struct * lib_stdoutstream_s to be initialized. * stream - User provided stream instance (must have been opened for diff --git a/libc/stdio/lib_stdsistream.c b/libc/stdio/lib_stdsistream.c index b569bb4122..5fd2544729 100644 --- a/libc/stdio/lib_stdsistream.c +++ b/libc/stdio/lib_stdsistream.c @@ -90,7 +90,7 @@ static off_t stdsistream_seek(FAR struct lib_sistream_s *this, off_t offset, * Description: * Initializes a stream for use with a FILE instance. * - * Input parameters: + * Input Parameters: * instream - User allocated, uninitialized instance of struct * lib_stdsistream_s to be initialized. * stream - User provided stream instance (must have been opened for diff --git a/libc/stdio/lib_stdsostream.c b/libc/stdio/lib_stdsostream.c index 8654b63562..c7891f0e8c 100644 --- a/libc/stdio/lib_stdsostream.c +++ b/libc/stdio/lib_stdsostream.c @@ -115,7 +115,7 @@ static off_t stdsostream_seek(FAR struct lib_sostream_s *this, off_t offset, * Description: * Initializes a stream for use with a FILE instance. * - * Input parameters: + * Input Parameters: * outstream - User allocated, uninitialized instance of struct * lib_stdsostream_s to be initialized. * stream - User provided stream instance (must have been opened for diff --git a/libc/stdio/lib_zeroinstream.c b/libc/stdio/lib_zeroinstream.c index 506d005871..a9d543f4df 100644 --- a/libc/stdio/lib_zeroinstream.c +++ b/libc/stdio/lib_zeroinstream.c @@ -62,7 +62,7 @@ static int zeroinstream_getc(FAR struct lib_instream_s *this) * Initializes a NULL stream. The initialized stream will return an * infinitely long stream of zeroes. * - * Input parameters: + * Input Parameters: * zeroinstream - User allocated, uninitialized instance of struct * lib_instream_s to be initialized. * diff --git a/libc/stdlib/lib_abort.c b/libc/stdlib/lib_abort.c index f037e8d8cc..87751c5a45 100644 --- a/libc/stdlib/lib_abort.c +++ b/libc/stdlib/lib_abort.c @@ -87,7 +87,7 @@ * It does this by restoring the default disposition for SIGABRT and * then raising the signal for a second time. * - * Input parameters: + * Input Parameters: * None * * Returned Value: diff --git a/libc/stdlib/lib_checkbase.c b/libc/stdlib/lib_checkbase.c index a94140e81e..9d11a1d536 100644 --- a/libc/stdlib/lib_checkbase.c +++ b/libc/stdlib/lib_checkbase.c @@ -59,7 +59,7 @@ * Assumptions: * *ptr points to the first, non-whitespace character in the string. * - * Returns: + * Returned Value: * - if base is valid, the actual base to use, and pptr is updated to point * at the first digit. * - if base is invalid (<2 or >36), return -1. diff --git a/libc/stdlib/lib_ptsname.c b/libc/stdlib/lib_ptsname.c index 54cdabd69e..af08e494de 100644 --- a/libc/stdlib/lib_ptsname.c +++ b/libc/stdlib/lib_ptsname.c @@ -54,7 +54,7 @@ * The ptsname() function returns the name of the slave pseudoterminal * device corresponding to the master referred to by fd. * - * Returned Values: + * Returned Value: * On success, ptsname() returns a pointer to a string in static storage * which will be overwritten by subsequent calls. This pointer must not * be freed. On failure, NULL is returned. diff --git a/libc/stdlib/lib_ptsnamer.c b/libc/stdlib/lib_ptsnamer.c index e5df9c0ec7..17a1ad4b3c 100644 --- a/libc/stdlib/lib_ptsnamer.c +++ b/libc/stdlib/lib_ptsnamer.c @@ -59,7 +59,7 @@ * terminated string in the buffer pointed to by buf. The buflen * argument specifies the number of bytes available in buf. * - * Returned Values: + * Returned Value: * On success, ptsname_r() returns 0. On failure, a nonzero value is * returned and errno is set to indicate the error. * diff --git a/libc/stdlib/lib_strtol.c b/libc/stdlib/lib_strtol.c index 2c6c6a24de..411f7d6d41 100644 --- a/libc/stdlib/lib_strtol.c +++ b/libc/stdlib/lib_strtol.c @@ -61,7 +61,7 @@ * nptr to a long integer value according to the given base, which must be * between 2 and 36 inclusive, or be the special value 0. * - * Returns: + * Returned Value: * - The converted value, if the base and number are valid * - 0 if an error occurs, and set errno to: * * EINVAL if base < 2 or base > 36 diff --git a/libc/stdlib/lib_strtoll.c b/libc/stdlib/lib_strtoll.c index a5f8b2cdc3..865af86a21 100644 --- a/libc/stdlib/lib_strtoll.c +++ b/libc/stdlib/lib_strtoll.c @@ -63,7 +63,7 @@ * nptr to a long long integer value according to the given base, which * must be between 2 and 36 inclusive, or be the special value 0. * - * Returns: + * Returned Value: * - The converted value, if the base and number are valid * - 0 if an error occurs, and set errno to: * * EINVAL if base < 2 or base > 36 diff --git a/libc/stdlib/lib_strtoul.c b/libc/stdlib/lib_strtoul.c index 8828aa830c..82ea183d73 100644 --- a/libc/stdlib/lib_strtoul.c +++ b/libc/stdlib/lib_strtoul.c @@ -56,7 +56,7 @@ * nptr to a long unsigned integer value according to the given base, which * must be between 2 and 36 inclusive, or be the special value 0. * - * Returns: + * Returned Value: * - The converted value, if the base and number are valid * - 0 if an error occurs, and set errno to: * * EINVAL if base < 2 or base > 36 diff --git a/libc/stdlib/lib_strtoull.c b/libc/stdlib/lib_strtoull.c index fe13b63249..1896aec570 100644 --- a/libc/stdlib/lib_strtoull.c +++ b/libc/stdlib/lib_strtoull.c @@ -59,7 +59,7 @@ * nptr to a long unsigned integer value according to the given base, which * must be between 2 and 36 inclusive, or be the special value 0. * - * Returns: + * Returned Value: * - The converted value, if the base and number are valid * - 0 if an error occurs, and set errno to: * * EINVAL if base < 2 or base > 36 diff --git a/libc/stdlib/lib_unlockpt.c b/libc/stdlib/lib_unlockpt.c index 8ea6e4c7ef..0626d86571 100644 --- a/libc/stdlib/lib_unlockpt.c +++ b/libc/stdlib/lib_unlockpt.c @@ -57,7 +57,7 @@ * unlockpt() must be called before opening the slave side of a * pseudoterminal. * - * Returned Values: + * Returned Value: * When successful, unlockpt() returns 0. Otherwise, it returns -1 and * sets errno appropriately. * diff --git a/libc/string/lib_stpcpy.c b/libc/string/lib_stpcpy.c index dd2917f7bc..edfdd4ca00 100644 --- a/libc/string/lib_stpcpy.c +++ b/libc/string/lib_stpcpy.c @@ -52,7 +52,7 @@ * Copies the string pointed to by 'src' (including the terminating NUL * character) into the array pointed to by 'dest'. * - * Returned value: + * Returned Value: * The stpcpy() function returns a pointer to the terminating NUL * character copied into the 'dest' buffer * diff --git a/libc/string/lib_strcpy.c b/libc/string/lib_strcpy.c index a329dc2925..9c1b197a61 100644 --- a/libc/string/lib_strcpy.c +++ b/libc/string/lib_strcpy.c @@ -52,7 +52,7 @@ * Copies the string pointed to by 'src' (including the terminating NUL * character) into the array pointed to by 'des'. * - * Returned value: + * Returned Value: * The strcpy() function returns the 'dest' pointer * ****************************************************************************/ diff --git a/libc/string/lib_strtok.c b/libc/string/lib_strtok.c index 9373265558..8821a7d7ea 100644 --- a/libc/string/lib_strtok.c +++ b/libc/string/lib_strtok.c @@ -75,7 +75,7 @@ static char *g_saveptr = NULL; * end of the string are ignored. The tokens returned by * strtok() are always non-empty strings. * - * Return + * Returned Value: * strtok() returns a pointer to the next token, or NULL * if there are no more tokens. * diff --git a/libc/string/lib_strtokr.c b/libc/string/lib_strtokr.c index 22579f91ee..c179521961 100644 --- a/libc/string/lib_strtokr.c +++ b/libc/string/lib_strtokr.c @@ -84,7 +84,7 @@ * end of the string are ignored. The tokens returned by * strtok() are always non-empty strings. * - * Return + * Returned Value: * strtok_r() returns a pointer to the next token, or NULL * if there are no more tokens. * diff --git a/libc/time/lib_asctime.c b/libc/time/lib_asctime.c index af633ebd73..3ddf1074f8 100644 --- a/libc/time/lib_asctime.c +++ b/libc/time/lib_asctime.c @@ -58,7 +58,7 @@ * Parameters: * tp - Pointer to the time to be converted. * - * Return Value: + * Returned Value: * One success a pointer to the string is returned; on failure, NULL is * returned. * diff --git a/libc/time/lib_asctimer.c b/libc/time/lib_asctimer.c index 11b25974fa..bebbd21a12 100644 --- a/libc/time/lib_asctimer.c +++ b/libc/time/lib_asctimer.c @@ -78,7 +78,7 @@ static const char * const g_mon_name[12] = * tp - Pointer to the time to be converted. * buf - A user provided buffer to receive the 26 character time string. * - * Return Value: + * Returned Value: * One success, the pointer to the 'buf' is returned; on failure, NULL is * returned. * diff --git a/libc/time/lib_ctime.c b/libc/time/lib_ctime.c index 4072663fb8..1151382816 100644 --- a/libc/time/lib_ctime.c +++ b/libc/time/lib_ctime.c @@ -58,7 +58,7 @@ * Parameters: * timep - The current time represented as seconds since the epoch. * - * Return Value: + * Returned Value: * One success a pointer to the string is returned; on failure, NULL is * returned. * diff --git a/libc/time/lib_ctimer.c b/libc/time/lib_ctimer.c index ccc9c8f928..1286976c6d 100644 --- a/libc/time/lib_ctimer.c +++ b/libc/time/lib_ctimer.c @@ -63,7 +63,7 @@ * timep - The current time represented as seconds since the epoch. * buf - A user provided buffer to receive the 26 character time string. * - * Return Value: + * Returned Value: * One success, the pointer to the 'buf' is returned; on failure, NULL is * returned. * diff --git a/libc/time/lib_dayofweek.c b/libc/time/lib_dayofweek.c index 981e027025..9549dc3e44 100644 --- a/libc/time/lib_dayofweek.c +++ b/libc/time/lib_dayofweek.c @@ -90,7 +90,7 @@ * month - The month of the year 1 - 12 * year - the year including the 1900 * - * Returned value: + * Returned Value: * Zero based day of the week 0-6, 0 = Sunday, 1 = Monday... 6 = Saturday * ****************************************************************************/ diff --git a/libc/time/lib_gettimeofday.c b/libc/time/lib_gettimeofday.c index 6a1f01d16e..89a8caefd8 100644 --- a/libc/time/lib_gettimeofday.c +++ b/libc/time/lib_gettimeofday.c @@ -64,7 +64,7 @@ * tv - The location to return the current time * tz - Ignored * - * Returned value: + * Returned Value: * Zero (OK) on success; -1 is returned on failure with the errno variable * set appropriately. * diff --git a/libc/time/lib_settimeofday.c b/libc/time/lib_settimeofday.c index a36f32911b..1fc96d5ec7 100644 --- a/libc/time/lib_settimeofday.c +++ b/libc/time/lib_settimeofday.c @@ -63,7 +63,7 @@ * tv - The net to time to be set * tz - Ignored * - * Returned value: + * Returned Value: * Zero (OK) on success; -1 is returned on failure with the errno variable * set appropriately. * diff --git a/libc/time/lib_time.c b/libc/time/lib_time.c index 504f7795f9..683d8a71b9 100644 --- a/libc/time/lib_time.c +++ b/libc/time/lib_time.c @@ -63,7 +63,7 @@ * parameter is not used, but a time_t object is still returned by the * function. * - * Return Value: + * Returned Value: * The current calendar time as a time_t object. If the argument is not * a null pointer, the return value is the same as the one stored in the * location pointed by the argument. diff --git a/libc/unistd/lib_chdir.c b/libc/unistd/lib_chdir.c index 16786a0f31..b87a3ebb82 100644 --- a/libc/unistd/lib_chdir.c +++ b/libc/unistd/lib_chdir.c @@ -90,7 +90,7 @@ static inline void _trimdir(char *path) * is, the starting point for path searches for pathnames not beginning * with '/'. * - * Input Parmeters: + * Input Parameters: * path - A pointer to a directory to use as the new current working * directory * diff --git a/libc/unistd/lib_getcwd.c b/libc/unistd/lib_getcwd.c index 55587a599e..9a04de995c 100644 --- a/libc/unistd/lib_getcwd.c +++ b/libc/unistd/lib_getcwd.c @@ -71,7 +71,7 @@ * symbolic links. The 'size' argument is the size in bytes of the * character array pointed to by the 'buf' argument. * - * Input Parmeters: + * Input Parameters: * buf - a pointer to the location in which the current working directory * pathaname is returned. * size - The size in bytes avaiable at 'buf' diff --git a/libc/unistd/lib_getopt.c b/libc/unistd/lib_getopt.c index 47ac085509..8826588eca 100644 --- a/libc/unistd/lib_getopt.c +++ b/libc/unistd/lib_getopt.c @@ -101,13 +101,14 @@ static bool g_binitialized = false; * errors are returned ('?' or ':') until getopt() finally returns -1. * (You can also set optind to -1 to force a reset). * - * Return: If an option was successfully found, then getopt() returns the - * option character. If all command-line options have been parsed, then - * getopt() returns -1. If getopt() encounters an option character that - * was not in optstring, then '?' is returned. If getopt() encounters an - * option with a missing argument, then the return value depends on the - * first character in optstring: if it is ':', then ':' is returned; - * otherwise '?' is returned. + * Return Value: + * If an option was successfully found, then getopt() returns the option + * haracter. If all command-line options have been parsed, then getopt() + * returns -1. If getopt() encounters an option character that was not + * in optstring, then '?' is returned. If getopt() encounters an option + * with a missing argument, then the return value depends on the first + * character in optstring: if it is ':', then ':' is returned; otherwise + * '?' is returned. * ****************************************************************************/ diff --git a/libc/unistd/lib_pipe.c b/libc/unistd/lib_pipe.c index 469dd5a1d5..dc251b33c8 100644 --- a/libc/unistd/lib_pipe.c +++ b/libc/unistd/lib_pipe.c @@ -57,11 +57,11 @@ * and places them in the array pointed to by 'fd'. fd[0] is for reading, * fd[1] is for writing. * - * Inputs: + * Input Parameters: * fd[2] - The user provided array in which to catch the pipe file * descriptors * - * Return: + * Returned Value: * 0 is returned on success; otherwise, -1 is returned with errno set * appropriately. * diff --git a/libc/userfs/lib_userfs.c b/libc/userfs/lib_userfs.c index 8f04c21f1d..f08b936375 100644 --- a/libc/userfs/lib_userfs.c +++ b/libc/userfs/lib_userfs.c @@ -901,7 +901,7 @@ static inline int userfs_destroy_dispatch(FAR struct userfs_info_s *info, * NOTE: This is a user function that is implemented as part of the * NuttX C library and is intended to be called by appliation logic. * - * Input parameters: + * Input Parameters: * mountpt - Mountpoint path * userops - The caller operations that implement the file system * interface. diff --git a/libc/wqueue/work_cancel.c b/libc/wqueue/work_cancel.c index 31ccbf68d3..c035307056 100644 --- a/libc/wqueue/work_cancel.c +++ b/libc/wqueue/work_cancel.c @@ -62,7 +62,7 @@ * After work has been cancelled, it may be re-queue by calling work_queue() * again. * - * Input parameters: + * Input Parameters: * qid - The work queue ID * work - The previously queue work structure to cancel * @@ -124,7 +124,7 @@ static int work_qcancel(FAR struct usr_wqueue_s *wqueue, FAR struct work_s *work * user mode work queue. After work has been cancelled, it may be re-queue * by calling work_queue() again. * - * Input parameters: + * Input Parameters: * qid - The work queue ID (must be USRWORK) * work - The previously queue work structure to cancel * diff --git a/libc/wqueue/work_lock.c b/libc/wqueue/work_lock.c index eec61847ac..8b8a5682c0 100644 --- a/libc/wqueue/work_lock.c +++ b/libc/wqueue/work_lock.c @@ -58,7 +58,7 @@ * Description: * Lock the user-mode work queue. * - * Input parameters: + * Input Parameters: * None * * Returned Value: @@ -98,7 +98,7 @@ int work_lock(void) * Description: * Unlock the user-mode work queue. * - * Input parameters: + * Input Parameters: * None * * Returned Value: diff --git a/libc/wqueue/work_queue.c b/libc/wqueue/work_queue.c index 5b9a0ac3e4..40cbdf5635 100644 --- a/libc/wqueue/work_queue.c +++ b/libc/wqueue/work_queue.c @@ -70,7 +70,7 @@ * from the queue, or (2) work_cancel() has been called to cancel the work * and remove it from the work queue. * - * Input parameters: + * Input Parameters: * qid - The work queue ID (index) * work - The work structure to queue * worker - The worker callback to be invoked. The callback will invoked @@ -141,7 +141,7 @@ static int work_qqueue(FAR struct usr_wqueue_s *wqueue, * previous work as been performed and removed from the queue, then any * pending work will be canceled and lost. * - * Input parameters: + * Input Parameters: * qid - The work queue ID (index) * work - The work structure to queue * worker - The worker callback to be invoked. The callback will invoked diff --git a/libc/wqueue/work_signal.c b/libc/wqueue/work_signal.c index 53fc8f829d..1854210cc5 100644 --- a/libc/wqueue/work_signal.c +++ b/libc/wqueue/work_signal.c @@ -79,7 +79,7 @@ * is used internally by the work logic but could also be used by the * user to force an immediate re-assessment of pending work. * - * Input parameters: + * Input Parameters: * qid - The work queue ID * * Returned Value: diff --git a/libc/wqueue/work_usrthread.c b/libc/wqueue/work_usrthread.c index 5e919d8e0a..bb62a8d645 100644 --- a/libc/wqueue/work_usrthread.c +++ b/libc/wqueue/work_usrthread.c @@ -106,7 +106,7 @@ pthread_mutex_t g_usrmutex; * part of the internal implementation of each work queue; it should not * be called from application level logic. * - * Input parameters: + * Input Parameters: * wqueue - Describes the work queue to be processed * * Returned Value: @@ -285,7 +285,7 @@ void work_process(FAR struct usr_wqueue_s *wqueue) * miscellaneous operations. The user work thread must be started by * application start-up logic by calling work_usrstart(). * - * Input parameters: + * Input Parameters: * argc, argv (not used) * * Returned Value: @@ -327,7 +327,7 @@ static pthread_addr_t work_usrthread(pthread_addr_t arg) * Description: * Start the user mode work queue. * - * Input parameters: + * Input Parameters: * None * * Returned Value: diff --git a/libc/wqueue/wqueue.h b/libc/wqueue/wqueue.h index 6075ea00e8..f16574e663 100644 --- a/libc/wqueue/wqueue.h +++ b/libc/wqueue/wqueue.h @@ -92,7 +92,7 @@ extern pthread_mutex_t g_usrmutex; * Description: * Lock the user-mode work queue. * - * Input parameters: + * Input Parameters: * None * * Returned Value: @@ -111,7 +111,7 @@ int work_lock(void); * Description: * Unlock the user-mode work queue. * - * Input parameters: + * Input Parameters: * None * * Returned Value: diff --git a/libnx/nx/nx_drawcircle.c b/libnx/nx/nx_drawcircle.c index c06413b458..0502747971 100644 --- a/libnx/nx/nx_drawcircle.c +++ b/libnx/nx/nx_drawcircle.c @@ -102,7 +102,7 @@ * width - The width of the line * color - The color to use to fill the line * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nx/nx_drawline.c b/libnx/nx/nx_drawline.c index 6ca0ade436..ecd0df074f 100644 --- a/libnx/nx/nx_drawline.c +++ b/libnx/nx/nx_drawline.c @@ -86,7 +86,7 @@ * caps - Draw a circular cap on the ends of the line to support better * line joins * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nx/nx_fillcircle.c b/libnx/nx/nx_fillcircle.c index 7bfa1551f5..adec60a406 100644 --- a/libnx/nx/nx_fillcircle.c +++ b/libnx/nx/nx_fillcircle.c @@ -84,7 +84,7 @@ * radius - The radius of the circle in pixels. * color - The color to use to fill the circle. * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxfonts/nxfonts_cache.c b/libnx/nxfonts/nxfonts_cache.c index fbf99eca87..6276b91dc7 100644 --- a/libnx/nxfonts/nxfonts_cache.c +++ b/libnx/nxfonts/nxfonts_cache.c @@ -639,7 +639,7 @@ nxf_findcache(enum nx_fontid_e fontid, nxgl_mxpixel_t fgcolor, * bpp - Bits per pixel * maxglyphs - Maximum number of glyphs permitted in the cache * - * Returned value: + * Returned Value: * On success a non-NULL handle is returned that then may sequently be * used with nxf_getglyph() to extract fonts from the font cache. NULL * returned on any failure with the errno value set to indicate the nature @@ -798,7 +798,7 @@ errout_with_lock: * Input Parameters: * fhandle - A font cache handle previously returned by nxf_cache_connect(); * - * Returned value: + * Returned Value: * None * ****************************************************************************/ @@ -876,7 +876,7 @@ void nxf_cache_disconnect(FCACHE fhandle) * Input Parameters: * fhandle - A font cache handle previously returned by nxf_cache_connect(); * - * Returned value: + * Returned Value: * Zero (OK) is returned if the metrics were * * Returned Value: diff --git a/libnx/nxglib/nxglib_circlepts.c b/libnx/nxglib/nxglib_circlepts.c index 21d2340a71..a7132ce5f5 100644 --- a/libnx/nxglib/nxglib_circlepts.c +++ b/libnx/nxglib/nxglib_circlepts.c @@ -89,13 +89,13 @@ * circumference of the circle. These points may then be used by * nx_drawcircle() or related APIs to draw a circle outline. * - * Input parameters: + * Input Parameters: * center - A pointer to the point that is the center of the circle * radius - The radius of the circle in pixels. * circle - A pointer the first entry in an array of 16 points where the * circle points will be returned. * - * Returned value: + * Returned Value: * None * ****************************************************************************/ diff --git a/libnx/nxglib/nxglib_circletraps.c b/libnx/nxglib/nxglib_circletraps.c index f7038703ba..158c044e4e 100644 --- a/libnx/nxglib/nxglib_circletraps.c +++ b/libnx/nxglib/nxglib_circletraps.c @@ -68,13 +68,13 @@ * Given a description of a a circle, return 8 trapezoids that can be * used to fill the circle by nx_fillcircle() and other interfaces. * - * Input parameters: + * Input Parameters: * center - A pointer to the point that is the center of the circle * radius - The radius of the circle in pixels. * circle - A pointer the first entry in an array of 8 trapezoids where * the circle description will be returned. * - * Returned value: + * Returned Value: * None * ****************************************************************************/ diff --git a/libnx/nxglib/nxglib_splitline.c b/libnx/nxglib/nxglib_splitline.c index 31b5d914bd..10bffa257b 100644 --- a/libnx/nxglib/nxglib_splitline.c +++ b/libnx/nxglib/nxglib_splitline.c @@ -104,12 +104,12 @@ static b16_t nxgl_interpolate(b16_t x, b16_t dy, b16_t dxdy) * this case, 3 trapezoids will be returned, but traps[1] will be * degenerate. * - * Input parameters: + * Input Parameters: * vector - A pointer to the vector described the line to be drawn. * traps - A pointer to a array of trapezoids (size 3). * rect - A pointer to a rectangle. * - * Returned value: + * Returned Value: * 0: Line successfully broken up into three trapezoids. Values in * traps[0], traps[1], and traps[2] are valid. * 1: Line successfully represented by one trapezoid. Value in traps[1] diff --git a/libnx/nxmu/nx_bitmap.c b/libnx/nxmu/nx_bitmap.c index 2c455d424b..e1fcb8451b 100644 --- a/libnx/nxmu/nx_bitmap.c +++ b/libnx/nxmu/nx_bitmap.c @@ -69,7 +69,7 @@ * may lie outside of the display. * stride - The width of the full source image in pixels. * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxmu/nx_block.c b/libnx/nxmu/nx_block.c index 4569a195ad..2bf8efa64c 100644 --- a/libnx/nxmu/nx_block.c +++ b/libnx/nxmu/nx_block.c @@ -74,7 +74,7 @@ * arg - An argument that will accompany the block messages (This is arg2 * in the blocked callback). * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxmu/nx_closewindow.c b/libnx/nxmu/nx_closewindow.c index 6e5661f6b4..b0aac838b7 100644 --- a/libnx/nxmu/nx_closewindow.c +++ b/libnx/nxmu/nx_closewindow.c @@ -60,7 +60,7 @@ * Input Parameters: * wnd - The window to be destroyed * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxmu/nx_connect.c b/libnx/nxmu/nx_connect.c index e69580bce8..d600666e8a 100644 --- a/libnx/nxmu/nx_connect.c +++ b/libnx/nxmu/nx_connect.c @@ -93,7 +93,7 @@ static uint32_t g_nxcid = 1; * Input Parameters: * svrmqname - The name for the server incoming message queue * - * Return: + * Returned Value: * Success: A non-NULL handle used with subsequent NX accesses * Failure: NULL is returned and errno is set appropriately * diff --git a/libnx/nxmu/nx_constructwindow.c b/libnx/nxmu/nx_constructwindow.c index cc8b1656b1..3cfd88c12e 100644 --- a/libnx/nxmu/nx_constructwindow.c +++ b/libnx/nxmu/nx_constructwindow.c @@ -75,7 +75,7 @@ * cb - Callbacks used to process window events * arg - User provided value that will be returned with NX callbacks. * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately. In the * case of ERROR, NX will have deallocated the pre-allocated window. * diff --git a/libnx/nxmu/nx_disconnect.c b/libnx/nxmu/nx_disconnect.c index 6b1877efc3..2b6a9638e9 100644 --- a/libnx/nxmu/nx_disconnect.c +++ b/libnx/nxmu/nx_disconnect.c @@ -61,7 +61,7 @@ * Input Parameters: * handle - the handle returned by nx_connect * - * Return: + * Returned Value: * OK on success; ERROR on failure with the errno set appropriately. * NOTE that handle will no long be valid upon return. * diff --git a/libnx/nxmu/nx_eventhandler.c b/libnx/nxmu/nx_eventhandler.c index a82b10839a..bc6a746850 100644 --- a/libnx/nxmu/nx_eventhandler.c +++ b/libnx/nxmu/nx_eventhandler.c @@ -108,7 +108,7 @@ static inline void nx_disconnected(FAR struct nxfe_conn_s *conn) * Input Parameters: * handle - the handle returned by nx_connect * - * Return: + * Returned Value: * OK: No errors occurred. If CONFIG_NX_BLOCKING is defined, then * one or more server message was processed. * ERROR: An error occurred and errno has been set appropriately. Of diff --git a/libnx/nxmu/nx_eventnotify.c b/libnx/nxmu/nx_eventnotify.c index 70653f62e2..a136774349 100644 --- a/libnx/nxmu/nx_eventnotify.c +++ b/libnx/nxmu/nx_eventnotify.c @@ -69,7 +69,7 @@ * Input Parameters: * handle - the handle returned by nx_connect * - * Return: + * Returned Value: * OK: No errors occurred. If CONFIG_NX_BLOCKING is defined, then * one or more server message was processed. * ERROR: An error occurred and errno has been set appropriately diff --git a/libnx/nxmu/nx_fill.c b/libnx/nxmu/nx_fill.c index bb59f6b281..d8a6231caf 100644 --- a/libnx/nxmu/nx_fill.c +++ b/libnx/nxmu/nx_fill.c @@ -63,7 +63,7 @@ * rect - The location to be filled * color - The color to use in the fill * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxmu/nx_filltrapezoid.c b/libnx/nxmu/nx_filltrapezoid.c index 6dbdf27ab3..a9c8508429 100644 --- a/libnx/nxmu/nx_filltrapezoid.c +++ b/libnx/nxmu/nx_filltrapezoid.c @@ -64,7 +64,7 @@ * trap - The trapezoidal region to be filled * color - The color to use in the fill * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxmu/nx_getposition.c b/libnx/nxmu/nx_getposition.c index d18d1d3a59..757c1621c5 100644 --- a/libnx/nxmu/nx_getposition.c +++ b/libnx/nxmu/nx_getposition.c @@ -61,7 +61,7 @@ * Input Parameters: * hwnd - The window handle * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxmu/nx_getrectangle.c b/libnx/nxmu/nx_getrectangle.c index 958a1e05e8..fb1843b52d 100644 --- a/libnx/nxmu/nx_getrectangle.c +++ b/libnx/nxmu/nx_getrectangle.c @@ -68,7 +68,7 @@ * dest - The location to copy the memory region * deststride - The width, in bytes, of the dest memory * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxmu/nx_lower.c b/libnx/nxmu/nx_lower.c index 06952d17f7..8d0ceca40d 100644 --- a/libnx/nxmu/nx_lower.c +++ b/libnx/nxmu/nx_lower.c @@ -56,10 +56,10 @@ * Description: * Lower the specified window to the bottom of the display. * - * Input parameters: + * Input Parameters: * hwnd - the window to be lowered * - * Returned value: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxmu/nx_move.c b/libnx/nxmu/nx_move.c index 144e9e588b..71a4ca7f44 100644 --- a/libnx/nxmu/nx_move.c +++ b/libnx/nxmu/nx_move.c @@ -61,7 +61,7 @@ * rect - Describes the rectangular region to move * offset - The offset to move the region * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxmu/nx_openwindow.c b/libnx/nxmu/nx_openwindow.c index 3280ee4225..d5152192b7 100644 --- a/libnx/nxmu/nx_openwindow.c +++ b/libnx/nxmu/nx_openwindow.c @@ -63,7 +63,7 @@ * cb - Callbacks used to process window events * arg - User provided value that will be returned with NX callbacks. * - * Return: + * Returned Value: * Success: A non-NULL handle used with subsequent NX accesses * Failure: NULL is returned and errno is set appropriately * diff --git a/libnx/nxmu/nx_raise.c b/libnx/nxmu/nx_raise.c index a149acdb28..92f82d456d 100644 --- a/libnx/nxmu/nx_raise.c +++ b/libnx/nxmu/nx_raise.c @@ -56,10 +56,10 @@ * Description: * Bring the specified window to the top of the display. * - * Input parameters: + * Input Parameters: * hwnd - the window to be raised * - * Returned value: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxmu/nx_releasebkgd.c b/libnx/nxmu/nx_releasebkgd.c index 9fe9a44c71..22620193ce 100644 --- a/libnx/nxmu/nx_releasebkgd.c +++ b/libnx/nxmu/nx_releasebkgd.c @@ -60,7 +60,7 @@ * Input Parameters: * hwnd - The handle returned (indirectly) by nx_requestbkgd * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxmu/nx_requestbkgd.c b/libnx/nxmu/nx_requestbkgd.c index 77a4ae8ed5..d3eff5c553 100644 --- a/libnx/nxmu/nx_requestbkgd.c +++ b/libnx/nxmu/nx_requestbkgd.c @@ -84,7 +84,7 @@ * cb - Callbacks to use for processing background window events * arg - User provided argument (see nx_openwindow, nx_constructwindow) * - * Return: + * Returned Value: * OK: Success; ERROR of failure with errno set appropriately. * ****************************************************************************/ diff --git a/libnx/nxmu/nx_setbgcolor.c b/libnx/nxmu/nx_setbgcolor.c index 74c683acf3..43d74187a8 100644 --- a/libnx/nxmu/nx_setbgcolor.c +++ b/libnx/nxmu/nx_setbgcolor.c @@ -59,7 +59,7 @@ * handle - The connection handle * color - The color to use in the background * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxmu/nx_setpixel.c b/libnx/nxmu/nx_setpixel.c index 376f85b04c..bef3768073 100644 --- a/libnx/nxmu/nx_setpixel.c +++ b/libnx/nxmu/nx_setpixel.c @@ -64,7 +64,7 @@ * pos - The pixel location to be set * col - The color to use in the set * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxmu/nx_setposition.c b/libnx/nxmu/nx_setposition.c index a537d1b79a..e8d6887271 100644 --- a/libnx/nxmu/nx_setposition.c +++ b/libnx/nxmu/nx_setposition.c @@ -60,7 +60,7 @@ * hwnd - The window handle * pos - The new position of the window * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxmu/nx_setsize.c b/libnx/nxmu/nx_setsize.c index dd2ee119ff..7a73710d9e 100644 --- a/libnx/nxmu/nx_setsize.c +++ b/libnx/nxmu/nx_setsize.c @@ -60,7 +60,7 @@ * hwnd - The window handle * size - The new size of the window. * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxmu/nxmu_sendserver.c b/libnx/nxmu/nxmu_sendserver.c index 2072ad2894..833d03f9d9 100644 --- a/libnx/nxmu/nxmu_sendserver.c +++ b/libnx/nxmu/nxmu_sendserver.c @@ -61,7 +61,7 @@ * msg - A pointer to the message to send * msglen - The length of the message in bytes. * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxmu/nxmu_sendwindow.c b/libnx/nxmu/nxmu_sendwindow.c index 350fecd41d..aa59204249 100644 --- a/libnx/nxmu/nxmu_sendwindow.c +++ b/libnx/nxmu/nxmu_sendwindow.c @@ -62,7 +62,7 @@ * msg - A pointer to the message to send * msglen - The length of the message in bytes. * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxtk/nxtk.h b/libnx/nxtk/nxtk.h index 44d507ee01..97f5b486ec 100644 --- a/libnx/nxtk/nxtk.h +++ b/libnx/nxtk/nxtk.h @@ -125,13 +125,13 @@ void nxtk_setsubwindows(FAR struct nxtk_framedwindow_s *fwnd); * then move the rectangle to that it is relative to the containing * window. * - * Input parameters: + * Input Parameters: * fwnd - The framed window to be used * dest - The locaton to put the result * src - The src rectangle in relative sub-window coordinates * bounds - The subwindow bounds in absolute screen coordinates. * - * Returned value: + * Returned Value: * None * ****************************************************************************/ @@ -152,13 +152,13 @@ void nxtk_subwindowclip(FAR struct nxtk_framedwindow_s *fwnd, * relative to the sub-window (i.e., (0,0) is the top left corner of the * sub-window). * - * Input parameters: + * Input Parameters: * fwnd - The framed window to be used * dest - The location to put the result * src - The src rectangle in relative container-window coordinates * bounds - The subwindow bounds in absolute screen coordinates. * - * Returned value: + * Returned Value: * None * ****************************************************************************/ @@ -185,7 +185,7 @@ void nxtk_containerclip(FAR struct nxtk_framedwindow_s *fwnd, * srcoffset - The offset to move the region * bounds - The subwindow bounds in absolute screen coordinates. * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -203,13 +203,13 @@ void nxtk_subwindowmove(FAR struct nxtk_framedwindow_s *fwnd, * Description: * Redraw the window frame. * - * Input parameters: + * Input Parameters: * fwnd - the framed window whose frame needs to be re-drawn. This must * have been previously created by nxtk_openwindow(). * bounds - Only draw the ports of the frame within this bounding box. * (window relative coordinates). * - * Returned value: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxtk/nxtk_bitmaptoolbar.c b/libnx/nxtk/nxtk_bitmaptoolbar.c index 6f31d93009..6ba5d383c9 100644 --- a/libnx/nxtk/nxtk_bitmaptoolbar.c +++ b/libnx/nxtk/nxtk_bitmaptoolbar.c @@ -89,7 +89,7 @@ * origin may lie outside of the sub-window display. * stride - The width of the full source image in pixels. * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxtk/nxtk_bitmapwindow.c b/libnx/nxtk/nxtk_bitmapwindow.c index 0371715ba7..8ba53f9485 100644 --- a/libnx/nxtk/nxtk_bitmapwindow.c +++ b/libnx/nxtk/nxtk_bitmapwindow.c @@ -89,7 +89,7 @@ * origin may lie outside of the sub-window display. * stride - The width of the full source image in pixels. * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxtk/nxtk_block.c b/libnx/nxtk/nxtk_block.c index d68dbe8fc2..625e862d17 100644 --- a/libnx/nxtk/nxtk_block.c +++ b/libnx/nxtk/nxtk_block.c @@ -71,7 +71,7 @@ * arg - An argument that will accompany the block messages (This is arg2 * in the blocked callback). * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxtk/nxtk_closetoolbar.c b/libnx/nxtk/nxtk_closetoolbar.c index 7be217d18d..ed4cbb190a 100644 --- a/libnx/nxtk/nxtk_closetoolbar.c +++ b/libnx/nxtk/nxtk_closetoolbar.c @@ -81,7 +81,7 @@ * Input Parameters: * hfwnd - The handle returned by nxtk_openwindow * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxtk/nxtk_closewindow.c b/libnx/nxtk/nxtk_closewindow.c index 5485752130..cf2e6ad90b 100644 --- a/libnx/nxtk/nxtk_closewindow.c +++ b/libnx/nxtk/nxtk_closewindow.c @@ -82,7 +82,7 @@ * Input Parameters: * hfwnd - The handle returned by nxtk_openwindow * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxtk/nxtk_containerclip.c b/libnx/nxtk/nxtk_containerclip.c index 67ed6cb17b..42951f470b 100644 --- a/libnx/nxtk/nxtk_containerclip.c +++ b/libnx/nxtk/nxtk_containerclip.c @@ -83,13 +83,13 @@ * relative to the sub-window (i.e., (0,0) is the top left corner of the * sub-window). * - * Input parameters: + * Input Parameters: * fwnd - The framed window to be used * dest - The locaton to put the result * src - The src rectangle in relative container-window coordinates * bounds - The subwindow bounds in absolute screen coordinates. * - * Returned value: + * Returned Value: * None * ****************************************************************************/ diff --git a/libnx/nxtk/nxtk_drawcircletoolbar.c b/libnx/nxtk/nxtk_drawcircletoolbar.c index 37998b70f8..69ea9a67ca 100644 --- a/libnx/nxtk/nxtk_drawcircletoolbar.c +++ b/libnx/nxtk/nxtk_drawcircletoolbar.c @@ -102,7 +102,7 @@ * width - The width of the line * color - The color to use to fill the line * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxtk/nxtk_drawcirclewindow.c b/libnx/nxtk/nxtk_drawcirclewindow.c index 3f6cdd2882..1ba7717085 100644 --- a/libnx/nxtk/nxtk_drawcirclewindow.c +++ b/libnx/nxtk/nxtk_drawcirclewindow.c @@ -102,7 +102,7 @@ * width - The width of the line * color - The color to use to fill the line * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxtk/nxtk_drawframe.c b/libnx/nxtk/nxtk_drawframe.c index adafccc574..2e1ea68b17 100644 --- a/libnx/nxtk/nxtk_drawframe.c +++ b/libnx/nxtk/nxtk_drawframe.c @@ -98,13 +98,13 @@ static void nxtk_drawframeside(FAR struct nxtk_framedwindow_s *fwnd, * Description: * Redraw the window frame. * - * Input parameters: + * Input Parameters: * fwnd - the framed window whose frame needs to be re-drawn. This must * have been previously created by nxtk_openwindow(). * bounds - Only draw the ports of the frame within this bounding box. * (window relative coordinates). * - * Returned value: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxtk/nxtk_drawlinetoolbar.c b/libnx/nxtk/nxtk_drawlinetoolbar.c index 84d25ad83c..51820a47f8 100644 --- a/libnx/nxtk/nxtk_drawlinetoolbar.c +++ b/libnx/nxtk/nxtk_drawlinetoolbar.c @@ -88,7 +88,7 @@ * caps - Draw a circular cap on the ends of the line to support better * line joins * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxtk/nxtk_drawlinewindow.c b/libnx/nxtk/nxtk_drawlinewindow.c index 231842b882..970ce40e60 100644 --- a/libnx/nxtk/nxtk_drawlinewindow.c +++ b/libnx/nxtk/nxtk_drawlinewindow.c @@ -87,7 +87,7 @@ * caps - Draw a circular cap on the ends of the line to support better * line joins * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxtk/nxtk_fillcircletoolbar.c b/libnx/nxtk/nxtk_fillcircletoolbar.c index af502c7660..0772d8c75e 100644 --- a/libnx/nxtk/nxtk_fillcircletoolbar.c +++ b/libnx/nxtk/nxtk_fillcircletoolbar.c @@ -84,7 +84,7 @@ * radius - The radius of the circle in pixels. * color - The color to use to fill the circle. * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxtk/nxtk_fillcirclewindow.c b/libnx/nxtk/nxtk_fillcirclewindow.c index b155e85ff9..20273be3a5 100644 --- a/libnx/nxtk/nxtk_fillcirclewindow.c +++ b/libnx/nxtk/nxtk_fillcirclewindow.c @@ -84,7 +84,7 @@ * radius - The radius of the circle in pixels. * color - The color to use to fill the circle. * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxtk/nxtk_filltoolbar.c b/libnx/nxtk/nxtk_filltoolbar.c index 25eb6a8e8e..146fc59ad2 100644 --- a/libnx/nxtk/nxtk_filltoolbar.c +++ b/libnx/nxtk/nxtk_filltoolbar.c @@ -83,7 +83,7 @@ * rect - The location within the toolbar window to be filled * color - The color to use in the fill * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxtk/nxtk_filltraptoolbar.c b/libnx/nxtk/nxtk_filltraptoolbar.c index 3ca0b38ad2..afbc11be3e 100644 --- a/libnx/nxtk/nxtk_filltraptoolbar.c +++ b/libnx/nxtk/nxtk_filltraptoolbar.c @@ -83,7 +83,7 @@ * trap - The trapezoidal region to be filled * color - The color to use in the fill * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxtk/nxtk_filltrapwindow.c b/libnx/nxtk/nxtk_filltrapwindow.c index 88c3077223..886ab81b8b 100644 --- a/libnx/nxtk/nxtk_filltrapwindow.c +++ b/libnx/nxtk/nxtk_filltrapwindow.c @@ -83,7 +83,7 @@ * trap - The trapezoidal region to be filled * color - The color to use in the fill * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxtk/nxtk_fillwindow.c b/libnx/nxtk/nxtk_fillwindow.c index 9ff1caca57..103fdc2795 100644 --- a/libnx/nxtk/nxtk_fillwindow.c +++ b/libnx/nxtk/nxtk_fillwindow.c @@ -83,7 +83,7 @@ * rect - The location within the client window to be filled * color - The color to use in the fill * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxtk/nxtk_getposition.c b/libnx/nxtk/nxtk_getposition.c index 1f0bdceeef..dafbe01139 100644 --- a/libnx/nxtk/nxtk_getposition.c +++ b/libnx/nxtk/nxtk_getposition.c @@ -83,7 +83,7 @@ * Input Parameters: * hfwnd - The window handle returned by nxtk_openwindow. * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxtk/nxtk_gettoolbar.c b/libnx/nxtk/nxtk_gettoolbar.c index bc05cbce94..ab404d1231 100644 --- a/libnx/nxtk/nxtk_gettoolbar.c +++ b/libnx/nxtk/nxtk_gettoolbar.c @@ -88,7 +88,7 @@ * dest - The location to copy the memory region * deststride - The width, in bytes, of the dest memory * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxtk/nxtk_getwindow.c b/libnx/nxtk/nxtk_getwindow.c index 4106267fb0..6f7e15e131 100644 --- a/libnx/nxtk/nxtk_getwindow.c +++ b/libnx/nxtk/nxtk_getwindow.c @@ -88,7 +88,7 @@ * dest - The location to copy the memory region * deststride - The width, in bytes, of the dest memory * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxtk/nxtk_lower.c b/libnx/nxtk/nxtk_lower.c index 08a588897d..fee5fd075d 100644 --- a/libnx/nxtk/nxtk_lower.c +++ b/libnx/nxtk/nxtk_lower.c @@ -79,11 +79,11 @@ * Lower the window containing the specified client sub-window to the * bottom of the display. * - * Input parameters: + * Input Parameters: * hfwnd - the window to be lowered. This must have been previously * created by nxtk_openwindow(). * - * Returned value: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxtk/nxtk_movetoolbar.c b/libnx/nxtk/nxtk_movetoolbar.c index 913142a0d4..08a1e3beb3 100644 --- a/libnx/nxtk/nxtk_movetoolbar.c +++ b/libnx/nxtk/nxtk_movetoolbar.c @@ -87,7 +87,7 @@ * sub-window to move * offset - The offset to move the region * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxtk/nxtk_movewindow.c b/libnx/nxtk/nxtk_movewindow.c index 302cff98d1..e0064ba795 100644 --- a/libnx/nxtk/nxtk_movewindow.c +++ b/libnx/nxtk/nxtk_movewindow.c @@ -86,7 +86,7 @@ * sub-window to move * offset - The offset to move the region * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxtk/nxtk_opentoolbar.c b/libnx/nxtk/nxtk_opentoolbar.c index f5d58979ea..2bf68b69c1 100644 --- a/libnx/nxtk/nxtk_opentoolbar.c +++ b/libnx/nxtk/nxtk_opentoolbar.c @@ -85,7 +85,7 @@ * arg - User provided value that will be returned with toolbar * callbacks. * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxtk/nxtk_openwindow.c b/libnx/nxtk/nxtk_openwindow.c index ebefaec892..f333ea79c7 100644 --- a/libnx/nxtk/nxtk_openwindow.c +++ b/libnx/nxtk/nxtk_openwindow.c @@ -107,7 +107,7 @@ nxgl_mxpixel_t g_bordercolor3[CONFIG_NX_NPLANES] = * cb - Callbacks used to process window events * arg - User provided value that will be returned with NXTK callbacks. * - * Return: + * Returned Value: * Success: A non-NULL handle used with subsequent NXTK window accesses * Failure: NULL is returned and errno is set appropriately * diff --git a/libnx/nxtk/nxtk_raise.c b/libnx/nxtk/nxtk_raise.c index d0273fe704..2fa954a6ea 100644 --- a/libnx/nxtk/nxtk_raise.c +++ b/libnx/nxtk/nxtk_raise.c @@ -79,11 +79,11 @@ * Bring the window containing the specified client sub-window to the top * of the display. * - * Input parameters: + * Input Parameters: * hfwnd - the window to be raised. This must have been previously * created by nxtk_openwindow(). * - * Returned value: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxtk/nxtk_setposition.c b/libnx/nxtk/nxtk_setposition.c index ed85625272..642db0fb54 100644 --- a/libnx/nxtk/nxtk_setposition.c +++ b/libnx/nxtk/nxtk_setposition.c @@ -84,7 +84,7 @@ * hfwnd - The window handle returned by nxtk_openwindow * pos - The new position of the client sub-window * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxtk/nxtk_setsize.c b/libnx/nxtk/nxtk_setsize.c index 7e90796966..d9ccfe46c8 100644 --- a/libnx/nxtk/nxtk_setsize.c +++ b/libnx/nxtk/nxtk_setsize.c @@ -84,7 +84,7 @@ * hfwnd - The window handle returned by nxtk_openwindow * size - The new size of the client sub-window. * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxtk/nxtk_subwindowclip.c b/libnx/nxtk/nxtk_subwindowclip.c index b1b4024ee7..3aa0a5dc28 100644 --- a/libnx/nxtk/nxtk_subwindowclip.c +++ b/libnx/nxtk/nxtk_subwindowclip.c @@ -83,13 +83,13 @@ * containing window (i.e., (0,0) is the top left corner of the containing * window). * - * Input parameters: + * Input Parameters: * fwnd - The framed window to be used * dest - The locaton to put the result * src - The src rectangle in relative sub-window coordinates * bounds - The subwindow bounds in absolute screen coordinates. * - * Returned value: + * Returned Value: * None * ****************************************************************************/ diff --git a/libnx/nxtk/nxtk_subwindowmove.c b/libnx/nxtk/nxtk_subwindowmove.c index 6b80609d3d..2c14d010ce 100644 --- a/libnx/nxtk/nxtk_subwindowmove.c +++ b/libnx/nxtk/nxtk_subwindowmove.c @@ -89,7 +89,7 @@ * srcoffset - The offset to move the region * bounds - The subwindow bounds in absolute screen coordinates. * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/libnx/nxtk/nxtk_toolbarbounds.c b/libnx/nxtk/nxtk_toolbarbounds.c index eacaf90573..0657d60276 100644 --- a/libnx/nxtk/nxtk_toolbarbounds.c +++ b/libnx/nxtk/nxtk_toolbarbounds.c @@ -87,7 +87,7 @@ * hfwnd - The handle returned by nxtk_openwindow * bounds - User provided location in which to return the bounding box. * - * Return: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ diff --git a/mm/kmm_heap/kmm_addregion.c b/mm/kmm_heap/kmm_addregion.c index 41884fa7c3..96bf448eec 100644 --- a/mm/kmm_heap/kmm_addregion.c +++ b/mm/kmm_heap/kmm_addregion.c @@ -57,7 +57,7 @@ * heap_start - Address of the beginning of the memory region * heap_size - The size (in bytes) if the memory region. * - * Return Value: + * Returned Value: * None * ****************************************************************************/ diff --git a/mm/kmm_heap/kmm_free.c b/mm/kmm_heap/kmm_free.c index c901678818..466b268b7e 100644 --- a/mm/kmm_heap/kmm_free.c +++ b/mm/kmm_heap/kmm_free.c @@ -60,7 +60,7 @@ * Parameters: * None * - * Return Value: + * Returned Value: * None * ****************************************************************************/ diff --git a/mm/kmm_heap/kmm_heapmember.c b/mm/kmm_heap/kmm_heapmember.c index 53fa7027b7..dc1c916ef7 100644 --- a/mm/kmm_heap/kmm_heapmember.c +++ b/mm/kmm_heap/kmm_heapmember.c @@ -58,7 +58,7 @@ * Parameters: * mem - The address to check * - * Return Value: + * Returned Value: * true if the address is a member of the kernel heap. false if not * not. If the address is not a member of the kernel heap, then it * must be a member of the user-space heap (unchecked) diff --git a/mm/kmm_heap/kmm_initialize.c b/mm/kmm_heap/kmm_initialize.c index 03baba8120..4bf8d99027 100644 --- a/mm/kmm_heap/kmm_initialize.c +++ b/mm/kmm_heap/kmm_initialize.c @@ -66,7 +66,7 @@ struct mm_heap_s g_kmmheap; * heap_start - Address of the beginning of the (initial) memory region * heap_size - The size (in bytes) if the (initial) memory region. * - * Return Value: + * Returned Value: * None * ****************************************************************************/ diff --git a/mm/kmm_heap/kmm_kernel.c b/mm/kmm_heap/kmm_kernel.c index e2fc9232b8..0faf6944ab 100644 --- a/mm/kmm_heap/kmm_kernel.c +++ b/mm/kmm_heap/kmm_kernel.c @@ -59,7 +59,7 @@ * Parameters: * mem - The address to check * - * Return Value: + * Returned Value: * true if the address is a member of the kernel heap. false if not * not. If the address is not a member of the kernel heap, then it * must be a member of the user-space heap (unchecked) diff --git a/mm/kmm_heap/kmm_malloc.c b/mm/kmm_heap/kmm_malloc.c index 06bed81c50..9f0e6e7949 100644 --- a/mm/kmm_heap/kmm_malloc.c +++ b/mm/kmm_heap/kmm_malloc.c @@ -56,7 +56,7 @@ * Parameters: * size - Size (in bytes) of the memory region to be allocated. * - * Return Value: + * Returned Value: * The address of the allocated memory (NULL on failure to allocate) * ****************************************************************************/ diff --git a/mm/kmm_heap/kmm_memalign.c b/mm/kmm_heap/kmm_memalign.c index 2ca1465bf0..9c0ba608ec 100644 --- a/mm/kmm_heap/kmm_memalign.c +++ b/mm/kmm_heap/kmm_memalign.c @@ -59,7 +59,7 @@ * alignment - Log2 byte alignment * size - Size (in bytes) of the new memory region to be allocated. * - * Return Value: + * Returned Value: * The address of the re-allocated memory (NULL on failure to allocate) * ****************************************************************************/ diff --git a/mm/kmm_heap/kmm_realloc.c b/mm/kmm_heap/kmm_realloc.c index 477e2b70b1..f06d6fa161 100644 --- a/mm/kmm_heap/kmm_realloc.c +++ b/mm/kmm_heap/kmm_realloc.c @@ -57,7 +57,7 @@ * oldmem - The old memory allocated * newsize - Size (in bytes) of the new memory region to be re-allocated. * - * Return Value: + * Returned Value: * The address of the re-allocated memory (NULL on failure to re-allocate) * ****************************************************************************/ diff --git a/mm/kmm_heap/kmm_sem.c b/mm/kmm_heap/kmm_sem.c index 2ba019f673..dc05bf78ed 100644 --- a/mm/kmm_heap/kmm_sem.c +++ b/mm/kmm_heap/kmm_sem.c @@ -56,7 +56,7 @@ * Parameters: * None * - * Return Value: + * Returned Value: * OK on success; a negated errno on failure * ****************************************************************************/ @@ -75,7 +75,7 @@ int kmm_trysemaphore(void) * Parameters: * None * - * Return Value: + * Returned Value: * OK on success; a negated errno on failure * ****************************************************************************/ diff --git a/mm/kmm_heap/kmm_zalloc.c b/mm/kmm_heap/kmm_zalloc.c index 19bea29f15..525ee8cb8d 100644 --- a/mm/kmm_heap/kmm_zalloc.c +++ b/mm/kmm_heap/kmm_zalloc.c @@ -56,7 +56,7 @@ * Parameters: * size - Size (in bytes) of the memory region to be allocated. * - * Return Value: + * Returned Value: * The address of the allocated memory (NULL on failure to allocate) * ****************************************************************************/ diff --git a/mm/mm_heap/mm_initialize.c b/mm/mm_heap/mm_initialize.c index 7696676fde..becafc88a6 100644 --- a/mm/mm_heap/mm_initialize.c +++ b/mm/mm_heap/mm_initialize.c @@ -60,7 +60,7 @@ * heapstart - Start of the heap region * heapsize - Size of the heap region * - * Return Value: + * Returned Value: * None * * Assumptions: @@ -145,7 +145,7 @@ void mm_addregion(FAR struct mm_heap_s *heap, FAR void *heapstart, * heapstart - Start of the initial heap region * heapsize - Size of the initial heap region * - * Return Value: + * Returned Value: * None * * Assumptions: diff --git a/mm/shm/shmget.c b/mm/shm/shmget.c index 682b4707ed..c7701cbfc8 100644 --- a/mm/shm/shmget.c +++ b/mm/shm/shmget.c @@ -63,10 +63,10 @@ * Description: * Find the shared memory region with matching key * - * Input parameters: + * Input Parameters: * key - The value that uniquely identifies a shared memory region. * - * Returned value: + * Returned Value: * On success, an index in the range of 0 to CONFIG_ARCH_SHM_MAXREGIONS-1 * is returned to identify the matching region; -ENOENT is returned on * failure. @@ -94,10 +94,10 @@ static int shm_find(key_t key) * Description: * Allocate an unused shared memory region. That is one with a key of -1 * - * Input parameters: + * Input Parameters: * None * - * Returned value: + * Returned Value: * On success, an index in the range of 0 to CONFIG_ARCH_SHM_MAXREGIONS-1 * is returned to identify the matching region; -ENOSPC is returned on * failure. @@ -154,12 +154,12 @@ static int shm_reserve(key_t key, int shmflg) * Extend the size of a memory regions by allocating physical pages as * necessary * - * Input parameters: + * Input Parameters: * shmid - The index of the region of interest in the shared memory region * table. * size - The new size of the region. * - * Returned value: + * Returned Value: * Zero is returned on success; -ENOMEM is returned on failure. * (Should a different error be returned if the region is just too big?) * @@ -224,7 +224,7 @@ static int shm_extend(int shmid, size_t size) * Description: * Create the shared memory region. * - * Input parameters: + * Input Parameters: * key - The key that is used to access the unique shared memory * identifier. * size - The shared memory region that is created will be at least @@ -232,7 +232,7 @@ static int shm_extend(int shmid, size_t size) * shmflgs - See IPC_* definitions in sys/ipc.h. Only the values * IPC_PRIVATE or IPC_CREAT are supported. * - * Returned value: + * Returned Value: * Zero is returned on success; A negated errno value is returned on * failure. * diff --git a/mm/umm_heap/umm_addregion.c b/mm/umm_heap/umm_addregion.c index 00e5372ee8..9197cf3f33 100644 --- a/mm/umm_heap/umm_addregion.c +++ b/mm/umm_heap/umm_addregion.c @@ -59,7 +59,7 @@ * heap_start - Address of the beginning of the memory region * heap_size - The size (in bytes) if the memory region. * - * Return Value: + * Returned Value: * None * ****************************************************************************/ diff --git a/mm/umm_heap/umm_initialize.c b/mm/umm_heap/umm_initialize.c index 04e045e073..55fc430fc1 100644 --- a/mm/umm_heap/umm_initialize.c +++ b/mm/umm_heap/umm_initialize.c @@ -89,7 +89,7 @@ * heap_start - Address of the beginning of the (initial) memory region * heap_size - The size (in bytes) if the (initial) memory region. * - * Return Value: + * Returned Value: * None * ****************************************************************************/ diff --git a/mm/umm_heap/umm_malloc.c b/mm/umm_heap/umm_malloc.c index 7832af4e29..ddbb03a2c6 100644 --- a/mm/umm_heap/umm_malloc.c +++ b/mm/umm_heap/umm_malloc.c @@ -59,7 +59,7 @@ * Parameters: * size - Size (in bytes) of the memory region to be allocated. * - * Return Value: + * Returned Value: * The address of the allocated memory (NULL on failure to allocate) * ****************************************************************************/ diff --git a/mm/umm_heap/umm_realloc.c b/mm/umm_heap/umm_realloc.c index a517aa200a..394a4e2cd2 100644 --- a/mm/umm_heap/umm_realloc.c +++ b/mm/umm_heap/umm_realloc.c @@ -59,7 +59,7 @@ * oldmem - The old memory allocated * newsize - Size (in bytes) of the new memory region to be re-allocated. * - * Return Value: + * Returned Value: * The address of the re-allocated memory (NULL on failure to re-allocate) * ****************************************************************************/ diff --git a/mm/umm_heap/umm_sem.c b/mm/umm_heap/umm_sem.c index a9012e542c..37b0fb42cd 100644 --- a/mm/umm_heap/umm_sem.c +++ b/mm/umm_heap/umm_sem.c @@ -58,7 +58,7 @@ * Parameters: * None * - * Return Value: + * Returned Value: * OK on success; a negated errno on failure * ****************************************************************************/ @@ -79,7 +79,7 @@ int umm_trysemaphore(void) * Parameters: * None * - * Return Value: + * Returned Value: * OK on success; a negated errno on failure * ****************************************************************************/ diff --git a/mm/umm_heap/umm_zalloc.c b/mm/umm_heap/umm_zalloc.c index 7103e3233b..6ce7fe14fb 100644 --- a/mm/umm_heap/umm_zalloc.c +++ b/mm/umm_heap/umm_zalloc.c @@ -59,7 +59,7 @@ * Parameters: * size - Size (in bytes) of the memory region to be allocated. * - * Return Value: + * Returned Value: * The address of the allocated memory (NULL on failure to allocate) * ****************************************************************************/ diff --git a/net/arp/arp.h b/net/arp/arp.h index 0fbea68c51..643c5a6093 100644 --- a/net/arp/arp.h +++ b/net/arp/arp.h @@ -374,7 +374,7 @@ void arp_notify(in_addr_t ipaddr); * Description: * Find the ARP entry corresponding to this IP address. * - * Input parameters: + * Input Parameters: * ipaddr - Refers to an IP address in network order * * Assumptions @@ -391,7 +391,7 @@ FAR struct arp_entry *arp_find(in_addr_t ipaddr); * Description: * Remove an IP association from the ARP table * - * Input parameters: + * Input Parameters: * ipaddr - Refers to an IP address in network order * * Assumptions @@ -416,7 +416,7 @@ FAR struct arp_entry *arp_find(in_addr_t ipaddr); * Add the IP/HW address mapping to the ARP table -OR- change the IP * address of an existing association. * - * Input parameters: + * Input Parameters: * ipaddr - The IP address as an inaddr_t * ethaddr - Refers to a HW address uint8_t[IFHWADDRLEN] * @@ -438,7 +438,7 @@ int arp_update(in_addr_t ipaddr, FAR uint8_t *ethaddr); * Add the IP/HW address mapping to the ARP table -OR- change the IP * address of an existing association. * - * Input parameters: + * Input Parameters: * pipaddr - Refers to an IP address uint16_t[2] in network order * ethaddr - Refers to a HW address uint8_t[IFHWADDRLEN] * diff --git a/net/arp/arp_table.c b/net/arp/arp_table.c index 928ed59019..d8818ddf39 100644 --- a/net/arp/arp_table.c +++ b/net/arp/arp_table.c @@ -129,7 +129,7 @@ void arp_timer(void) * Add the IP/HW address mapping to the ARP table -OR- change the IP * address of an existing association. * - * Input parameters: + * Input Parameters: * ipaddr - The IP address as an inaddr_t * ethaddr - Refers to a HW address uint8_t[IFHWADDRLEN] * @@ -227,7 +227,7 @@ int arp_update(in_addr_t ipaddr, FAR uint8_t *ethaddr) * Add the IP/HW address mapping to the ARP table -OR- change the IP * address of an existing association. * - * Input parameters: + * Input Parameters: * pipaddr - Refers to an IP address uint16_t[2] in network order * ethaddr - Refers to a HW address uint8_t[IFHWADDRLEN] * @@ -255,7 +255,7 @@ void arp_hdr_update(FAR uint16_t *pipaddr, FAR uint8_t *ethaddr) * Description: * Find the ARP entry corresponding to this IP address. * - * Input parameters: + * Input Parameters: * ipaddr - Refers to an IP address in network order * * Assumptions diff --git a/net/devif/devif.h b/net/devif/devif.h index 438e275f46..2eeb97f7f0 100644 --- a/net/devif/devif.h +++ b/net/devif/devif.h @@ -309,7 +309,7 @@ EXTERN systime_t g_polltime; * Parameters: * None * - * Return: + * Returned Value: * None * ****************************************************************************/ @@ -400,7 +400,7 @@ void devif_dev_callback_free(FAR struct net_driver_s *dev, * Description: * Execute a list of callbacks. * - * Input parameters: + * Input Parameters: * dev - The network device state structure associated with the network * device that initiated the callback event. * pvconn - Holds a reference to the TCP connection structure or the UDP @@ -409,7 +409,7 @@ void devif_dev_callback_free(FAR struct net_driver_s *dev, * flags - The bit set of events to be notified. * list - The list to traverse in performing the notifications * - * Returned value: + * Returned Value: * The updated flags as modified by the callback functions. * * Assumptions: @@ -426,7 +426,7 @@ uint16_t devif_conn_event(FAR struct net_driver_s *dev, FAR void *pvconn, * Description: * Execute a list of callbacks using the device event chain. * - * Input parameters: + * Input Parameters: * dev - The network device state structure associated with the network * device that initiated the callback event. * pvconn - Holds a reference to the TCP connection structure or the UDP @@ -434,7 +434,7 @@ uint16_t devif_conn_event(FAR struct net_driver_s *dev, FAR void *pvconn, * connection or UDP port. * flags - The bit set of events to be notified. * - * Returned value: + * Returned Value: * The updated flags as modified by the callback functions. * * Assumptions: diff --git a/net/devif/devif_callback.c b/net/devif/devif_callback.c index 92718b9798..e2261b750f 100644 --- a/net/devif/devif_callback.c +++ b/net/devif/devif_callback.c @@ -170,7 +170,7 @@ static void devif_callback_free(FAR struct net_driver_s *dev, * Return true if the current set of events should trigger a callback to * occur. * - * Input paramters: + * Input Parameters: * events - The set of events that has occurred. * triggers - The set of events that will trigger a callback. * @@ -402,7 +402,7 @@ void devif_dev_callback_free(FAR struct net_driver_s *dev, * Description: * Execute a list of callbacks using the packet event chain. * - * Input parameters: + * Input Parameters: * dev - The network device state structure associated with the network * device that initiated the callback event. * pvconn - Holds a reference to the TCP connection structure or the UDP @@ -411,7 +411,7 @@ void devif_dev_callback_free(FAR struct net_driver_s *dev, * flags - The bit set of events to be notified. * list - The list to traverse in performing the notifications * - * Returned value: + * Returned Value: * The updated flags as modified by the callback functions. * * Assumptions: @@ -465,7 +465,7 @@ uint16_t devif_conn_event(FAR struct net_driver_s *dev, void *pvconn, * Description: * Execute a list of callbacks using the device event chain. * - * Input parameters: + * Input Parameters: * dev - The network device state structure associated with the network * device that initiated the callback event. * pvconn - Holds a reference to the TCP connection structure or the UDP @@ -473,7 +473,7 @@ uint16_t devif_conn_event(FAR struct net_driver_s *dev, void *pvconn, * connection or UDP port. * flags - The bit set of events to be notified. * - * Returned value: + * Returned Value: * The updated flags as modified by the callback functions. * * Assumptions: diff --git a/net/devif/devif_initialize.c b/net/devif/devif_initialize.c index 244d7a1b6c..ecbe15479e 100644 --- a/net/devif/devif_initialize.c +++ b/net/devif/devif_initialize.c @@ -85,7 +85,7 @@ uint8_t g_reassembly_timer; * Parameters: * None * - * Return: + * Returned Value: * None * ****************************************************************************/ diff --git a/net/icmp/icmp.h b/net/icmp/icmp.h index 77aa832f8f..d17f5d1fbd 100644 --- a/net/icmp/icmp.h +++ b/net/icmp/icmp.h @@ -129,7 +129,7 @@ struct pollfd; /* Forward reference */ * dev - The device driver structure containing the received ICMP * packet * - * Return: + * Returned Value: * None * * Assumptions: @@ -235,7 +235,7 @@ FAR struct icmp_conn_s *icmp_findconn(FAR struct net_driver_s *dev, uint8_t id); * Parameters: * dev - The device driver structure to use in the send operation * - * Return: + * Returned Value: * None * * Assumptions: diff --git a/net/icmp/icmp_input.c b/net/icmp/icmp_input.c index 38937dad64..973b0326c1 100644 --- a/net/icmp/icmp_input.c +++ b/net/icmp/icmp_input.c @@ -89,7 +89,7 @@ * buffers * buflen - The number of bytes to copy to the read-ahead buffer. * - * Returned value: + * Returned Value: * The number of bytes actually buffered is returned. This will be either * zero or equal to buflen; partial packets are not buffered. * @@ -214,7 +214,7 @@ drop: * dev - The device driver structure containing the received ICMP * packet * - * Return: + * Returned Value: * None * * Assumptions: diff --git a/net/icmp/icmp_poll.c b/net/icmp/icmp_poll.c index f86e3a6e14..190bc06744 100644 --- a/net/icmp/icmp_poll.c +++ b/net/icmp/icmp_poll.c @@ -62,7 +62,7 @@ * Parameters: * dev - The device driver structure to use in the send operation * - * Return: + * Returned Value: * None * * Assumptions: diff --git a/net/icmp/icmp_sendto.c b/net/icmp/icmp_sendto.c index 9ee74e000e..7c20668273 100644 --- a/net/icmp/icmp_sendto.c +++ b/net/icmp/icmp_sendto.c @@ -150,7 +150,7 @@ static inline int sendto_timeout(FAR struct icmp_sendto_s *pstate) * dev - The device driver structure to use in the send operation * pstate - Reference to an instance of the ICMP sendto state structure * - * Return: + * Returned Value: * None * * Assumptions: diff --git a/net/icmpv6/icmpv6.h b/net/icmpv6/icmpv6.h index 582712c5e5..f5bee4251e 100644 --- a/net/icmpv6/icmpv6.h +++ b/net/icmpv6/icmpv6.h @@ -158,7 +158,7 @@ struct pollfd; /* Forward reference */ * dev - The device driver structure containing the received ICMPv6 * packet * - * Return: + * Returned Value: * None * * Assumptions: @@ -214,7 +214,7 @@ int icmpv6_neighbor(const net_ipv6addr_t ipaddr); * Parameters: * dev - The device driver structure to use in the send operation * - * Return: + * Returned Value: * None * * Assumptions: @@ -236,7 +236,7 @@ void icmpv6_poll(FAR struct net_driver_s *dev); * dev - Reference to an Ethernet device driver structure * ipaddr - IP address of Neighbor to be solicited * - * Return: + * Returned Value: * None * ****************************************************************************/ @@ -261,7 +261,7 @@ void icmpv6_solicit(FAR struct net_driver_s *dev, * Parameters: * dev - Reference to an Ethernet device driver structure * - * Return: + * Returned Value: * None * ****************************************************************************/ @@ -280,7 +280,7 @@ void icmpv6_rsolicit(FAR struct net_driver_s *dev); * dev - The device driver structure containing the outgoing ICMPv6 packet * buffer * - * Return: + * Returned Value: * None. * * Assumptions: @@ -301,7 +301,7 @@ void icmpv6_advertise(FAR struct net_driver_s *dev, * dev - The device driver structure containing the outgoing ICMPv6 packet * buffer * - * Return: + * Returned Value: * None * * Assumptions: @@ -406,7 +406,7 @@ void icmpv6_notify(net_ipv6addr_t ipaddr); * Parameters: * dev - The device driver structure to assign the address to * - * Return: + * Returned Value: * Zero (OK) is returned on success; A negated errno value is returned on * any failure. * diff --git a/net/icmpv6/icmpv6_advertise.c b/net/icmpv6/icmpv6_advertise.c index 37c8c8ebb9..e0a7d8a770 100644 --- a/net/icmpv6/icmpv6_advertise.c +++ b/net/icmpv6/icmpv6_advertise.c @@ -85,7 +85,7 @@ * dev - The device driver structure containing the outgoing ICMPv6 packet * buffer * - * Return: + * Returned Value: * None * * Assumptions: diff --git a/net/icmpv6/icmpv6_autoconfig.c b/net/icmpv6/icmpv6_autoconfig.c index bb481224e2..3f1ea9d2a6 100644 --- a/net/icmpv6/icmpv6_autoconfig.c +++ b/net/icmpv6/icmpv6_autoconfig.c @@ -331,7 +331,7 @@ static int icmpv6_wait_radvertise(FAR struct net_driver_s *dev, * Parameters: * dev - The device driver structure to assign the address to * - * Return: + * Returned Value: * Zero (OK) is returned on success; A negated errno value is returned on * any failure. * diff --git a/net/icmpv6/icmpv6_input.c b/net/icmpv6/icmpv6_input.c index 66030ad901..42c2e8c55d 100644 --- a/net/icmpv6/icmpv6_input.c +++ b/net/icmpv6/icmpv6_input.c @@ -99,7 +99,7 @@ * buffers * buflen - The number of bytes to copy to the read-ahead buffer. * - * Returned value: + * Returned Value: * The number of bytes actually buffered is returned. This will be either * zero or equal to buflen; partial packets are not buffered. * @@ -221,7 +221,7 @@ drop: * dev - The device driver structure containing the received ICMPv6 * packet * - * Return: + * Returned Value: * None * * Assumptions: diff --git a/net/icmpv6/icmpv6_poll.c b/net/icmpv6/icmpv6_poll.c index 145dd62e69..d6853ff4a6 100644 --- a/net/icmpv6/icmpv6_poll.c +++ b/net/icmpv6/icmpv6_poll.c @@ -63,7 +63,7 @@ * Parameters: * dev - The device driver structure to use in the send operation * - * Return: + * Returned Value: * None * * Assumptions: diff --git a/net/icmpv6/icmpv6_rsolicit.c b/net/icmpv6/icmpv6_rsolicit.c index 1ff49d712c..ba24bbeef1 100644 --- a/net/icmpv6/icmpv6_rsolicit.c +++ b/net/icmpv6/icmpv6_rsolicit.c @@ -84,7 +84,7 @@ * Parameters: * dev - Reference to an Ethernet device driver structure * - * Return: + * Returned Value: * None * ****************************************************************************/ diff --git a/net/icmpv6/icmpv6_sendto.c b/net/icmpv6/icmpv6_sendto.c index cbff44a3ea..8db6d370e7 100644 --- a/net/icmpv6/icmpv6_sendto.c +++ b/net/icmpv6/icmpv6_sendto.c @@ -150,7 +150,7 @@ static inline int sendto_timeout(FAR struct icmpv6_sendto_s *pstate) * dev - The device driver structure to use in the send operation * pstate - Reference to an instance of the ICMPv6 sendto state structure * - * Return: + * Returned Value: * None * * Assumptions: diff --git a/net/icmpv6/icmpv6_solicit.c b/net/icmpv6/icmpv6_solicit.c index 7fa1a55d19..30fe57b266 100644 --- a/net/icmpv6/icmpv6_solicit.c +++ b/net/icmpv6/icmpv6_solicit.c @@ -94,7 +94,7 @@ static const uint16_t g_icmpv_mcastaddr[6] = * dev - Reference to an Ethernet device driver structure * ipaddr - IP address of Neighbor to be solicited * - * Return: + * Returned Value: * None * ****************************************************************************/ diff --git a/net/ieee802154/ieee802154.h b/net/ieee802154/ieee802154.h index bf60db0530..3dc1673507 100644 --- a/net/ieee802154/ieee802154.h +++ b/net/ieee802154/ieee802154.h @@ -268,7 +268,7 @@ FAR struct ieee802154_conn_s * * If there are multilple frames in the list, this metadata * must apply to all of the frames in the list. * - * Return: + * Returned Value: * OK The IEEE 802.15.4 has been processed and can be deleted * ERROR Hold the IEEE 802.15.4 and try again later. There is a listening * socket but no recv in place to catch the IEEE 802.15.4 yet. @@ -364,7 +364,7 @@ FAR struct radio_driver_s * * dev - The device driver structure to use in the send operation * conn - The IEEE 802.15.4 "connection" to poll for TX data * - * Return: + * Returned Value: * None * * Assumptions: @@ -413,10 +413,10 @@ ssize_t psock_ieee802154_sendto(FAR struct socket *psock, * be called early in the initialization sequence before any socket * activity. * - * Inputs: + * Input Parameters: * None * - * Return Value: + * Returned Value: * None * * Assumptions: @@ -437,10 +437,10 @@ void ieee802154_container_initialize(void); * list. If that the list is empty, then the meta-data structure will be * allocated from the dynamic memory pool. * - * Inputs: + * Input Parameters: * None * - * Return Value: + * Returned Value: * A reference to the allocated container structure. All user fields in this * structure have been zeroed. On a failure to allocate, NULL is * returned. @@ -461,10 +461,10 @@ FAR struct ieee802154_container_s *ieee802154_container_allocate(void); * structure. If the container structure was allocated dynamically it will * be deallocated. * - * Inputs: + * Input Parameters: * container - container structure to free * - * Return Value: + * Returned Value: * None * * Assumptions: diff --git a/net/ieee802154/ieee802154_container.c b/net/ieee802154/ieee802154_container.c index af70fe645d..88f01755de 100644 --- a/net/ieee802154/ieee802154_container.c +++ b/net/ieee802154/ieee802154_container.c @@ -82,10 +82,10 @@ static struct ieee802154_container_s * be called early in the initialization sequence before any socket * activity. * - * Inputs: + * Input Parameters: * None * - * Return Value: + * Returned Value: * None * * Assumptions: @@ -127,10 +127,10 @@ void ieee802154_container_initialize(void) * list. If that the list is empty, then the meta-data structure will be * allocated from the dynamic memory pool. * - * Inputs: + * Input Parameters: * None * - * Return Value: + * Returned Value: * A reference to the allocated container structure. All user fields in this * structure have been zeroed. On a failure to allocate, NULL is * returned. @@ -185,10 +185,10 @@ FAR struct ieee802154_container_s *ieee802154_container_allocate(void) * structure. If the container structure was allocated dynamically it will * be deallocated. * - * Inputs: + * Input Parameters: * container - container structure to free * - * Return Value: + * Returned Value: * None * * Assumptions: diff --git a/net/ieee802154/ieee802154_input.c b/net/ieee802154/ieee802154_input.c index 1d50451cc3..57f32eaf70 100644 --- a/net/ieee802154/ieee802154_input.c +++ b/net/ieee802154/ieee802154_input.c @@ -64,7 +64,7 @@ * Parameters: * conn - The socket connection structure. * - * Return: + * Returned Value: * The number of frames in the queue. * ****************************************************************************/ @@ -96,7 +96,7 @@ static int ieee802154_count_frames(FAR struct ieee802154_conn_s *conn) * framel - A single frame to add to the RX queue. * meta - Meta data characterizing the received frane. * - * Return: + * Returned Value: * Zero (OK) is returned on success; A negated errno value is returned on * any failure. * @@ -227,7 +227,7 @@ static int ieee802154_queue_frame(FAR struct ieee802154_conn_s *conn, * If there are multilple frames in the list, this metadata * must apply to all of the frames in the list. * - * Return: + * Returned Value: * OK The IEEE 802.15.4 has been processed and can be deleted * ERROR Hold the IEEE 802.15.4 and try again later. There is a listening * socket but no recv in place to catch the IEEE 802.15.4 yet. diff --git a/net/ieee802154/ieee802154_poll.c b/net/ieee802154/ieee802154_poll.c index 0d313e0e4b..fb33ea1bbb 100644 --- a/net/ieee802154/ieee802154_poll.c +++ b/net/ieee802154/ieee802154_poll.c @@ -64,7 +64,7 @@ * dev - The device driver structure to use in the send operation * conn - The packet "connection" to poll for TX data * - * Return: + * Returned Value: * None * * Assumptions: diff --git a/net/ieee802154/ieee802154_recvfrom.c b/net/ieee802154/ieee802154_recvfrom.c index 2e47f18fb7..7ee3c7d041 100644 --- a/net/ieee802154/ieee802154_recvfrom.c +++ b/net/ieee802154/ieee802154_recvfrom.c @@ -91,7 +91,7 @@ struct ieee802154_recvfrom_s * Parameters: * conn - The socket connection structure. * - * Return: + * Returned Value: * The number of frames in the queue. * ****************************************************************************/ @@ -121,7 +121,7 @@ static int ieee802154_count_frames(FAR struct ieee802154_conn_s *conn) * * Parameters: * - * Returned Values: + * Returned Value: * * Assumptions: * The network is lockec @@ -209,7 +209,7 @@ static ssize_t ieee802154_recvfrom_rxqueue(FAR struct radio_driver_s *radio, * * Parameters: * - * Returned Values: + * Returned Value: * * Assumptions: * The network is locked. diff --git a/net/ieee802154/ieee802154_sendto.c b/net/ieee802154/ieee802154_sendto.c index 2c2c79e5b1..47657ac1f9 100644 --- a/net/ieee802154/ieee802154_sendto.c +++ b/net/ieee802154/ieee802154_sendto.c @@ -96,7 +96,7 @@ struct ieee802154_sendto_s * If the destination address is all zero in the MAC header buf, then it is * broadcast on the 802.15.4 network. * - * Input parameters: + * Input Parameters: * addr - The address to check * addrlen - The length of the address in bytes * @@ -125,7 +125,7 @@ static bool ieee802154_anyaddrnull(FAR const uint8_t *addr, uint8_t addrlen) * If the destination address is all zero in the MAC header buf, then it is * broadcast on the 802.15.4 network. * - * Input parameters: + * Input Parameters: * eaddr - The short address to check * * Returned Value: @@ -145,7 +145,7 @@ static inline bool ieee802154_saddrnull(FAR const uint8_t *saddr) * If the destination address is all zero in the MAC header buf, then it is * broadcast on the 802.15.4 network. * - * Input parameters: + * Input Parameters: * eaddr - The extended address to check * * Returned Value: diff --git a/net/igmp/igmp.h b/net/igmp/igmp.h index 4850bd511e..eef6cad00b 100644 --- a/net/igmp/igmp.h +++ b/net/igmp/igmp.h @@ -247,7 +247,7 @@ void igmp_poll(FAR struct net_driver_s *dev); * message to be sent. * destipaddr - The IP address of the recipient of the message * - * Return: + * Returned Value: * None * * Assumptions: diff --git a/net/igmp/igmp_send.c b/net/igmp/igmp_send.c index 3a28cccc8c..e6941d7f2b 100644 --- a/net/igmp/igmp_send.c +++ b/net/igmp/igmp_send.c @@ -106,7 +106,7 @@ static uint16_t igmp_chksum(FAR uint8_t *buffer, int buflen) * message to be sent. * destipaddr - The IP address of the recipient of the message * - * Return: + * Returned Value: * None * * Assumptions: diff --git a/net/ipforward/ipv6_forward.c b/net/ipforward/ipv6_forward.c index b2fea28f4a..4250692d89 100644 --- a/net/ipforward/ipv6_forward.c +++ b/net/ipforward/ipv6_forward.c @@ -187,7 +187,7 @@ static int ipv6_decr_ttl(FAR struct ipv6_hdr_s *ipv6) * but this is a point where support for other conversions may be * provided. * - * Returned value: + * Returned Value: * PACKET_FORWARDED - Packet was forwarded * PACKET_NOT_FORWARDED - Packet was not forwarded * < 0 - And error occurred (and packet not fowarded). diff --git a/net/local/local.h b/net/local/local.h index b4ccfd9a8a..f49d399bf5 100644 --- a/net/local/local.h +++ b/net/local/local.h @@ -375,7 +375,7 @@ int local_accept(FAR struct socket *psock, FAR struct sockaddr *addr, * len Length of data to send * flags Send flags (ignored for now) * - * Return: + * Returned Value: * On success, returns the number of characters sent. On error, * -1 is returned, and errno is set appropriately (see send() for the * list of errno numbers). @@ -429,7 +429,7 @@ ssize_t psock_local_sendto(FAR struct socket *psock, FAR const void *buf, * buf Data to send * len Length of data to send * - * Return: + * Returned Value: * Zero is returned on success; a negated errno value is returned on any * failure. * @@ -482,7 +482,7 @@ ssize_t local_recvfrom(FAR struct socket *psock, FAR void *buf, * len - Length of data to receive [in] * Length of data actually received [out] * - * Return: + * Returned Value: * Zero is returned on success; a negated errno value is returned on any * failure. If -ECONNRESET is received, then the sending side has closed * the FIFO. In this case, the returned data may still be valid (if the @@ -504,7 +504,7 @@ int local_fifo_read(FAR struct file *filep, FAR uint8_t *buf, size_t *len); * addrlen - The size of the memory allocat by the caller to receive the * address. * - * Return: + * Returned Value: * Zero (OK) on success; a negated errno value on failure. * ****************************************************************************/ @@ -521,7 +521,7 @@ int local_getaddr(FAR struct local_conn_s *conn, FAR struct sockaddr *addr, * Parameters: * filep - File structure of write-only FIFO. * - * Return: + * Returned Value: * The non-zero size of the following packet is returned on success; a * negated errno value is returned on any failure. * diff --git a/net/local/local_connect.c b/net/local/local_connect.c index 9a875b314b..28215e67f6 100644 --- a/net/local/local_connect.c +++ b/net/local/local_connect.c @@ -117,7 +117,7 @@ static inline void _local_semtake(sem_t *sem) * Find a local connection structure that is the appropriate "server" * connection to be used with the provided "client" connection. * - * Returned Values: + * Returned Value: * Zero (OK) returned on success; A negated errno value is returned on a * failure. Possible failures include: * @@ -250,7 +250,7 @@ errout_with_fifos: * Find a local connection structure that is the appropriate "server" * connection to be used with the provided "client" connection. * - * Returned Values: + * Returned Value: * Zero (OK) returned on success; A negated errno value is returned on a * failure. Possible failures include: * diff --git a/net/local/local_recvutils.c b/net/local/local_recvutils.c index 91e185754f..798107e534 100644 --- a/net/local/local_recvutils.c +++ b/net/local/local_recvutils.c @@ -69,7 +69,7 @@ * len - Length of data to receive [in] * Length of data actually received [out] * - * Return: + * Returned Value: * Zero is returned on success; a negated errno value is returned on any * failure. If -ECONNRESET is received, then the sending side has closed * the FIFO. In this case, the returned data may still be valid (if the @@ -133,7 +133,7 @@ errout: * Parameters: * filep - File structure of write-only FIFO. * - * Return: + * Returned Value: * The non-zero size of the following packet is returned on success; a * negated errno value is returned on any failure. * @@ -201,7 +201,7 @@ int local_sync(FAR struct file *filep) * addrlen - The size of the memory allocated by the caller to receive the * address. * - * Return: + * Returned Value: * Zero (OK) on success; a negated errno value on failure. * ****************************************************************************/ diff --git a/net/local/local_send.c b/net/local/local_send.c index a305dac441..6f170ba0a2 100644 --- a/net/local/local_send.c +++ b/net/local/local_send.c @@ -66,7 +66,7 @@ * len Length of data to send * flags Send flags (ignored for now) * - * Return: + * Returned Value: * On success, returns the number of characters sent. On error, * -1 is returned, and errno is set appropriately (see send() for the * list of errno numbers). diff --git a/net/local/local_sendpacket.c b/net/local/local_sendpacket.c index fad305fd0b..8a4fcae61c 100644 --- a/net/local/local_sendpacket.c +++ b/net/local/local_sendpacket.c @@ -83,7 +83,7 @@ static const uint8_t g_preamble[LOCAL_PREAMBLE_SIZE] = * buf Data to send * len Length of data to send * - * Return: + * Returned Value: * Zero is returned on success; a negated errno value is returned on any * failure. * @@ -133,7 +133,7 @@ static int local_fifo_write(FAR struct file *filep, FAR const uint8_t *buf, * buf Data to send * len Length of data to send * - * Return: + * Returned Value: * Zero is returned on success; a negated errno value is returned on any * failure. * diff --git a/net/netdev/netdev_ioctl.c b/net/netdev/netdev_ioctl.c index e4b1e13a46..9fdb2f1e8c 100644 --- a/net/netdev/netdev_ioctl.c +++ b/net/netdev/netdev_ioctl.c @@ -382,7 +382,7 @@ static void ioctl_set_ipv6addr(FAR net_ipv6addr_t outaddr, * cmd The ioctl command * req The argument of the ioctl cmd * - * Return: + * Returned Value: * >=0 on success (positive non-zero values are cmd-specific) * Negated errno returned on failure. * @@ -444,7 +444,7 @@ static int netdev_iee802154_ioctl(FAR struct socket *psock, int cmd, * cmd The ioctl command * req The argument of the ioctl cmd * - * Return: + * Returned Value: * >=0 on success (positive non-zero values are cmd-specific) * Negated errno returned on failure. * @@ -507,7 +507,7 @@ static int netdev_pktradio_ioctl(FAR struct socket *psock, int cmd, * cmd The ioctl command * req The argument of the ioctl cmd * - * Return: + * Returned Value: * >=0 on success (positive non-zero values are cmd-specific) * Negated errno returned on failure. * @@ -548,7 +548,7 @@ static int netdev_wifr_ioctl(FAR struct socket *psock, int cmd, * Parameters: * req - The argument of the ioctl cmd * - * Return: + * Returned Value: * A pointer to the driver structure on success; NULL on failure. * ****************************************************************************/ @@ -578,7 +578,7 @@ static FAR struct net_driver_s *netdev_ifr_dev(FAR struct ifreq *req) * cmd The ioctl command * req The argument of the ioctl cmd * - * Return: + * Returned Value: * >=0 on success (positive non-zero values are cmd-specific) * Negated errno returned on failure. * @@ -1030,7 +1030,7 @@ static int netdev_ifr_ioctl(FAR struct socket *psock, int cmd, * Parameters: * req - The argument of the ioctl cmd * - * Return: + * Returned Value: * A pointer to the driver structure on success; NULL on failure. * ****************************************************************************/ @@ -1063,7 +1063,7 @@ static FAR struct net_driver_s *netdev_imsfdev(FAR struct ip_msfilter *imsf) * cmd The ioctl command * imsf The argument of the ioctl cmd * - * Return: + * Returned Value: * >=0 on success (positive non-zero values are cmd-specific) * Negated errno returned on failure. * @@ -1122,7 +1122,7 @@ static int netdev_imsf_ioctl(FAR struct socket *psock, int cmd, * cmd The ioctl command * req The argument of the ioctl cmd * - * Return: + * Returned Value: * >=0 on success (positive non-zero values are cmd-specific) * Negated errno returned on failure. * @@ -1245,7 +1245,7 @@ static int netdev_arp_ioctl(FAR struct socket *psock, int cmd, * cmd The ioctl command * rtentry The argument of the ioctl cmd * - * Return: + * Returned Value: * >=0 on success (positive non-zero values are cmd-specific) * Negated errno returned on failure. * @@ -1359,7 +1359,7 @@ static int netdev_rt_ioctl(FAR struct socket *psock, int cmd, * cmd The ioctl command * arg The argument of the ioctl cmd * - * Return: + * Returned Value: * A non-negative value is returned on success; a negated errno value is * returned on any failure to indicate the nature of the failure: * @@ -1469,7 +1469,7 @@ int psock_ioctl(FAR struct socket *psock, int cmd, unsigned long arg) * cmd The ioctl command * arg The argument of the ioctl cmd * - * Return: + * Returned Value: * A non-negative value is returned on success; a negated errno value is * returned on any failure to indicate the nature of the failure: * diff --git a/net/pkt/pkt.h b/net/pkt/pkt.h index 2351e91192..f4bcfca1e6 100644 --- a/net/pkt/pkt.h +++ b/net/pkt/pkt.h @@ -193,7 +193,7 @@ uint16_t pkt_callback(FAR struct net_driver_s *dev, * Parameters: * dev - The device driver structure containing the received packet * - * Return: + * Returned Value: * OK The packet has been processed and can be deleted * ERROR There is a matching connection, but could not dispatch the packet * yet. Useful when a packet arrives before a recv call is in @@ -267,7 +267,7 @@ FAR struct net_driver_s *pkt_find_device(FAR struct pkt_conn_s *conn); * dev - The device driver structure to use in the send operation * conn - The packet "connection" to poll for TX data * - * Return: + * Returned Value: * None * * Assumptions: diff --git a/net/pkt/pkt_input.c b/net/pkt/pkt_input.c index e4ba86c2d1..4676426f12 100644 --- a/net/pkt/pkt_input.c +++ b/net/pkt/pkt_input.c @@ -73,7 +73,7 @@ * Parameters: * dev - The device driver structure containing the received packet * - * Return: + * Returned Value: * OK The packet has been processed and can be deleted * ERROR There is a matching connection, but could not dispatch the packet * yet. Useful when a packet arrives before a recv call is in diff --git a/net/pkt/pkt_poll.c b/net/pkt/pkt_poll.c index 272de209f3..7fdb76d036 100644 --- a/net/pkt/pkt_poll.c +++ b/net/pkt/pkt_poll.c @@ -68,7 +68,7 @@ * dev - The device driver structure to use in the send operation * conn - The packet "connection" to poll for TX data * - * Return: + * Returned Value: * None * * Assumptions: diff --git a/net/pkt/pkt_recvfrom.c b/net/pkt/pkt_recvfrom.c index ae801d07bb..137fd5f647 100644 --- a/net/pkt/pkt_recvfrom.c +++ b/net/pkt/pkt_recvfrom.c @@ -159,7 +159,7 @@ static void pkt_recvfrom_newdata(FAR struct net_driver_s *dev, * * Parameters: * - * Returned Values: + * Returned Value: * * Assumptions: * @@ -177,7 +177,7 @@ static inline void pkt_recvfrom_sender(FAR struct net_driver_s *dev, * * Parameters: * - * Returned Values: + * Returned Value: * * Assumptions: * diff --git a/net/sixlowpan/sixlowpan.h b/net/sixlowpan/sixlowpan.h index 4d0ba44685..7760e47e58 100644 --- a/net/sixlowpan/sixlowpan.h +++ b/net/sixlowpan/sixlowpan.h @@ -86,7 +86,7 @@ void sixlowpan_initialize(void); * psock_6lowpan_tcp_send() call may be used only when the TCP socket is in a * connected state (so that the intended recipient is known). * - * Input Parmeters + * Input Parameters: * psock - An instance of the internal socket structure. * buf - Data to send * len - Length of data to send @@ -126,7 +126,7 @@ ssize_t psock_6lowpan_tcp_send(FAR struct socket *psock, FAR const void *buf, * driver. Under those conditions, this function will be called to create * the IEEE80215.4 frames. * - * Input Parmeters + * Input Parameters: * dev - The network device containing the packet to be sent. * fwddev - The network device used to send the data. This will be the * same device except for the IP forwarding case where packets @@ -159,7 +159,7 @@ void sixlowpan_tcp_send(FAR struct net_driver_s *dev, * * Both cases are handled here. * - * Input Parmeters + * Input Parameters: * dev - The network device containing the packet to be sent. * fwddev - The network device used to send the data. This will be the * same device except for the IP forwarding case where packets @@ -189,7 +189,7 @@ void sixlowpan_icmpv6_send(FAR struct net_driver_s *dev, * psock_6lowpan_udp_send() call may be used with connectionlesss UDP * sockets. * - * Input Parmeters + * Input Parameters: * psock - An instance of the internal socket structure. * buf - Data to send * len - Length of data to send @@ -219,7 +219,7 @@ ssize_t psock_6lowpan_udp_send(FAR struct socket *psock, FAR const void *buf, * may be returned when they are not NULL and 0), and the error ENOTCONN is * returned when the socket was not actually connected. * - * Input Parmeters + * Input Parameters: * psock A pointer to a NuttX-specific, internal socket structure * buf Data to send * len Length of data to send @@ -251,7 +251,7 @@ ssize_t psock_6lowpan_udp_sendto(FAR struct socket *psock, * Handles forwarding a UDP packet via 6LoWPAN. This is currently only * used by the IPv6 forwarding logic. * - * Input Parmeters + * Input Parameters: * dev - An instance of nework device state structure * fwddev - The network device used to send the data. This will be the * same device except for the IP forwarding case where packets diff --git a/net/sixlowpan/sixlowpan_framelist.c b/net/sixlowpan/sixlowpan_framelist.c index 545bea004a..d69e007a1f 100644 --- a/net/sixlowpan/sixlowpan_framelist.c +++ b/net/sixlowpan/sixlowpan_framelist.c @@ -199,7 +199,7 @@ static uint16_t sixlowpan_protosize(FAR const struct ipv6_hdr_s *ipv6hdr, * destmac - The IEEE802.15.4 MAC address of the destination * meta - Location to return the final metadata. * - * Returned value + * Returned Value: * OK is returned on success; Othewise a negated errno value is returned. * ****************************************************************************/ @@ -298,7 +298,7 @@ static int sixlowpan_ieee802154_metadata(FAR struct radio_driver_s *radio, * destmac - The radio-specific MAC address of the destination * meta - Location to return the final metadata. * - * Returned value + * Returned Value: * OK is returned on success; Othewise a negated errno value is returned. * ****************************************************************************/ diff --git a/net/sixlowpan/sixlowpan_framer.c b/net/sixlowpan/sixlowpan_framer.c index 666c6a3adf..023d59f83f 100644 --- a/net/sixlowpan/sixlowpan_framer.c +++ b/net/sixlowpan/sixlowpan_framer.c @@ -64,7 +64,7 @@ * If the destination address is all zero in the MAC header buf, then it is * broadcast on the 802.15.4 network. * - * Input parameters: + * Input Parameters: * addr - The address to check * addrlen - The length of the address in bytes * @@ -93,7 +93,7 @@ static bool sixlowpan_anyaddrnull(FAR const uint8_t *addr, uint8_t addrlen) * If the destination address is all zero in the MAC header buf, then it is * broadcast on the 802.15.4 network. * - * Input parameters: + * Input Parameters: * eaddr - The short address to check * * Returned Value: @@ -113,7 +113,7 @@ static inline bool sixlowpan_saddrnull(FAR const uint8_t *saddr) * If the destination address is all zero in the MAC header buf, then it is * broadcast on the 802.15.4 network. * - * Input parameters: + * Input Parameters: * eaddr - The extended address to check * * Returned Value: @@ -247,7 +247,7 @@ int sixlowpan_meta_data(FAR struct radio_driver_s *radio, * determine what the size of the IEEE802.15.4 header will be. No frame * buffer is required to make this determination. * - * Input parameters: + * Input Parameters: * radio - A reference IEEE802.15.4 MAC network device structure. * meta - Meta data that describes the MAC header * @@ -272,7 +272,7 @@ int sixlowpan_frame_hdrlen(FAR struct radio_driver_s *radio, * new incoming frame and the network responds with an outgoing packet. It * submits any new outgoing frame to the MAC. * - * Input parameters: + * Input Parameters: * radio - A reference to a radio network device instance. * meta - Meta data that describes the MAC header * frame - The IOB containing the frame to be submitted. diff --git a/net/sixlowpan/sixlowpan_hc06.c b/net/sixlowpan/sixlowpan_hc06.c index c9e05410e1..204cf69cbc 100644 --- a/net/sixlowpan/sixlowpan_hc06.c +++ b/net/sixlowpan/sixlowpan_hc06.c @@ -1078,7 +1078,7 @@ int sixlowpan_compresshdr_hc06(FAR struct radio_driver_s *radio, * decompression, g_frame_hdrlen and g_uncompressed_hdrlen are set to the * appropriate values * - * Input Parmeters: + * Input Parameters: * radio - Reference to a radio network driver state instance. * metadata - Obfuscated MAC metadata including node addressing * information. diff --git a/net/sixlowpan/sixlowpan_hc1.c b/net/sixlowpan/sixlowpan_hc1.c index 977c268cab..ffbc479edf 100644 --- a/net/sixlowpan/sixlowpan_hc1.c +++ b/net/sixlowpan/sixlowpan_hc1.c @@ -108,7 +108,7 @@ * | src p.| dst p.| UDP checksum | L4 data... * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * - * Input Parmeters: + * Input Parameters: * radio - A reference to a radio network device instance * ipv6 - The IPv6 header followd by TCP, UDP, or ICMPv6 header to be * compressed diff --git a/net/sixlowpan/sixlowpan_icmpv6send.c b/net/sixlowpan/sixlowpan_icmpv6send.c index e62c617ed1..a4ef1dc79a 100644 --- a/net/sixlowpan/sixlowpan_icmpv6send.c +++ b/net/sixlowpan/sixlowpan_icmpv6send.c @@ -63,7 +63,7 @@ * Handles forwarding a ICMPv6 packet via 6LoWPAN. This is currently only * used by the IPv6 forwarding logic. * - * Input Parmeters + * Input Parameters: * dev - An instance of nework device state structure * fwddev - The network device used to send the data. This will be the * same device except for the IP forwarding case where packets diff --git a/net/sixlowpan/sixlowpan_input.c b/net/sixlowpan/sixlowpan_input.c index e64becd9c1..50a757a604 100644 --- a/net/sixlowpan/sixlowpan_input.c +++ b/net/sixlowpan/sixlowpan_input.c @@ -597,7 +597,7 @@ errout_with_reass: * Description: * Inject the packet in d_buf into the network for normal packet processing. * - * Input Parmeters + * Input Parameters: * radio - The IEEE802.15.4 MAC network driver interface. * * Returned Value: diff --git a/net/sixlowpan/sixlowpan_internal.h b/net/sixlowpan/sixlowpan_internal.h index 7e527dae0d..e07e401549 100644 --- a/net/sixlowpan/sixlowpan_internal.h +++ b/net/sixlowpan/sixlowpan_internal.h @@ -319,7 +319,7 @@ int sixlowpan_meta_data(FAR struct radio_driver_s *radio, * determine what the size of the IEEE802.15.4 header will be. No frame * buffer is required to make this determination. * - * Input parameters: + * Input Parameters: * radio - Reference to a radio network driver state instance. * meta - obfuscated meta data that describes the MAC header * @@ -341,7 +341,7 @@ int sixlowpan_frame_hdrlen(FAR struct radio_driver_s *radio, * new incoming frame and the network responds with an outgoing packet. It * submits any new outgoing frame to the MAC. * - * Input parameters: + * Input Parameters: * radio - Reference to a radio network driver state instance. * meta - Obfuscated metadata that describes the MAC header * frame - The IOB containing the frame to be submitted. @@ -471,7 +471,7 @@ int sixlowpan_compresshdr_hc06(FAR struct radio_driver_s *radio, * decompression, g_frame_hdrlen and g_uncompressed_hdrlen are set to the * appropriate values * - * Input Parmeters: + * Input Parameters: * radio - Reference to a radio network driver state instance. * metadata - Obfuscated MAC metadata including node addressing * information. @@ -506,7 +506,7 @@ void sixlowpan_uncompresshdr_hc06(FAR struct radio_driver_s *radio, * 6lowpan packet in the packetbuf buffer from a full IPv6 packet in the * uip_buf buffer. * - * Input Parmeters: + * Input Parameters: * radio - Reference to a radio network driver state instance. * ipv6 - The IPv6 header to be compressed * destmac - L2 destination address, needed to compress the IP @@ -629,7 +629,7 @@ bool sixlowpan_ismacbased(const net_ipv6addr_t ipaddr, * Description: * Get the maximum frame length supported by radio network drvier. * - * Input parameters: + * Input Parameters: * radio - Reference to a radio network driver state instance. * * Returned Value: @@ -646,7 +646,7 @@ int sixlowpan_radio_framelen(FAR struct radio_driver_s *radio); * Description: * Get the source PAN ID from the IEEE802.15.4 radio. * - * Input parameters: + * Input Parameters: * radio - Reference to a radio network driver state instance. * panid - The location in which to return the PAN ID. 0xfff may be * returned if the device is not associated. @@ -668,7 +668,7 @@ int sixlowpan_src_panid(FAR struct radio_driver_s *radio, * Extract the source MAC address from the radio-specific RX metadata, and * return the source address in a radio-agnostic form. * - * Input parameters: + * Input Parameters: * radio - Reference to a radio network driver state instance. * metadata - Opaque reference to the radio-specific RX metadata. * srcaddr - The location in which to return the source MAC address. @@ -689,7 +689,7 @@ int sixlowpan_extract_srcaddr(FAR struct radio_driver_s *radio, * Extract the destination MAC address from the radio-specific RX metadata, * and return the destination address in a radio-agnostic form. * - * Input parameters: + * Input Parameters: * radio - Reference to a radio network driver state instance. * metadata - Opaque reference to the radio-specific RX metadata. * destaddr - The location in which to return the destination MAC address. @@ -713,10 +713,10 @@ int sixlowpan_extract_destaddr(FAR struct radio_driver_s *radio, * * Called only once during network initialization. * - * Inputs: + * Input Parameters: * None * - * Return Value: + * Returned Value: * None * ****************************************************************************/ @@ -734,11 +734,11 @@ void sixlowpan_reass_initialize(void); * list. If that the list is empty, then the reassembly buffer structure * will be allocated from the dynamic memory pool. * - * Inputs: + * Input Parameters: * reasstag - The reassembly tag for subsequent lookup. * fragsrc - The source address of the fragment. * - * Return Value: + * Returned Value: * A reference to the allocated reass structure. All fields used by the * reasembly logic have been zeroed. On a failure to allocate, NULL is * returned. @@ -759,11 +759,11 @@ FAR struct sixlowpan_reassbuf_s * * Find a previously allocated, active reassembly buffer with the specified * reassembly tag. * - * Inputs: + * Input Parameters: * reasstag - The reassembly tag to match. * fragsrc - The source address of the fragment. * - * Return Value: + * Returned Value: * A reference to the matching reass structure. * * Assumptions: @@ -784,10 +784,10 @@ FAR struct sixlowpan_reassbuf_s * * structure. If the reass structure was allocated dynamically it will * be deallocated. * - * Inputs: + * Input Parameters: * reass - reass structure to free * - * Return Value: + * Returned Value: * None * * Assumptions: diff --git a/net/sixlowpan/sixlowpan_reassbuf.c b/net/sixlowpan/sixlowpan_reassbuf.c index c3ae7eeb80..13b57fa0b9 100644 --- a/net/sixlowpan/sixlowpan_reassbuf.c +++ b/net/sixlowpan/sixlowpan_reassbuf.c @@ -121,10 +121,10 @@ static bool sixlowpan_compare_fragsrc(FAR struct sixlowpan_reassbuf_s *reass, * Description: * Free all expired or inactive reassembly buffers. * - * Inputs: + * Input Parameters: * None * - * Return Value: + * Returned Value: * None * * Assumptions: @@ -177,10 +177,10 @@ static void sixlowpan_reass_expire(void) * Description: * Remove a reassembly buffer from the active reassembly buffer list. * - * Inputs: + * Input Parameters: * reass - The reassembly buffer to be removed. * - * Return Value: + * Returned Value: * None * * Assumptions: @@ -234,10 +234,10 @@ static void sixlowpan_remove_active(FAR struct sixlowpan_reassbuf_s *reass) * * Called only once during network initialization. * - * Inputs: + * Input Parameters: * None * - * Return Value: + * Returned Value: * None * ****************************************************************************/ @@ -276,11 +276,11 @@ void sixlowpan_reass_initialize(void) * list. If that the list is empty, then the reassembly buffer structure * will be allocated from the dynamic memory pool. * - * Inputs: + * Input Parameters: * reasstag - The reassembly tag for subsequent lookup. * fragsrc - The source address of the fragment. * - * Return Value: + * Returned Value: * A reference to the allocated reass structure. All fields used by the * reasembly logic have been zeroed. On a failure to allocate, NULL is * returned. @@ -355,11 +355,11 @@ FAR struct sixlowpan_reassbuf_s * * Find a previously allocated, active reassembly buffer with the specified * reassembly tag. * - * Inputs: + * Input Parameters: * reasstag - The reassembly tag to match. * fragsrc - The source address of the fragment. * - * Return Value: + * Returned Value: * A reference to the matching reass structure. * * Assumptions: @@ -411,10 +411,10 @@ FAR struct sixlowpan_reassbuf_s * * structure. If the reass structure was allocated dynamically it will * be deallocated. * - * Inputs: + * Input Parameters: * reass - reass structure to free * - * Return Value: + * Returned Value: * None * * Assumptions: diff --git a/net/sixlowpan/sixlowpan_send.c b/net/sixlowpan/sixlowpan_send.c index b8fceb8958..3deb9d5b1c 100644 --- a/net/sixlowpan/sixlowpan_send.c +++ b/net/sixlowpan/sixlowpan_send.c @@ -141,7 +141,7 @@ static inline bool send_timeout(FAR struct sixlowpan_send_s *sinfo) * This function is called from the interrupt level to perform the actual * send operation when polled by the lower, device interfacing layer. * - * Input Parmeters + * Input Parameters: * dev - The structure of the network driver that caused the interrupt * conn - The connection structure associated with the socket * flags - Set of events describing why the callback was invoked diff --git a/net/sixlowpan/sixlowpan_tcpsend.c b/net/sixlowpan/sixlowpan_tcpsend.c index df7eab7971..bc2085c498 100644 --- a/net/sixlowpan/sixlowpan_tcpsend.c +++ b/net/sixlowpan/sixlowpan_tcpsend.c @@ -178,7 +178,7 @@ static uint16_t sixlowpan_tcp_chksum(FAR const struct ipv6tcp_hdr_s *ipv6tcp, * Description: * sixlowpan_tcp_header() will construct the IPv6 and TCP headers * - * Input Parmeters + * Input Parameters: * conn - An instance of the TCP connection structure. * dev - The network device that will route the packet * buf - Data to send @@ -328,7 +328,7 @@ static inline bool send_timeout(FAR struct sixlowpan_send_s *sinfo) * This function is called from the interrupt level to perform the actual * TCP send operation when polled by the lower, device interfacing layer. * - * Input Parmeters + * Input Parameters: * dev - The structure of the network driver that caused the interrupt * pvconn - The connection structure associated with the socket * pvpriv - The interrupt handler's private data argument @@ -745,7 +745,7 @@ static int sixlowpan_send_packet(FAR struct socket *psock, * psock_6lowpan_tcp_send() call may be used only when the TCP socket is in a * connected state (so that the intended recipient is known). * - * Input Parmeters + * Input Parameters: * psock - An instance of the internal socket structure. * buf - Data to send * bulen - Length of data to send @@ -898,7 +898,7 @@ ssize_t psock_6lowpan_tcp_send(FAR struct socket *psock, FAR const void *buf, * driver. Under those conditions, this function will be called to create * the IEEE80215.4 frames. * - * Input Parmeters + * Input Parameters: * dev - The network device containing the packet to be sent. * fwddev - The network device used to send the data. This will be the * same device except for the IP forwarding case where packets diff --git a/net/sixlowpan/sixlowpan_udpsend.c b/net/sixlowpan/sixlowpan_udpsend.c index e2f115eb09..6f99f31b7c 100644 --- a/net/sixlowpan/sixlowpan_udpsend.c +++ b/net/sixlowpan/sixlowpan_udpsend.c @@ -136,7 +136,7 @@ static uint16_t sixlowpan_udp_chksum(FAR const struct ipv6udp_hdr_s *ipv6udp, * may be returned when they are not NULL and 0), and the error ENOTCONN is * returned when the socket was not actually connected. * - * Input Parmeters + * Input Parameters: * psock A pointer to a NuttX-specific, internal socket structure * buf Data to send * buflen Length of data to send @@ -337,7 +337,7 @@ ssize_t psock_6lowpan_udp_sendto(FAR struct socket *psock, * psock_6lowpan_udp_send() call may be used with connectionlesss UDP * sockets. * - * Input Parmeters + * Input Parameters: * psock - An instance of the internal socket structure. * buf - Data to send * buflen - Length of data to send @@ -413,7 +413,7 @@ ssize_t psock_6lowpan_udp_send(FAR struct socket *psock, FAR const void *buf, * Handles forwarding a UDP packet via 6LoWPAN. This is currently only * used by the IPv6 forwarding logic. * - * Input Parmeters + * Input Parameters: * dev - An instance of nework device state structure * fwddev - The network device used to send the data. This will be the * same device except for the IP forwarding case where packets diff --git a/net/sixlowpan/sixlowpan_utils.c b/net/sixlowpan/sixlowpan_utils.c index 696503b5a9..644ad1484e 100644 --- a/net/sixlowpan/sixlowpan_utils.c +++ b/net/sixlowpan/sixlowpan_utils.c @@ -573,7 +573,7 @@ bool sixlowpan_ismacbased(const net_ipv6addr_t ipaddr, * Description: * Get the maximum frame length supported by radio network drvier. * - * Input parameters: + * Input Parameters: * radio - Reference to a radio network driver state instance. * * Returned Value: @@ -607,7 +607,7 @@ int sixlowpan_radio_framelen(FAR struct radio_driver_s *radio) * Description: * Get the source PAN ID from the IEEE802.15.4 MAC layer. * - * Input parameters: + * Input Parameters: * radio - Reference to a radio network driver state instance. * panid - The location in which to return the PAN ID. 0xfff may be * returned if the device is not associated. @@ -647,7 +647,7 @@ int sixlowpan_src_panid(FAR struct radio_driver_s *radio, * Extract the source MAC address from the radio-specific RX metadata, and * return the source address in a radio-agnostic form. * - * Input parameters: + * Input Parameters: * radio - Reference to a radio network driver state instance. * metadata - Opaque reference to the radio-specific RX metadata. * srcaddr - The location in which to return the source MAC address. @@ -714,7 +714,7 @@ int sixlowpan_extract_srcaddr(FAR struct radio_driver_s *radio, * Extract the destination MAC address from the radio-specific RX metadata, * and return the destination address in a radio-agnostic form. * - * Input parameters: + * Input Parameters: * radio - Reference to a radio network driver state instance. * metadata - Opaque reference to the radio-specific RX metadata. * destaddr - The location in which to return the destination MAC address. diff --git a/net/tcp/tcp.h b/net/tcp/tcp.h index bfd402c00a..13ab0d803d 100644 --- a/net/tcp/tcp.h +++ b/net/tcp/tcp.h @@ -480,7 +480,7 @@ FAR struct tcp_conn_s *tcp_alloc_accept(FAR struct net_driver_s *dev, * This function implements the lower level parts of the standard TCP * bind() operation. * - * Return: + * Returned Value: * 0 on success or -EADDRINUSE on failure * * Assumptions: @@ -727,7 +727,7 @@ void tcp_nextsequence(void); * dev - The device driver structure to use in the send operation * conn - The TCP "connection" to poll for TX data * - * Return: + * Returned Value: * None * * Assumptions: @@ -748,7 +748,7 @@ void tcp_poll(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn); * conn - The TCP "connection" to poll for TX data * hsec - The polling interval in halves of a second * - * Return: + * Returned Value: * None * * Assumptions: @@ -859,7 +859,7 @@ int tcp_accept_connection(FAR struct net_driver_s *dev, * flags - flags to apply to the TCP header * len - length of the message * - * Return: + * Returned Value: * None * * Assumptions: @@ -904,7 +904,7 @@ ssize_t tcp_sendfile(FAR struct socket *psock, FAR struct file *infile, * Parameters: * dev - The device driver structure to use in the send operation * - * Return: + * Returned Value: * None * * Assumptions: @@ -925,7 +925,7 @@ void tcp_reset(FAR struct net_driver_s *dev); * conn - The TCP connection structure holding connection information * ack - The ACK response to send * - * Return: + * Returned Value: * None * * Assumptions: @@ -949,7 +949,7 @@ void tcp_ack(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn, * conn - The TCP connection structure holding connection information * result - App result event sent * - * Return: + * Returned Value: * None * * Assumptions: @@ -971,7 +971,7 @@ void tcp_appsend(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn, * conn - The TCP connection structure holding connection information * result - App result event sent * - * Return: + * Returned Value: * None * * Assumptions: @@ -991,7 +991,7 @@ void tcp_rexmit(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn, * Parameters: * dev - The device driver structure containing the received TCP packet. * - * Return: + * Returned Value: * None * * Assumptions: @@ -1012,7 +1012,7 @@ void tcp_ipv4_input(FAR struct net_driver_s *dev); * Parameters: * dev - The device driver structure containing the received TCP packet. * - * Return: + * Returned Value: * None * * Assumptions: @@ -1053,7 +1053,7 @@ uint16_t tcp_callback(FAR struct net_driver_s *dev, * buffers * buflen - The number of bytes to copy to the read-ahead buffer. * - * Returned value: + * Returned Value: * The number of bytes actually buffered is returned. This will be either * zero or equal to buflen; partial packets are not buffered. * @@ -1320,7 +1320,7 @@ void tcp_wrbuffer_initialize(void); * the free list. This function is called from TCP logic when a buffer * of TCP data is about to sent * - * Input parameters: + * Input Parameters: * None * * Assumptions: diff --git a/net/tcp/tcp_appsend.c b/net/tcp/tcp_appsend.c index 7ee1f06779..b87c679b6e 100644 --- a/net/tcp/tcp_appsend.c +++ b/net/tcp/tcp_appsend.c @@ -72,7 +72,7 @@ * conn - The TCP connection structure holding connection information * result - App result event sent * - * Return: + * Returned Value: * None * * Assumptions: @@ -197,7 +197,7 @@ void tcp_appsend(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn, * conn - The TCP connection structure holding connection information * result - App result event sent * - * Return: + * Returned Value: * None * * Assumptions: diff --git a/net/tcp/tcp_callback.c b/net/tcp/tcp_callback.c index dcc16927b9..a43af2fb90 100644 --- a/net/tcp/tcp_callback.c +++ b/net/tcp/tcp_callback.c @@ -218,7 +218,7 @@ uint16_t tcp_callback(FAR struct net_driver_s *dev, * buffers * buflen - The number of bytes to copy to the read-ahead buffer. * - * Returned value: + * Returned Value: * The number of bytes actually buffered is returned. This will be either * zero or equal to buflen; partial packets are not buffered. * diff --git a/net/tcp/tcp_conn.c b/net/tcp/tcp_conn.c index 43282501ea..0c125d4717 100644 --- a/net/tcp/tcp_conn.c +++ b/net/tcp/tcp_conn.c @@ -243,7 +243,7 @@ static FAR struct tcp_conn_s * * portno -- the selected port number in host order. Zero means no port * selected. * - * Return: + * Returned Value: * Selected or verified port number in host order on success, a negated * errno on failure: * @@ -445,7 +445,7 @@ static inline FAR struct tcp_conn_s * * This function implements the lower level parts of the standard TCP * bind() operation. * - * Return: + * Returned Value: * 0 on success or -EADDRINUSE on failure * * Assumptions: @@ -510,7 +510,7 @@ static inline int tcp_ipv4_bind(FAR struct tcp_conn_s *conn, * This function implements the lower level parts of the standard TCP * bind() operation. * - * Return: + * Returned Value: * 0 on success or -EADDRINUSE on failure * * Assumptions: @@ -1039,7 +1039,7 @@ FAR struct tcp_conn_s *tcp_alloc_accept(FAR struct net_driver_s *dev, * This function implements the lower level parts of the standard TCP * bind() operation. * - * Return: + * Returned Value: * 0 on success or -EADDRINUSE on failure * * Assumptions: diff --git a/net/tcp/tcp_devpoll.c b/net/tcp/tcp_devpoll.c index ee00d7f7d1..8097f442f4 100644 --- a/net/tcp/tcp_devpoll.c +++ b/net/tcp/tcp_devpoll.c @@ -70,7 +70,7 @@ * dev - The device driver structure to use in the send operation * conn - The TCP "connection" to poll for TX data * - * Return: + * Returned Value: * None * * Assumptions: diff --git a/net/tcp/tcp_input.c b/net/tcp/tcp_input.c index b78a819fc0..015374aa2c 100644 --- a/net/tcp/tcp_input.c +++ b/net/tcp/tcp_input.c @@ -76,7 +76,7 @@ * domain - IP domain (PF_INET or PF_INET6) * iplen - Lngth of the IP header (IPv4_HDRLEN or IPv6_HDRLEN). * - * Return: + * Returned Value: * None * * Assumptions: @@ -947,7 +947,7 @@ drop: * Parameters: * dev - The device driver structure containing the received TCP packet. * - * Return: + * Returned Value: * None * * Assumptions: @@ -977,7 +977,7 @@ void tcp_ipv4_input(FAR struct net_driver_s *dev) * Parameters: * dev - The device driver structure containing the received TCP packet. * - * Return: + * Returned Value: * None * * Assumptions: diff --git a/net/tcp/tcp_send.c b/net/tcp/tcp_send.c index b4e833aa9b..def99b137f 100644 --- a/net/tcp/tcp_send.c +++ b/net/tcp/tcp_send.c @@ -86,7 +86,7 @@ * Parameters: * dev - The device driver structure to use in the send operation * - * Return: + * Returned Value: * The length of the IP header (IPv4_HDRLEN or IPv6_HDRLEN) * ****************************************************************************/ @@ -122,7 +122,7 @@ static inline FAR struct tcp_hdr_s *tcp_header(FAR struct net_driver_s *dev) * Parameters: * dev - The device driver structure to use in the send operation * - * Return: + * Returned Value: * None * * Assumptions: @@ -190,7 +190,7 @@ static inline void tcp_ipv4_sendcomplete(FAR struct net_driver_s *dev, * Parameters: * dev - The device driver structure to use in the send operation * - * Return: + * Returned Value: * None * * Assumptions: @@ -253,7 +253,7 @@ static inline void tcp_ipv6_sendcomplete(FAR struct net_driver_s *dev, * Parameters: * dev - The device driver structure to use in the send operation * - * Return: + * Returned Value: * None * * Assumptions: @@ -301,7 +301,7 @@ static void tcp_sendcomplete(FAR struct net_driver_s *dev, * dev - The device driver structure to use in the send operation * conn - The TCP connection structure holding connection information * - * Return: + * Returned Value: * None * * Assumptions: @@ -403,7 +403,7 @@ static void tcp_sendcommon(FAR struct net_driver_s *dev, * len - length of the message (includes the length of the IP and TCP * headers) * - * Return: + * Returned Value: * None * * Assumptions: @@ -431,7 +431,7 @@ void tcp_send(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn, * Parameters: * dev - The device driver structure to use in the send operation * - * Return: + * Returned Value: * None * * Assumptions: @@ -548,7 +548,7 @@ void tcp_reset(FAR struct net_driver_s *dev) * conn - The TCP connection structure holding connection information * ack - The ACK response to send * - * Return: + * Returned Value: * None * * Assumptions: diff --git a/net/tcp/tcp_timer.c b/net/tcp/tcp_timer.c index b5f5ffb5ab..a5812140f3 100644 --- a/net/tcp/tcp_timer.c +++ b/net/tcp/tcp_timer.c @@ -72,7 +72,7 @@ * conn - The TCP "connection" to poll for TX data * hsed - The polling interval in halves of a second * - * Return: + * Returned Value: * None * * Assumptions: diff --git a/net/tcp/tcp_wrbuffer.c b/net/tcp/tcp_wrbuffer.c index 6553d34f20..643d990708 100644 --- a/net/tcp/tcp_wrbuffer.c +++ b/net/tcp/tcp_wrbuffer.c @@ -125,7 +125,7 @@ void tcp_wrbuffer_initialize(void) * the free list. This function is called from TCP logic when a buffer * of TCP data is about to sent * - * Input parameters: + * Input Parameters: * None * * Assumptions: diff --git a/net/udp/udp.h b/net/udp/udp.h index 24be51dc21..315c0bfed0 100644 --- a/net/udp/udp.h +++ b/net/udp/udp.h @@ -301,7 +301,7 @@ void udp_ipv6_select(FAR struct net_driver_s *dev); * dev - The device driver structure to use in the send operation * conn - The UDP "connection" to poll for TX data * - * Return: + * Returned Value: * None * * Assumptions: @@ -321,7 +321,7 @@ void udp_poll(FAR struct net_driver_s *dev, FAR struct udp_conn_s *conn); * dev - The device driver structure to use in the send operation * conn - The UDP "connection" structure holding port information * - * Return: + * Returned Value: * None * * Assumptions: @@ -354,7 +354,7 @@ void udp_wrbuffer_initialize(void); * the free list. This function is called from UDP logic when a buffer * of UDP data is about to sent * - * Input parameters: + * Input Parameters: * None * * Assumptions: @@ -426,7 +426,7 @@ void udp_wrbuffer_dump(FAR const char *msg, FAR struct udp_wrbuffer_s *wrb, * Parameters: * dev - The device driver structure containing the received UDP packet * - * Return: + * Returned Value: * OK The packet has been processed and can be deleted * ERROR Hold the packet and try again later. There is a listening socket * but no receive in place to catch the packet yet. @@ -449,7 +449,7 @@ int udp_ipv4_input(FAR struct net_driver_s *dev); * Parameters: * dev - The device driver structure containing the received UDP packet * - * Return: + * Returned Value: * OK The packet has been processed and can be deleted * ERROR Hold the packet and try again later. There is a listening socket * but no receive in place to catch the packet yet. diff --git a/net/udp/udp_conn.c b/net/udp/udp_conn.c index 61e67028f6..d301b36543 100644 --- a/net/udp/udp_conn.c +++ b/net/udp/udp_conn.c @@ -203,7 +203,7 @@ static FAR struct udp_conn_s *udp_find_conn(uint8_t domain, * Input Parameters: * None * - * Return: + * Returned Value: * Next available port number * ****************************************************************************/ diff --git a/net/udp/udp_devpoll.c b/net/udp/udp_devpoll.c index 9b6de1a0a0..e23dd68301 100644 --- a/net/udp/udp_devpoll.c +++ b/net/udp/udp_devpoll.c @@ -68,7 +68,7 @@ * dev - The device driver structure to use in the send operation * conn - The UDP "connection" to poll for TX data * - * Return: + * Returned Value: * None * * Assumptions: diff --git a/net/udp/udp_input.c b/net/udp/udp_input.c index 081dc26b06..dffd3be129 100644 --- a/net/udp/udp_input.c +++ b/net/udp/udp_input.c @@ -71,7 +71,7 @@ * udp - A pointer to the UDP header in the packet * iplen - Length of the IP and UDP headers * - * Return: + * Returned Value: * OK - The packet has been processed and can be deleted * ERROR - Hold the packet and try again later. There is a listening * socket but no receive in place to catch the packet yet. The @@ -241,7 +241,7 @@ static int udp_input(FAR struct net_driver_s *dev, unsigned int iplen) * Parameters: * dev - The device driver structure containing the received UDP packet * - * Return: + * Returned Value: * OK The packet has been processed and can be deleted * ERROR Hold the packet and try again later. There is a listening socket * but no receive in place to catch the packet yet. @@ -273,7 +273,7 @@ int udp_ipv4_input(FAR struct net_driver_s *dev) * Parameters: * dev - The device driver structure containing the received UDP packet * - * Return: + * Returned Value: * OK The packet has been processed and can be deleted * ERROR Hold the packet and try again later. There is a listening socket * but no receive in place to catch the packet yet. diff --git a/net/udp/udp_send.c b/net/udp/udp_send.c index 7779d03875..46a9b3e86d 100644 --- a/net/udp/udp_send.c +++ b/net/udp/udp_send.c @@ -89,7 +89,7 @@ * dev - The device driver structure to use in the send operation * conn - The UDP "connection" structure holding port information * - * Return: + * Returned Value: * None * * Assumptions: diff --git a/net/udp/udp_wrbuffer.c b/net/udp/udp_wrbuffer.c index ae8fafd7ff..5e0eca8677 100644 --- a/net/udp/udp_wrbuffer.c +++ b/net/udp/udp_wrbuffer.c @@ -124,7 +124,7 @@ void udp_wrbuffer_initialize(void) * the free list. This function is called from UDP logic when a buffer * of UDP data is about to sent * - * Input parameters: + * Input Parameters: * None * * Assumptions: diff --git a/net/utils/net_ipv6_mask2pref.c b/net/utils/net_ipv6_mask2pref.c index cc4fd245c8..95b1b2000a 100644 --- a/net/utils/net_ipv6_mask2pref.c +++ b/net/utils/net_ipv6_mask2pref.c @@ -152,7 +152,7 @@ static inline uint8_t net_msbits16(uint16_t hword) * Parameters: * mask Points to an IPv6 netmask in the form of uint16_t[8] * - * Return: + * Returned Value: * The prefix length, range 0-128 on success; This function will not * fail. * diff --git a/net/utils/net_lock.c b/net/utils/net_lock.c index fff004bd3f..3cfad414d6 100644 --- a/net/utils/net_lock.c +++ b/net/utils/net_lock.c @@ -124,7 +124,7 @@ void net_lockinitialize(void) * Input Parameters: * None * - * Returned value: + * Returned Value: * None * ****************************************************************************/ @@ -163,7 +163,7 @@ void net_lock(void) * Input Parameters: * None * - * Returned value: + * Returned Value: * None * ****************************************************************************/ @@ -201,7 +201,7 @@ void net_unlock(void) * sem - A reference to the semaphore to be taken. * abstime - The absolute time to wait until a timeout is declared. * - * Returned value: + * Returned Value: * Zero (OK) is returned on success; a negated errno value is returned on * any failure. * @@ -265,7 +265,7 @@ int net_timedwait(sem_t *sem, FAR const struct timespec *abstime) * Input Parameters: * sem - A reference to the semaphore to be taken. * - * Returned value: + * Returned Value: * Zero (OK) is returned on success; a negated errno value is returned on * any failure. * diff --git a/net/utils/utils.h b/net/utils/utils.h index fc72447084..81dac87c15 100644 --- a/net/utils/utils.h +++ b/net/utils/utils.h @@ -161,7 +161,7 @@ unsigned int net_timeval2dsec(FAR struct timeval *tv, * Parameters: * mask Points to an IPv6 netmask in the form of uint16_t[8] * - * Return: + * Returned Value: * The prefix length, range 0-128 on success; This function will not * fail. * diff --git a/sched/clock/clock_abstime2ticks.c b/sched/clock/clock_abstime2ticks.c index 25a4af540e..4cfbea8b5b 100644 --- a/sched/clock/clock_abstime2ticks.c +++ b/sched/clock/clock_abstime2ticks.c @@ -89,7 +89,7 @@ static long compare_timespec(FAR const struct timespec *a, * reltime - Convert this absolue time to system clock ticks. * ticks - Return the converted number of ticks here. * - * Return Value: + * Returned Value: * OK on success; A non-zero error number on failure; * * Assumptions: diff --git a/sched/clock/clock_dow.c b/sched/clock/clock_dow.c index c922e856bc..41b7f8fafa 100644 --- a/sched/clock/clock_dow.c +++ b/sched/clock/clock_dow.c @@ -70,7 +70,7 @@ static const uint8_t g_lookup[12] = {2, 5, 7, 10, 12, 15, 17, 20, 23, 25, 28, 30 * month - 0 through 11 * day - 1 through 31 * - * Return Value: + * Returned Value: * The day of the week as days since Sunday: 0 = Sunday, 1 = Monday, etc. * * Assumptions: diff --git a/sched/clock/clock_initialize.c b/sched/clock/clock_initialize.c index 6edf41d90d..6cdf1b3a81 100644 --- a/sched/clock/clock_initialize.c +++ b/sched/clock/clock_initialize.c @@ -275,7 +275,7 @@ void clock_initialize(void) * Parameters: * None * - * Return Value: + * Returned Value: * None * * Assumptions: @@ -314,7 +314,7 @@ void clock_synchronize(void) * Parameters: * rtc_diff: amount of time system-time is adjusted forward with RTC * - * Return Value: + * Returned Value: * None * * Assumptions: diff --git a/sched/clock/clock_systimer.c b/sched/clock/clock_systimer.c index e1d4440ab1..6334c5232b 100644 --- a/sched/clock/clock_systimer.c +++ b/sched/clock/clock_systimer.c @@ -72,7 +72,7 @@ * Parameters: * None * - * Return Value: + * Returned Value: * The current value of the system timer counter * * Assumptions: diff --git a/sched/clock/clock_systimespec.c b/sched/clock/clock_systimespec.c index 5d6009d051..bdab9b115b 100644 --- a/sched/clock/clock_systimespec.c +++ b/sched/clock/clock_systimespec.c @@ -62,7 +62,7 @@ * Parameters: * ts - Location to return the time * - * Return Value: + * Returned Value: * Current version always returns OK * * Assumptions: diff --git a/sched/clock/clock_ticks2time.c b/sched/clock/clock_ticks2time.c index 899ecd9818..0ea5295f57 100644 --- a/sched/clock/clock_ticks2time.c +++ b/sched/clock/clock_ticks2time.c @@ -56,7 +56,7 @@ * ticks - The number of system time ticks to convert. * reltime - Return the converted system time here. * - * Return Value: + * Returned Value: * Always returns OK * * Assumptions: diff --git a/sched/clock/clock_time2ticks.c b/sched/clock/clock_time2ticks.c index 5f0bc28c40..5f0cb36bec 100644 --- a/sched/clock/clock_time2ticks.c +++ b/sched/clock/clock_time2ticks.c @@ -60,7 +60,7 @@ * reltime - Convert this relative time to system clock ticks. * ticks - Return the converted number of ticks here. * - * Return Value: + * Returned Value: * Always returns OK * * Assumptions: diff --git a/sched/clock/clock_timespec_add.c b/sched/clock/clock_timespec_add.c index 0e0fb931db..08bf634d76 100644 --- a/sched/clock/clock_timespec_add.c +++ b/sched/clock/clock_timespec_add.c @@ -54,11 +54,11 @@ * Description: * Add timespec ts1 to to2 and return the result in ts3 * - * Inputs: + * Input Parameters: * ts1 and ts2: The two timespecs to be added * t23: The location to return the result (may be ts1 or ts2) * - * Return Value: + * Returned Value: * None * ****************************************************************************/ diff --git a/sched/clock/clock_timespec_subtract.c b/sched/clock/clock_timespec_subtract.c index 754c84d1cb..873dd75d7c 100644 --- a/sched/clock/clock_timespec_subtract.c +++ b/sched/clock/clock_timespec_subtract.c @@ -55,11 +55,11 @@ * Subtract timespec ts2 from to1 and return the result in ts3. * Zero is returned if the time difference is negative. * - * Inputs: + * Input Parameters: * ts1 and ts2: The two timespecs to be subtracted (ts1 - ts2) * t23: The location to return the result (may be ts1 or ts2) * - * Return Value: + * Returned Value: * None * ****************************************************************************/ diff --git a/sched/environ/env_clearenv.c b/sched/environ/env_clearenv.c index ededbadbed..97aee7e230 100644 --- a/sched/environ/env_clearenv.c +++ b/sched/environ/env_clearenv.c @@ -60,7 +60,7 @@ * Parameters: * None * - * Return Value: + * Returned Value: * None * * Assumptions: diff --git a/sched/environ/env_dup.c b/sched/environ/env_dup.c index 08b0e1b617..5544c1faf6 100644 --- a/sched/environ/env_dup.c +++ b/sched/environ/env_dup.c @@ -67,7 +67,7 @@ * group The child task group to receive the newly allocated copy of the * parent task groups environment structure. * - * Return Value: + * Returned Value: * zero on success * * Assumptions: diff --git a/sched/environ/env_findvar.c b/sched/environ/env_findvar.c index f6b44da5c4..953aefebf3 100644 --- a/sched/environ/env_findvar.c +++ b/sched/environ/env_findvar.c @@ -86,7 +86,7 @@ static bool env_cmpname(const char *pszname, const char *peqname) * group The task group containging environment array to be searched. * pname The variable name to find * - * Return Value: + * Returned Value: * A pointer to the name=value string in the environment * * Assumptions: diff --git a/sched/environ/env_getenv.c b/sched/environ/env_getenv.c index 6e92f90d3f..be20805204 100644 --- a/sched/environ/env_getenv.c +++ b/sched/environ/env_getenv.c @@ -63,7 +63,7 @@ * Parameters: * name - The name of the variable to find. * - * Return Value: + * Returned Value: * The value of the valiable (read-only) or NULL on failure * * Assumptions: diff --git a/sched/environ/env_getenvironptr.c b/sched/environ/env_getenvironptr.c index 11c4f5368e..43f7a2cfcf 100644 --- a/sched/environ/env_getenvironptr.c +++ b/sched/environ/env_getenvironptr.c @@ -60,7 +60,7 @@ * Parameters: * None * - * Return Value: + * Returned Value: * A pointer to the per-thread environ variable. * * Assumptions: diff --git a/sched/environ/env_putenv.c b/sched/environ/env_putenv.c index ec683b298c..f54dea241f 100644 --- a/sched/environ/env_putenv.c +++ b/sched/environ/env_putenv.c @@ -65,7 +65,7 @@ * Parameters: * name=value string describing the environment setting to add/modify * - * Return Value: + * Returned Value: * Zero on sucess * * Assumptions: diff --git a/sched/environ/env_release.c b/sched/environ/env_release.c index d1ace0505b..fd9bdfd312 100644 --- a/sched/environ/env_release.c +++ b/sched/environ/env_release.c @@ -65,7 +65,7 @@ * group Identifies the task group containing the environment structure * to be released. * - * Return Value: + * Returned Value: * None * * Assumptions: diff --git a/sched/environ/env_removevar.c b/sched/environ/env_removevar.c index b18ebbf899..197357ea08 100644 --- a/sched/environ/env_removevar.c +++ b/sched/environ/env_removevar.c @@ -60,7 +60,7 @@ * group The task group with the environment containing the name=value pair * pvar A pointer to the name=value pair in the restroom * - * Return Value: + * Returned Value: * Zero on success * * Assumptions: diff --git a/sched/environ/env_setenv.c b/sched/environ/env_setenv.c index 38faae839a..96cd06ac4c 100644 --- a/sched/environ/env_setenv.c +++ b/sched/environ/env_setenv.c @@ -71,7 +71,7 @@ * value - The new value of the variable * overwrite - Replace any existing value if non-zero. * - * Return Value: + * Returned Value: * Zero on success * * Assumptions: diff --git a/sched/environ/env_unsetenv.c b/sched/environ/env_unsetenv.c index 2956cfe783..fa85358abf 100644 --- a/sched/environ/env_unsetenv.c +++ b/sched/environ/env_unsetenv.c @@ -63,7 +63,7 @@ * Parameters: * name - The name of the variable to delete * - * Return Value: + * Returned Value: * Zero on success * * Assumptions: diff --git a/sched/errno/errno_get.c b/sched/errno/errno_get.c index 8982ac61e7..3664a3e054 100644 --- a/sched/errno/errno_get.c +++ b/sched/errno/errno_get.c @@ -65,7 +65,7 @@ * Parameters: * None * - * Return Value: + * Returned Value: * The current value of the thread specific errno. * * Assumptions: diff --git a/sched/errno/errno_getptr.c b/sched/errno/errno_getptr.c index 4e47895a0b..4d220db23d 100644 --- a/sched/errno/errno_getptr.c +++ b/sched/errno/errno_getptr.c @@ -75,7 +75,7 @@ static int g_irqerrno; * Parameters: * None * - * Return Value: + * Returned Value: * A pointer to the per-thread errno variable. * * Assumptions: diff --git a/sched/errno/errno_set.c b/sched/errno/errno_set.c index 540bc8b782..a7a00af67a 100644 --- a/sched/errno/errno_set.c +++ b/sched/errno/errno_set.c @@ -64,7 +64,7 @@ * Parameters: * errcode - The thread specific errno will be set to this error code value. * - * Return Value: + * Returned Value: * None * * Assumptions: diff --git a/sched/group/group_addrenv.c b/sched/group/group_addrenv.c index 52330c04cc..bc301c9b43 100644 --- a/sched/group/group_addrenv.c +++ b/sched/group/group_addrenv.c @@ -82,7 +82,7 @@ gid_t g_gid_current; * be the TCB at the head of the ready-to-run list, but that is not * enough. * - * Return Value: + * Returned Value: * Zero (OK) is returned on success. A negated errno value is returned on * any failure. * diff --git a/sched/group/group_childstatus.c b/sched/group/group_childstatus.c index e4e994677d..915c1c9a96 100644 --- a/sched/group/group_childstatus.c +++ b/sched/group/group_childstatus.c @@ -100,7 +100,7 @@ static struct child_pool_s g_child_pool; * Parameters: * group - The task group containing the child status. * - * Return Value: + * Returned Value: * None. * * Assumptions: @@ -140,7 +140,7 @@ static void group_dumpchildren(FAR struct task_group_s *group, * Parameters: * None. * - * Return Value: + * Returned Value: * None. * * Assumptions: @@ -176,7 +176,7 @@ void task_initialize(void) * Parameters: * None. * - * Return Value: + * Returned Value: * On success, a non-NULL pointer to a child status structure. NULL is * returned if there are no remaining, pre-allocated child status structures. * @@ -211,7 +211,7 @@ FAR struct child_status_s *group_allocchild(void) * Parameters: * status - The child status structure to be freed. * - * Return Value: + * Returned Value: * None. * * Assumptions: @@ -241,7 +241,7 @@ void group_freechild(FAR struct child_status_s *child) * group - The task group for the child status. * child - The structure to be added * - * Return Value: + * Returned Value: * N * * Assumptions: @@ -273,7 +273,7 @@ void group_addchild(FAR struct task_group_s *group, * group - The ID of the parent task group to containing the child status. * pid - The ID of the child to find. * - * Return Value: + * Returned Value: * On success, a non-NULL pointer to a child status structure. NULL is * returned if there is child status structure for that pid in the TCB. * @@ -312,7 +312,7 @@ FAR struct child_status_s *group_findchild(FAR struct task_group_s *group, * Parameters: * tcb - The TCB of the parent task to containing the child status. * - * Return Value: + * Returned Value: * On success, a non-NULL pointer to a child status structure for the * exited child. NULL is returned if not child has exited. * @@ -351,7 +351,7 @@ FAR struct child_status_s *group_exitchild(FAR struct task_group_s *group) * group - The task group containing the child status. * pid - The ID of the child to find. * - * Return Value: + * Returned Value: * On success, a non-NULL pointer to a child status structure. NULL is * returned if there is child status structure for that pid in the TCB. * @@ -412,7 +412,7 @@ FAR struct child_status_s *group_removechild(FAR struct task_group_s *group, * Parameters: * group - The task group containing the child status. * - * Return Value: + * Returned Value: * None. * * Assumptions: diff --git a/sched/group/group_create.c b/sched/group/group_create.c index 0cb29b4e2e..29ca989ca6 100644 --- a/sched/group/group_create.c +++ b/sched/group/group_create.c @@ -92,7 +92,7 @@ FAR struct task_group_s *g_grouphead; * Parameters: * tcb - The tcb in need of the task group. * - * Return Value: + * Returned Value: * None * * Assumptions: @@ -165,7 +165,7 @@ static void group_assigngid(FAR struct task_group_s *group) * tcb - The tcb in need of the task group. * ttype - Type of the thread that is the parent of the group * - * Return Value: + * Returned Value: * 0 (OK) on success; a negated errno value on failure. * * Assumptions: @@ -274,7 +274,7 @@ int group_allocate(FAR struct task_tcb_s *tcb, uint8_t ttype) * Parameters: * tcb - The tcb in need of the task group. * - * Return Value: + * Returned Value: * 0 (OK) on success; a negated errno value on failure. * * Assumptions: diff --git a/sched/group/group_find.c b/sched/group/group_find.c index 3db582fa25..ade869dd01 100644 --- a/sched/group/group_find.c +++ b/sched/group/group_find.c @@ -68,7 +68,7 @@ * Parameters: * gid - The group ID to find. * - * Return Value: + * Returned Value: * On success, a pointer to the group task structure is returned. This * function can fail only if there is no group that corresponds to the * group ID. @@ -114,7 +114,7 @@ FAR struct task_group_s *group_findbygid(gid_t gid) * Parameters: * pid - The task ID of the main task thread. * - * Return Value: + * Returned Value: * On success, a pointer to the group task structure is returned. This * function can fail only if there is no group that corresponds to the * task ID. diff --git a/sched/group/group_foreachchild.c b/sched/group/group_foreachchild.c index 10fed5f90a..5908d6a121 100644 --- a/sched/group/group_foreachchild.c +++ b/sched/group/group_foreachchild.c @@ -60,7 +60,7 @@ * handler - The function to be called * arg - An additional argument to provide to the handler * - * Return Value: + * Returned Value: * Success (OK) is always returned unless the handler returns a non-zero * value (a negated errno on errors). In that case, the traversal * terminates and that non-zero value is returned. diff --git a/sched/group/group_join.c b/sched/group/group_join.c index 7fb2a817fa..1bb2fdfdeb 100644 --- a/sched/group/group_join.c +++ b/sched/group/group_join.c @@ -74,7 +74,7 @@ * group - The task group to add the new member * pid - The new member * - * Return Value: + * Returned Value: * 0 (OK) on success; a negated errno value on failure. * * Assumptions: @@ -152,7 +152,7 @@ static inline int group_addmember(FAR struct task_group_s *group, pid_t pid) * Parameters: * tcb - The TCB of the new "child" task that need to join the group. * - * Return Value: + * Returned Value: * 0 (OK) on success; a negated errno value on failure. * * Assumptions: @@ -189,7 +189,7 @@ int group_bind(FAR struct pthread_tcb_s *tcb) * Parameters: * tcb - The TCB of the new "child" task that need to join the group. * - * Return Value: + * Returned Value: * 0 (OK) on success; a negated errno value on failure. * * Assumptions: diff --git a/sched/group/group_killchildren.c b/sched/group/group_killchildren.c index 3b719a495c..aa4ae077b7 100644 --- a/sched/group/group_killchildren.c +++ b/sched/group/group_killchildren.c @@ -59,7 +59,7 @@ * pid - The ID of the group member that may be signalled. * arg - The PID of the thread to be retained. * - * Return Value: + * Returned Value: * 0 (OK) on success; a negated errno value on failure. * ****************************************************************************/ @@ -95,7 +95,7 @@ static int group_killchildren_handler(pid_t pid, FAR void *arg) * Parameters: * tcb - TCB of the task to be retained. * - * Return Value: + * Returned Value: * None * * Assumptions: diff --git a/sched/group/group_leave.c b/sched/group/group_leave.c index 79a1bde1a1..e20bb3bdd7 100644 --- a/sched/group/group_leave.c +++ b/sched/group/group_leave.c @@ -70,7 +70,7 @@ * Parameters: * group - The group to be removed. * - * Return Value: + * Returned Value: * None. * * Assumptions: @@ -129,7 +129,7 @@ static void group_remove(FAR struct task_group_s *group) * Parameters: * group - The group to be removed. * - * Return Value: + * Returned Value: * None. * * Assumptions: @@ -289,7 +289,7 @@ static inline void group_release(FAR struct task_group_s *group) * group - The group from which to remove the member. * pid - The member to be removed. * - * Return Value: + * Returned Value: * On success, returns the number of members remaining in the group (>=0). * Can fail only if the member is not found in the group. On failure, * returns -ENOENT @@ -346,7 +346,7 @@ static inline void group_removemember(FAR struct task_group_s *group, pid_t pid) * Parameters: * tcb - The TCB of the task that is exiting. * - * Return Value: + * Returned Value: * None. * * Assumptions: diff --git a/sched/group/group_setupidlefiles.c b/sched/group/group_setupidlefiles.c index 0d4eb19ca2..076017360d 100644 --- a/sched/group/group_setupidlefiles.c +++ b/sched/group/group_setupidlefiles.c @@ -66,7 +66,7 @@ * Parameters: * tcb - tcb of the idle task. * - * Return Value: + * Returned Value: * None * * Assumptions: diff --git a/sched/group/group_setuptaskfiles.c b/sched/group/group_setuptaskfiles.c index e106871250..1a1ec07963 100644 --- a/sched/group/group_setuptaskfiles.c +++ b/sched/group/group_setuptaskfiles.c @@ -79,7 +79,7 @@ * Input Parameters: * tcb - tcb of the new task. * - * Return Value: + * Returned Value: * None * ****************************************************************************/ @@ -137,7 +137,7 @@ static inline void sched_dupfiles(FAR struct task_tcb_s *tcb) * Input Parameters: * tcb - tcb of the new task. * - * Return Value: + * Returned Value: * None * ****************************************************************************/ @@ -198,7 +198,7 @@ static inline void sched_dupsockets(FAR struct task_tcb_s *tcb) * Parameters: * tcb - tcb of the new task. * - * Return Value: + * Returned Value: * Zero (OK) is returned on success; A negated errno value is returned on * failure. * diff --git a/sched/group/group_signal.c b/sched/group/group_signal.c index f066fc7f5d..e0de4bcf64 100644 --- a/sched/group/group_signal.c +++ b/sched/group/group_signal.c @@ -80,7 +80,7 @@ struct group_signal_s * pid - The ID of the group member that may be signalled. * arg - A pointer to a struct group_signal_s instance. * - * Return Value: + * Returned Value: * 0 (OK) on success; a negated errno value on failure. * ****************************************************************************/ @@ -195,7 +195,7 @@ static int group_signal_handler(pid_t pid, FAR void *arg) * Parameters: * group - The task group that needs to be signalled. * - * Return Value: + * Returned Value: * 0 (OK) on success; a negated errno value on failure. * * Assumptions: diff --git a/sched/init/init.h b/sched/init/init.h index 4724c83392..b602786bc4 100644 --- a/sched/init/init.h +++ b/sched/init/init.h @@ -57,7 +57,7 @@ * Input Parameters: * None * - * Returned value: + * Returned Value: * Does not return. * ****************************************************************************/ diff --git a/sched/init/os_start.c b/sched/init/os_start.c index 9033189e63..0fcbd4ba48 100644 --- a/sched/init/os_start.c +++ b/sched/init/os_start.c @@ -361,7 +361,7 @@ static FAR char *g_idleargv[1][2]; * Input Parameters: * None * - * Returned value: + * Returned Value: * Does not return. * ****************************************************************************/ diff --git a/sched/irq/irq.h b/sched/irq/irq.h index ac38158f3c..a51455f175 100644 --- a/sched/irq/irq.h +++ b/sched/irq/irq.h @@ -180,10 +180,10 @@ int irq_unexpected_isr(int irq, FAR void *context, FAR void *arg); * the IRQ lock is also set UNLESS the CPU starting the task is the * holder of the IRQ lock. * - * Inputs: + * Input Parameters: * rtcb - Points to the blocked TCB that is ready-to-run * - * Return Value: + * Returned Value: * true - IRQs are locked by a different CPU. * false - IRQs are unlocked OR if they are locked BUT this CPU * is the holder of the lock. diff --git a/sched/irq/irq_csection.c b/sched/irq/irq_csection.c index 63e0be9f66..ca75810ca0 100644 --- a/sched/irq/irq_csection.c +++ b/sched/irq/irq_csection.c @@ -587,10 +587,10 @@ void leave_critical_section(irqstate_t flags) * the IRQ lock is also set UNLESS the CPU starting the task is the * holder of the IRQ lock. * - * Inputs: + * Input Parameters: * rtcb - Points to the blocked TCB that is ready-to-run * - * Return Value: + * Returned Value: * true - IRQs are locked by a different CPU. * false - IRQs are unlocked OR if they are locked BUT this CPU * is the holder of the lock. diff --git a/sched/mqueue/mq_desclose.c b/sched/mqueue/mq_desclose.c index b4c72c0e96..c4a5d68f52 100644 --- a/sched/mqueue/mq_desclose.c +++ b/sched/mqueue/mq_desclose.c @@ -60,7 +60,7 @@ * Description: * Deallocate a message queue descriptor but returning it to the free list * - * Inputs: + * Input Parameters: * mqdes - message queue descriptor to free * ****************************************************************************/ @@ -82,7 +82,7 @@ * mqdes - Message queue descriptor. * group - Group that has the open descriptor. * - * Return Value: + * Returned Value: * None. * * Assumptions: diff --git a/sched/mqueue/mq_descreate.c b/sched/mqueue/mq_descreate.c index d3b574f623..47dad5bd3b 100644 --- a/sched/mqueue/mq_descreate.c +++ b/sched/mqueue/mq_descreate.c @@ -67,10 +67,10 @@ * Description: * Allocate a message queue descriptor. * - * Inputs: + * Input Parameters: * None * - * Return Value: + * Returned Value: * Reference to the allocated mq descriptor. * ****************************************************************************/ @@ -109,12 +109,12 @@ static mqd_t nxmq_alloc_des(void) * Description: * Create a message queue descriptor for the specified TCB * - * Inputs: + * Input Parameters: * mtcb - task that needs the descriptor. * msgq - Named message queue containing the message * oflags - access rights for the descriptor * - * Return Value: + * Returned Value: * On success, the message queue descriptor is returned. NULL is returned * on a failure to allocate. * diff --git a/sched/mqueue/mq_getattr.c b/sched/mqueue/mq_getattr.c index b1475b6846..2bcf0902a7 100644 --- a/sched/mqueue/mq_getattr.c +++ b/sched/mqueue/mq_getattr.c @@ -57,7 +57,7 @@ * mqdes - Message queue descriptor * mq_stat - Buffer in which to return attributes * - * Return Value: + * Returned Value: * 0 (OK) if attributes provided, -1 (ERROR) otherwise. * * Assumptions: diff --git a/sched/mqueue/mq_initialize.c b/sched/mqueue/mq_initialize.c index 3e46ac2554..46e820c9fc 100644 --- a/sched/mqueue/mq_initialize.c +++ b/sched/mqueue/mq_initialize.c @@ -111,7 +111,7 @@ static sq_queue_t g_desalloc; * Description: * Allocate a block of messages and place them on the free list. * - * Inputs Parameters: + * Input Parameters: * queue * ****************************************************************************/ @@ -156,10 +156,10 @@ mq_msgblockalloc(FAR sq_queue_t *queue, uint16_t nmsgs, * be called early in the initialization sequence before any of the * other message interfaces execute. * - * Inputs: + * Input Parameters: * None * - * Return Value: + * Returned Value: * None * ****************************************************************************/ @@ -198,10 +198,10 @@ void nxmq_initialize(void) * Allocate a block of message descriptors and place them on the free * list. * - * Inputs: + * Input Parameters: * None * - * Return Value: + * Returned Value: * None * ****************************************************************************/ diff --git a/sched/mqueue/mq_msgfree.c b/sched/mqueue/mq_msgfree.c index 9492a93d38..4ea3735f73 100644 --- a/sched/mqueue/mq_msgfree.c +++ b/sched/mqueue/mq_msgfree.c @@ -59,10 +59,10 @@ * messages if it was a pre-allocated message. If the message was * allocated dynamically it will be deallocated. * - * Inputs: + * Input Parameters: * mqmsg - message to free * - * Return Value: + * Returned Value: * None * ****************************************************************************/ diff --git a/sched/mqueue/mq_msgqalloc.c b/sched/mqueue/mq_msgqalloc.c index 473896c3f2..becf7bd394 100644 --- a/sched/mqueue/mq_msgqalloc.c +++ b/sched/mqueue/mq_msgqalloc.c @@ -66,7 +66,7 @@ * queue is created to determine the maximum number of * messages that may be placed in the message queue. * - * Return Value: + * Returned Value: * The allocated and initialized message queue structure or NULL in the * event of a failure. * diff --git a/sched/mqueue/mq_msgqfree.c b/sched/mqueue/mq_msgqfree.c index b52494813e..54f858ced8 100644 --- a/sched/mqueue/mq_msgqfree.c +++ b/sched/mqueue/mq_msgqfree.c @@ -57,10 +57,10 @@ * closed so that no thread will attempt access it while it is being * deleted. * - * Inputs: + * Input Parameters: * msgq - Named essage queue to be freed * - * Return Value: + * Returned Value: * None * ****************************************************************************/ diff --git a/sched/mqueue/mq_notify.c b/sched/mqueue/mq_notify.c index 8dd0e89080..3cf3d42278 100644 --- a/sched/mqueue/mq_notify.c +++ b/sched/mqueue/mq_notify.c @@ -78,7 +78,7 @@ * sigev_signo - The signo to use for the notification * sigev_value - Value associated with the signal * - * Return Value: + * Returned Value: * On success mq_notify() returns 0; on error, -1 is returned, with * errno set to indicate the error. * diff --git a/sched/mqueue/mq_recover.c b/sched/mqueue/mq_recover.c index 087dc4d341..b150c0a28b 100644 --- a/sched/mqueue/mq_recover.c +++ b/sched/mqueue/mq_recover.c @@ -58,10 +58,10 @@ * via pthread_cancel. I checks if the task was waiting for a message * queue event and adjusts counts appropriately. * - * Inputs: + * Input Parameters: * tcb - The TCB of the terminated task or thread * - * Return Value: + * Returned Value: * None. * * Assumptions: diff --git a/sched/mqueue/mq_release.c b/sched/mqueue/mq_release.c index c916c7b41d..2e253b915b 100644 --- a/sched/mqueue/mq_release.c +++ b/sched/mqueue/mq_release.c @@ -55,10 +55,10 @@ * This function closes all of the message queues opened by members of * the task group. * - * Inputs: + * Input Parameters: * group - The task group that is terminating. * - * Return Value: + * Returned Value: * None * ****************************************************************************/ diff --git a/sched/mqueue/mq_setattr.c b/sched/mqueue/mq_setattr.c index de238e4601..eb70f779de 100644 --- a/sched/mqueue/mq_setattr.c +++ b/sched/mqueue/mq_setattr.c @@ -65,7 +65,7 @@ * mq_stat - New attributes * oldstate - Old attributes * - * Return Value: + * Returned Value: * 0 (OK) if attributes are set successfully, otherwise * -1 (ERROR). * diff --git a/sched/mqueue/mq_sndinternal.c b/sched/mqueue/mq_sndinternal.c index 933d684a13..7ad32132cb 100644 --- a/sched/mqueue/mq_sndinternal.c +++ b/sched/mqueue/mq_sndinternal.c @@ -131,7 +131,7 @@ int nxmq_verify_send(mqd_t mqdes, FAR const char *msg, size_t msglen, * the g_msgfreeirq list. If this is unsuccessful, the calling interrupt * handler will be notified. * - * Inputs: + * Input Parameters: * None * * Returned Value: diff --git a/sched/mqueue/mq_waitirq.c b/sched/mqueue/mq_waitirq.c index ee24c4d9f7..d542adc8af 100644 --- a/sched/mqueue/mq_waitirq.c +++ b/sched/mqueue/mq_waitirq.c @@ -65,7 +65,7 @@ * wtcb - A pointer to the TCB of the task that is waiting on a message * queue, but has received a signal instead. * - * Return Value: + * Returned Value: * None * * Assumptions: diff --git a/sched/paging/paging.h b/sched/paging/paging.h index cccda6e4ed..c7e253b421 100644 --- a/sched/paging/paging.h +++ b/sched/paging/paging.h @@ -107,7 +107,7 @@ extern FAR struct tcb_s *g_pftcb; * This is the entry point of the worker thread that performs the actual * page file. * - * Input parameters: + * Input Parameters: * argc, argv (not used) * * Returned Value: diff --git a/sched/paging/pg_worker.c b/sched/paging/pg_worker.c index a2ded4c1ae..e6fe07b62a 100644 --- a/sched/paging/pg_worker.c +++ b/sched/paging/pg_worker.c @@ -141,7 +141,7 @@ static systime_t g_starttime; * task that is waiting for a fill. * - Signal the page fill worker thread. * - * Input parameters: + * Input Parameters: * tcb - The TCB of the task that just received the fill. * result - The result of the page fill operation. * @@ -223,7 +223,7 @@ static void pg_callback(FAR struct tcb_s *tcb, int result) * The result (NULL or a TCB pointer) will be returned in the global * variable, g_pftcb. * - * Input parameters: + * Input Parameters: * None * * Returned Value: @@ -334,7 +334,7 @@ static inline bool pg_dequeue(void) * prioritized list, or (2) when a page fill completes and there are more * pages to be filled in g_waitingforfill list. * - * Input parameters: + * Input Parameters: * None * * Returned Value: @@ -441,7 +441,7 @@ static inline bool pg_startfill(void) * - Set g_pftcb to NULL. * - Restore the default priority of the page fill worker thread. * - * Input parameters: + * Input Parameters: * None. * * Returned Value: @@ -475,7 +475,7 @@ static inline void pg_alldone(void) * This function is just a dumb wrapper around up_unblocktask(). This * function simply makes the task that just received the fill ready-to-run. * - * Input parameters: + * Input Parameters: * None. * * Returned Value: @@ -515,7 +515,7 @@ static inline void pg_fillcomplete(void) * after completing a page fill. * - A configurable timeout with no activity. * - * Input parameters: + * Input Parameters: * argc, argv (not used) * * Returned Value: diff --git a/sched/pthread/pthread_cleanup.c b/sched/pthread/pthread_cleanup.c index a4f6e45b21..cbfc2558be 100644 --- a/sched/pthread/pthread_cleanup.c +++ b/sched/pthread/pthread_cleanup.c @@ -64,7 +64,7 @@ * Input Parameters: * tcb - The TCB of the pthread that is exiting or being canceled. * - * Return Value: + * Returned Value: * None * * Assumptions: diff --git a/sched/pthread/pthread_completejoin.c b/sched/pthread/pthread_completejoin.c index 0b934c1033..6dc23185c5 100644 --- a/sched/pthread/pthread_completejoin.c +++ b/sched/pthread/pthread_completejoin.c @@ -115,7 +115,7 @@ static bool pthread_notifywaiters(FAR struct join_s *pjoin) * Parameters: * pid * - * Return Value: + * Returned Value: * None. * * Assumptions: diff --git a/sched/pthread/pthread_condbroadcast.c b/sched/pthread/pthread_condbroadcast.c index 0fddd76927..5a19538882 100644 --- a/sched/pthread/pthread_condbroadcast.c +++ b/sched/pthread/pthread_condbroadcast.c @@ -59,7 +59,7 @@ * Parameters: * None * - * Return Value: + * Returned Value: * None * * Assumptions: diff --git a/sched/pthread/pthread_condsignal.c b/sched/pthread/pthread_condsignal.c index 5826a425de..21eab53ec2 100644 --- a/sched/pthread/pthread_condsignal.c +++ b/sched/pthread/pthread_condsignal.c @@ -58,7 +58,7 @@ * Parameters: * None * - * Return Value: + * Returned Value: * None * * Assumptions: diff --git a/sched/pthread/pthread_condtimedwait.c b/sched/pthread/pthread_condtimedwait.c index 66410faebd..0093d3def3 100644 --- a/sched/pthread/pthread_condtimedwait.c +++ b/sched/pthread/pthread_condtimedwait.c @@ -75,7 +75,7 @@ * pid - the task ID of the task to wakeup * signo - The signal to use to wake up the task * - * Return Value: + * Returned Value: * None * * Assumptions: @@ -156,7 +156,7 @@ static void pthread_condtimedout(int argc, uint32_t pid, uint32_t signo) * mutex - the mutex that protects the condition variable * abstime - wait until this absolute time * - * Return Value: + * Returned Value: * OK (0) on success; A non-zero errno value is returned on failure. * * Assumptions: diff --git a/sched/pthread/pthread_condwait.c b/sched/pthread/pthread_condwait.c index b3716da0a6..734dc55bad 100644 --- a/sched/pthread/pthread_condwait.c +++ b/sched/pthread/pthread_condwait.c @@ -62,7 +62,7 @@ * Parameters: * None * - * Return Value: + * Returned Value: * None * * Assumptions: diff --git a/sched/pthread/pthread_create.c b/sched/pthread/pthread_create.c index 4900574e16..7f6f2ed2b2 100644 --- a/sched/pthread/pthread_create.c +++ b/sched/pthread/pthread_create.c @@ -103,7 +103,7 @@ static const char g_pthreadname[] = ""; * tcb - Address of the new task's TCB * arg - The argument to provide to the pthread on startup. * - * Return Value: + * Returned Value: * None * ****************************************************************************/ @@ -133,7 +133,7 @@ static inline void pthread_argsetup(FAR struct pthread_tcb_s *tcb, pthread_addr_ * Parameters: * pjoin * - * Return Value: + * Returned Value: * None * * Assumptions: @@ -232,7 +232,7 @@ static void pthread_start(void) * start_routine * arg * - * Returned value: + * Returned Value: * OK (0) on success; a (non-negated) errno value on failure. The errno * variable is not set. * diff --git a/sched/pthread/pthread_detach.c b/sched/pthread/pthread_detach.c index 47e0a3b42d..184f164272 100644 --- a/sched/pthread/pthread_detach.c +++ b/sched/pthread/pthread_detach.c @@ -68,7 +68,7 @@ * Parameters: * thread * - * Return Value: + * Returned Value: * 0 if successful. Otherwise, an error code. * * Assumptions: diff --git a/sched/pthread/pthread_findjoininfo.c b/sched/pthread/pthread_findjoininfo.c index 23fcc6a46d..9ddc34cdd8 100644 --- a/sched/pthread/pthread_findjoininfo.c +++ b/sched/pthread/pthread_findjoininfo.c @@ -58,7 +58,7 @@ * group - The that the pid is (or was) a member of of * pid - The ID of the pthread * - * Return Value: + * Returned Value: * None or pointer to the found entry. * * Assumptions: diff --git a/sched/pthread/pthread_getaffinity.c b/sched/pthread/pthread_getaffinity.c index 868fe7003d..d3eb4d9f89 100644 --- a/sched/pthread/pthread_getaffinity.c +++ b/sched/pthread/pthread_getaffinity.c @@ -71,7 +71,7 @@ * cpusetsize - Size of cpuset. MUST be sizeofcpu_set_t(). * cpuset - The location to return the thread's new affinity set. * - * Return Value: + * Returned Value: * 0 if successful. Otherwise, an errno value is returned indicating the * nature of the failure. * diff --git a/sched/pthread/pthread_getschedparam.c b/sched/pthread/pthread_getschedparam.c index 0167f172a1..fa3e030a45 100644 --- a/sched/pthread/pthread_getschedparam.c +++ b/sched/pthread/pthread_getschedparam.c @@ -80,7 +80,7 @@ * policy - The location to store the thread's scheduling policy. * param - The location to store the thread's priority. * - * Return Value: + * Returned Value: * 0 if successful. Otherwise, the error code ESRCH if the value specified * by thread does not refer to an existing thread. * diff --git a/sched/pthread/pthread_getspecific.c b/sched/pthread/pthread_getspecific.c index 51927549c1..889f712dd3 100644 --- a/sched/pthread/pthread_getspecific.c +++ b/sched/pthread/pthread_getspecific.c @@ -65,7 +65,7 @@ * Parameters: * key = The data key to get or set * - * Return Value: + * Returned Value: * The function pthread_getspecific() returns the thread-specific data * associated with the given key. If no thread specific data is * associated with the key, then the value NULL is returned. diff --git a/sched/pthread/pthread_initialize.c b/sched/pthread/pthread_initialize.c index be0cb85ae4..5da4bcdaa0 100644 --- a/sched/pthread/pthread_initialize.c +++ b/sched/pthread/pthread_initialize.c @@ -64,7 +64,7 @@ * Parameters: * None * - * Return Value: + * Returned Value: * None * ****************************************************************************/ @@ -91,7 +91,7 @@ void pthread_initialize(void) * intr - false: ignore EINTR errors when locking; true tread EINTR as * other errors by returning the errno value * - * Return Value: + * Returned Value: * 0 on success or an errno value on failure. * ****************************************************************************/ diff --git a/sched/pthread/pthread_join.c b/sched/pthread/pthread_join.c index 4f22777b9a..24bec6bb0d 100644 --- a/sched/pthread/pthread_join.c +++ b/sched/pthread/pthread_join.c @@ -70,7 +70,7 @@ * thread * pexit_value * - * Return Value: + * Returned Value: * 0 if successful. Otherwise, one of the following error codes: * * EINVAL The value specified by thread does not refer to joinable diff --git a/sched/pthread/pthread_keycreate.c b/sched/pthread/pthread_keycreate.c index 60be2fb5e3..9daade6a31 100644 --- a/sched/pthread/pthread_keycreate.c +++ b/sched/pthread/pthread_keycreate.c @@ -71,7 +71,7 @@ * with each key that is invoked when a thread exits. However, this * argument is ignored in the current implementation. * - * Return Value: + * Returned Value: * If successful, the pthread_key_create() function will store the newly * created key value at *key and return zero (OK). Otherwise, an error * number will bereturned to indicate the error: diff --git a/sched/pthread/pthread_keydelete.c b/sched/pthread/pthread_keydelete.c index 57cd46309a..ab72fad9db 100644 --- a/sched/pthread/pthread_keydelete.c +++ b/sched/pthread/pthread_keydelete.c @@ -60,7 +60,7 @@ * Parameters: * key = the key to delete * - * Return Value: + * Returned Value: * Always returns ENOSYS. * * Assumptions: diff --git a/sched/pthread/pthread_kill.c b/sched/pthread/pthread_kill.c index 1c2663e47e..e3f04a0b7a 100644 --- a/sched/pthread/pthread_kill.c +++ b/sched/pthread/pthread_kill.c @@ -70,7 +70,7 @@ * signo - The signal number to send. If 'signo' is zero, no signal is * sent, but all error checking is performed. * - * Return Value: + * Returned Value: * On success the signal was send and zero is returned. On error one * of the following error numbers is returned. * diff --git a/sched/pthread/pthread_mutex.c b/sched/pthread/pthread_mutex.c index 6e1edd49d8..02092a0117 100644 --- a/sched/pthread/pthread_mutex.c +++ b/sched/pthread/pthread_mutex.c @@ -64,7 +64,7 @@ * Parameters: * mutex - The mutex to be locked * - * Return Value: + * Returned Value: * None * ****************************************************************************/ @@ -107,7 +107,7 @@ static void pthread_mutex_add(FAR struct pthread_mutex_s *mutex) * Parameters: * mutex - The mutex to be locked * - * Return Value: + * Returned Value: * None * ****************************************************************************/ @@ -172,7 +172,7 @@ static void pthread_mutex_remove(FAR struct pthread_mutex_s *mutex) * intr - false: ignore EINTR errors when locking; true treat EINTR as * other errors by returning the errno value * - * Return Value: + * Returned Value: * 0 on success or an errno value on failure. * ****************************************************************************/ @@ -242,7 +242,7 @@ int pthread_mutex_take(FAR struct pthread_mutex_s *mutex, bool intr) * intr - false: ignore EINTR errors when locking; true treat EINTR as * other errors by returning the errno value * - * Return Value: + * Returned Value: * 0 on success or an errno value on failure. * ****************************************************************************/ @@ -299,7 +299,7 @@ int pthread_mutex_trytake(FAR struct pthread_mutex_s *mutex) * Parameters: * mutex - The mutex to be unlocked * - * Return Value: + * Returned Value: * 0 on success or an errno value on failure. * ****************************************************************************/ diff --git a/sched/pthread/pthread_mutexdestroy.c b/sched/pthread/pthread_mutexdestroy.c index 17f58fbda5..7c5055504c 100644 --- a/sched/pthread/pthread_mutexdestroy.c +++ b/sched/pthread/pthread_mutexdestroy.c @@ -63,7 +63,7 @@ * Parameters: * None * - * Return Value: + * Returned Value: * None * * Assumptions: diff --git a/sched/pthread/pthread_mutexinit.c b/sched/pthread/pthread_mutexinit.c index 9885869bbe..a648544bfa 100644 --- a/sched/pthread/pthread_mutexinit.c +++ b/sched/pthread/pthread_mutexinit.c @@ -61,7 +61,7 @@ * Parameters: * None * - * Return Value: + * Returned Value: * None * * Assumptions: diff --git a/sched/pthread/pthread_mutexlock.c b/sched/pthread/pthread_mutexlock.c index 223b2193c5..88611c7be3 100644 --- a/sched/pthread/pthread_mutexlock.c +++ b/sched/pthread/pthread_mutexlock.c @@ -91,7 +91,7 @@ * Parameters: * mutex - A reference to the mutex to be locked. * - * Return Value: + * Returned Value: * 0 on success or an errno value on failure. Note that the errno EINTR * is never returned by pthread_mutex_lock(). * diff --git a/sched/pthread/pthread_mutextrylock.c b/sched/pthread/pthread_mutextrylock.c index b88916ae50..fb74a76d5c 100644 --- a/sched/pthread/pthread_mutextrylock.c +++ b/sched/pthread/pthread_mutextrylock.c @@ -69,7 +69,7 @@ * Parameters: * mutex - A reference to the mutex to be locked. * - * Return Value: + * Returned Value: * 0 on success or an errno value on failure. Note that the errno EINTR * is never returned by pthread_mutex_trylock(). * diff --git a/sched/pthread/pthread_mutexunlock.c b/sched/pthread/pthread_mutexunlock.c index a29fc490da..75492515ac 100644 --- a/sched/pthread/pthread_mutexunlock.c +++ b/sched/pthread/pthread_mutexunlock.c @@ -61,7 +61,7 @@ * Parameters: * None * - * Return Value: + * Returned Value: * Returns true if the mutex is locked * ****************************************************************************/ @@ -105,7 +105,7 @@ static inline bool pthread_mutex_islocked(FAR struct pthread_mutex_s *mutex) * Parameters: * None * - * Return Value: + * Returned Value: * None * * Assumptions: diff --git a/sched/pthread/pthread_release.c b/sched/pthread/pthread_release.c index ff7164f1eb..fd79544c9c 100644 --- a/sched/pthread/pthread_release.c +++ b/sched/pthread/pthread_release.c @@ -61,7 +61,7 @@ * group = The task group containing the pthread resources to be * released. * - * Return Value: + * Returned Value: * None * * Assumptions: diff --git a/sched/pthread/pthread_setaffinity.c b/sched/pthread/pthread_setaffinity.c index 87f91e9be9..5f3ba7283c 100644 --- a/sched/pthread/pthread_setaffinity.c +++ b/sched/pthread/pthread_setaffinity.c @@ -73,7 +73,7 @@ * cpusetsize - Size of cpuset. MUST be sizeofcpu_set_t(). * cpuset - Provides the new affinity set for the thread. * - * Return Value: + * Returned Value: * 0 if successful. Otherwise, an errno value is returned indicating the * nature of the failure. * diff --git a/sched/pthread/pthread_setschedparam.c b/sched/pthread/pthread_setschedparam.c index 2ba1e85116..bfbbf2dbcd 100644 --- a/sched/pthread/pthread_setschedparam.c +++ b/sched/pthread/pthread_setschedparam.c @@ -82,7 +82,7 @@ * SCHED_RR. SCHED_OTHER and SCHED_SPORADIC are not supported. * param - Provides the new priority of the thread. * - * Return Value: + * Returned Value: * 0 if successful. Otherwise, an error code identifying the cause of the * failure: * diff --git a/sched/pthread/pthread_setschedprio.c b/sched/pthread/pthread_setschedprio.c index e698d3bf29..aed67e4559 100644 --- a/sched/pthread/pthread_setschedprio.c +++ b/sched/pthread/pthread_setschedprio.c @@ -61,12 +61,12 @@ * If the thread_setschedprio() function fails, the scheduling priority * of the target thread will not be changed. * - * Inputs: + * Input Parameters: * thread - the thread ID of the task to reprioritize. * prio - The new thread priority. The range of valid priority numbers is * from SCHED_PRIORITY_MIN through SCHED_PRIORITY_MAX. * - * Return Value: + * Returned Value: * OK if successful, otherwise an error number. This function can * fail for the following reasons: * diff --git a/sched/pthread/pthread_setspecific.c b/sched/pthread/pthread_setspecific.c index 3a0db5b7ef..371353b424 100644 --- a/sched/pthread/pthread_setspecific.c +++ b/sched/pthread/pthread_setspecific.c @@ -72,7 +72,7 @@ * key = The data key to get or set * value = The value to bind to the key. * - * Return Value: + * Returned Value: * If successful, pthread_setspecific() will return zero (OK). * Otherwise, an error number will be returned: * diff --git a/sched/pthread/pthread_sigmask.c b/sched/pthread/pthread_sigmask.c index fb87f28c3f..43eb6c27ed 100644 --- a/sched/pthread/pthread_sigmask.c +++ b/sched/pthread/pthread_sigmask.c @@ -71,7 +71,7 @@ * set - Location of the new signal mask * oset - Location to store the old signal mask * - * Return Value: + * Returned Value: * On success, this function will return 0 (OK). It will return EINVAL if * how is invalid. * diff --git a/sched/sched/sched_addblocked.c b/sched/sched/sched_addblocked.c index 151faedb69..487330714d 100644 --- a/sched/sched/sched_addblocked.c +++ b/sched/sched/sched_addblocked.c @@ -55,11 +55,11 @@ * This function adds a TCB to one of the blocked state task lists as * inferred from task_state. * - * Inputs: + * Input Parameters: * btcb - Points to the TCB that is blocked * task_state - identifies the state of the blocked task * - * Return Value: + * Returned Value: * None * * Assumptions: diff --git a/sched/sched/sched_addprioritized.c b/sched/sched/sched_addprioritized.c index b94b60255d..15e20319be 100644 --- a/sched/sched/sched_addprioritized.c +++ b/sched/sched/sched_addprioritized.c @@ -56,11 +56,11 @@ * Description: * This function adds a TCB to a prioritized TCB list. * - * Inputs: + * Input Parameters: * tcb - Points to the TCB to add to the prioritized list * list - Points to the prioritized list to add tcb to * - * Return Value: + * Returned Value: * true if the head of the list has changed. * * Assumptions: diff --git a/sched/sched/sched_addreadytorun.c b/sched/sched/sched_addreadytorun.c index 880f4b85bb..2f5a7704c9 100644 --- a/sched/sched/sched_addreadytorun.c +++ b/sched/sched/sched_addreadytorun.c @@ -60,10 +60,10 @@ * instead. The pending tasks will be made ready-to-run when preemption is * unlocked. * - * Inputs: + * Input Parameters: * btcb - Points to the blocked TCB that is ready-to-run * - * Return Value: + * Returned Value: * true if the currently active task (the head of the ready-to-run list) * has changed. * @@ -144,10 +144,10 @@ bool sched_addreadytorun(FAR struct tcb_s *btcb) * g_pendingtasks list instead. The pending tasks will be made * ready-to-run when preemption isunlocked. * - * Inputs: + * Input Parameters: * btcb - Points to the blocked TCB that is ready-to-run * - * Return Value: + * Returned Value: * true if the currently active task (the head of the ready-to-run list) * has changed. * diff --git a/sched/sched/sched_cpuload.c b/sched/sched/sched_cpuload.c index ef35c39848..1ee7275bd3 100644 --- a/sched/sched/sched_cpuload.c +++ b/sched/sched/sched_cpuload.c @@ -110,10 +110,10 @@ volatile uint32_t g_cpuload_total; * Description: * Collect data that can be used for CPU load measurements. * - * Inputs: + * Input Parameters: * cpu - The CPU that we are performing the load operations on. * - * Return Value: + * Returned Value: * None * * Assumptions/Limitations: @@ -156,10 +156,10 @@ static inline void sched_cpu_process_cpuload(int cpu) * Description: * Collect data that can be used for CPU load measurements. * - * Inputs: + * Input Parameters: * None * - * Return Value: + * Returned Value: * None * * Assumptions/Limitations: @@ -228,7 +228,7 @@ void weak_function sched_process_cpuload(void) * pid - The task ID of the thread of interest. pid == 0 is the IDLE thread. * cpuload - The location to return the CPU load * - * Return Value: + * Returned Value: * OK (0) on success; a negated errno value on failure. The only reason * that this function can fail is if 'pid' no longer refers to a valid * thread. diff --git a/sched/sched/sched_cpuselect.c b/sched/sched/sched_cpuselect.c index c995cb8764..b96436cdd4 100644 --- a/sched/sched/sched_cpuselect.c +++ b/sched/sched/sched_cpuselect.c @@ -65,10 +65,10 @@ * Return the index to the CPU with the lowest priority running task, * possbily its IDLE task. * - * Inputs: + * Input Parameters: * affinity - The set of CPUs on which the thread is permitted to run. * - * Return Value: + * Returned Value: * Index of the CPU with the lowest priority running task * * Assumptions: diff --git a/sched/sched/sched_foreach.c b/sched/sched/sched_foreach.c index 1ee962d772..3bd7898a84 100644 --- a/sched/sched/sched_foreach.c +++ b/sched/sched/sched_foreach.c @@ -59,7 +59,7 @@ * handler - The function to be called with the TCB of * each task * - * Return Value: + * Returned Value: * None * * Assumptions: diff --git a/sched/sched/sched_garbage.c b/sched/sched/sched_garbage.c index 7c853232d0..a5fce0c8d0 100644 --- a/sched/sched/sched_garbage.c +++ b/sched/sched/sched_garbage.c @@ -53,7 +53,7 @@ * Description: * Clean-up deferred de-allocations of user memory * - * Input parameters: + * Input Parameters: * None * * Returned Value: @@ -110,7 +110,7 @@ static inline void sched_kucleanup(void) * Description: * Return TRUE if there is user heap garbage to be collected. * - * Input parameters: + * Input Parameters: * None * * Returned Value: @@ -133,7 +133,7 @@ static inline bool sched_have_kugarbage(void) * Description: * Clean-up deferred de-allocations of kernel memory * - * Input parameters: + * Input Parameters: * None * * Returned Value: @@ -184,7 +184,7 @@ static inline void sched_kcleanup(void) * Description: * Return TRUE if there is kernal heap garbage to be collected. * - * Input parameters: + * Input Parameters: * None * * Returned Value: @@ -220,7 +220,7 @@ static inline bool sched_have_kgarbage(void) * collection to be called from the IDLE thread because it runs at a very * low priority and could cause false memory out conditions. * - * Input parameters: + * Input Parameters: * None * * Returned Value: @@ -254,7 +254,7 @@ void sched_garbage_collection(void) * state. The looping nature of the IDLE loops should catch any missed * garbage from the test on the next time arround. * - * Input parameters: + * Input Parameters: * None * * Returned Value: diff --git a/sched/sched/sched_getfiles.c b/sched/sched/sched_getfiles.c index 7e634053d9..d36fe7f0c0 100644 --- a/sched/sched/sched_getfiles.c +++ b/sched/sched/sched_getfiles.c @@ -58,7 +58,7 @@ * Parameters: * None * - * Return Value: + * Returned Value: * A pointer to the errno. * * Assumptions: diff --git a/sched/sched/sched_getparam.c b/sched/sched/sched_getparam.c index 9c164e374d..c1668d00c5 100644 --- a/sched/sched/sched_getparam.c +++ b/sched/sched/sched_getparam.c @@ -64,14 +64,14 @@ * use by application logic. Applications should use the standard * sched_getparam(). * - * Inputs: + * Input Parameters: * pid - the task ID of the task. If pid is zero, the priority * of the calling task is returned. * param - A structure whose member sched_priority is the integer * priority. The task's priority is copied to the sched_priority * element of this structure. * - * Return Value: + * Returned Value: * 0 (OK) if successful, otherwise a negated errno value is returned to * indicate the nature of the failure.. * @@ -165,14 +165,14 @@ int nxsched_getparam (pid_t pid, FAR struct sched_param *param) * pid. This function is a simply wrapper around nxsched_getparam() that * sets the errno value in the event of an error. * - * Inputs: + * Input Parameters: * pid - the task ID of the task. If pid is zero, the priority * of the calling task is returned. * param - A structure whose member sched_priority is the integer * priority. The task's priority is copied to the sched_priority * element of this structure. * - * Return Value: + * Returned Value: * 0 (OK) if successful, otherwise -1 (ERROR) with the errno value set * to indicate the nature of the problem. * diff --git a/sched/sched/sched_getscheduler.c b/sched/sched/sched_getscheduler.c index 1ca4cf64ed..13150854ba 100644 --- a/sched/sched/sched_getscheduler.c +++ b/sched/sched/sched_getscheduler.c @@ -68,11 +68,11 @@ * use by application logic. Applications should use the standard * sched_getscheduler(). * - * Inputs: + * Input Parameters: * pid - the task ID of the task to query. If pid is zero, the * calling task is queried. * - * Return Value: + * Returned Value: * On success, sched_getscheduler() returns the policy for the task * (either SCHED_FIFO or SCHED_RR). On error, a negated errno value * returned: @@ -121,11 +121,11 @@ int nxsched_getscheduler(pid_t pid) * sched_getscheduler() is a simply wrapper around nxsched_getscheduler() * that sets the errno value in the event of an error. * - * Inputs: + * Input Parameters: * pid - the task ID of the task to query. If pid is zero, the * calling task is queried. * - * Return Value: + * Returned Value: * On success, sched_getscheduler() returns the policy for the task * (either SCHED_FIFO or SCHED_RR). On error, ERROR (-1) is * returned, and errno is set appropriately: diff --git a/sched/sched/sched_getsockets.c b/sched/sched/sched_getsockets.c index 2601f90783..a2dfdedd18 100644 --- a/sched/sched/sched_getsockets.c +++ b/sched/sched/sched_getsockets.c @@ -57,7 +57,7 @@ * Parameters: * None * - * Return Value: + * Returned Value: * A pointer to the errno. * * Assumptions: diff --git a/sched/sched/sched_getstreams.c b/sched/sched/sched_getstreams.c index 91f3c9f6f3..0a99a1e453 100644 --- a/sched/sched/sched_getstreams.c +++ b/sched/sched/sched_getstreams.c @@ -54,7 +54,7 @@ * Parameters: * None * - * Return Value: + * Returned Value: * A pointer to the errno. * * Assumptions: diff --git a/sched/sched/sched_lock.c b/sched/sched/sched_lock.c index 708b7780b1..a7a55ac264 100644 --- a/sched/sched/sched_lock.c +++ b/sched/sched/sched_lock.c @@ -132,10 +132,10 @@ volatile cpu_set_t g_cpu_lockset SP_SECTION; * either calls sched_unlock() (the appropriate number of times) or * until it blocks itself. * - * Inputs + * Input Parameters: * None * - * Return Value: + * Returned Value: * OK on success; ERROR on failure * ****************************************************************************/ diff --git a/sched/sched/sched_lockcount.c b/sched/sched/sched_lockcount.c index c3a8ef1903..9aeef35894 100644 --- a/sched/sched/sched_lockcount.c +++ b/sched/sched/sched_lockcount.c @@ -57,10 +57,10 @@ * execution. sched_unlock() will have to called that many times from * this thread in order to re-enable pre-emption. * - * Inputs: + * Input Parameters: * None * - * Return Value: + * Returned Value: * lockcount * ****************************************************************************/ diff --git a/sched/sched/sched_mergepending.c b/sched/sched/sched_mergepending.c index 6e258c7554..826a0e7833 100644 --- a/sched/sched/sched_mergepending.c +++ b/sched/sched/sched_mergepending.c @@ -68,10 +68,10 @@ * This function merges the prioritized g_pendingtasks list into the * prioritized ready-to-run task list. * - * Inputs: + * Input Parameters: * None * - * Return Value: + * Returned Value: * true if the head of the ready-to-run task list has changed indicating * a context switch is needed. * @@ -173,10 +173,10 @@ bool sched_mergepending(void) * This function merges the prioritized g_pendingtasks list into the * prioritized ready-to-run task list. * - * Inputs: + * Input Parameters: * None * - * Return Value: + * Returned Value: * true if the head of the ready-to-run task list has changed indicating * a context switch is needed. * diff --git a/sched/sched/sched_mergeprioritized.c b/sched/sched/sched_mergeprioritized.c index 7ff70b14df..7fb7d07284 100644 --- a/sched/sched/sched_mergeprioritized.c +++ b/sched/sched/sched_mergeprioritized.c @@ -58,14 +58,14 @@ * into the prioritized task list, 'list2'. On return 'list2' will contain * the prioritized content of both lists; 'list1' will be empty. * - * Inputs: + * Input Parameters: * list1 - Points to the prioritized list to merge into list 1. This list * will be empty upon return. * list2 - That list that will contained the prioritized content of * both lists upon return. * task_state - The task state/list index associated with list2. * - * Return Value: + * Returned Value: * None * * Assumptions: diff --git a/sched/sched/sched_releasetcb.c b/sched/sched/sched_releasetcb.c index b7046aa790..26ab60b7f7 100644 --- a/sched/sched/sched_releasetcb.c +++ b/sched/sched/sched_releasetcb.c @@ -102,7 +102,7 @@ static void sched_releasepid(pid_t pid) * however, there are certain error recovery contexts where the TCB my * not be fully initialized when sched_releasetcb is called. * - * Return Value: + * Returned Value: * OK on success; ERROR on failure * * Assumptions: diff --git a/sched/sched/sched_removeblocked.c b/sched/sched/sched_removeblocked.c index 36c92e96f0..9ed15a98bb 100644 --- a/sched/sched/sched_removeblocked.c +++ b/sched/sched/sched_removeblocked.c @@ -55,10 +55,10 @@ * This function removes a TCB from one of the blocked state task * lists as inferred from the task_state inside the TCB. * - * Inputs: + * Input Parameters: * btcb - Points to the TCB that is blocked * - * Return Value: + * Returned Value: * None * * Assumptions: diff --git a/sched/sched/sched_removereadytorun.c b/sched/sched/sched_removereadytorun.c index f5e93b881c..78919d4989 100644 --- a/sched/sched/sched_removereadytorun.c +++ b/sched/sched/sched_removereadytorun.c @@ -57,10 +57,10 @@ * Description: * This function removes a TCB from the ready to run list. * - * Inputs: + * Input Parameters: * rtcb - Points to the TCB that is ready-to-run * - * Return Value: + * Returned Value: * true if the currently active task (the head of the ready-to-run list) * has changed. * @@ -116,10 +116,10 @@ bool sched_removereadytorun(FAR struct tcb_s *rtcb) * Description: * This function removes a TCB from the ready to run list. * - * Inputs: + * Input Parameters: * rtcb - Points to the TCB that is ready-to-run * - * Return Value: + * Returned Value: * true if the currently active task (the head of the ready-to-run list) * has changed. * diff --git a/sched/sched/sched_reprioritize.c b/sched/sched/sched_reprioritize.c index 66112c3da0..3c65eec35f 100644 --- a/sched/sched/sched_reprioritize.c +++ b/sched/sched/sched_reprioritize.c @@ -63,11 +63,11 @@ * to sched_yield() -- The task will be moved to after all other tasks * with the same priority. * - * Inputs: + * Input Parameters: * tcb - the TCB of task to reprioritize. * sched_priority - The new task priority * - * Return Value: + * Returned Value: * On success, sched_reporioritize() returns 0 (OK). On error, a negated * errno value is returned. * diff --git a/sched/sched/sched_roundrobin.c b/sched/sched/sched_roundrobin.c index 9aa5a6b8ed..798b4265cf 100644 --- a/sched/sched/sched_roundrobin.c +++ b/sched/sched/sched_roundrobin.c @@ -73,12 +73,12 @@ * Description: * Check if the currently executing task has exceeded its time slice. * - * Inputs: + * Input Parameters: * tcb - The TCB of the currently executing task * ticks - The number of ticks that have elapsed on the interval timer. * noswitches - True: Can't do context switches now. * - * Return Value: + * Returned Value: * The number if ticks remaining until the next time slice expires. * Zero is returned if there is no time slicing (i.e., the task at the * head of the ready-to-run list does not support round robin diff --git a/sched/sched/sched_rrgetinterval.c b/sched/sched/sched_rrgetinterval.c index 3faefb44d2..fc96d8bd3b 100644 --- a/sched/sched/sched_rrgetinterval.c +++ b/sched/sched/sched_rrgetinterval.c @@ -62,12 +62,12 @@ * is written into 'interval. The identified process should be running * under the SCHED_RRscheduling policy.' * - * Inputs: + * Input Parameters: * pid - the task ID of the task. If pid is zero, the priority of the * calling task is returned. * interval - a structure used to return the time slice * - * Return Value: + * Returned Value: * On success, sched_rr_get_interval() returns OK (0). On error, * ERROR (-1) is returned, and errno is set to: * diff --git a/sched/sched/sched_setaffinity.c b/sched/sched/sched_setaffinity.c index 06ab16f865..d9ba779669 100644 --- a/sched/sched/sched_setaffinity.c +++ b/sched/sched/sched_setaffinity.c @@ -72,12 +72,12 @@ * is not intended for use by application logic. Applications should * use the standard sched_setparam(). * - * Inputs: + * Input Parameters: * pid - The ID of thread whose affinity set will be modified. * cpusetsize - Size of mask. MUST be sizeofcpu_set_t(). * mask - The location to return the thread's new affinity set. * - * Return Value: + * Returned Value: * Zero (OK) if successful. Otherwise, a negated errno value is returned: * * ESRCH The task whose ID is pid could not be found. @@ -180,12 +180,12 @@ errout_with_lock: * This function is a simply wrapper around nxsched_setaffinity() that sets * the errno value in the event of an error. * - * Inputs: + * Input Parameters: * pid - The ID of thread whose affinity set will be modified. * cpusetsize - Size of mask. MUST be sizeofcpu_set_t(). * mask - The location to return the thread's new affinity set. * - * Return Value: + * Returned Value: * 0 if successful. Otherwise, ERROR (-1) is returned, and errno is * set appropriately: * diff --git a/sched/sched/sched_setparam.c b/sched/sched/sched_setparam.c index 33307f1575..9a36299d7b 100644 --- a/sched/sched/sched_setparam.c +++ b/sched/sched/sched_setparam.c @@ -72,14 +72,14 @@ * use by application logic. Applications should use the standard * sched_setparam(). * - * Inputs: + * Input Parameters: * pid - the task ID of the task to reprioritize. If pid is zero, the * priority of the calling task is changed. * param - A structure whose member sched_priority is the integer priority. * The range of valid priority numbers is from SCHED_PRIORITY_MIN * through SCHED_PRIORITY_MAX. * - * Return Value: + * Returned Value: * 0 (OK) if successful, otherwise a negated errno value is returned to * indicate the nature of the failure.. * @@ -239,14 +239,14 @@ errout_with_lock: * to sched_yield() -- The task will be moved to after all other tasks * with the same priority. * - * Inputs: + * Input Parameters: * pid - the task ID of the task to reprioritize. If pid is zero, the * priority of the calling task is changed. * param - A structure whose member sched_priority is the integer priority. * The range of valid priority numbers is from SCHED_PRIORITY_MIN * through SCHED_PRIORITY_MAX. * - * Return Value: + * Returned Value: * On success, sched_setparam() returns 0 (OK). On error, -1 (ERROR) is * returned, and errno is set appropriately. * diff --git a/sched/sched/sched_setpriority.c b/sched/sched/sched_setpriority.c index 1e8cbd41bf..ead70de4fd 100644 --- a/sched/sched/sched_setpriority.c +++ b/sched/sched/sched_setpriority.c @@ -59,10 +59,10 @@ * Description: * Get the next highest priority ready-to-run task. * - * Inputs: + * Input Parameters: * tcb - the TCB of task to reprioritize. * - * Return Value: + * Returned Value: * TCB of the next highest priority ready-to-run task. * ****************************************************************************/ @@ -124,11 +124,11 @@ static FAR struct tcb_s *sched_nexttcb(FAR struct tcb_s *tcb) * to sched_yield() -- The task will be moved to after all other tasks * with the same priority. * - * Inputs: + * Input Parameters: * tcb - the TCB of task to reprioritize. * sched_priority - The new task priority * - * Return Value: + * Returned Value: * None * ****************************************************************************/ @@ -178,11 +178,11 @@ static inline void sched_running_setpriority(FAR struct tcb_s *tcb, * the position of the task in the ready-to-run list and if the priority * is increased, may cause the task to become running. * - * Inputs: + * Input Parameters: * tcb - the TCB of task to reprioritize. * sched_priority - The new task priority * - * Return Value: + * Returned Value: * None * ****************************************************************************/ @@ -267,11 +267,11 @@ static void sched_readytorun_setpriority(FAR struct tcb_s *tcb, * Change the priority of a blocked tasks. The only issue here is that * the task may like in a prioritized or an non-prioritized queue. * - * Inputs: + * Input Parameters: * tcb - the TCB of task to reprioritize. * sched_priority - The new task priority * - * Return Value: + * Returned Value: * None * ****************************************************************************/ @@ -324,11 +324,11 @@ static inline void sched_blocked_setpriority(FAR struct tcb_s *tcb, * to sched_yield() -- The task will be moved to after all other tasks * with the same priority. * - * Inputs: + * Input Parameters: * tcb - the TCB of task to reprioritize. * sched_priority - The new task priority * - * Return Value: + * Returned Value: * On success, nxsched_setpriority() returns 0 (OK). On error, a negated * errno value is returned. * diff --git a/sched/sched/sched_timerexpiration.c b/sched/sched/sched_timerexpiration.c index d00150654f..b1c137535a 100644 --- a/sched/sched/sched_timerexpiration.c +++ b/sched/sched/sched_timerexpiration.c @@ -162,12 +162,12 @@ static struct timespec g_stop_time; * Check for operations specific to scheduling policy of the currently * active task on a single CPU. * - * Inputs: + * Input Parameters: * cpu - The CPU that we are performing the scheduler operations on. * ticks - The number of ticks that have elapsed on the interval timer. * noswitches - True: Can't do context switches now. * - * Return Value: + * Returned Value: * The number if ticks remaining until the next time slice expires. * Zero is returned if there is no time slicing (i.e., the task at the * head of the ready-to-run list does not support round robin @@ -264,11 +264,11 @@ static uint32_t sched_cpu_scheduler(int cpu, uint32_t ticks, bool noswitches) * Check for operations specific to scheduling policy of the currently * active task on a single CPU. * - * Inputs: + * Input Parameters: * ticks - The number of ticks that have elapsed on the interval timer. * noswitches - True: Can't do context switches now. * - * Return Value: + * Returned Value: * The number if ticks remaining until the next time slice expires. * Zero is returned if there is no time slicing (i.e., the task at the * head of the ready-to-run list does not support round robin diff --git a/sched/sched/sched_waitpid.c b/sched/sched/sched_waitpid.c index 1763ee966f..faca0216aa 100644 --- a/sched/sched/sched_waitpid.c +++ b/sched/sched/sched_waitpid.c @@ -147,7 +147,7 @@ * stat_loc - The location to return the exit status * options - ignored * - * Return Value: + * Returned Value: * If waitpid() returns because the status of a child process is available, * it will return a value equal to the process ID of the child process for * which status is reported. diff --git a/sched/sched/sched_yield.c b/sched/sched/sched_yield.c index e9e62920f9..320de61c10 100644 --- a/sched/sched/sched_yield.c +++ b/sched/sched/sched_yield.c @@ -54,10 +54,10 @@ * This function forces the calling task to give up the CPU (only to other * tasks at the same priority). * - * Inputs: + * Input Parameters: * None * - * Return Value: + * Returned Value: * 0 (OK) or -1 (ERROR) (errno is not set) * * Assumptions: diff --git a/sched/semaphore/sem_destroy.c b/sched/semaphore/sem_destroy.c index 5cc05f222c..7c0522d29f 100644 --- a/sched/semaphore/sem_destroy.c +++ b/sched/semaphore/sem_destroy.c @@ -65,7 +65,7 @@ * Parameters: * sem - Semaphore to be destroyed. * - * Return Value: + * Returned Value: * This is an internal OS interface and should not be used by applications. * It follows the NuttX internal error return policy: Zero (OK) is * returned on success. A negated errno value is returned on failure. @@ -119,7 +119,7 @@ int nxsem_destroy (FAR sem_t *sem) * Parameters: * sem - Semaphore to be destroyed. * - * Return Value: + * Returned Value: * This function is a application interface. It returns zero (OK) if * successful. Otherwise, -1 (ERROR) is returned and the errno value is * set appropriately. diff --git a/sched/semaphore/sem_holder.c b/sched/semaphore/sem_holder.c index 3080c3080f..9095f98e7f 100644 --- a/sched/semaphore/sem_holder.c +++ b/sched/semaphore/sem_holder.c @@ -717,7 +717,7 @@ static int nxsem_restoreholderprioB(FAR struct semholder_s *pholder, * - If it is >0 then there should be no threads waiting for counts and * stcb should be null. * - * Return Value: + * Returned Value: * None * * Assumptions: @@ -778,7 +778,7 @@ static inline void nxsem_restorebaseprio_irq(FAR struct tcb_s *stcb, * - If it is >0 then there should be no threads waiting for counts and * stcb should be null. * - * Return Value: + * Returned Value: * None * * Assumptions: @@ -848,7 +848,7 @@ static inline void nxsem_restorebaseprio_task(FAR struct tcb_s *stcb, * Parameters: * None * - * Return Value: + * Returned Value: * None * * Assumptions: @@ -882,7 +882,7 @@ void nxsem_initholders(void) * Parameters: * sem - A reference to the semaphore being destroyed * - * Return Value: + * Returned Value: * None * * Assumptions: @@ -933,7 +933,7 @@ void nxsem_destroyholder(FAR sem_t *sem) * htcb - TCB of the thread that just obtained the semaphore * sem - A reference to the incremented semaphore * - * Return Value: + * Returned Value: * 0 (OK) or -1 (ERROR) if unsuccessful * * Assumptions: @@ -976,7 +976,7 @@ void nxsem_addholder_tcb(FAR struct tcb_s *htcb, FAR sem_t *sem) * Parameters: * sem - A reference to the incremented semaphore * - * Return Value: + * Returned Value: * 0 (OK) or -1 (ERROR) if unsuccessful * * Assumptions: @@ -998,7 +998,7 @@ void nxsem_addholder(FAR sem_t *sem) * Parameters: * None * - * Return Value: + * Returned Value: * 0 (OK) or -1 (ERROR) if unsuccessful * * Assumptions: @@ -1027,7 +1027,7 @@ void nxsem_boostpriority(FAR sem_t *sem) * Parameters: * sem - A reference to the semaphore being posted * - * Return Value: + * Returned Value: * None * * Assumptions: @@ -1077,7 +1077,7 @@ void nxsem_releaseholder(FAR sem_t *sem) * - If it is >0 then there should be no threads waiting for counts and * stcb should be null. * - * Return Value: + * Returned Value: * None * * Assumptions: @@ -1122,7 +1122,7 @@ void nxsem_restorebaseprio(FAR struct tcb_s *stcb, FAR sem_t *sem) * Parameters: * sem - A reference to the semaphore no longer being waited for * - * Return Value: + * Returned Value: * None * * Assumptions: @@ -1151,7 +1151,7 @@ void nxsem_canceled(FAR struct tcb_s *stcb, FAR sem_t *sem) * Parameters: * sem - A reference to the semaphore * - * Return Value: + * Returned Value: * None * * Assumptions: @@ -1177,7 +1177,7 @@ void sem_enumholders(FAR sem_t *sem) * Parameters: * sem - A reference to the semaphore * - * Return Value: + * Returned Value: * The number of available holder containers * * Assumptions: diff --git a/sched/semaphore/sem_initialize.c b/sched/semaphore/sem_initialize.c index 769313781c..3b629de0a4 100644 --- a/sched/semaphore/sem_initialize.c +++ b/sched/semaphore/sem_initialize.c @@ -59,7 +59,7 @@ * Parameters: * None * - * Return Value: + * Returned Value: * None * * Assumptions: diff --git a/sched/semaphore/sem_post.c b/sched/semaphore/sem_post.c index f20cb68c77..67822aca19 100644 --- a/sched/semaphore/sem_post.c +++ b/sched/semaphore/sem_post.c @@ -74,7 +74,7 @@ * Parameters: * sem - Semaphore descriptor * - * Return Value: + * Returned Value: * This is an internal OS interface and should not be used by applications. * It follows the NuttX internal error return policy: Zero (OK) is * returned on success. A negated errno value is returned on failure. @@ -211,7 +211,7 @@ int nxsem_post(FAR sem_t *sem) * Parameters: * sem - Semaphore descriptor * - * Return Value: + * Returned Value: * This function is a standard, POSIX application interface. It will * return zero (OK) if successful. Otherwise, -1 (ERROR) is returned and * the errno value is set appropriately. diff --git a/sched/semaphore/sem_recover.c b/sched/semaphore/sem_recover.c index 6305f0d35e..343ba330a9 100644 --- a/sched/semaphore/sem_recover.c +++ b/sched/semaphore/sem_recover.c @@ -64,10 +64,10 @@ * only the task, there is not mechanism to traverse all of the semaphores * with counts held by the task. * - * Inputs: + * Input Parameters: * tcb - The TCB of the terminated task or thread * - * Return Value: + * Returned Value: * None. * * Assumptions: diff --git a/sched/semaphore/sem_reset.c b/sched/semaphore/sem_reset.c index 28a0965a4c..81f8fce83a 100644 --- a/sched/semaphore/sem_reset.c +++ b/sched/semaphore/sem_reset.c @@ -64,7 +64,7 @@ * sem - Semaphore descriptor to be reset * count - The requested semaphore count * - * Return Value: + * Returned Value: * This is an internal OS interface, not available to applications, and * hence follows the NuttX internal error return policy: Zero (OK) is * returned on success. A negated errno value is returned on failure. diff --git a/sched/semaphore/sem_setprotocol.c b/sched/semaphore/sem_setprotocol.c index f4b202b22b..be98b88c17 100644 --- a/sched/semaphore/sem_setprotocol.c +++ b/sched/semaphore/sem_setprotocol.c @@ -82,7 +82,7 @@ * modified * protocol - The new protocol to use * - * Return Value: + * Returned Value: * This is an internal OS interface and should not be used by applications. * It follows the NuttX internal error return policy: Zero (OK) is * returned on success. A negated errno value is returned on failure. @@ -153,7 +153,7 @@ int nxsem_setprotocol(FAR sem_t *sem, int protocol) * modified * protocol - The new protocol to use * - * Return Value: + * Returned Value: * This function is exposed as a non-standard application interface. It * returns zero (OK) if successful. Otherwise, -1 (ERROR) is returned and * the errno value is set appropriately. diff --git a/sched/semaphore/sem_tickwait.c b/sched/semaphore/sem_tickwait.c index 350a7a1cec..fd549e4aa3 100644 --- a/sched/semaphore/sem_tickwait.c +++ b/sched/semaphore/sem_tickwait.c @@ -76,7 +76,7 @@ * posted. If ticks is zero, then this function is equivalent * to nxsem_trywait(). * - * Return Value: + * Returned Value: * This is an internal OS interface, not available to applications, and * hence follows the NuttX internal error return policy: Zero (OK) is * returned on success. A negated errno value is returned on failure. diff --git a/sched/semaphore/sem_timedwait.c b/sched/semaphore/sem_timedwait.c index 98e5c84b2b..a5ae5116f4 100644 --- a/sched/semaphore/sem_timedwait.c +++ b/sched/semaphore/sem_timedwait.c @@ -86,7 +86,7 @@ * sem - Semaphore object * abstime - The absolute time to wait until a timeout is declared. * - * Return Value: + * Returned Value: * This is an internal OS interface and should not be used by applications. * It follows the NuttX internal error return policy: Zero (OK) is * returned on success. A negated errno value is returned on failure. @@ -235,7 +235,7 @@ errout_with_irqdisabled: * sem - Semaphore object * abstime - The absolute time to wait until a timeout is declared. * - * Return Value: + * Returned Value: * Zero (OK) is returned on success. On failure, -1 (ERROR) is returned * and the errno is set appropriately: * diff --git a/sched/semaphore/sem_timeout.c b/sched/semaphore/sem_timeout.c index 377793930b..d4ba2a0d88 100644 --- a/sched/semaphore/sem_timeout.c +++ b/sched/semaphore/sem_timeout.c @@ -63,7 +63,7 @@ * argc - The number of arguments (should be 1) * pid - The task ID of the task to wakeup * - * Return Value: + * Returned Value: * None * * Assumptions: diff --git a/sched/semaphore/sem_trywait.c b/sched/semaphore/sem_trywait.c index e990427c45..d7480e0540 100644 --- a/sched/semaphore/sem_trywait.c +++ b/sched/semaphore/sem_trywait.c @@ -65,7 +65,7 @@ * Parameters: * sem - the semaphore descriptor * - * Return Value: + * Returned Value: * This is an internal OS interface and should not be used by applications. * It follows the NuttX internal error return policy: Zero (OK) is * returned on success. A negated errno value is returned on failure. @@ -136,7 +136,7 @@ int nxsem_trywait(FAR sem_t *sem) * Parameters: * sem - the semaphore descriptor * - * Return Value: + * Returned Value: * Zero (OK) on success or -1 (ERROR) if unsuccessful. If this function * returns -1(ERROR), then the cause of the failure will be reported in * errno variable as: diff --git a/sched/semaphore/sem_wait.c b/sched/semaphore/sem_wait.c index 5b2b8ceb5d..9bb1d3105c 100644 --- a/sched/semaphore/sem_wait.c +++ b/sched/semaphore/sem_wait.c @@ -72,7 +72,7 @@ * Parameters: * sem - Semaphore descriptor. * - * Return Value: + * Returned Value: * This is an internal OS interface and should not be used by applications. * It follows the NuttX internal error return policy: Zero (OK) is * returned on success. A negated errno value is returned on failure. @@ -221,7 +221,7 @@ int nxsem_wait(FAR sem_t *sem) * Parameters: * sem - Semaphore descriptor. * - * Return Value: + * Returned Value: * This function is a standard, POSIX application interface. It returns * zero (OK) if successful. Otherwise, -1 (ERROR) is returned and * the errno value is set appropriately. Possible errno values include: diff --git a/sched/semaphore/sem_waitirq.c b/sched/semaphore/sem_waitirq.c index 4ca202f07e..11254e8fcb 100644 --- a/sched/semaphore/sem_waitirq.c +++ b/sched/semaphore/sem_waitirq.c @@ -70,7 +70,7 @@ * errcode - EINTR if the semaphore wait was awakened by a signal; * ETIMEDOUT if awakened by a timeout * - * Return Value: + * Returned Value: * None * * Assumptions: diff --git a/sched/signal/sig_action.c b/sched/signal/sig_action.c index 1b2f3be67e..d40ec627ed 100644 --- a/sched/signal/sig_action.c +++ b/sched/signal/sig_action.c @@ -139,7 +139,7 @@ static FAR sigactq_t *nxsig_alloc_action(void) * act - Location of new handler * oact - Location to store only handler * - * Return Value: + * Returned Value: * 0 (OK), or -1 (ERROR) if the signal number is invalid. * (errno is not set) * diff --git a/sched/signal/sig_pending.c b/sched/signal/sig_pending.c index 7dc44fc456..4dc27e0d98 100644 --- a/sched/signal/sig_pending.c +++ b/sched/signal/sig_pending.c @@ -62,7 +62,7 @@ * Parameters: * set - The location to return the pending signal set. * - * Return Value: + * Returned Value: * 0 (OK) or -1 (ERROR) * * Assumptions: diff --git a/sched/signal/sig_procmask.c b/sched/signal/sig_procmask.c index 19bf70316e..27f1d77102 100644 --- a/sched/signal/sig_procmask.c +++ b/sched/signal/sig_procmask.c @@ -92,7 +92,7 @@ * set - Location of the new signal mask * oset - Location to store the old signal mask * - * Return Value: + * Returned Value: * This is an internal OS interface and should not be used by applications. * It follows the NuttX internal error return policy: Zero (OK) is * returned on success. A negated errno value is returned on failure. @@ -197,7 +197,7 @@ int nxsig_procmask(int how, FAR const sigset_t *set, FAR sigset_t *oset) * set - Location of the new signal mask * oset - Location to store the old signal mask * - * Return Value: + * Returned Value: * This function will return 0 (OK) on success or -1 (ERROR) if how is * invalid. In the latter case, the errno variable will be set to EINVAL. * diff --git a/sched/signal/sig_queue.c b/sched/signal/sig_queue.c index 455b7ea72d..00e08f26c0 100644 --- a/sched/signal/sig_queue.c +++ b/sched/signal/sig_queue.c @@ -76,7 +76,7 @@ * signo - Signal number * value - Value to pass to task with signal * - * Return Value: + * Returned Value: * This is an internal OS interface and should not be used by applications. * It follows the NuttX internal error return policy: Zero (OK) is * returned on success. A negated errno value is returned on failure. @@ -157,7 +157,7 @@ int nxsig_queue(int pid, int signo, void *sival_ptr) * signo - Signal number * value - Value to pass to task with signal * - * Return Value: + * Returned Value: * On success (at least one signal was sent), zero (OK) is returned. On * any failure, -1 (ERROR) is returned and errno varaible is set * appropriately: diff --git a/sched/signal/sig_suspend.c b/sched/signal/sig_suspend.c index 4bfc114b34..8a8c068cdf 100644 --- a/sched/signal/sig_suspend.c +++ b/sched/signal/sig_suspend.c @@ -75,7 +75,7 @@ * Parameters: * set - signal mask to use while suspended. * - * Return Value: + * Returned Value: * -1 (ERROR) always * * Assumptions: diff --git a/sched/signal/sig_timedwait.c b/sched/signal/sig_timedwait.c index 01b735ffec..edc8a2c990 100644 --- a/sched/signal/sig_timedwait.c +++ b/sched/signal/sig_timedwait.c @@ -226,7 +226,7 @@ void nxsig_wait_irq(FAR struct tcb_s *wtcb, int errcode) * info - The returned value (may be NULL). * timeout - The amount of time to wait (may be NULL) * - * Return Value: + * Returned Value: * This is an internal OS interface and should not be used by applications. * It follows the NuttX internal error return policy: Zero (OK) is * returned on success. A negated errno value is returned on failure. @@ -483,7 +483,7 @@ int nxsig_timedwait(FAR const sigset_t *set, FAR struct siginfo *info, * info - The returned value (may be NULL). * timeout - The amount of time to wait (may be NULL) * - * Return Value: + * Returned Value: * Signal number that cause the wait to be terminated, otherwise -1 (ERROR) * is returned with errno set to either: * diff --git a/sched/signal/sig_waitinfo.c b/sched/signal/sig_waitinfo.c index 92d11acf28..0bac27e33f 100644 --- a/sched/signal/sig_waitinfo.c +++ b/sched/signal/sig_waitinfo.c @@ -59,7 +59,7 @@ * set - The pending signal set * info - The returned value * - * Return Value: + * Returned Value: * Signal number that cause the wait to be terminated, otherwise -1 (ERROR) * is returned and the errno variable is set appropriately. * diff --git a/sched/task/task_activate.c b/sched/task/task_activate.c index 47791c7a25..18dad9c71f 100644 --- a/sched/task/task_activate.c +++ b/sched/task/task_activate.c @@ -60,7 +60,7 @@ * Input Parameters: * tcb - The TCB for the task for the task (same as the task_init argument). * - * Return Value: + * Returned Value: * Always returns OK * ****************************************************************************/ diff --git a/sched/task/task_atexit.c b/sched/task/task_atexit.c index ba26f3ab8c..91c6c9c639 100644 --- a/sched/task/task_atexit.c +++ b/sched/task/task_atexit.c @@ -82,7 +82,7 @@ * Input Parameters: * func - A pointer to the function to be called when the task exits. * - * Return Value: + * Returned Value: * Zero on success. Non-zero on failure. * ****************************************************************************/ diff --git a/sched/task/task_cancelpt.c b/sched/task/task_cancelpt.c index bcd03621a9..9220264278 100644 --- a/sched/task/task_cancelpt.c +++ b/sched/task/task_cancelpt.c @@ -103,7 +103,7 @@ * Input Parameters: * None * - * Returned Value + * Returned Value: * true is returned if a cancellation is pending but cannot be performed * now due to the nesting level. * @@ -194,7 +194,7 @@ bool enter_cancellation_point(void) * Input Parameters: * None * - * Returned Value + * Returned Value: * None * ****************************************************************************/ @@ -274,7 +274,7 @@ void leave_cancellation_point(void) * Input Parameters: * None * - * Returned Value + * Returned Value: * true is returned if a cancellation is pending but cannot be performed * now due to the nesting level. * diff --git a/sched/task/task_create.c b/sched/task/task_create.c index c1cdedba29..f09d04578c 100644 --- a/sched/task/task_create.c +++ b/sched/task/task_create.c @@ -78,7 +78,7 @@ * should be terminated with a NULL argv[] value. If no * parameters are required, argv may be NULL. * - * Return Value: + * Returned Value: * Returns the positive, non-zero process ID of the new task or a negated * errno value to indicate the nature of any failure. If memory is * insufficient or the task cannot be created -ENOMEM will be returned. @@ -224,7 +224,7 @@ errout_with_tcb: * should be terminated with a NULL argv[] value. If no * parameters are required, argv may be NULL. * - * Return Value: + * Returned Value: * Returns the positive, non-zero process ID of the new task or a negated * errno value to indicate the nature of any failure. If memory is * insufficient or the task cannot be created -ENOMEM will be returned. @@ -265,7 +265,7 @@ int nxtask_create(FAR const char *name, int priority, * should be terminated with a NULL argv[] value. If no * parameters are required, argv may be NULL. * - * Return Value: + * Returned Value: * Returns the non-zero process ID of the new task or ERROR if memory is * insufficient or the task cannot be created. The errno will be set in * the failure case to indicate the nature of the error. @@ -306,7 +306,7 @@ int task_create(FAR const char *name, int priority, * should be terminated with a NULL argv[] value. If no * parameters are required, argv may be NULL. * - * Return Value: + * Returned Value: * Returns the positive, non-zero process ID of the new task or a negated * errno value to indicate the nature of any failure. If memory is * insufficient or the task cannot be created -ENOMEM will be returned. diff --git a/sched/task/task_exit.c b/sched/task/task_exit.c index f42ef1421e..a7e8522f4f 100644 --- a/sched/task/task_exit.c +++ b/sched/task/task_exit.c @@ -69,10 +69,10 @@ * and task_restart(). In the last two cases, the task will be terminated * as though exit() were called. * - * Inputs: + * Input Parameters: * None * - * Return Value: + * Returned Value: * OK on success; or ERROR on failure * * Assumeptions: diff --git a/sched/task/task_getgroup.c b/sched/task/task_getgroup.c index 34f52c2c9c..871d4b1f4c 100644 --- a/sched/task/task_getgroup.c +++ b/sched/task/task_getgroup.c @@ -60,7 +60,7 @@ * Parameters: * pid - The task ID to use in the lookup. * - * Return Value: + * Returned Value: * On success, a pointer to the group task structure is returned. This * function can fail only if there is no group that corresponds to the * groupd ID. diff --git a/sched/task/task_init.c b/sched/task/task_init.c index f9b7002d33..2d15f84736 100644 --- a/sched/task/task_init.c +++ b/sched/task/task_init.c @@ -80,7 +80,7 @@ * should be terminated with a NULL argv[] value. If no * parameters are required, argv may be NULL. * - * Return Value: + * Returned Value: * OK on success; ERROR on failure with errno set appropriately. (See * task_schedsetup() for possible failure conditions). On failure, the * caller is responsible for freeing the stack memory and for calling diff --git a/sched/task/task_onexit.c b/sched/task/task_onexit.c index 6d3d47fce6..135ed2b657 100644 --- a/sched/task/task_onexit.c +++ b/sched/task/task_onexit.c @@ -84,7 +84,7 @@ * arg - An argument that will be provided to the on_exit() function when * the task exits. * - * Return Value: + * Returned Value: * Zero on success. Non-zero on failure. * ****************************************************************************/ diff --git a/sched/task/task_recover.c b/sched/task/task_recover.c index 7c6bee2114..c4fea9b9b0 100644 --- a/sched/task/task_recover.c +++ b/sched/task/task_recover.c @@ -63,10 +63,10 @@ * via pthread_cancel. I checks checks for semaphores, message queue, and * watchdog timer resources stranded in bad conditions. * - * Inputs: + * Input Parameters: * tcb - The TCB of the terminated task or thread * - * Return Value: + * Returned Value: * None. * * Assumptions: diff --git a/sched/task/task_reparent.c b/sched/task/task_reparent.c index 075a391940..88f2bb8b45 100644 --- a/sched/task/task_reparent.c +++ b/sched/task/task_reparent.c @@ -64,7 +64,7 @@ * of the current parent task) * chpid - PID of the child to be reparented. * - * Return Value: + * Returned Value: * 0 (OK) on success; A negated errno value on failure. * ****************************************************************************/ diff --git a/sched/task/task_restart.c b/sched/task/task_restart.c index c7ad08e384..a8ff657068 100644 --- a/sched/task/task_restart.c +++ b/sched/task/task_restart.c @@ -63,11 +63,11 @@ * reinitialized with same ID, priority, original entry point, stack size, * and parameters it had when it was first started. * - * Inputs: + * Input Parameters: * pid - The task ID of the task to delete. An ID of zero signifies the * calling task. * - * Return Value: + * Returned Value: * OK on sucess; ERROR on failure. * * This function can fail if: diff --git a/sched/task/task_setup.c b/sched/task/task_setup.c index fc2ff3f6c8..8389e2bc54 100644 --- a/sched/task/task_setup.c +++ b/sched/task/task_setup.c @@ -82,10 +82,10 @@ static const char g_noname[] = ""; * Description: * This function assigns the next unique task ID to a task. * - * Inputs: + * Input Parameters: * tcb - TCB of task * - * Return: + * Returned Value: * OK on success; ERROR on failure (errno is not set) * ****************************************************************************/ @@ -344,7 +344,7 @@ static inline void task_dupdspace(FAR struct tcb_s *tcb) * entry - Thread user entry point * ttype - Type of the new thread: task, pthread, or kernel thread * - * Return Value: + * Returned Value: * OK on success; ERROR on failure. * * This function can only failure is it is unable to assign a new, unique @@ -449,7 +449,7 @@ static int thread_schedsetup(FAR struct tcb_s *tcb, int priority, * tcb - Address of the new task's TCB * name - Name of the new task * - * Return Value: + * Returned Value: * None * ****************************************************************************/ @@ -491,7 +491,7 @@ static void task_namesetup(FAR struct task_tcb_s *tcb, FAR const char *name) * terminated with a NULL argv[] value. If no parameters are * required, argv may be NULL. * - * Return Value: + * Returned Value: * Zero (OK) on success; a negated errno on failure. * ****************************************************************************/ @@ -631,7 +631,7 @@ static inline int task_stackargsetup(FAR struct task_tcb_s *tcb, * main - Application start point of the new task * ttype - Type of the new thread: task or kernel thread * - * Return Value: + * Returned Value: * OK on success; ERROR on failure. * * This function can only failure is it is unable to assign a new, unique @@ -664,7 +664,7 @@ int task_schedsetup(FAR struct task_tcb_s *tcb, int priority, start_t start, * entry - Entry point of the new pthread * ttype - Type of the new thread: task, pthread, or kernel thread * - * Return Value: + * Returned Value: * OK on success; ERROR on failure. * * This function can only failure is it is unable to assign a new, unique @@ -709,7 +709,7 @@ int pthread_schedsetup(FAR struct pthread_tcb_s *tcb, int priority, * terminated with a NULL argv[] value. If no parameters are * required, argv may be NULL. * - * Return Value: + * Returned Value: * OK * ****************************************************************************/ diff --git a/sched/task/task_start.c b/sched/task/task_start.c index b1f1e3cd1a..a0c88329e5 100644 --- a/sched/task/task_start.c +++ b/sched/task/task_start.c @@ -70,10 +70,10 @@ * execution of a task. It receives initial control when the task is * started and calls main entry point of the newly started task. * - * Inputs: + * Input Parameters: * None * - * Return: + * Returned Value: * None * ****************************************************************************/ diff --git a/sched/task/task_starthook.c b/sched/task/task_starthook.c index 6bf8de9695..908629a646 100644 --- a/sched/task/task_starthook.c +++ b/sched/task/task_starthook.c @@ -58,12 +58,12 @@ * The start hook is useful, for example, for setting up automatic * configuration of C++ constructors. * - * Inputs: + * Input Parameters: * tcb - The new, unstarted task task that needs the start hook * starthook - The pointer to the start hook function * arg - The argument to pass to the start hook function. * - * Return: + * Returned Value: * None * ****************************************************************************/ diff --git a/sched/task/task_terminate.c b/sched/task/task_terminate.c index 2edb749277..8215d70f9c 100644 --- a/sched/task/task_terminate.c +++ b/sched/task/task_terminate.c @@ -84,13 +84,13 @@ * exit() and pthread_exit(). In those cases task_exithook() has already * been called with nonblocking == false; * - * Inputs: + * Input Parameters: * pid - The task ID of the task to delete. A pid of zero * signifies the calling task. * nonblocking - True: The task is an unhealthy, partially torn down * state and is not permitted to block. * - * Return Value: + * Returned Value: * OK on success; or ERROR on failure * * This function can fail if the provided pid does not correspond to a diff --git a/sched/task/task_vfork.c b/sched/task/task_vfork.c index 7b4f53a123..124a7fd077 100644 --- a/sched/task/task_vfork.c +++ b/sched/task/task_vfork.c @@ -82,7 +82,7 @@ * tcb - Address of the new task's TCB * name - Name of the new task * - * Return Value: + * Returned Value: * None * ****************************************************************************/ @@ -110,7 +110,7 @@ static inline void vfork_namesetup(FAR struct tcb_s *parent, * parent - Address of the parent task's TCB * child - Address of the child task's TCB * - * Return Value: + * Returned Value: * Zero (OK) on success; a negated errno on failure. * ****************************************************************************/ @@ -177,7 +177,7 @@ static inline int vfork_stackargsetup(FAR struct tcb_s *parent, * parent - Address of the parent task's TCB * child - Address of the child task's TCB * - * Return Value: + * Returned Value: * Zero (OK) on success; a negated errno on failure. * ****************************************************************************/ diff --git a/sched/timer/timer_create.c b/sched/timer/timer_create.c index e6c775093d..f842690a92 100644 --- a/sched/timer/timer_create.c +++ b/sched/timer/timer_create.c @@ -146,7 +146,7 @@ static FAR struct posix_timer_s *timer_allocate(void) * asynchronous notification. evp may be NULL (see above). * timerid - The pre-thread timer created by the call to timer_create(). * - * Return Value: + * Returned Value: * If the call succeeds, timer_create() will return 0 (OK) and update the * location referenced by timerid to a timer_t, which can be passed to the * other per-thread timer calls. If an error occurs, the function will diff --git a/sched/timer/timer_delete.c b/sched/timer/timer_delete.c index 6d6e5bebc1..63a189427d 100644 --- a/sched/timer/timer_delete.c +++ b/sched/timer/timer_delete.c @@ -64,7 +64,7 @@ * timerid - The per-thread timer, previously created by the call to * timer_create(), to be deleted. * - * Return Value: + * Returned Value: * If the call succeeds, timer_create() will return 0 (OK). Otherwise, * the function will return a value of -1 (ERROR) and set errno to * indicate the error. diff --git a/sched/timer/timer_getoverrun.c b/sched/timer/timer_getoverrun.c index da07dcedca..c5aaee8799 100644 --- a/sched/timer/timer_getoverrun.c +++ b/sched/timer/timer_getoverrun.c @@ -76,7 +76,7 @@ * timerid - The pre-thread timer, previously created by the call to * timer_create(), whose overrun count will be returned.. * - * Return Value: + * Returned Value: * If the timer_getoverrun() function succeeds, it will return the timer * expiration overrun count as explained above. timer_getoverrun() will * fail if: diff --git a/sched/timer/timer_gettime.c b/sched/timer/timer_gettime.c index 25e0168765..138b7a5f7d 100644 --- a/sched/timer/timer_gettime.c +++ b/sched/timer/timer_gettime.c @@ -68,7 +68,7 @@ * timerid - The pre-thread timer, previously created by the call to * timer_create(), whose remaining time count will be returned.. * - * Return Value: + * Returned Value: * If the timer_gettime() succeeds, a value of 0 (OK) will be returned. * If an error occurs, the value -1 (ERROR) will be returned, and errno * set to indicate the error. diff --git a/sched/timer/timer_initialize.c b/sched/timer/timer_initialize.c index 25a64b1a51..1ab262c26e 100644 --- a/sched/timer/timer_initialize.c +++ b/sched/timer/timer_initialize.c @@ -91,7 +91,7 @@ volatile sq_queue_t g_alloctimers; * Parameters: * None * - * Return Value: + * Returned Value: * None * ****************************************************************************/ @@ -132,7 +132,7 @@ void weak_function timer_initialize(void) * Parameters: * pid - the task ID of the thread that exited * - * Return Value: + * Returned Value: * None * ****************************************************************************/ diff --git a/sched/timer/timer_release.c b/sched/timer/timer_release.c index 2608092a16..eef4fcae6a 100644 --- a/sched/timer/timer_release.c +++ b/sched/timer/timer_release.c @@ -106,7 +106,7 @@ static inline void timer_free(struct posix_timer_s *timer) * timer - The per-thread timer, previously created by the call to * timer_create(), to be deleted. * - * Return Value: + * Returned Value: * If the call succeeds, timer_release() will return 0 (OK) or 1 (meaning * that the timer is still valid). Otherwise, the function will return a * negated errno value: diff --git a/sched/timer/timer_settime.c b/sched/timer/timer_settime.c index 3724ed5ebd..3311de1c7f 100644 --- a/sched/timer/timer_settime.c +++ b/sched/timer/timer_settime.c @@ -77,7 +77,7 @@ static void timer_timeout(int argc, wdparm_t itimer); * Parameters: * timer - A reference to the POSIX timer that just timed out * - * Return Value: + * Returned Value: * None * * Assumptions: @@ -132,7 +132,7 @@ static inline void timer_signotify(FAR struct posix_timer_s *timer) * Parameters: * timer - A reference to the POSIX timer that just timed out * - * Return Value: + * Returned Value: * None * * Assumptions: @@ -165,7 +165,7 @@ static inline void timer_restart(FAR struct posix_timer_s *timer, * itimer - A reference to the POSIX timer that just timed out * signo - The signal to use to wake up the task * - * Return Value: + * Returned Value: * None * * Assumptions: @@ -284,7 +284,7 @@ static void timer_timeout(int argc, wdparm_t itimer) * ovalue - A location in which to return the time remaining from the * previous timer setting. (ignored) * - * Return Value: + * Returned Value: * If the timer_settime() succeeds, a value of 0 (OK) will be returned. * If an error occurs, the value -1 (ERROR) will be returned, and errno set * to indicate the error. diff --git a/sched/wdog/wd_cancel.c b/sched/wdog/wd_cancel.c index 040385d31d..6eaab00c3b 100644 --- a/sched/wdog/wd_cancel.c +++ b/sched/wdog/wd_cancel.c @@ -64,7 +64,7 @@ * Parameters: * wdog - ID of the watchdog to cancel. * - * Return Value: + * Returned Value: * Zero (OK) is returned on success; A negated errno value is returned to * indicate the nature of any failure. * diff --git a/sched/wdog/wd_create.c b/sched/wdog/wd_create.c index 8bd6496153..bc8509bad7 100644 --- a/sched/wdog/wd_create.c +++ b/sched/wdog/wd_create.c @@ -63,7 +63,7 @@ * Parameters: * None * - * Return Value: + * Returned Value: * Pointer to watchdog (i.e., the watchdog ID), or NULL if insufficient * watchdogs are available. * diff --git a/sched/wdog/wd_delete.c b/sched/wdog/wd_delete.c index 785d4ec87c..46fe6cef5a 100644 --- a/sched/wdog/wd_delete.c +++ b/sched/wdog/wd_delete.c @@ -67,7 +67,7 @@ * wdog - The watchdog ID to delete. This is actually a pointer to a * watchdog structure. * - * Return Value: + * Returned Value: * Zero (OK) is returned on success; a negated errno value is return to * indicate the nature of any failure. * diff --git a/sched/wdog/wd_gettime.c b/sched/wdog/wd_gettime.c index 0e48dec2f3..1a5c31f9cc 100644 --- a/sched/wdog/wd_gettime.c +++ b/sched/wdog/wd_gettime.c @@ -58,7 +58,7 @@ * Parameters: * wdog - watchdog ID * - * Return Value: + * Returned Value: * The time in system ticks remaining until the watchdog time expires. * Zero means either that wdog is not valid or that the wdog has already * expired. diff --git a/sched/wdog/wd_initialize.c b/sched/wdog/wd_initialize.c index 54b98e4838..17e1e001a5 100644 --- a/sched/wdog/wd_initialize.c +++ b/sched/wdog/wd_initialize.c @@ -90,7 +90,7 @@ static struct wdog_s g_wdpool[CONFIG_PREALLOC_WDOGS]; * Parameters: * None * - * Return Value: + * Returned Value: * None * * Assumptions: diff --git a/sched/wdog/wd_recover.c b/sched/wdog/wd_recover.c index 2a4847471b..4b2e28368b 100644 --- a/sched/wdog/wd_recover.c +++ b/sched/wdog/wd_recover.c @@ -58,10 +58,10 @@ * task_delete() or via pthread_cancel(). It checks if the deleted task * is waiting for a timed event and if so cancels the timeout * - * Inputs: + * Input Parameters: * tcb - The TCB of the terminated task or thread * - * Return Value: + * Returned Value: * None. * * Assumptions: diff --git a/sched/wdog/wd_start.c b/sched/wdog/wd_start.c index f861cbfab7..ec7fa96ec9 100644 --- a/sched/wdog/wd_start.c +++ b/sched/wdog/wd_start.c @@ -101,7 +101,7 @@ typedef void (*wdentry4_t)(int argc, wdparm_t arg1, wdparm_t arg2, * Parameters: * None * - * Return Value: + * Returned Value: * None * ****************************************************************************/ @@ -209,7 +209,7 @@ static inline void wd_expiration(void) * wdentry - function to call on timeout * parm1..4 - parameters to pass to wdentry * - * Return Value: + * Returned Value: * Zero (OK) is returned on success; a negated errno value is return to * indicate the nature of any failure. * @@ -406,7 +406,7 @@ int wd_start(WDOG_ID wdog, int32_t delay, wdentry_t wdentry, int argc, ...) * this function is called on each timer interrupt and a value of one * is implicit. * - * Return Value: + * Returned Value: * If CONFIG_SCHED_TICKLESS is defined then the number of ticks for the * next delay is provided (zero if no delay). Otherwise, this function * has no returned value. diff --git a/sched/wdog/wdog.h b/sched/wdog/wdog.h index 4b51b2355f..aed2657939 100644 --- a/sched/wdog/wdog.h +++ b/sched/wdog/wdog.h @@ -93,7 +93,7 @@ extern uint16_t g_wdnfree; * Parameters: * None * - * Return Value: + * Returned Value: * None * * Assumptions: @@ -120,7 +120,7 @@ void weak_function wd_initialize(void); * this function is called on each timer interrupt and a value of one * is implicit. * - * Return Value: + * Returned Value: * If CONFIG_SCHED_TICKLESS is defined then the number of ticks for the * next delay is provided (zero if no delay). Otherwise, this function * has no returned value. @@ -144,10 +144,10 @@ void wd_timer(void); * task_delete() or via pthread_cancel(). It checks if the deleted task * is waiting for a timed event and if so cancels the timeout * - * Inputs: + * Input Parameters: * tcb - The TCB of the terminated task or thread * - * Return Value: + * Returned Value: * None. * * Assumptions: diff --git a/sched/wqueue/kwork_cancel.c b/sched/wqueue/kwork_cancel.c index 659d9688b7..526a3d906a 100644 --- a/sched/wqueue/kwork_cancel.c +++ b/sched/wqueue/kwork_cancel.c @@ -63,7 +63,7 @@ * After work has been cancelled, it may be re-queue by calling work_queue() * again. * - * Input parameters: + * Input Parameters: * qid - The work queue ID * work - The previously queue work structure to cancel * @@ -124,7 +124,7 @@ static int work_qcancel(FAR struct kwork_wqueue_s *wqueue, * user mode work queue. After work has been cancelled, it may be re-queue * by calling work_queue() again. * - * Input parameters: + * Input Parameters: * qid - The work queue ID (must be HPWORK or LPWORK) * work - The previously queue work structure to cancel * diff --git a/sched/wqueue/kwork_hpthread.c b/sched/wqueue/kwork_hpthread.c index 7389220452..a923ad1122 100644 --- a/sched/wqueue/kwork_hpthread.c +++ b/sched/wqueue/kwork_hpthread.c @@ -82,7 +82,7 @@ struct hp_wqueue_s g_hpwork; * bring up. This entry point is referenced by OS internally and should * not be accessed by application logic. * - * Input parameters: + * Input Parameters: * argc, argv (not used) * * Returned Value: @@ -132,7 +132,7 @@ static int work_hpthread(int argc, char *argv[]) * Description: * Start the high-priority, kernel-mode work queue. * - * Input parameters: + * Input Parameters: * None * * Returned Value: diff --git a/sched/wqueue/kwork_inherit.c b/sched/wqueue/kwork_inherit.c index c648c4b4ed..6647a415c7 100644 --- a/sched/wqueue/kwork_inherit.c +++ b/sched/wqueue/kwork_inherit.c @@ -65,7 +65,7 @@ * Parameters: * reqprio - Requested minimum worker thread priority * - * Return Value: + * Returned Value: * None * ****************************************************************************/ @@ -178,7 +178,7 @@ static void lpwork_boostworker(pid_t wpid, uint8_t reqprio) * reqprio - Previously requested minimum worker thread priority to be * "unboosted" * - * Return Value: + * Returned Value: * None * ****************************************************************************/ @@ -324,7 +324,7 @@ static void lpwork_restoreworker(pid_t wpid, uint8_t reqprio) * Parameters: * reqprio - Requested minimum worker thread priority * - * Return Value: + * Returned Value: * None * ****************************************************************************/ @@ -370,7 +370,7 @@ void lpwork_boostpriority(uint8_t reqprio) * reqprio - Previously requested minimum worker thread priority to be * "unboosted" * - * Return Value: + * Returned Value: * None * ****************************************************************************/ diff --git a/sched/wqueue/kwork_lpthread.c b/sched/wqueue/kwork_lpthread.c index dcb0726efe..5d6911fef3 100644 --- a/sched/wqueue/kwork_lpthread.c +++ b/sched/wqueue/kwork_lpthread.c @@ -84,7 +84,7 @@ struct lp_wqueue_s g_lpwork; * bring up. This entry point is referenced by OS internally and should * not be accessed by application logic. * - * Input parameters: + * Input Parameters: * argc, argv (not used) * * Returned Value: @@ -168,7 +168,7 @@ static int work_lpthread(int argc, char *argv[]) * Description: * Start the low-priority, kernel-mode worker thread(s) * - * Input parameters: + * Input Parameters: * None * * Returned Value: diff --git a/sched/wqueue/kwork_process.c b/sched/wqueue/kwork_process.c index 80c7befca2..2266949f5f 100644 --- a/sched/wqueue/kwork_process.c +++ b/sched/wqueue/kwork_process.c @@ -85,7 +85,7 @@ * part of the internal implementation of each work queue; it should not * be called from application level logic. * - * Input parameters: + * Input Parameters: * wqueue - Describes the work queue to be processed * * Returned Value: diff --git a/sched/wqueue/kwork_queue.c b/sched/wqueue/kwork_queue.c index 8b5a8e6f5a..483a7e55af 100644 --- a/sched/wqueue/kwork_queue.c +++ b/sched/wqueue/kwork_queue.c @@ -71,7 +71,7 @@ * from the queue, or (2) work_cancel() has been called to cancel the work * and remove it from the work queue. * - * Input parameters: + * Input Parameters: * qid - The work queue ID (index) * work - The work structure to queue * worker - The worker callback to be invoked. The callback will invoked @@ -144,7 +144,7 @@ static void work_qqueue(FAR struct kwork_wqueue_s *wqueue, * previous work as been performed and removed from the queue, then any * pending work will be canceled and lost. * - * Input parameters: + * Input Parameters: * qid - The work queue ID (index) * work - The work structure to queue * worker - The worker callback to be invoked. The callback will invoked diff --git a/sched/wqueue/kwork_signal.c b/sched/wqueue/kwork_signal.c index 2efec2ea45..73ca066a61 100644 --- a/sched/wqueue/kwork_signal.c +++ b/sched/wqueue/kwork_signal.c @@ -61,7 +61,7 @@ * is used internally by the work logic but could also be used by the * user to force an immediate re-assessment of pending work. * - * Input parameters: + * Input Parameters: * qid - The work queue ID * * Returned Value: diff --git a/sched/wqueue/wqueue.h b/sched/wqueue/wqueue.h index 701af9b300..7e7942ef02 100644 --- a/sched/wqueue/wqueue.h +++ b/sched/wqueue/wqueue.h @@ -134,7 +134,7 @@ extern struct lp_wqueue_s g_lpwork; * Description: * Start the high-priority, kernel-mode work queue. * - * Input parameters: + * Input Parameters: * None * * Returned Value: @@ -153,7 +153,7 @@ int work_hpstart(void); * Description: * Start the low-priority, kernel-mode worker thread(s) * - * Input parameters: + * Input Parameters: * None * * Returned Value: @@ -175,7 +175,7 @@ int work_lpstart(void); * part of the internal implementation of each work queue; it should not * be called from application level logic. * - * Input parameters: + * Input Parameters: * wqueue - Describes the work queue to be processed * period - The polling period in clock ticks * wndx - The worker thread index diff --git a/wireless/ieee802154/ieee802154_primitive.c b/wireless/ieee802154/ieee802154_primitive.c index 35db231fcd..4b3e14d594 100644 --- a/wireless/ieee802154/ieee802154_primitive.c +++ b/wireless/ieee802154/ieee802154_primitive.c @@ -135,10 +135,10 @@ static bool g_poolinit = false; * be called early in the initialization sequence before any radios * begin operation. * - * Inputs: + * Input Parameters: * None * - * Return Value: + * Returned Value: * None * ****************************************************************************/ @@ -224,10 +224,10 @@ void ieee802154_primitivepool_initialize(void) * list. If that the list is empty, then the primitive structure will be * allocated from the dynamic memory pool. * - * Inputs: + * Input Parameters: * None * - * Return Value: + * Returned Value: * A reference to the allocated primitive structure. All user fields in this * structure have been zeroed. On a failure to allocate, NULL is * returned. @@ -341,10 +341,10 @@ FAR struct ieee802154_primitive_s *ieee802154_primitive_allocate(void) * structure. If the primitive structure was allocated dynamically it will * be deallocated. * - * Inputs: + * Input Parameters: * prim - primitive structure to free * - * Return Value: + * Returned Value: * None * ****************************************************************************/ diff --git a/wireless/ieee802154/mac802154_device.c b/wireless/ieee802154/mac802154_device.c index 3ab60e4a08..13dcc31a0f 100644 --- a/wireless/ieee802154/mac802154_device.c +++ b/wireless/ieee802154/mac802154_device.c @@ -846,7 +846,7 @@ static int mac802154dev_rxframe(FAR struct mac802154_chardevice_s *dev, * minor - The device minor number. The IEEE802.15.4 MAC character device * will be registered as /dev/ieeeN where N is the minor number * - * Returned Values: + * Returned Value: * Zero (OK) is returned on success. Otherwise a negated errno value is * returned to indicate the nature of the failure. * diff --git a/wireless/ieee802154/mac802154_loopback.c b/wireless/ieee802154/mac802154_loopback.c index 1eabcd1a78..04dbd9139e 100644 --- a/wireless/ieee802154/mac802154_loopback.c +++ b/wireless/ieee802154/mac802154_loopback.c @@ -888,7 +888,7 @@ static int lo_ioctl(FAR struct net_driver_s *dev, int cmd, * Description: * Calculate the MAC header length given the frame meta-data. * - * Input parameters: + * Input Parameters: * netdev - The networkd device that will mediate the MAC interface * meta - Obfuscated metadata structure needed to create the radio * MAC header @@ -911,7 +911,7 @@ static int lo_get_mhrlen(FAR struct radio_driver_s *netdev, * Description: * Requests the transfer of a list of frames to the MAC. * - * Input parameters: + * Input Parameters: * netdev - The networkd device that will mediate the MAC interface * meta - Obfuscated metadata structure needed to create the radio * MAC header @@ -983,7 +983,7 @@ static int lo_req_data(FAR struct radio_driver_s *netdev, * run time. This information is provided to the 6LoWPAN network via the * following structure. * - * Input parameters: + * Input Parameters: * netdev - The network device to be queried * properties - Location where radio properities will be returned. * diff --git a/wireless/ieee802154/mac802154_netdev.c b/wireless/ieee802154/mac802154_netdev.c index aa4abe8ab2..0a11caf017 100644 --- a/wireless/ieee802154/mac802154_netdev.c +++ b/wireless/ieee802154/mac802154_netdev.c @@ -664,7 +664,7 @@ static void macnet_txpoll_expiry(int argc, wdparm_t arg, ...) * Description: * Get the extended address of the PAN coordinator. * - * Input parameters: + * Input Parameters: * radio - Reference to a radio network driver state instance. * eaddr - The location in which to return the extended address. * @@ -701,7 +701,7 @@ static int macnet_coord_eaddr(FAR struct radio_driver_s *radio, * Description: * Get the short address of the PAN coordinator. * - * Input parameters: + * Input Parameters: * radio - Reference to a radio network driver state instance. * saddr - The location in which to return the short address. * @@ -1169,7 +1169,7 @@ static int macnet_ioctl(FAR struct net_driver_s *dev, int cmd, * Description: * Calculate the MAC header length given the frame meta-data. * - * Input parameters: + * Input Parameters: * netdev - The networkd device that will mediate the MAC interface * meta - Obfuscated metadata structure needed to create the radio * MAC header @@ -1198,7 +1198,7 @@ static int macnet_get_mhrlen(FAR struct radio_driver_s *netdev, * Description: * Requests the transfer of a list of frames to the MAC. * - * Input parameters: + * Input Parameters: * netdev - The networkd device that will mediate the MAC interface * meta - Obfuscated metadata structure needed to create the radio * MAC header @@ -1280,7 +1280,7 @@ static int macnet_req_data(FAR struct radio_driver_s *netdev, * run time. This information is provided to the 6LoWPAN network via the * following structure. * - * Input parameters: + * Input Parameters: * netdev - The network device to be queried * properties - Location where radio properities will be returned. * @@ -1357,7 +1357,7 @@ static int macnet_properties(FAR struct radio_driver_s *netdev, * Input Parameters: * mac - Pointer to the mac layer struct to be registered. * - * Returned Values: + * Returned Value: * Zero (OK) is returned on success. Otherwise a negated errno value is * returned to indicate the nature of the failure. * diff --git a/wireless/pktradio/pktradio_loopback.c b/wireless/pktradio/pktradio_loopback.c index c9e144eb4d..71c963126d 100644 --- a/wireless/pktradio/pktradio_loopback.c +++ b/wireless/pktradio/pktradio_loopback.c @@ -848,7 +848,7 @@ static int lo_ioctl(FAR struct net_driver_s *dev, int cmd, * Description: * Calculate the MAC header length given the frame meta-data. * - * Input parameters: + * Input Parameters: * netdev - The networkd device that will mediate the MAC interface * meta - Obfuscated metadata structure needed to create the radio * MAC header @@ -871,7 +871,7 @@ static int lo_get_mhrlen(FAR struct radio_driver_s *netdev, * Description: * Requests the transfer of a list of frames to the MAC. * - * Input parameters: + * Input Parameters: * netdev - The networkd device that will mediate the MAC interface * meta - Obfuscated metadata structure needed to create the radio * MAC header @@ -943,7 +943,7 @@ static int lo_req_data(FAR struct radio_driver_s *netdev, * run time. This information is provided to the 6LoWPAN network via the * following structure. * - * Input parameters: + * Input Parameters: * netdev - The network device to be queried * properties - Location where radio properities will be returned. * diff --git a/wireless/pktradio/pktradio_metadata.c b/wireless/pktradio/pktradio_metadata.c index 585b6bac23..4dce2ec756 100644 --- a/wireless/pktradio/pktradio_metadata.c +++ b/wireless/pktradio/pktradio_metadata.c @@ -86,10 +86,10 @@ static struct pktradio_metadata_s g_metadata_pool[CONFIG_PKTRADIO_NRXMETA]; * be called early in the initialization sequence before any radios * begin operation. * - * Inputs: + * Input Parameters: * None * - * Return Value: + * Returned Value: * None * ****************************************************************************/ @@ -136,10 +136,10 @@ void pktradio_metadata_initialize(void) * list. If that the list is empty, then the meta-data structure will be * allocated from the dynamic memory pool. * - * Inputs: + * Input Parameters: * None * - * Return Value: + * Returned Value: * A reference to the allocated metadata structure. All user fields in this * structure have been zeroed. On a failure to allocate, NULL is * returned. @@ -216,10 +216,10 @@ FAR struct pktradio_metadata_s *pktradio_metadata_allocate(void) * structure. If the metadata structure was allocated dynamically it will * be deallocated. * - * Inputs: + * Input Parameters: * metadata - metadata structure to free * - * Return Value: + * Returned Value: * None * ****************************************************************************/ -- GitLab From 12474d2c384c57cfd5903b72e63e7fb02f8178a3 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 1 Feb 2018 10:25:48 -0600 Subject: [PATCH 155/228] Eliminate new warnings due to unused local variables noted in build testing. --- graphics/vnc/server/vnc_negotiate.c | 1 - graphics/vnc/server/vnc_receiver.c | 4 +--- sched/init/os_bringup.c | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/graphics/vnc/server/vnc_negotiate.c b/graphics/vnc/server/vnc_negotiate.c index f685acb438..d9ee9c42e6 100644 --- a/graphics/vnc/server/vnc_negotiate.c +++ b/graphics/vnc/server/vnc_negotiate.c @@ -115,7 +115,6 @@ int vnc_negotiate(FAR struct vnc_session_s *session) ssize_t nsent; ssize_t nrecvd; size_t len; - int errcode; #ifdef CONFIG_NET_SOCKOPTS struct timeval tv; diff --git a/graphics/vnc/server/vnc_receiver.c b/graphics/vnc/server/vnc_receiver.c index 35633f9d14..34d0757067 100644 --- a/graphics/vnc/server/vnc_receiver.c +++ b/graphics/vnc/server/vnc_receiver.c @@ -92,7 +92,6 @@ int vnc_read_remainder(FAR struct vnc_session_s *session, size_t msglen, { ssize_t nrecvd; size_t ntotal; - int errcode; /* Loop until the rest of the message is recieved. */ @@ -136,7 +135,6 @@ int vnc_receiver(FAR struct vnc_session_s *session) struct timeval tv; #endif ssize_t nrecvd; - int errcode; int ret; DEBUGASSERT(session); @@ -180,7 +178,7 @@ int vnc_receiver(FAR struct vnc_session_s *session) else if (nrecvd == 0) { - gwarn("WARNING: Connection closed\n", errcode); + gwarn("WARNING: Connection closed\n"); return OK; } diff --git a/sched/init/os_bringup.c b/sched/init/os_bringup.c index e5dfddbafa..316809654c 100644 --- a/sched/init/os_bringup.c +++ b/sched/init/os_bringup.c @@ -359,7 +359,7 @@ static inline void os_start_application(void) CONFIG_BOARD_INITTHREAD_STACKSIZE, (main_t)os_start_task, (FAR char * const *)NULL); DEBUGASSERT(pid > 0); - + UNUSED(pid); #else /* Do the board/application initialization on this thread of execution. */ -- GitLab From 1567b8242904b781e3008d4801ef6bd283f7ab89 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 1 Feb 2018 12:03:55 -0600 Subject: [PATCH 156/228] Make sure that labeling is used consistently in all function headers (part 2). --- arch/arm/src/a1x/a1x_boot.c | 2 +- arch/arm/src/a1x/a1x_serial.c | 4 +- arch/arm/src/arm/up_prefetchabort.c | 2 +- arch/arm/src/armv7-a/arm_prefetchabort.c | 2 +- arch/arm/src/armv7-r/arm_prefetchabort.c | 2 +- arch/arm/src/bcm2708/bcm_boot.c | 2 +- arch/arm/src/c5471/c5471_ethernet.c | 24 ++++---- arch/arm/src/efm32/efm32_adc.c | 6 +- arch/arm/src/imx6/imx_boot.c | 4 +- arch/arm/src/lpc11xx/lpc11_serial.c | 2 +- arch/arm/src/lpc17xx/lpc17_serial.c | 6 +- arch/arm/src/lpc2378/lpc23xx_io.c | 3 +- arch/arm/src/sam34/sam_udp.c | 4 +- arch/arm/src/sama5/sam_boot.c | 4 +- arch/arm/src/sama5/sam_udphs.c | 4 +- arch/arm/src/samdl/sam_usb.c | 4 +- arch/arm/src/samv7/sam_usbdevhs.c | 4 +- arch/arm/src/stm32/stm32_adc.c | 20 ++++--- arch/arm/src/stm32/stm32_sdadc.c | 6 +- arch/arm/src/stm32/stm32f33xxx_adc.c | 6 +- arch/arm/src/stm32f7/stm32_adc.c | 6 +- arch/arm/src/stm32l4/stm32l4_adc.c | 3 +- arch/arm/src/stm32l4/stm32l4_dfsdm.c | 3 +- arch/arm/src/str71x/str71x_head.S | 2 +- arch/avr/src/avr/up_switchcontext.S | 2 +- arch/avr/src/avr32/up_fullcontextrestore.S | 2 +- arch/risc-v/src/nr5m100/nr5_allocateheap.c | 2 +- drivers/audio/cs43l22.c | 27 +++++---- drivers/audio/cs43l22.h | 2 +- drivers/audio/wm8904.c | 2 +- drivers/audio/wm8904.h | 2 +- drivers/input/ads7843e.c | 2 +- drivers/power/pm.h | 4 +- drivers/sensors/qencoder.c | 2 +- drivers/sensors/zerocross.c | 2 +- drivers/serial/tcdrain.c | 2 +- drivers/serial/uart_16550.c | 2 +- drivers/spi/spi_bitbang.c | 2 +- drivers/timers/oneshot.c | 2 +- .../wireless/ieee802154/xbee/xbee_netdev.c | 2 +- fs/fat/fs_fat32dirent.c | 56 +++++++++---------- fs/nfs/nfs_util.c | 12 ++-- fs/romfs/fs_romfsutil.c | 32 +++++------ fs/smartfs/smartfs_utils.c | 4 +- graphics/nxbe/nxbe.h | 4 +- graphics/nxbe/nxbe_clipper.c | 4 +- graphics/nxbe/nxbe_redraw.c | 2 +- graphics/nxbe/nxbe_redrawbelow.c | 2 +- graphics/nxbe/nxbe_setposition.c | 2 +- graphics/nxbe/nxbe_setsize.c | 2 +- graphics/nxbe/nxbe_visible.c | 2 +- graphics/nxglib/fb/nxglib_copyrectangle.c | 2 +- graphics/nxglib/fb/nxglib_fillrectangle.c | 2 +- graphics/nxglib/fb/nxglib_filltrapezoid.c | 2 +- graphics/nxglib/fb/nxglib_getrectangle.c | 2 +- graphics/nxglib/fb/nxglib_moverectangle.c | 2 +- graphics/nxglib/fb/nxglib_setpixel.c | 2 +- graphics/nxglib/lcd/nxglib_copyrectangle.c | 2 +- graphics/nxglib/lcd/nxglib_fillrectangle.c | 2 +- graphics/nxglib/lcd/nxglib_filltrapezoid.c | 2 +- graphics/nxglib/lcd/nxglib_getrectangle.c | 2 +- graphics/nxglib/lcd/nxglib_moverectangle.c | 2 +- graphics/nxglib/lcd/nxglib_setpixel.c | 2 +- graphics/nxmu/nxmu_redrawreq.c | 2 +- graphics/nxmu/nxmu_reportposition.c | 2 +- include/nuttx/nx/nxglib.h | 12 ++-- include/nuttx/spi/spi_bitbang.h | 2 +- libc/netdb/lib_gethostbynamer.c | 2 +- libc/queue/dq_addlast.c | 2 +- libc/queue/dq_rem.c | 2 +- libc/stdio/lib_fclose.c | 2 +- libc/termios/lib_cfgetspeed.c | 2 +- libc/termios/lib_cfsetspeed.c | 2 +- libc/termios/lib_tcflow.c | 2 +- libc/termios/lib_tcflush.c | 2 +- libc/termios/lib_tcgetattr.c | 2 +- libc/termios/lib_tcsetattr.c | 2 +- libnx/nxmu/nx_redrawreq.c | 2 +- 78 files changed, 193 insertions(+), 177 deletions(-) diff --git a/arch/arm/src/a1x/a1x_boot.c b/arch/arm/src/a1x/a1x_boot.c index 1dc27fd636..95bfc97aa1 100644 --- a/arch/arm/src/a1x/a1x_boot.c +++ b/arch/arm/src/a1x/a1x_boot.c @@ -124,7 +124,7 @@ static const struct section_mapping_s section_mapping[] = /**************************************************************************** * Name: a1x_setupmappings * - * Description + * Description: * Map all of the initial memory regions defined in section_mapping[] * ****************************************************************************/ diff --git a/arch/arm/src/a1x/a1x_serial.c b/arch/arm/src/a1x/a1x_serial.c index 307dac2d5e..0a91003a28 100644 --- a/arch/arm/src/a1x/a1x_serial.c +++ b/arch/arm/src/a1x/a1x_serial.c @@ -710,7 +710,7 @@ static inline void up_enablebreaks(struct up_dev_s *priv, bool enable) /************************************************************************************ * Name: a1x_uart0config, uart1config, uart2config, ..., uart7config * - * Descrption: + * Description: * Configure the UART * ************************************************************************************/ @@ -886,7 +886,7 @@ static inline void a1x_uart7config(void) /************************************************************************************ * Name: a1x_uartdl * - * Descrption: + * Description: * Select a divider to produce the BAUD from the UART PCLK. * * BAUD = PCLK / (16 * DL), or diff --git a/arch/arm/src/arm/up_prefetchabort.c b/arch/arm/src/arm/up_prefetchabort.c index ab97efd573..7fc02b11df 100644 --- a/arch/arm/src/arm/up_prefetchabort.c +++ b/arch/arm/src/arm/up_prefetchabort.c @@ -69,7 +69,7 @@ /**************************************************************************** * Name: up_prefetchabort * - * Description; + * Description: * This is the prefetch abort exception handler. The ARM prefetch abort * exception occurs when a memory fault is detected during an an * instruction fetch. diff --git a/arch/arm/src/armv7-a/arm_prefetchabort.c b/arch/arm/src/armv7-a/arm_prefetchabort.c index 0bb8cd3793..a10f703287 100644 --- a/arch/arm/src/armv7-a/arm_prefetchabort.c +++ b/arch/arm/src/armv7-a/arm_prefetchabort.c @@ -57,7 +57,7 @@ /**************************************************************************** * Name: arm_prefetchabort * - * Description; + * Description: * This is the prefetch abort exception handler. The ARM prefetch abort * exception occurs when a memory fault is detected during an an * instruction fetch. diff --git a/arch/arm/src/armv7-r/arm_prefetchabort.c b/arch/arm/src/armv7-r/arm_prefetchabort.c index 74713f5ad3..7d5fd7cd86 100644 --- a/arch/arm/src/armv7-r/arm_prefetchabort.c +++ b/arch/arm/src/armv7-r/arm_prefetchabort.c @@ -54,7 +54,7 @@ /**************************************************************************** * Name: arm_prefetchabort * - * Description; + * Description: * This is the prefetch abort exception handler. The ARM prefetch abort * exception occurs when a memory fault is detected during an an * instruction fetch. diff --git a/arch/arm/src/bcm2708/bcm_boot.c b/arch/arm/src/bcm2708/bcm_boot.c index a73dbf5e66..7dbc32cb81 100644 --- a/arch/arm/src/bcm2708/bcm_boot.c +++ b/arch/arm/src/bcm2708/bcm_boot.c @@ -104,7 +104,7 @@ static inline void bcm_set_level1entry(uint32_t paddr, uint32_t vaddr, /**************************************************************************** * Name: bcm_setupmappings * - * Description + * Description: * Map all of the initial memory regions defined in g_section_mapping[] * ****************************************************************************/ diff --git a/arch/arm/src/c5471/c5471_ethernet.c b/arch/arm/src/c5471/c5471_ethernet.c index f38497a37e..b92f2f2094 100644 --- a/arch/arm/src/c5471/c5471_ethernet.c +++ b/arch/arm/src/c5471/c5471_ethernet.c @@ -439,7 +439,7 @@ static void c5471_macassign(struct c5471_driver_s *priv); /**************************************************************************** * Name: c5471_dumpbuffer * - * Description + * Description: * Debug only * ****************************************************************************/ @@ -461,7 +461,7 @@ static inline void c5471_dumpbuffer(const char *msg, const uint8_t *buffer, /**************************************************************************** * Name: c5471_mdtxbit * - * Description + * Description: * A helper routine used when serially communicating with the c547X's * external ethernet transeiver device. GPIO pins are connected to the * transeiver's MDCLK and MDIO pins and are used to accomplish the serial @@ -528,7 +528,7 @@ static void c5471_mdtxbit (int bit_state) /**************************************************************************** * Name: c5471_mdrxbit * - * Description + * Description: * A helper routine used when serially communicating with the c547X's * external ethernet transeiver device. GPIO pins are connected to the * transeiver's MDCLK and MDIO pins and are used to accomplish the serial @@ -589,7 +589,7 @@ static int c5471_mdrxbit (void) /**************************************************************************** * Name: c5471_mdwrite * - * Description + * Description: * A helper routine used when serially communicating with the c547X's * external ethernet transeiver device. GPIO pins are connected to the * transeiver's MDCLK and MDIO pins and are used to accomplish the serial @@ -651,7 +651,7 @@ static void c5471_mdwrite (int adr, int reg, int data) /**************************************************************************** * Name: c5471_mdread * - * Description + * Description: * A helper routine used when serially communicating with the c547X's * external ethernet transeiver device. GPIO pins are connected to the * transeiver's MDCLK and MDIO pins and are used to accomplish the serial @@ -716,7 +716,7 @@ static int c5471_mdread (int adr, int reg) /**************************************************************************** * Name: c5471_phyinit * - * Description + * Description: * The c547X EVM board uses a Lucent LU3X31T-T64 transeiver device to * handle the physical layer (PHY). It's a h/w block that on the one end * offers a Media Independent Interface (MII) which is connected to the @@ -820,7 +820,7 @@ static int c5471_phyinit (void) /**************************************************************************** * Name: c5471_inctxcpu * - * Description + * Description: * ****************************************************************************/ @@ -843,7 +843,7 @@ static inline void c5471_inctxcpu(struct c5471_driver_s *priv) /**************************************************************************** * Name: c5471_incrxcpu * - * Description + * Description: * ****************************************************************************/ @@ -2073,7 +2073,7 @@ static int c5471_rmmac(struct net_driver_s *dev, FAR const uint8_t *mac) /**************************************************************************** * Name: c5471_eimreset * - * Description + * Description: * The C547x docs states that a module should generally be reset according * to the following algorithm: * @@ -2121,7 +2121,7 @@ static void c5471_eimreset (struct c5471_driver_s *priv) /**************************************************************************** * Name: c5471_eimconfig * - * Description + * Description: * Assumes that all registers are currently in the power-up reset state. * This routine then modifies that state to provide our specific ethernet * configuration. @@ -2332,7 +2332,7 @@ static void c5471_eimconfig(struct c5471_driver_s *priv) /**************************************************************************** * Name: c5471_reset * - * Description + * Description: * ****************************************************************************/ @@ -2352,7 +2352,7 @@ static void c5471_reset(struct c5471_driver_s *priv) /**************************************************************************** * Name: c5471_macassign * - * Description + * Description: * Set the mac address of our CPU ether port so that when the SWITCH * receives packets from the PROMISCUOUS ENET0 it will switch them to the * CPU port and cause a packet arrival event on the Switch's CPU TX queue diff --git a/arch/arm/src/efm32/efm32_adc.c b/arch/arm/src/efm32/efm32_adc.c index a1224e2d75..abe463ca37 100644 --- a/arch/arm/src/efm32/efm32_adc.c +++ b/arch/arm/src/efm32/efm32_adc.c @@ -847,9 +847,9 @@ static void adc_hw_reset(struct efm32_dev_s *priv, bool reset) /**************************************************************************** * Name: adc_enable * - * Description : Enables or disables the specified ADC peripheral. - * Also, starts a conversion when the ADC is not - * triggered by timers + * Description: + * Enables or disables the specified ADC peripheral. Also, starts a + * conversion when the ADC is not triggered by timers * * Input Parameters: * diff --git a/arch/arm/src/imx6/imx_boot.c b/arch/arm/src/imx6/imx_boot.c index 6abc6f8b15..f48b3e70a2 100644 --- a/arch/arm/src/imx6/imx_boot.c +++ b/arch/arm/src/imx6/imx_boot.c @@ -91,7 +91,7 @@ extern uint32_t _vector_end; /* End+1 of vector block */ /**************************************************************************** * Name: imx_setupmappings * - * Description + * Description: * Map all of the initial memory regions defined in g_section_mapping[] * ****************************************************************************/ @@ -115,7 +115,7 @@ static inline void imx_setupmappings(void) /**************************************************************************** * Name: imx_remap * - * Description + * Description: * Map all of the final memory regions defined in g_operational_mapping[] * ****************************************************************************/ diff --git a/arch/arm/src/lpc11xx/lpc11_serial.c b/arch/arm/src/lpc11xx/lpc11_serial.c index 941a4475b4..4799e4ed51 100644 --- a/arch/arm/src/lpc11xx/lpc11_serial.c +++ b/arch/arm/src/lpc11xx/lpc11_serial.c @@ -362,7 +362,7 @@ static inline void lpc11_uart0config(void) /************************************************************************************ * Name: lpc11_uartdl * - * Descrption: + * Description: * Select a divider to produce the BAUD from the UART PCLK. * * BAUD = PCLK / (16 * DL), or diff --git a/arch/arm/src/lpc17xx/lpc17_serial.c b/arch/arm/src/lpc17xx/lpc17_serial.c index 9c13a06d4a..f6a7fabbb9 100644 --- a/arch/arm/src/lpc17xx/lpc17_serial.c +++ b/arch/arm/src/lpc17xx/lpc17_serial.c @@ -550,7 +550,7 @@ static inline void up_enablebreaks(struct up_dev_s *priv, bool enable) /************************************************************************************ * Name: lpc17_uartcclkdiv * - * Descrption: + * Description: * Select a CCLK divider to produce the UART PCLK. The stratey is to select the * smallest divisor that results in an solution within range of the 16-bit * DLM and DLL divisor: @@ -667,7 +667,7 @@ static inline uint32_t lpc17_uartcclkdiv(uint32_t baud) /************************************************************************************ * Name: lpc17_uart0config, uart1config, uart2config, and uart3config * - * Descrption: + * Description: * Configure the UART. UART0/1/2/3 peripherals are configured using the following * registers: * @@ -815,7 +815,7 @@ static inline void lpc17_uart3config(void) /************************************************************************************ * Name: lpc17_uartdl * - * Descrption: + * Description: * Select a divider to produce the BAUD from the UART PCLK. * * BAUD = PCLK / (16 * DL), or diff --git a/arch/arm/src/lpc2378/lpc23xx_io.c b/arch/arm/src/lpc2378/lpc23xx_io.c index 94e7f99c54..f871ce17f8 100644 --- a/arch/arm/src/lpc2378/lpc23xx_io.c +++ b/arch/arm/src/lpc2378/lpc23xx_io.c @@ -55,7 +55,8 @@ /**************************************************************************** * Name: IO_Init() * - * Descriptions: Initialize the target board before running the main() + * Description: + * Initialize the target board before running the main() * ****************************************************************************/ diff --git a/arch/arm/src/sam34/sam_udp.c b/arch/arm/src/sam34/sam_udp.c index 908716ebb0..c2edada328 100644 --- a/arch/arm/src/sam34/sam_udp.c +++ b/arch/arm/src/sam34/sam_udp.c @@ -2525,7 +2525,7 @@ static void sam_resume(struct sam_usbdev_s *priv) /**************************************************************************** * Name: sam_ep_reset * - * Description + * Description: * Reset and disable one endpoints. * ****************************************************************************/ @@ -2565,7 +2565,7 @@ static void sam_ep_reset(struct sam_usbdev_s *priv, uint8_t epno) /**************************************************************************** * Name: sam_epset_reset * - * Description + * Description: * Reset and disable a set of endpoints. * ****************************************************************************/ diff --git a/arch/arm/src/sama5/sam_boot.c b/arch/arm/src/sama5/sam_boot.c index 0098100945..609f147608 100644 --- a/arch/arm/src/sama5/sam_boot.c +++ b/arch/arm/src/sama5/sam_boot.c @@ -84,7 +84,7 @@ extern uint32_t _vector_end; /* End+1 of vector block */ /**************************************************************************** * Name: sam_setupmappings * - * Description + * Description: * Map all of the initial memory regions defined in g_section_mapping[] * ****************************************************************************/ @@ -106,7 +106,7 @@ static inline void sam_setupmappings(void) /**************************************************************************** * Name: sam_remap * - * Description + * Description: * Map all of the final memory regions defined in g_operational_mapping[] * ****************************************************************************/ diff --git a/arch/arm/src/sama5/sam_udphs.c b/arch/arm/src/sama5/sam_udphs.c index 090e10b4d8..1c04600e1a 100644 --- a/arch/arm/src/sama5/sam_udphs.c +++ b/arch/arm/src/sama5/sam_udphs.c @@ -3048,7 +3048,7 @@ static void sam_resume(struct sam_usbdev_s *priv) /**************************************************************************** * Name: sam_ep_reset * - * Description + * Description: * Reset and disable a set of endpoints. * ****************************************************************************/ @@ -3090,7 +3090,7 @@ static void sam_ep_reset(struct sam_usbdev_s *priv, uint8_t epno) /**************************************************************************** * Name: sam_epset_reset * - * Description + * Description: * Reset and disable a set of endpoints. * ****************************************************************************/ diff --git a/arch/arm/src/samdl/sam_usb.c b/arch/arm/src/samdl/sam_usb.c index 0252125073..2ed2fa2ff4 100644 --- a/arch/arm/src/samdl/sam_usb.c +++ b/arch/arm/src/samdl/sam_usb.c @@ -3491,7 +3491,7 @@ errout: /**************************************************************************** * Name: sam_ep_reset * - * Description + * Description: * Reset and disable one endpoints. * ****************************************************************************/ @@ -3528,7 +3528,7 @@ static void sam_ep_reset(struct sam_usbdev_s *priv, uint8_t epno) /**************************************************************************** * Name: sam_epset_reset * - * Description + * Description: * Reset and disable a set of endpoints. * ****************************************************************************/ diff --git a/arch/arm/src/samv7/sam_usbdevhs.c b/arch/arm/src/samv7/sam_usbdevhs.c index d27dafd5cc..5959cde64a 100644 --- a/arch/arm/src/samv7/sam_usbdevhs.c +++ b/arch/arm/src/samv7/sam_usbdevhs.c @@ -3319,7 +3319,7 @@ static void sam_resume(struct sam_usbdev_s *priv) /**************************************************************************** * Name: sam_ep_reset * - * Description + * Description: * Reset and disable a set of endpoints. * ****************************************************************************/ @@ -3377,7 +3377,7 @@ static void sam_ep_reset(struct sam_usbdev_s *priv, uint8_t epno) /**************************************************************************** * Name: sam_epset_reset * - * Description + * Description: * Reset and disable a set of endpoints. * ****************************************************************************/ diff --git a/arch/arm/src/stm32/stm32_adc.c b/arch/arm/src/stm32/stm32_adc.c index 89e826f6f0..a1a3d5523c 100644 --- a/arch/arm/src/stm32/stm32_adc.c +++ b/arch/arm/src/stm32/stm32_adc.c @@ -1366,7 +1366,8 @@ static void adc_rccreset(FAR struct stm32_dev_s *priv, bool reset) /**************************************************************************** * Name: adc_power_down_idle * - * Description : Enables or disables power down during the idle phase. + * Description: + * Enables or disables power down during the idle phase. * * Input Parameters: * @@ -1407,7 +1408,8 @@ static void adc_power_down_idle(FAR struct stm32_dev_s *priv, bool pdi_high) /**************************************************************************** * Name: adc_power_down_delay * - * Description : Enables or disables power down during the delay phase. + * Description: + * Enables or disables power down during the delay phase. * * Input Parameters: * @@ -1448,8 +1450,9 @@ static void adc_power_down_delay(FAR struct stm32_dev_s *priv, bool pdd_high) /**************************************************************************** * Name: adc_dels_after_conversion * - * Description : Defines the length of the delay which is applied - * after a conversion or a sequence of conversions. + * Description: + * Defines the length of the delay which is applied after a conversion or + * a sequence of conversions. * * Input Parameters: * @@ -1474,7 +1477,8 @@ static void adc_dels_after_conversion(FAR struct stm32_dev_s *priv, /**************************************************************************** * Name: adc_select_ch_bank * - * Description : Selects the bank of channels to be converted + * Description: + * Selects the bank of channels to be converted * (! Must be modified only when no conversion is on going !) * * Input Parameters: @@ -1507,9 +1511,9 @@ static void adc_select_ch_bank(FAR struct stm32_dev_s *priv, /**************************************************************************** * Name: adc_enable * - * Description : Enables or disables the specified ADC peripheral. - * Also, starts a conversion when the ADC is not - * triggered by timers + * Description: + * Enables or disables the specified ADC peripheral. Also, starts a + * conversion when the ADC is not triggered by timers * * Input Parameters: * diff --git a/arch/arm/src/stm32/stm32_sdadc.c b/arch/arm/src/stm32/stm32_sdadc.c index eaaf486e9d..67e348c81d 100644 --- a/arch/arm/src/stm32/stm32_sdadc.c +++ b/arch/arm/src/stm32/stm32_sdadc.c @@ -629,7 +629,8 @@ static void sdadc_rccreset(FAR struct stm32_dev_s *priv, bool reset) /**************************************************************************** * Name: sdadc_power_down_idle * - * Description : Enables or disables power down during the idle phase. + * Description: + * Enables or disables power down during the idle phase. * * Input Parameters: * priv - A reference to the SDADC block state @@ -670,7 +671,8 @@ static void sdadc_power_down_idle(FAR struct stm32_dev_s *priv, bool pdi_high) /**************************************************************************** * Name: sdadc_enable * - * Description : Enables or disables the specified SDADC peripheral. + * Description: + * Enables or disables the specified SDADC peripheral. * Does not start conversion unless the SDADC is * triggered by timer * diff --git a/arch/arm/src/stm32/stm32f33xxx_adc.c b/arch/arm/src/stm32/stm32f33xxx_adc.c index 412c3453d7..b75641c27a 100644 --- a/arch/arm/src/stm32/stm32f33xxx_adc.c +++ b/arch/arm/src/stm32/stm32f33xxx_adc.c @@ -1350,9 +1350,9 @@ static void adc_rccreset(FAR struct stm32_dev_s *priv, bool reset) /**************************************************************************** * Name: adc_enable * - * Description : Enables or disables the specified ADC peripheral. - * Also, starts a conversion when the ADC is not - * triggered by timers + * Description: + * Enables or disables the specified ADC peripheral. Also, starts a + * conversion when the ADC is not triggered by timers * * Input Parameters: * diff --git a/arch/arm/src/stm32f7/stm32_adc.c b/arch/arm/src/stm32f7/stm32_adc.c index 587983c40a..710209a2bf 100644 --- a/arch/arm/src/stm32f7/stm32_adc.c +++ b/arch/arm/src/stm32f7/stm32_adc.c @@ -1082,9 +1082,9 @@ static void adc_rccreset(FAR struct stm32_dev_s *priv, bool reset) /**************************************************************************** * Name: adc_enable * - * Description : Enables or disables the specified ADC peripheral. - * Also, starts a conversion when the ADC is not - * triggered by timers + * Description: + * Enables or disables the specified ADC peripheral. Also, starts a + * conversion when the ADC is not triggered by timers * * Input Parameters: * diff --git a/arch/arm/src/stm32l4/stm32l4_adc.c b/arch/arm/src/stm32l4/stm32l4_adc.c index 2576ec182e..ada9f4d879 100644 --- a/arch/arm/src/stm32l4/stm32l4_adc.c +++ b/arch/arm/src/stm32l4/stm32l4_adc.c @@ -1145,7 +1145,8 @@ static void adc_rccreset(FAR struct stm32_dev_s *priv, bool reset) /**************************************************************************** * Name: adc_enable * - * Description : Enables the specified ADC peripheral. + * Description: + * Enables the specified ADC peripheral. * * Input Parameters: * priv - A reference to the ADC block status diff --git a/arch/arm/src/stm32l4/stm32l4_dfsdm.c b/arch/arm/src/stm32l4/stm32l4_dfsdm.c index 4e54b77c51..a52ad71df0 100644 --- a/arch/arm/src/stm32l4/stm32l4_dfsdm.c +++ b/arch/arm/src/stm32l4/stm32l4_dfsdm.c @@ -1070,7 +1070,8 @@ static void dfsdm_rccreset(FAR struct stm32_dev_s *priv, bool reset) /**************************************************************************** * Name: dfsdm_enable * - * Description : Enables the DFSDM peripheral. + * Description: + * Enables the DFSDM peripheral. * * Input Parameters: * priv - A reference to the DFSDM block status diff --git a/arch/arm/src/str71x/str71x_head.S b/arch/arm/src/str71x/str71x_head.S index c35715e02d..934fd7fdfd 100644 --- a/arch/arm/src/str71x/str71x_head.S +++ b/arch/arm/src/str71x/str71x_head.S @@ -346,7 +346,7 @@ eicloop: /***************************************************************************** * Name: periphinit * - * Description" + * Description: * Disable all perfipherals (except EIC) * *****************************************************************************/ diff --git a/arch/avr/src/avr/up_switchcontext.S b/arch/avr/src/avr/up_switchcontext.S index c6ab3f8c08..c5613b9814 100644 --- a/arch/avr/src/avr/up_switchcontext.S +++ b/arch/avr/src/avr/up_switchcontext.S @@ -106,7 +106,7 @@ up_switchcontext: /**************************************************************************** * Name: up_fullcontextrestore * - * Descripion: + * Description: * Restore the full-running context of a thread. * * Input Parameters: diff --git a/arch/avr/src/avr32/up_fullcontextrestore.S b/arch/avr/src/avr32/up_fullcontextrestore.S index 8b09109983..45019c424b 100644 --- a/arch/avr/src/avr32/up_fullcontextrestore.S +++ b/arch/avr/src/avr32/up_fullcontextrestore.S @@ -53,7 +53,7 @@ /**************************************************************************** * Name: up_fullcontextrestore * - * Descripion: + * Description: * Restore the full-running contex of a thread. * * NOTE: Thus function must handle one very strange case. That is when diff --git a/arch/risc-v/src/nr5m100/nr5_allocateheap.c b/arch/risc-v/src/nr5m100/nr5_allocateheap.c index 3467cee05c..38fb84c162 100644 --- a/arch/risc-v/src/nr5m100/nr5_allocateheap.c +++ b/arch/risc-v/src/nr5m100/nr5_allocateheap.c @@ -51,7 +51,7 @@ /************************************************************************************ * Name: up_addregion * - * Descripton: + * Description: * RAM may be added in non-contiguous chunks. This routine adds all chunks * that may be used for heap. * diff --git a/drivers/audio/cs43l22.c b/drivers/audio/cs43l22.c index be90d84c56..ad09df65ec 100644 --- a/drivers/audio/cs43l22.c +++ b/drivers/audio/cs43l22.c @@ -209,7 +209,7 @@ static const struct audio_ops_s g_audioops = /**************************************************************************** * Name: cs43l22_readreg * - * Description + * Description: * Read the specified 16-bit register from the CS43L22 device. * ****************************************************************************/ @@ -1206,8 +1206,8 @@ static int cs43l22_start(FAR struct audio_lowerhalf_s *dev) /**************************************************************************** * Name: cs43l22_stop * - * Description: Stop the configured operation (audio streaming, volume - * disabled, etc.). + * Description: + * Stop the configured operation (audio streaming, volume disabled, etc.). * ****************************************************************************/ @@ -1244,7 +1244,8 @@ static int cs43l22_stop(FAR struct audio_lowerhalf_s *dev) /**************************************************************************** * Name: cs43l22_pause * - * Description: Pauses the playback. + * Description: + * Pauses the playback. * ****************************************************************************/ @@ -1273,7 +1274,8 @@ static int cs43l22_pause(FAR struct audio_lowerhalf_s *dev) /**************************************************************************** * Name: cs43l22_resume * - * Description: Resumes the playback. + * Description: + * Resumes the playback. * ****************************************************************************/ @@ -1306,7 +1308,8 @@ static int cs43l22_resume(FAR struct audio_lowerhalf_s *dev) /**************************************************************************** * Name: cs43l22_enqueuebuffer * - * Description: Enqueue an Audio Pipeline Buffer for playback/ processing. + * Description: + * Enqueue an Audio Pipeline Buffer for playback/ processing. * ****************************************************************************/ @@ -1356,7 +1359,8 @@ static int cs43l22_enqueuebuffer(FAR struct audio_lowerhalf_s *dev, /**************************************************************************** * Name: cs43l22_cancelbuffer * - * Description: Called when an enqueued buffer is being cancelled. + * Description: + * Called when an enqueued buffer is being cancelled. * ****************************************************************************/ @@ -1370,7 +1374,8 @@ static int cs43l22_cancelbuffer(FAR struct audio_lowerhalf_s *dev, /**************************************************************************** * Name: cs43l22_ioctl * - * Description: Perform a device ioctl + * Description: + * Perform a device ioctl * ****************************************************************************/ @@ -1424,7 +1429,8 @@ static int cs43l22_ioctl(FAR struct audio_lowerhalf_s *dev, int cmd, /**************************************************************************** * Name: cs43l22_reserve * - * Description: Reserves a session (the only one we have). + * Description: + * Reserves a session (the only one we have). * ****************************************************************************/ @@ -1469,7 +1475,8 @@ static int cs43l22_reserve(FAR struct audio_lowerhalf_s *dev) /**************************************************************************** * Name: cs43l22_release * - * Description: Releases the session (the only one we have). + * Description: + * Releases the session (the only one we have). * ****************************************************************************/ diff --git a/drivers/audio/cs43l22.h b/drivers/audio/cs43l22.h index f2ec078e10..ce83523527 100644 --- a/drivers/audio/cs43l22.h +++ b/drivers/audio/cs43l22.h @@ -374,7 +374,7 @@ extern const uint8_t g_fllratio[CS43L22_NFLLRATIO]; /**************************************************************************** * Name: cs43l22_readreg * - * Description + * Description: * Read the specified 8-bit register from the CS43L22 device. * ****************************************************************************/ diff --git a/drivers/audio/wm8904.c b/drivers/audio/wm8904.c index 50fb2a7045..d917a8ee35 100644 --- a/drivers/audio/wm8904.c +++ b/drivers/audio/wm8904.c @@ -247,7 +247,7 @@ const uint8_t g_fllratio[WM8904_NFLLRATIO] = /**************************************************************************** * Name: wm8904_readreg * - * Description + * Description: * Read the specified 16-bit register from the WM8904 device. * ****************************************************************************/ diff --git a/drivers/audio/wm8904.h b/drivers/audio/wm8904.h index e51d247c5f..0ba1e16c9f 100644 --- a/drivers/audio/wm8904.h +++ b/drivers/audio/wm8904.h @@ -1118,7 +1118,7 @@ extern const uint8_t g_fllratio[WM8904_NFLLRATIO]; /**************************************************************************** * Name: wm8904_readreg * - * Description + * Description: * Read the specified 16-bit register from the WM8904 device. * ****************************************************************************/ diff --git a/drivers/input/ads7843e.c b/drivers/input/ads7843e.c index e62d2c2de3..56f1b6d88d 100644 --- a/drivers/input/ads7843e.c +++ b/drivers/input/ads7843e.c @@ -225,7 +225,7 @@ static void ads7843e_unlock(FAR struct spi_dev_s *spi) /**************************************************************************** * Name: ads7843e_sendcmd * - * Description. + * Description: * The command/data sequences is as follows: * * DCLK diff --git a/drivers/power/pm.h b/drivers/power/pm.h index 472b42a948..03e405910b 100644 --- a/drivers/power/pm.h +++ b/drivers/power/pm.h @@ -76,7 +76,7 @@ /**************************************************************************** * Name: pm_lock * - * Descripton: + * Description: * Lock the power management registry. NOTE: This function may return * an error if a signal is received while what (errno == EINTR). * @@ -87,7 +87,7 @@ /**************************************************************************** * Name: pm_unlock * - * Descripton: + * Description: * Unlock the power management registry. * ****************************************************************************/ diff --git a/drivers/sensors/qencoder.c b/drivers/sensors/qencoder.c index be5879ac25..6649bf0ab3 100644 --- a/drivers/sensors/qencoder.c +++ b/drivers/sensors/qencoder.c @@ -236,7 +236,7 @@ errout: /************************************************************************************ * Name: qe_read * - * Description:O + * Description: * A dummy read method. This is provided only to satsify the VFS layer. * ************************************************************************************/ diff --git a/drivers/sensors/zerocross.c b/drivers/sensors/zerocross.c index 3f01650f17..e2260ec042 100644 --- a/drivers/sensors/zerocross.c +++ b/drivers/sensors/zerocross.c @@ -370,7 +370,7 @@ errout_with_exclsem: /**************************************************************************** * Name: zc_read * - * Description:O + * Description: * A dummy read method. This is provided only to satsify the VFS layer. * ****************************************************************************/ diff --git a/drivers/serial/tcdrain.c b/drivers/serial/tcdrain.c index 1dcdf456bb..5171aedf72 100644 --- a/drivers/serial/tcdrain.c +++ b/drivers/serial/tcdrain.c @@ -55,7 +55,7 @@ /**************************************************************************** * Name: tcdrain * - * Descripton: + * Description: * Function for draining the output buffer of a terminal/serial device * * Input Parameters: diff --git a/drivers/serial/uart_16550.c b/drivers/serial/uart_16550.c index 3ba4a4f056..79918be449 100644 --- a/drivers/serial/uart_16550.c +++ b/drivers/serial/uart_16550.c @@ -518,7 +518,7 @@ static inline void u16550_enablebreaks(FAR struct u16550_s *priv, /**************************************************************************** * Name: u16550_divisor * - * Descrption: + * Description: * Select a divider to produce the BAUD from the UART_CLK. * * BAUD = UART_CLK / (16 * DL), or diff --git a/drivers/spi/spi_bitbang.c b/drivers/spi/spi_bitbang.c index 8c650282bc..06c0a1e81f 100644 --- a/drivers/spi/spi_bitbang.c +++ b/drivers/spi/spi_bitbang.c @@ -528,7 +528,7 @@ static int spi_cmddata(FAR struct spi_dev_s *dev, uint32_t devid, /**************************************************************************** * Name: spi_create_bitbang * - * Descripton: + * Description: * Create an instance of the SPI bit-bang driver. * ****************************************************************************/ diff --git a/drivers/timers/oneshot.c b/drivers/timers/oneshot.c index 404bb2a1d4..8de9a3ef32 100644 --- a/drivers/timers/oneshot.c +++ b/drivers/timers/oneshot.c @@ -179,7 +179,7 @@ static int oneshot_close(FAR struct file *filep) /************************************************************************************ * Name: oneshot_read * - * Description:O + * Description: * A dummy read method. This is provided only to satsify the VFS layer. * ************************************************************************************/ diff --git a/drivers/wireless/ieee802154/xbee/xbee_netdev.c b/drivers/wireless/ieee802154/xbee/xbee_netdev.c index ea7db25986..77e75e1187 100644 --- a/drivers/wireless/ieee802154/xbee/xbee_netdev.c +++ b/drivers/wireless/ieee802154/xbee/xbee_netdev.c @@ -1165,7 +1165,7 @@ static int xbeenet_ioctl(FAR struct net_driver_s *dev, int cmd, /**************************************************************************** * Name: xbeemac_get_mhrlen * - * Description + * Description: * Calculate the MAC header length given the frame meta-data. * * Input Parameters: diff --git a/fs/fat/fs_fat32dirent.c b/fs/fat/fs_fat32dirent.c index bc2f79801f..bd1655aa79 100644 --- a/fs/fat/fs_fat32dirent.c +++ b/fs/fat/fs_fat32dirent.c @@ -182,7 +182,7 @@ static uint8_t fat_lfnchecksum(const uint8_t *sfname) /**************************************************************************** * Name: fat_parsesfname * - * Desciption: Convert a user filename into a properly formatted FAT + * Description: Convert a user filename into a properly formatted FAT * (short 8.3) filename as it would appear in a directory entry. Here are * the rules for the 8+3 short file name in the directory: * @@ -458,7 +458,7 @@ errout: /**************************************************************************** * Name: fat_parselfname * - * Desciption: Convert a user filename into a properly formatted FAT + * Description: Convert a user filename into a properly formatted FAT * long filename as it would appear in a directory entry. Here are * the rules for the long file name in the directory: * @@ -549,7 +549,7 @@ errout: /**************************************************************************** * Name: fat_createalias * - * Desciption: Given a valid long file name, create a short filename alias. + * Description: Given a valid long file name, create a short filename alias. * Here are the rules for creation of the alias: * * 1. All uppercase @@ -761,7 +761,7 @@ static inline int fat_createalias(struct fat_dirinfo_s *dirinfo) /**************************************************************************** * Name: fat_findalias * - * Desciption: Make sure that the short alias for the long file name is + * Description: Make sure that the short alias for the long file name is * unique, ie., that there is no other * * NOTE: This function does not restore the directory entry that was in the @@ -800,7 +800,7 @@ static inline int fat_findalias(struct fat_mountpt_s *fs, /**************************************************************************** * Name: fat_uniquealias * - * Desciption: Make sure that the short alias for the long file name is + * Description: Make sure that the short alias for the long file name is * unique, modifying the alias as necessary to assure uniqueness. * * NOTE: This function does not restore the directory entry that was in the @@ -913,7 +913,7 @@ static inline int fat_uniquealias(struct fat_mountpt_s *fs, /**************************************************************************** * Name: fat_path2dirname * - * Desciption: Convert a user filename into a properly formatted FAT + * Description: Convert a user filename into a properly formatted FAT * (short 8.3) filename as it would appear in a directory entry. * ****************************************************************************/ @@ -951,7 +951,7 @@ static int fat_path2dirname(const char **path, struct fat_dirinfo_s *dirinfo, /**************************************************************************** * Name: fat_findsfnentry * - * Desciption: Find a short file name directory entry. Returns OK if the + * Description: Find a short file name directory entry. Returns OK if the * directory exists; -ENOENT if it does not. * ****************************************************************************/ @@ -1038,7 +1038,7 @@ static int fat_findsfnentry(struct fat_mountpt_s *fs, /**************************************************************************** * Name: fat_cmplfnchunk * - * Desciption: There are 13 characters per LFN entry, broken up into three + * Description: There are 13 characters per LFN entry, broken up into three * chunks for characts 1-5, 6-11, and 12-13. This function will perform * the comparison of a single chunk. * @@ -1102,7 +1102,7 @@ static bool fat_cmplfnchunk(uint8_t *chunk, const uint8_t *substr, int nchunk) /**************************************************************************** * Name: fat_cmplfname * - * Desciption: Given an LFN directory entry, compare a substring of the name + * Description: Given an LFN directory entry, compare a substring of the name * to a portion in the directory entry. * ****************************************************************************/ @@ -1146,7 +1146,7 @@ static bool fat_cmplfname(const uint8_t *direntry, const uint8_t *substr) /**************************************************************************** * Name: fat_findlfnentry * - * Desciption: Find a sequence of long file name directory entries. + * Description: Find a sequence of long file name directory entries. * * NOTE: As a side effect, this function returns with the sector containing * the short file name directory entry in the cache. @@ -1368,7 +1368,7 @@ next_entry: /**************************************************************************** * Name: fat_allocatesfnentry * - * Desciption: Find a free directory entry for a short file name entry. + * Description: Find a free directory entry for a short file name entry. * ****************************************************************************/ @@ -1450,7 +1450,7 @@ static inline int fat_allocatesfnentry(struct fat_mountpt_s *fs, /**************************************************************************** * Name: fat_allocatelfnentry * - * Desciption: Find a sequence of free directory entries for a several long + * Description: Find a sequence of free directory entries for a several long * and one short file name entry. * * On entry, dirinfo.dir refers to the first interesting entry the directory. @@ -1592,7 +1592,7 @@ static inline int fat_allocatelfnentry(struct fat_mountpt_s *fs, /**************************************************************************** * Name: fat_getsfname * - * Desciption: Get the 8.3 filename from a directory entry. On entry, the + * Description: Get the 8.3 filename from a directory entry. On entry, the * short file name entry is already in the cache. * ****************************************************************************/ @@ -1711,7 +1711,7 @@ static inline int fat_getsfname(uint8_t *direntry, char *buffer, /**************************************************************************** * Name: fat_getlfnchunk * - * Desciption: There are 13 characters per LFN entry, broken up into three + * Description: There are 13 characters per LFN entry, broken up into three * chunks for characts 1-5, 6-11, and 12-13. This function will get the * file name characters from one chunk. * @@ -1742,7 +1742,7 @@ static void fat_getlfnchunk(uint8_t *chunk, uint8_t *dest, int nchunk) /**************************************************************************** * Name: fat_getlfname * - * Desciption: Get the long filename from a sequence of directory entries. + * Description: Get the long filename from a sequence of directory entries. * On entry, the "last" long file name entry is in the cache. Returns with * the short file name entry in the cache. * @@ -1903,7 +1903,7 @@ static inline int fat_getlfname(struct fat_mountpt_s *fs, struct fs_dirent_s *di /**************************************************************************** * Name: fat_putsfname * - * Desciption: Write the short directory entry name. + * Description: Write the short directory entry name. * * Assumption: The directory sector is in the cache. * @@ -1928,7 +1928,7 @@ static int fat_putsfname(struct fat_mountpt_s *fs, struct fat_dirinfo_s *dirinfo /**************************************************************************** * Name: fat_initlfname * - * Desciption: There are 13 characters per LFN entry, broken up into three + * Description: There are 13 characters per LFN entry, broken up into three * chunks for characts 1-5, 6-11, and 12-13. This function will put the * 0xffff characters into one chunk. * @@ -1954,7 +1954,7 @@ static void fat_initlfname(uint8_t *chunk, int nchunk) /**************************************************************************** * Name: fat_putlfnchunk * - * Desciption: There are 13 characters per LFN entry, broken up into three + * Description: There are 13 characters per LFN entry, broken up into three * chunks for characts 1-5, 6-11, and 12-13. This function will put the * file name characters into one chunk. * @@ -1986,7 +1986,7 @@ static void fat_putlfnchunk(uint8_t *chunk, const uint8_t *src, int nchunk) /**************************************************************************** * Name: fat_putlfname * - * Desciption: Write the long filename into a sequence of directory entries. + * Description: Write the long filename into a sequence of directory entries. * On entry, the "last" long file name entry is in the cache. Returns with * the short file name entry in the cache. * @@ -2192,7 +2192,7 @@ static int fat_putlfname(struct fat_mountpt_s *fs, /**************************************************************************** * Name: fat_putsfdirentry * - * Desciption: Write a short file name directory entry + * Description: Write a short file name directory entry * * Assumption: The directory sector is in the cache. The caller will write * sector information. @@ -2236,7 +2236,7 @@ static int fat_putsfdirentry(struct fat_mountpt_s *fs, /**************************************************************************** * Name: fat_finddirentry * - * Desciption: Given a path to something that may or may not be in the file + * Description: Given a path to something that may or may not be in the file * system, return the description of the directory entry of the requested * item. * @@ -2407,7 +2407,7 @@ int fat_finddirentry(struct fat_mountpt_s *fs, struct fat_dirinfo_s *dirinfo, /**************************************************************************** * Name: fat_allocatedirentry * - * Desciption: + * Description: * Find (or allocate) all needed directory entries to contain the file name * ****************************************************************************/ @@ -2544,7 +2544,7 @@ int fat_allocatedirentry(struct fat_mountpt_s *fs, /**************************************************************************** * Name: fat_freedirentry * - * Desciption: Free the directory entry. + * Description: Free the directory entry. * * NOTE: As a side effect, this function returns with the sector containing * the deleted short file name directory entry in the cache. @@ -2647,7 +2647,7 @@ int fat_freedirentry(struct fat_mountpt_s *fs, struct fat_dirseq_s *seq) /**************************************************************************** * Name: fat_dirname2path * - * Desciption: Convert a filename in a raw directory entry into a user + * Description: Convert a filename in a raw directory entry into a user * filename. This is essentially the inverse operation of that performed * by fat_path2dirname. See that function for more details. * @@ -2690,7 +2690,7 @@ int fat_dirname2path(struct fat_mountpt_s *fs, struct fs_dirent_s *dir) /**************************************************************************** * Name: fat_dirnamewrite * - * Desciption: Write the (possibly long) directory entry name. This function + * Description: Write the (possibly long) directory entry name. This function * is called only from fat_rename to write the new file name. * * Assumption: The directory sector containing the short file name entry @@ -2731,7 +2731,7 @@ int fat_dirnamewrite(struct fat_mountpt_s *fs, struct fat_dirinfo_s *dirinfo) /**************************************************************************** * Name: fat_dirwrite * - * Desciption: Write a directory entry, possibly with a long file name. + * Description: Write a directory entry, possibly with a long file name. * Called from: * * fat_mkdir() to write the new FAT directory entry. @@ -2777,7 +2777,7 @@ int fat_dirwrite(struct fat_mountpt_s *fs, struct fat_dirinfo_s *dirinfo, /**************************************************************************** * Name: fat_dircreate * - * Desciption: Create a directory entry for a new file + * Description: Create a directory entry for a new file * ****************************************************************************/ @@ -2809,7 +2809,7 @@ int fat_dircreate(struct fat_mountpt_s *fs, struct fat_dirinfo_s *dirinfo) /**************************************************************************** * Name: fat_remove * - * Desciption: Remove a directory or file from the file system. This + * Description: Remove a directory or file from the file system. This * implements both rmdir() and unlink(). * ****************************************************************************/ diff --git a/fs/nfs/nfs_util.c b/fs/nfs/nfs_util.c index 7170970892..c012ef39b5 100644 --- a/fs/nfs/nfs_util.c +++ b/fs/nfs/nfs_util.c @@ -157,7 +157,7 @@ void nfs_semgive(struct nfsmount *nmp) /**************************************************************************** * Name: nfs_checkmount * - * Desciption: Check if the mountpoint is still valid. + * Description: Check if the mountpoint is still valid. * * The caller should hold the mountpoint semaphore * @@ -190,7 +190,7 @@ int nfs_checkmount(struct nfsmount *nmp) /**************************************************************************** * Name: nfs_request * - * Desciption: + * Description: * Perform the NFS request. On successful receipt, it verifies the NFS level of the * returned values. * @@ -255,7 +255,7 @@ tryagain: /**************************************************************************** * Name: nfs_lookup * - * Desciption: + * Description: * Given a directory file handle, and the path to file in the directory, * return the file handle of the path and attributes of both the file and * the directory containing the file. @@ -376,7 +376,7 @@ int nfs_lookup(struct nfsmount *nmp, FAR const char *filename, /**************************************************************************** * Name: nfs_findnode * - * Desciption: + * Description: * Given a path to something that may or may not be in the file system, * return the handle of the directory entry of the requested object. * @@ -483,7 +483,7 @@ int nfs_findnode(struct nfsmount *nmp, FAR const char *relpath, /**************************************************************************** * Name: nfs_finddir * - * Desciption: + * Description: * Given a path to something that may or may not be in the file system, * return the handle of the entry of the directory containing the requested * object. @@ -574,7 +574,7 @@ int nfs_finddir(struct nfsmount *nmp, FAR const char *relpath, /**************************************************************************** * Name: nfs_attrupdate * - * Desciption: + * Description: * Update file attributes on write or after the file is modified. * * Returned Value: diff --git a/fs/romfs/fs_romfsutil.c b/fs/romfs/fs_romfsutil.c index 145f349bc6..b796a3b018 100644 --- a/fs/romfs/fs_romfsutil.c +++ b/fs/romfs/fs_romfsutil.c @@ -64,7 +64,7 @@ /**************************************************************************** * Name: romfs_swap32 * - * Desciption: + * Description: * Convert the 32-bit big endian value to little endian * ****************************************************************************/ @@ -80,7 +80,7 @@ static inline uint32_t romfs_swap32(uint32_t value) /**************************************************************************** * Name: romfs_devread32 * - * Desciption: + * Description: * Read the big-endian 32-bit value from the mount device buffer * * Assumption: @@ -105,7 +105,7 @@ static uint32_t romfs_devread32(struct romfs_mountpt_s *rm, int ndx) /**************************************************************************** * Name: romfs_checkentry * - * Desciption: + * Description: * Check if the entry at offset is a directory or file path segment * ****************************************************************************/ @@ -181,7 +181,7 @@ static inline int romfs_checkentry(struct romfs_mountpt_s *rm, /**************************************************************************** * Name: romfs_devcacheread * - * Desciption: + * Description: * Read the specified sector for specified offset into the sector cache. * Return the index into the sector corresponding to the offset * @@ -234,7 +234,7 @@ int16_t romfs_devcacheread(struct romfs_mountpt_s *rm, uint32_t offset) /**************************************************************************** * Name: romfs_followhardlinks * - * Desciption: + * Description: * Given the offset to a file header, check if the file is a hardlink. * If so, traverse the hard links until the terminal, non-linked header * so found and return that offset. @@ -280,7 +280,7 @@ static int romfs_followhardlinks(struct romfs_mountpt_s *rm, uint32_t offset, /**************************************************************************** * Name: romfs_searchdir * - * Desciption: + * Description: * This is part of the romfs_finddirentry log. Search the directory * beginning at dirinfo->fr_firstoffset for entryname. * @@ -382,7 +382,7 @@ void romfs_semgive(struct romfs_mountpt_s *rm) /**************************************************************************** * Name: romfs_hwread * - * Desciption: Read the specified sector into the sector buffer + * Description: Read the specified sector into the sector buffer * ****************************************************************************/ @@ -432,7 +432,7 @@ int romfs_hwread(struct romfs_mountpt_s *rm, uint8_t *buffer, uint32_t sector, /**************************************************************************** * Name: romfs_filecacheread * - * Desciption: + * Description: * Read the specified sector into the sector cache * ****************************************************************************/ @@ -488,7 +488,7 @@ int romfs_filecacheread(struct romfs_mountpt_s *rm, struct romfs_file_s *rf, /**************************************************************************** * Name: romfs_hwconfigure * - * Desciption: + * Description: * This function is called as part of the ROMFS mount operation It * configures the ROMFS filestem for use on this block driver. This includes * the accounting for the geometry of the device, setting up any XIP modes @@ -561,7 +561,7 @@ int romfs_hwconfigure(struct romfs_mountpt_s *rm) /**************************************************************************** * Name: romfs_fsconfigure * - * Desciption: + * Description: * This function is called as part of the ROMFS mount operation It * sets up the mount structure to include configuration information contained * in the ROMFS header. This is the place where we actually determine if @@ -609,7 +609,7 @@ int romfs_fsconfigure(struct romfs_mountpt_s *rm) /**************************************************************************** * Name: romfs_fileconfigure * - * Desciption: + * Description: * This function is called as part of the ROMFS file open operation It * sets up the file structure to handle buffer appropriately, depending * upon XIP mode or not. @@ -650,7 +650,7 @@ int romfs_fileconfigure(struct romfs_mountpt_s *rm, struct romfs_file_s *rf) /**************************************************************************** * Name: romfs_checkmount * - * Desciption: Check if the mountpoint is still valid. + * Description: Check if the mountpoint is still valid. * * The caller should hold the mountpoint semaphore * @@ -694,7 +694,7 @@ int romfs_checkmount(struct romfs_mountpt_s *rm) /**************************************************************************** * Name: romfs_finddirentry * - * Desciption: + * Description: * Given a path to something that may or may not be in the file system, * return the directory entry of the item. * @@ -793,7 +793,7 @@ int romfs_finddirentry(struct romfs_mountpt_s *rm, /**************************************************************************** * Name: romfs_parsedirentry * - * Desciption: + * Description: * Return the directory entry at this offset. If rf is NULL, then the * mount device resources are used. Otherwise, file resources are used. * @@ -847,7 +847,7 @@ int romfs_parsedirentry(struct romfs_mountpt_s *rm, uint32_t offset, /**************************************************************************** * Name: romfs_parsefilename * - * Desciption: + * Description: * Return the filename from directory entry at this offset * ****************************************************************************/ @@ -914,7 +914,7 @@ int romfs_parsefilename(struct romfs_mountpt_s *rm, uint32_t offset, /**************************************************************************** * Name: romfs_datastart * - * Desciption: + * Description: * Given the offset to a file header, return the offset to the start of * the file data * diff --git a/fs/smartfs/smartfs_utils.c b/fs/smartfs/smartfs_utils.c index 0fcfecfd4e..5071030c41 100644 --- a/fs/smartfs/smartfs_utils.c +++ b/fs/smartfs/smartfs_utils.c @@ -190,7 +190,7 @@ void smartfs_wrle32(uint8_t *dest, uint32_t val) /**************************************************************************** * Name: smartfs_mount * - * Desciption: This function is called only when the mountpoint is first + * Description: This function is called only when the mountpoint is first * established. It initializes the mountpoint structure and verifies * that a valid SMART filesystem is provided by the block driver. * @@ -334,7 +334,7 @@ errout: /**************************************************************************** * Name: smartfs_unmount * - * Desciption: This function is called only when the mountpoint is being + * Description: This function is called only when the mountpoint is being * unbound. If we are serving multiple directories, then we have to * remove ourselves from the mount linked list, and potentially free * the shared buffers. diff --git a/graphics/nxbe/nxbe.h b/graphics/nxbe/nxbe.h index 2f9ce9a3f8..dc9de89a9d 100644 --- a/graphics/nxbe/nxbe.h +++ b/graphics/nxbe/nxbe.h @@ -208,7 +208,7 @@ void nxbe_closewindow(struct nxbe_window_s *wnd); /**************************************************************************** * Name: nxbe_setposition * - * Descripton: + * Description: * This function checks for intersections and redraws the display after * a change in the position of a window. * @@ -220,7 +220,7 @@ void nxbe_setposition(FAR struct nxbe_window_s *wnd, /**************************************************************************** * Name: nxbe_setsize * - * Descripton: + * Description: * This function checks for intersections and redraws the display after * a change in the size of a window. * diff --git a/graphics/nxbe/nxbe_clipper.c b/graphics/nxbe/nxbe_clipper.c index e73ba6c853..bf013f2e15 100644 --- a/graphics/nxbe/nxbe_clipper.c +++ b/graphics/nxbe/nxbe_clipper.c @@ -156,7 +156,7 @@ static inline bool nxbe_poprectangle(struct nxbe_clipstack_s *stack, /**************************************************************************** * Name: nxbe_clipper * - * Descripton: + * Description: * Perform flexible clipping operations. Callbacks are executed for * each oscured and visible portions of the window. * @@ -265,7 +265,7 @@ void nxbe_clipper(FAR struct nxbe_window_s *wnd, /**************************************************************************** * Name: nxbe_clipnull * - * Descripton: + * Description: * The do-nothing clipping callback function * ****************************************************************************/ diff --git a/graphics/nxbe/nxbe_redraw.c b/graphics/nxbe/nxbe_redraw.c index 397a019060..bafd497a25 100644 --- a/graphics/nxbe/nxbe_redraw.c +++ b/graphics/nxbe/nxbe_redraw.c @@ -83,7 +83,7 @@ static void nxbe_clipredraw(FAR struct nxbe_clipops_s *cops, /**************************************************************************** * Name: nxbe_redraw * - * Descripton: + * Description: * Re-draw the visible portions of the rectangular region for the * specified window * diff --git a/graphics/nxbe/nxbe_redrawbelow.c b/graphics/nxbe/nxbe_redrawbelow.c index 9715267048..f51afc1f57 100644 --- a/graphics/nxbe/nxbe_redrawbelow.c +++ b/graphics/nxbe/nxbe_redrawbelow.c @@ -51,7 +51,7 @@ /**************************************************************************** * Name: nxbe_redrawbelow * - * Descripton: + * Description: * Re-draw the visible portions of the rectangular region for all windows * below (and including) the specified window. This function is called * whenever a window is closed, moved, lowered or re-sized in order to diff --git a/graphics/nxbe/nxbe_setposition.c b/graphics/nxbe/nxbe_setposition.c index a40a01ebe7..e5ee663ba4 100644 --- a/graphics/nxbe/nxbe_setposition.c +++ b/graphics/nxbe/nxbe_setposition.c @@ -51,7 +51,7 @@ /**************************************************************************** * Name: nxbe_setposition * - * Descripton: + * Description: * This function checks for intersections and redraws the display after * a change in the position of a window. * diff --git a/graphics/nxbe/nxbe_setsize.c b/graphics/nxbe/nxbe_setsize.c index 3b522d38a4..c7f1064258 100644 --- a/graphics/nxbe/nxbe_setsize.c +++ b/graphics/nxbe/nxbe_setsize.c @@ -51,7 +51,7 @@ /**************************************************************************** * Name: nxbe_setsize * - * Descripton: + * Description: * This function checks for intersections and redraws the display after * a change in the size of a window. * diff --git a/graphics/nxbe/nxbe_visible.c b/graphics/nxbe/nxbe_visible.c index bf22ffa0be..e39eef8512 100644 --- a/graphics/nxbe/nxbe_visible.c +++ b/graphics/nxbe/nxbe_visible.c @@ -81,7 +81,7 @@ static void nxbe_clipvisible(FAR struct nxbe_clipops_s *cops, /**************************************************************************** * Name: nxbe_visible * - * Descripton: + * Description: * Return true if the point, pt, in window wnd is visible. pt is in * absolute screen coordinates * diff --git a/graphics/nxglib/fb/nxglib_copyrectangle.c b/graphics/nxglib/fb/nxglib_copyrectangle.c index 4b7270f1d0..a4e18cefda 100644 --- a/graphics/nxglib/fb/nxglib_copyrectangle.c +++ b/graphics/nxglib/fb/nxglib_copyrectangle.c @@ -53,7 +53,7 @@ /**************************************************************************** * Name: nxgl_copyrectangle_*bpp * - * Descripton: + * Description: * Copy a rectangular bitmap image into the specific position in the * framebuffer memory. * diff --git a/graphics/nxglib/fb/nxglib_fillrectangle.c b/graphics/nxglib/fb/nxglib_fillrectangle.c index 4fec88b60b..16fde377a1 100644 --- a/graphics/nxglib/fb/nxglib_fillrectangle.c +++ b/graphics/nxglib/fb/nxglib_fillrectangle.c @@ -61,7 +61,7 @@ /**************************************************************************** * Name: nxgl_fillrectangle_*bpp * - * Descripton: + * Description: * Fill a rectangle region in the framebuffer memory with a fixed color * ****************************************************************************/ diff --git a/graphics/nxglib/fb/nxglib_filltrapezoid.c b/graphics/nxglib/fb/nxglib_filltrapezoid.c index dcf29faad4..a66dbd6e21 100644 --- a/graphics/nxglib/fb/nxglib_filltrapezoid.c +++ b/graphics/nxglib/fb/nxglib_filltrapezoid.c @@ -63,7 +63,7 @@ /**************************************************************************** * Name: nxglib_filltrapezoid_*bpp * - * Descripton: + * Description: * Fill a trapezoidal region in the framebuffer memory with a fixed color. * Clip the trapezoid to lie within a boundng box. This is useful for * drawing complex shapes that can be broken into a set of trapezoids. diff --git a/graphics/nxglib/fb/nxglib_getrectangle.c b/graphics/nxglib/fb/nxglib_getrectangle.c index 280affae1a..419c36048b 100644 --- a/graphics/nxglib/fb/nxglib_getrectangle.c +++ b/graphics/nxglib/fb/nxglib_getrectangle.c @@ -105,7 +105,7 @@ static inline void nxgl_lowresmemcpy(FAR uint8_t *dline, FAR const uint8_t *slin /**************************************************************************** * Name: nxgl_getrectangle_*bpp * - * Descripton: + * Description: * Fetch a rectangular region from framebuffer memory. The source is * expressed as a rectangle. * diff --git a/graphics/nxglib/fb/nxglib_moverectangle.c b/graphics/nxglib/fb/nxglib_moverectangle.c index a24fc9f6f3..178f6070cc 100644 --- a/graphics/nxglib/fb/nxglib_moverectangle.c +++ b/graphics/nxglib/fb/nxglib_moverectangle.c @@ -105,7 +105,7 @@ static inline void nxgl_lowresmemcpy(FAR uint8_t *dline, FAR const uint8_t *slin /**************************************************************************** * Name: nxgl_moverectangle_*bpp * - * Descripton: + * Description: * Move a rectangular region from location to another in the * framebuffer memory. The source is expressed as a rectangle; the * destination position is expressed as a point corresponding to the diff --git a/graphics/nxglib/fb/nxglib_setpixel.c b/graphics/nxglib/fb/nxglib_setpixel.c index 0cde90ff1a..fd240469fb 100644 --- a/graphics/nxglib/fb/nxglib_setpixel.c +++ b/graphics/nxglib/fb/nxglib_setpixel.c @@ -61,7 +61,7 @@ /**************************************************************************** * Name: nxgl_setpixel_*bpp * - * Descripton: + * Description: * Draw a single pixel in frambuffer memory at the given position and with * the given color. This is equivalent to nxgl_fillrectangle_*bpp() with * a 1x1 rectangle but is more efficient. diff --git a/graphics/nxglib/lcd/nxglib_copyrectangle.c b/graphics/nxglib/lcd/nxglib_copyrectangle.c index a1fc20e870..69b973d7f7 100644 --- a/graphics/nxglib/lcd/nxglib_copyrectangle.c +++ b/graphics/nxglib/lcd/nxglib_copyrectangle.c @@ -55,7 +55,7 @@ /**************************************************************************** * Name: nxgl_copyrectangle_*bpp * - * Descripton: + * Description: * Copy a rectangular bitmap image into the specific position in the * framebuffer memory. * diff --git a/graphics/nxglib/lcd/nxglib_fillrectangle.c b/graphics/nxglib/lcd/nxglib_fillrectangle.c index e3c263bff2..bcef2c1502 100644 --- a/graphics/nxglib/lcd/nxglib_fillrectangle.c +++ b/graphics/nxglib/lcd/nxglib_fillrectangle.c @@ -63,7 +63,7 @@ /**************************************************************************** * Name: nxgl_fillrectangle_*bpp * - * Descripton: + * Description: * Fill a rectangle region in the LCD memory with a fixed color * ****************************************************************************/ diff --git a/graphics/nxglib/lcd/nxglib_filltrapezoid.c b/graphics/nxglib/lcd/nxglib_filltrapezoid.c index 5960384ab1..5da7418b2b 100644 --- a/graphics/nxglib/lcd/nxglib_filltrapezoid.c +++ b/graphics/nxglib/lcd/nxglib_filltrapezoid.c @@ -63,7 +63,7 @@ /**************************************************************************** * Name: nxglib_filltrapezoid_*bpp * - * Descripton: + * Description: * Fill a trapezoidal region in the LCD memory with a fixed color. * Clip the trapezoid to lie within a boundng box. This is useful for * drawing complex shapes that can be broken into a set of trapezoids. diff --git a/graphics/nxglib/lcd/nxglib_getrectangle.c b/graphics/nxglib/lcd/nxglib_getrectangle.c index adf6a90047..129a7dc5ed 100644 --- a/graphics/nxglib/lcd/nxglib_getrectangle.c +++ b/graphics/nxglib/lcd/nxglib_getrectangle.c @@ -53,7 +53,7 @@ /**************************************************************************** * Name: nxgl_moverectangle_*bpp * - * Descripton: + * Description: * Fetch a rectangular region from LCD GRAM memory. The source is * expressed as a rectangle. * diff --git a/graphics/nxglib/lcd/nxglib_moverectangle.c b/graphics/nxglib/lcd/nxglib_moverectangle.c index 85b388963a..1956ff17d3 100644 --- a/graphics/nxglib/lcd/nxglib_moverectangle.c +++ b/graphics/nxglib/lcd/nxglib_moverectangle.c @@ -53,7 +53,7 @@ /**************************************************************************** * Name: nxgl_moverectangle_*bpp * - * Descripton: + * Description: * Move a rectangular region from location to another in the * LCD memory. The source is expressed as a rectangle; the * destination position is expressed as a point corresponding to the diff --git a/graphics/nxglib/lcd/nxglib_setpixel.c b/graphics/nxglib/lcd/nxglib_setpixel.c index cb57d048ab..402d4f64da 100644 --- a/graphics/nxglib/lcd/nxglib_setpixel.c +++ b/graphics/nxglib/lcd/nxglib_setpixel.c @@ -62,7 +62,7 @@ /**************************************************************************** * Name: nxgl_setpixel_*bpp * - * Descripton: + * Description: * Draw a single pixel in LCD memory at the given position and with the * given color. This is equivalent to nxgl_fillrectangle_*bpp() with a 1x1 * rectangle but is more efficient. diff --git a/graphics/nxmu/nxmu_redrawreq.c b/graphics/nxmu/nxmu_redrawreq.c index 325fb1e72b..2214174b3e 100644 --- a/graphics/nxmu/nxmu_redrawreq.c +++ b/graphics/nxmu/nxmu_redrawreq.c @@ -73,7 +73,7 @@ /**************************************************************************** * Name: nxfe_redrawreq * - * Descripton: + * Description: * Request the client that has this window to redraw the rectangular region. * ****************************************************************************/ diff --git a/graphics/nxmu/nxmu_reportposition.c b/graphics/nxmu/nxmu_reportposition.c index 757873ac1e..e6166c49a3 100644 --- a/graphics/nxmu/nxmu_reportposition.c +++ b/graphics/nxmu/nxmu_reportposition.c @@ -73,7 +73,7 @@ /**************************************************************************** * Name: nxfe_reportposition * - * Descripton: + * Description: * Report the new size/position of the window. * ****************************************************************************/ diff --git a/include/nuttx/nx/nxglib.h b/include/nuttx/nx/nxglib.h index 89530cac25..30850049a7 100644 --- a/include/nuttx/nx/nxglib.h +++ b/include/nuttx/nx/nxglib.h @@ -222,7 +222,7 @@ void nxgl_yuv2rgb(uint8_t y, uint8_t u, uint8_t v, /**************************************************************************** * Name: nxgl_setpixel_*bpp * - * Descripton: + * Description: * Draw a single pixel in graphics memory at the given position and * with the given color. This is equivalent to nxgl_fillrectangle_*bpp() * with a 1x1 rectangle but is more efficient. @@ -247,7 +247,7 @@ void nxgl_setpixel_32bpp(FAR NX_PLANEINFOTYPE *pinfo, /**************************************************************************** * Name: nxgl_fillrectangle_*bpp * - * Descripton: + * Description: * Fill a rectangle region in the graphics memory with a fixed color * ****************************************************************************/ @@ -277,7 +277,7 @@ void nxgl_fillrectangle_32bpp(FAR NX_PLANEINFOTYPE *pinfo, /**************************************************************************** * Name: nxgl_getrectangle_*bpp * - * Descripton: + * Description: * Fetch a rectangular region from graphics memory. The source is * expressed as a rectangle. * @@ -308,7 +308,7 @@ void nxgl_getrectangle_32bpp(FAR NX_PLANEINFOTYPE *pinfo, /**************************************************************************** * Name: nxglib_filltrapezoid_*bpp * - * Descripton: + * Description: * Fill a trapezoidal region in the graphics memory with a fixed color. * Clip the trapezoid to lie within a bounding box. This is useful for * drawing complex shapes that can be broken into a set of trapezoids. @@ -347,7 +347,7 @@ void nxgl_filltrapezoid_32bpp(FAR NX_PLANEINFOTYPE *pinfo, /**************************************************************************** * Name: nxgl_moverectangle_*bpp * - * Descripton: + * Description: * Move a rectangular region from location to another in the * framebuffer/LCD memory. The source is expressed as a rectangle; the * destination position is expressed as a point corresponding to the @@ -380,7 +380,7 @@ void nxgl_moverectangle_32bpp(FAR NX_PLANEINFOTYPE *pinfo, /**************************************************************************** * Name: nxgl_copyrectangle_*bpp * - * Descripton: + * Description: * Copy a rectangular bitmap image into the specific position in the * graphics memory. * diff --git a/include/nuttx/spi/spi_bitbang.h b/include/nuttx/spi/spi_bitbang.h index 9f3a010671..228fbd6a50 100644 --- a/include/nuttx/spi/spi_bitbang.h +++ b/include/nuttx/spi/spi_bitbang.h @@ -129,7 +129,7 @@ extern "C" /**************************************************************************** * Name: spi_create_bitbang * - * Descripton: + * Description: * Create an instance of the SPI bit-bang driver. * * Input Parameters: diff --git a/libc/netdb/lib_gethostbynamer.c b/libc/netdb/lib_gethostbynamer.c index d1a2e5fb2d..b66e0994e9 100644 --- a/libc/netdb/lib_gethostbynamer.c +++ b/libc/netdb/lib_gethostbynamer.c @@ -420,7 +420,7 @@ static int lib_find_answer(FAR const char *name, FAR struct hostent *host, /**************************************************************************** * Name: lib_dns_query * - * Descriptions: + * Description: * Combines the operations of dns_bind(), dns_query(), and dns_free() to * obtain the IP address ('ipaddr') associated with the 'hostname' in one * operation. diff --git a/libc/queue/dq_addlast.c b/libc/queue/dq_addlast.c index a18ec9083b..51a423b813 100644 --- a/libc/queue/dq_addlast.c +++ b/libc/queue/dq_addlast.c @@ -46,7 +46,7 @@ /**************************************************************************** * Name: dq_addlast * - * Description + * Description: * dq_addlast adds 'node' to the end of 'queue' * ****************************************************************************/ diff --git a/libc/queue/dq_rem.c b/libc/queue/dq_rem.c index 2c6176ae1d..d53b692234 100644 --- a/libc/queue/dq_rem.c +++ b/libc/queue/dq_rem.c @@ -46,7 +46,7 @@ /**************************************************************************** * Name: dq_rem * - * Descripton: + * Description: * dq_rem removes 'node' from 'queue' * ****************************************************************************/ diff --git a/libc/stdio/lib_fclose.c b/libc/stdio/lib_fclose.c index 374e9f4e53..138cdc14f7 100644 --- a/libc/stdio/lib_fclose.c +++ b/libc/stdio/lib_fclose.c @@ -54,7 +54,7 @@ /**************************************************************************** * Name: fclose * - * Description + * Description: * The fclose() function will flush the stream pointed to by stream * (writing any buffered output data using lib_fflush()) and close the * underlying file descriptor. diff --git a/libc/termios/lib_cfgetspeed.c b/libc/termios/lib_cfgetspeed.c index 1471b23d36..bac31bdd8a 100644 --- a/libc/termios/lib_cfgetspeed.c +++ b/libc/termios/lib_cfgetspeed.c @@ -47,7 +47,7 @@ /**************************************************************************** * Name: cfgetspeed * - * Descripton: + * Description: * The cfgetspeed() function is a non-POSIX function will extract the baud * from the termios structure to which the termiosp argument points. * diff --git a/libc/termios/lib_cfsetspeed.c b/libc/termios/lib_cfsetspeed.c index 0c3e121586..6f742905ab 100644 --- a/libc/termios/lib_cfsetspeed.c +++ b/libc/termios/lib_cfsetspeed.c @@ -44,7 +44,7 @@ /**************************************************************************** * Name: cfsetspeed * - * Descripton: + * Description: * The cfsetspeed() function is a non-POSIX function that sets the baud * stored in the structure pointed to by termiosp to speed. * diff --git a/libc/termios/lib_tcflow.c b/libc/termios/lib_tcflow.c index 1ac7a7a7b4..13f3ec3c88 100644 --- a/libc/termios/lib_tcflow.c +++ b/libc/termios/lib_tcflow.c @@ -53,7 +53,7 @@ /**************************************************************************** * Name: tcflow * - * Descripton: + * Description: * The tcflow() function will suspend or restart transmission or reception * of data on the object referred to by 'fd', depending on the value of * 'action'. diff --git a/libc/termios/lib_tcflush.c b/libc/termios/lib_tcflush.c index 239e3610cf..1189686d13 100644 --- a/libc/termios/lib_tcflush.c +++ b/libc/termios/lib_tcflush.c @@ -53,7 +53,7 @@ /**************************************************************************** * Name: tcflush * - * Descripton: + * Description: * Function for flushing a terminal/serial device * * Input Parameters: diff --git a/libc/termios/lib_tcgetattr.c b/libc/termios/lib_tcgetattr.c index c7e0c2339e..c9354eef70 100644 --- a/libc/termios/lib_tcgetattr.c +++ b/libc/termios/lib_tcgetattr.c @@ -53,7 +53,7 @@ /**************************************************************************** * Name: tcgetattr * - * Descripton: + * Description: * The tcgetattr() function gets the parameters associated with the * terminal referred to by 'fd' and stores them in the termios structure * referenced by 'termiosp'. diff --git a/libc/termios/lib_tcsetattr.c b/libc/termios/lib_tcsetattr.c index 20903e2029..d77d964610 100644 --- a/libc/termios/lib_tcsetattr.c +++ b/libc/termios/lib_tcsetattr.c @@ -53,7 +53,7 @@ /**************************************************************************** * Name: tcsetattr * - * Descripton: + * Description: * The tcsetattr() function sets the parameters associated with the * terminal referred to by the open file descriptor 'fd' from the termios * structure referenced by 'termiop' as follows: diff --git a/libnx/nxmu/nx_redrawreq.c b/libnx/nxmu/nx_redrawreq.c index 520305bf80..d2745a1cc8 100644 --- a/libnx/nxmu/nx_redrawreq.c +++ b/libnx/nxmu/nx_redrawreq.c @@ -54,7 +54,7 @@ /**************************************************************************** * Name: nx_redrawreq * - * Descripton: + * Description: * This will cause a NX re-draw callback to the client that owns the * window. This is not normally called from user code, but may be * used within middle-ware layers when redrawing is needed. -- GitLab From 2683f713ab325303a8f04b78915f7cda7cdd999e Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 1 Feb 2018 12:17:03 -0600 Subject: [PATCH 157/228] Make sure that labeling is used consistently in all function headers (part 3). --- arch/arm/src/armv7-a/gtm.h | 11 ----------- arch/arm/src/efm32/efm32_flash.c | 2 +- arch/arm/src/sama5/sam_tsd.c | 2 +- arch/arm/src/stm32/stm32_ltdc.c | 2 +- arch/arm/src/stm32f7/stm32_ltdc.c | 2 +- arch/sim/src/up_framebuffer.c | 2 +- arch/sim/src/up_touchscreen.c | 2 +- arch/x86/src/i486/up_irq.c | 8 ++++---- arch/x86/src/qemu/qemu_handlers.c | 2 +- arch/xtensa/src/esp32/rom/esp32_gpio.h | 2 +- configs/mikroe-stm32f4/src/stm32_touchscreen.c | 2 +- configs/pic32mx7mmb/src/pic32_touchscreen.c | 2 +- configs/stm32f103-minimum/src/stm32f103_minimum.h | 2 +- configs/stm32f4discovery/src/stm32f4discovery.h | 4 ++-- drivers/bch/bchdev_driver.c | 2 +- drivers/input/ads7843e.c | 2 +- drivers/input/ft5x06.c | 2 +- drivers/input/max11802.c | 2 +- drivers/input/mxt.c | 2 +- drivers/input/tsc2007.c | 2 +- drivers/wireless/cc3000/cc3000.c | 4 ++-- drivers/wireless/cc3000/cc3000_common.c | 2 +- drivers/wireless/spirit/include/spirit_general.h | 11 ----------- drivers/wireless/spirit/lib/spirit_linearfifo.c | 2 +- include/hex2bin.h | 4 ++-- include/nuttx/net/net.h | 2 +- include/nuttx/nx/nx.h | 2 +- libc/hex2bin/lib_fhex2mem.c | 2 +- libc/hex2bin/lib_hex2mem.c | 2 +- libc/wchar/lib_wcsnrtombs.c | 2 +- net/local/local_sockif.c | 15 +-------------- 31 files changed, 35 insertions(+), 70 deletions(-) diff --git a/arch/arm/src/armv7-a/gtm.h b/arch/arm/src/armv7-a/gtm.h index 347085f673..4fa10f3184 100644 --- a/arch/arm/src/armv7-a/gtm.h +++ b/arch/arm/src/armv7-a/gtm.h @@ -111,17 +111,6 @@ extern "C" #define EXTERN extern #endif -/**************************************************************************** - * Name: - * - * Description: - * - * Input Parameters: - * - * Returned Value: - * - ****************************************************************************/ - /* Clocking: * CLK - This is the main clock of the Cortex-A9 processor. All Cortex-A9 * processors in the Cortex-A9 MPCore processor and the SCU are clocked diff --git a/arch/arm/src/efm32/efm32_flash.c b/arch/arm/src/efm32/efm32_flash.c index 1353bbbdb1..d02f9d2fa5 100644 --- a/arch/arm/src/efm32/efm32_flash.c +++ b/arch/arm/src/efm32/efm32_flash.c @@ -258,7 +258,7 @@ int __ramfunc__ msc_load_verify_address(uint32_t *address) } /**************************************************************************** - * Name:msc_load_data + * Name: msc_load_data * * Description: * Perform data phase of FLASH write cycle. diff --git a/arch/arm/src/sama5/sam_tsd.c b/arch/arm/src/sama5/sam_tsd.c index 875091a878..15c96f7f8a 100644 --- a/arch/arm/src/sama5/sam_tsd.c +++ b/arch/arm/src/sama5/sam_tsd.c @@ -1034,7 +1034,7 @@ errout: } /**************************************************************************** - * Name:sam_tsd_ioctl + * Name: sam_tsd_ioctl ****************************************************************************/ static int sam_tsd_ioctl(struct file *filep, int cmd, unsigned long arg) diff --git a/arch/arm/src/stm32/stm32_ltdc.c b/arch/arm/src/stm32/stm32_ltdc.c index 25644116de..9c798d1ab5 100644 --- a/arch/arm/src/stm32/stm32_ltdc.c +++ b/arch/arm/src/stm32/stm32_ltdc.c @@ -1949,7 +1949,7 @@ static void stm32_ltdc_lenable(FAR struct stm32_layer_s *layer) } /**************************************************************************** - * Name stm32_ltdc_lclear + * Name: stm32_ltdc_lclear * * Description: * Clear the whole layer diff --git a/arch/arm/src/stm32f7/stm32_ltdc.c b/arch/arm/src/stm32f7/stm32_ltdc.c index c84b766fa2..185a6ade19 100644 --- a/arch/arm/src/stm32f7/stm32_ltdc.c +++ b/arch/arm/src/stm32f7/stm32_ltdc.c @@ -1959,7 +1959,7 @@ static void stm32_ltdc_lenable(FAR struct stm32_layer_s *layer) } /**************************************************************************** - * Name stm32_ltdc_lclear + * Name: stm32_ltdc_lclear * * Description: * Clear the whole layer diff --git a/arch/sim/src/up_framebuffer.c b/arch/sim/src/up_framebuffer.c index 8e374a2781..8178c3994d 100644 --- a/arch/sim/src/up_framebuffer.c +++ b/arch/sim/src/up_framebuffer.c @@ -308,7 +308,7 @@ static int up_getcursor(FAR struct fb_vtable_s *vtable, #endif /**************************************************************************** - * Name: + * Name: up_setcursor ****************************************************************************/ #ifdef CONFIG_FB_HWCURSOR diff --git a/arch/sim/src/up_touchscreen.c b/arch/sim/src/up_touchscreen.c index 49e0954b5c..7e5d4a255d 100644 --- a/arch/sim/src/up_touchscreen.c +++ b/arch/sim/src/up_touchscreen.c @@ -486,7 +486,7 @@ errout: } /**************************************************************************** - * Name:up_ioctl + * Name: up_ioctl ****************************************************************************/ static int up_ioctl(FAR struct file *filep, int cmd, unsigned long arg) diff --git a/arch/x86/src/i486/up_irq.c b/arch/x86/src/i486/up_irq.c index b216a24a71..8689769ead 100644 --- a/arch/x86/src/i486/up_irq.c +++ b/arch/x86/src/i486/up_irq.c @@ -81,7 +81,7 @@ static struct idt_entry_s idt_entries[256]; ****************************************************************************/ /**************************************************************************** - * Name idt_outb + * Name: idt_outb * * Description: * A slightly slower version of outb @@ -94,7 +94,7 @@ static void idt_outb(uint8_t val, uint16_t addr) } /**************************************************************************** - * Name up_remappic + * Name: up_remappic * * Description: * Remap the PIC. The Programmable Interrupt Controller (PIC) is used to @@ -142,7 +142,7 @@ static void up_remappic(void) } /**************************************************************************** - * Name up_idtentry + * Name: up_idtentry * * Description: * Initialize one IDT entry. @@ -168,7 +168,7 @@ static void up_idtentry(unsigned int index, uint32_t base, uint16_t sel, } /**************************************************************************** - * Name up_idtinit + * Name: up_idtinit * * Description: * Initialize the IDT. The Interrupt Descriptor Table (IDT) is a data diff --git a/arch/x86/src/qemu/qemu_handlers.c b/arch/x86/src/qemu/qemu_handlers.c index 0f84efb313..610e4b2ee8 100644 --- a/arch/x86/src/qemu/qemu_handlers.c +++ b/arch/x86/src/qemu/qemu_handlers.c @@ -65,7 +65,7 @@ static void idt_outb(uint8_t val, uint16_t addr) noinline_function; ****************************************************************************/ /**************************************************************************** - * Name idt_outb + * Name: idt_outb * * Description: * A slightly slower version of outb diff --git a/arch/xtensa/src/esp32/rom/esp32_gpio.h b/arch/xtensa/src/esp32/rom/esp32_gpio.h index c29d21ee46..38eae27c80 100644 --- a/arch/xtensa/src/esp32/rom/esp32_gpio.h +++ b/arch/xtensa/src/esp32/rom/esp32_gpio.h @@ -329,7 +329,7 @@ void gpio_matrix_out(uint32_t gpio, uint32_t signal_idx, bool out_inv, bool oen_inv); /**************************************************************************** - * Name: + * Name: gpio_pad_select_gpio * * Description: * Select pad as a gpio function from IOMUX. diff --git a/configs/mikroe-stm32f4/src/stm32_touchscreen.c b/configs/mikroe-stm32f4/src/stm32_touchscreen.c index efdb46d9a2..7273285db9 100644 --- a/configs/mikroe-stm32f4/src/stm32_touchscreen.c +++ b/configs/mikroe-stm32f4/src/stm32_touchscreen.c @@ -1328,7 +1328,7 @@ errout: } /**************************************************************************** - * Name:tc_ioctl + * Name: tc_ioctl ****************************************************************************/ static int tc_ioctl(FAR struct file *filep, int cmd, unsigned long arg) diff --git a/configs/pic32mx7mmb/src/pic32_touchscreen.c b/configs/pic32mx7mmb/src/pic32_touchscreen.c index 3974d6a358..82e1a91b37 100644 --- a/configs/pic32mx7mmb/src/pic32_touchscreen.c +++ b/configs/pic32mx7mmb/src/pic32_touchscreen.c @@ -1197,7 +1197,7 @@ errout: } /**************************************************************************** - * Name:tc_ioctl + * Name: tc_ioctl ****************************************************************************/ static int tc_ioctl(FAR struct file *filep, int cmd, unsigned long arg) diff --git a/configs/stm32f103-minimum/src/stm32f103_minimum.h b/configs/stm32f103-minimum/src/stm32f103_minimum.h index 18b6a5e41b..8ccae09f3d 100644 --- a/configs/stm32f103-minimum/src/stm32f103_minimum.h +++ b/configs/stm32f103-minimum/src/stm32f103_minimum.h @@ -331,7 +331,7 @@ int stm32_qencoder_initialize(FAR const char *devpath, int timer); #endif /**************************************************************************** - * Name stm32_rgbled_setup + * Name: stm32_rgbled_setup * * Description: * This function is called by board initialization logic to configure the diff --git a/configs/stm32f4discovery/src/stm32f4discovery.h b/configs/stm32f4discovery/src/stm32f4discovery.h index 7a711fc3f1..fb1ee6b81f 100644 --- a/configs/stm32f4discovery/src/stm32f4discovery.h +++ b/configs/stm32f4discovery/src/stm32f4discovery.h @@ -720,7 +720,7 @@ int stm32_pca9635_initialize(void); #endif /**************************************************************************** - * Name stm32_rgbled_setup + * Name: stm32_rgbled_setup * * Description: * This function is called by board initialization logic to configure the @@ -761,7 +761,7 @@ int stm32_timer_driver_setup(FAR const char *devpath, int timer); #endif /**************************************************************************** - * Name xen1210_archinitialize + * Name: xen1210_archinitialize * * Description: * This function is called by board initialization logic to configure the diff --git a/drivers/bch/bchdev_driver.c b/drivers/bch/bchdev_driver.c index 84fbc81034..f9b8181e6c 100644 --- a/drivers/bch/bchdev_driver.c +++ b/drivers/bch/bchdev_driver.c @@ -314,7 +314,7 @@ static ssize_t bch_read(FAR struct file *filep, FAR char *buffer, size_t len) } /**************************************************************************** - * Name:bch_write + * Name: bch_write ****************************************************************************/ static ssize_t bch_write(FAR struct file *filep, FAR const char *buffer, size_t len) diff --git a/drivers/input/ads7843e.c b/drivers/input/ads7843e.c index 56f1b6d88d..225d33e765 100644 --- a/drivers/input/ads7843e.c +++ b/drivers/input/ads7843e.c @@ -975,7 +975,7 @@ errout: } /**************************************************************************** - * Name:ads7843e_ioctl + * Name: ads7843e_ioctl ****************************************************************************/ static int ads7843e_ioctl(FAR struct file *filep, int cmd, unsigned long arg) diff --git a/drivers/input/ft5x06.c b/drivers/input/ft5x06.c index de23742fba..0afc495662 100644 --- a/drivers/input/ft5x06.c +++ b/drivers/input/ft5x06.c @@ -977,7 +977,7 @@ errout: } /**************************************************************************** - * Name:ft5x06_ioctl + * Name: ft5x06_ioctl ****************************************************************************/ static int ft5x06_ioctl(FAR struct file *filep, int cmd, unsigned long arg) diff --git a/drivers/input/max11802.c b/drivers/input/max11802.c index 52ba527ed8..435ea30d21 100644 --- a/drivers/input/max11802.c +++ b/drivers/input/max11802.c @@ -981,7 +981,7 @@ errout: } /**************************************************************************** - * Name:max11802_ioctl + * Name: max11802_ioctl ****************************************************************************/ static int max11802_ioctl(FAR struct file *filep, int cmd, unsigned long arg) diff --git a/drivers/input/mxt.c b/drivers/input/mxt.c index af0f3bff98..37a6467ffa 100644 --- a/drivers/input/mxt.c +++ b/drivers/input/mxt.c @@ -1499,7 +1499,7 @@ errout: } /**************************************************************************** - * Name:mxt_ioctl + * Name: mxt_ioctl ****************************************************************************/ static int mxt_ioctl(FAR struct file *filep, int cmd, unsigned long arg) diff --git a/drivers/input/tsc2007.c b/drivers/input/tsc2007.c index 65c57304b0..fdaec44112 100644 --- a/drivers/input/tsc2007.c +++ b/drivers/input/tsc2007.c @@ -1029,7 +1029,7 @@ errout: } /**************************************************************************** - * Name:tsc2007_ioctl + * Name: tsc2007_ioctl ****************************************************************************/ static int tsc2007_ioctl(FAR struct file *filep, int cmd, unsigned long arg) diff --git a/drivers/wireless/cc3000/cc3000.c b/drivers/wireless/cc3000/cc3000.c index 447d19f337..b04a8afa14 100644 --- a/drivers/wireless/cc3000/cc3000.c +++ b/drivers/wireless/cc3000/cc3000.c @@ -1189,7 +1189,7 @@ errout_without_sem: } /**************************************************************************** - * Name:cc3000_write + * Name: cc3000_write * * Bit of non standard buffer management ahead * The buffer is memory allocated in the user space with space for the spi @@ -1306,7 +1306,7 @@ errout_without_sem: } /**************************************************************************** - * Name:cc3000_ioctl + * Name: cc3000_ioctl ****************************************************************************/ static int cc3000_ioctl(FAR struct file *filep, int cmd, unsigned long arg) diff --git a/drivers/wireless/cc3000/cc3000_common.c b/drivers/wireless/cc3000/cc3000_common.c index acbb1c4ea6..bf8a8da8cd 100644 --- a/drivers/wireless/cc3000/cc3000_common.c +++ b/drivers/wireless/cc3000/cc3000_common.c @@ -40,7 +40,7 @@ #include /**************************************************************************** - * Name:__error__ + * Name: __error__ * * Description: * Stub function for ASSERT macro diff --git a/drivers/wireless/spirit/include/spirit_general.h b/drivers/wireless/spirit/include/spirit_general.h index aa0b7f4c6d..942a66b982 100644 --- a/drivers/wireless/spirit/include/spirit_general.h +++ b/drivers/wireless/spirit/include/spirit_general.h @@ -123,15 +123,4 @@ enum spirit_version_e * Public Function Prototypes ******************************************************************************/ -/****************************************************************************** - * Name: - * - * Description: - * - * Input Parameters: - * - * Returned Value: - * - ******************************************************************************/ - #endif /* __DRIVERS_WIRELESS_SPIRIT_INCLUDE_SPIRIT_GENERAL_H */ diff --git a/drivers/wireless/spirit/lib/spirit_linearfifo.c b/drivers/wireless/spirit/lib/spirit_linearfifo.c index 3e22358412..452d8ed373 100644 --- a/drivers/wireless/spirit/lib/spirit_linearfifo.c +++ b/drivers/wireless/spirit/lib/spirit_linearfifo.c @@ -102,7 +102,7 @@ uint8_t spirit_fifo_get_txcount(FAR struct spirit_library_s *spirit) } /****************************************************************************** - * Name: + * Name: spirit_fifo_set_rxalmostfull * * Description: * Sets the almost full threshold for the Rx FIFO. When the number of diff --git a/include/hex2bin.h b/include/hex2bin.h index 3ee8e42dd4..b1dc9ff8a4 100644 --- a/include/hex2bin.h +++ b/include/hex2bin.h @@ -146,7 +146,7 @@ int hex2bin(FAR struct lib_instream_s *instream, uint32_t endpaddr, enum hex2bin_swap_e swap); /**************************************************************************** - * Name hex2mem + * Name: hex2mem * * Description: * Read the Intel HEX ASCII data provided on the file descriptor 'fd' and @@ -173,7 +173,7 @@ int hex2mem(int fd, uint32_t baseaddr, uint32_t endpaddr, enum hex2bin_swap_e swap); /**************************************************************************** - * Name fhex2mem + * Name: fhex2mem * * Description: * Read the Intel HEX ASCII data provided on the standard stream diff --git a/include/nuttx/net/net.h b/include/nuttx/net/net.h index c24b4245e1..0ca30d9aab 100644 --- a/include/nuttx/net/net.h +++ b/include/nuttx/net/net.h @@ -393,7 +393,7 @@ void net_setipid(uint16_t id); int net_checksd(int fd, int oflags); /**************************************************************************** - * Name: + * Name: net_initlist * * Description: * Initialize a list of sockets for a new task diff --git a/include/nuttx/nx/nx.h b/include/nuttx/nx/nx.h index 4287497017..209de4fe06 100644 --- a/include/nuttx/nx/nx.h +++ b/include/nuttx/nx/nx.h @@ -295,7 +295,7 @@ int nx_runinstance(FAR const char *mqname, FAR NX_DRIVERTYPE *dev); int nx_start(void); /**************************************************************************** - * Name:nx_connectinstance (and nx_connect macro) + * Name: nx_connectinstance (and nx_connect macro) * * Description: * Open a connection from a client to the NX server. One one client diff --git a/libc/hex2bin/lib_fhex2mem.c b/libc/hex2bin/lib_fhex2mem.c index b6bc91aa9f..13b344adf9 100644 --- a/libc/hex2bin/lib_fhex2mem.c +++ b/libc/hex2bin/lib_fhex2mem.c @@ -52,7 +52,7 @@ ****************************************************************************/ /**************************************************************************** - * Name fhex2mem + * Name: fhex2mem * * Description: * Read the Intel HEX ASCII data provided on the standard stream diff --git a/libc/hex2bin/lib_hex2mem.c b/libc/hex2bin/lib_hex2mem.c index 24b25b011d..fa21e59124 100644 --- a/libc/hex2bin/lib_hex2mem.c +++ b/libc/hex2bin/lib_hex2mem.c @@ -52,7 +52,7 @@ ****************************************************************************/ /**************************************************************************** - * Name hex2mem + * Name: hex2mem * * Description: * Read the Intel HEX ASCII data provided on the file descriptor 'fd' and diff --git a/libc/wchar/lib_wcsnrtombs.c b/libc/wchar/lib_wcsnrtombs.c index a77cdc685f..c59975ace6 100644 --- a/libc/wchar/lib_wcsnrtombs.c +++ b/libc/wchar/lib_wcsnrtombs.c @@ -51,7 +51,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: + * Name: wcsnrtombs * * Description: * The 'wcsrtombs' function converts a string of wide characters diff --git a/net/local/local_sockif.c b/net/local/local_sockif.c index 60d0b6cb9b..9413244bc5 100644 --- a/net/local/local_sockif.c +++ b/net/local/local_sockif.c @@ -530,7 +530,7 @@ static int local_connect(FAR struct socket *psock, } /**************************************************************************** - * Name: pkt_accept + * Name: local_accept * * Description: * The pkt_accept function is used with connection-based socket types @@ -799,17 +799,4 @@ static int local_close(FAR struct socket *psock) * Public Functions ****************************************************************************/ -/**************************************************************************** - * Name: - * - * Description: - * - * Parameters: - * - * Returned Value: - * - * Assumptions: - * - ****************************************************************************/ - #endif /* CONFIG_NET_LOCAL */ -- GitLab From fad70bf90ea7bc70b0a717d70cb2d3e1a003adca Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 3 Feb 2018 09:35:46 -0600 Subject: [PATCH 158/228] Update some comments --- TODO | 8 +++++--- drivers/sensors/bmp180.c | 2 +- sched/irq/irq_procfs.c | 27 ++++++++++++++++++++------- sched/sched/sched_sporadic.c | 4 ++-- 4 files changed, 28 insertions(+), 13 deletions(-) diff --git a/TODO b/TODO index 583177e4a7..7801c545aa 100644 --- a/TODO +++ b/TODO @@ -173,9 +173,11 @@ o Task/Scheduler (sched/) NOTE: glibc behaves this way unless __thread is defined then, in that case, it behaves like NuttX (using TLS to save the thread local errno). - Status: Closed. The existing solution is better (although its - incompatibilities could show up in porting some code). - Priority: Low + Status: Closed. The existing solution is better and compatible with + thread-aware GLIBC (although its incompatibilities could show + up in porting some code). I will retain this issue for + referencei only. + Priority: N/A Title: SCALABILITY Description: Task control information is retained in simple lists. This diff --git a/drivers/sensors/bmp180.c b/drivers/sensors/bmp180.c index d18d14e9ab..5b4ae52645 100644 --- a/drivers/sensors/bmp180.c +++ b/drivers/sensors/bmp180.c @@ -318,7 +318,7 @@ static int bmp180_checkid(FAR struct bmp180_dev_s *priv) devid = bmp180_getreg8(priv, BMP180_DEVID); sninfo("devid: 0x%02x\n", devid); - if (devid != (uint16_t) DEVID) + if (devid != (uint16_t)DEVID) { /* ID is not Correct */ diff --git a/sched/irq/irq_procfs.c b/sched/irq/irq_procfs.c index bbfb76df17..1c20b0e4aa 100644 --- a/sched/irq/irq_procfs.c +++ b/sched/irq/irq_procfs.c @@ -181,7 +181,23 @@ static int irq_callback(int irq, FAR struct irq_info_s *info, #endif leave_critical_section(flags); - /* Don't bother if count == 0 */ + /* Don't bother if count == 0. + * + * REVISIT: There is a logic problem with skipping if the count is zero. + * Normally this is a good thing because it makes the output concise. + * However, it can be a problem under certain conditions: + * + * It may take multiple passes through the IRQ table to enumerate the + * interrupts if the number of interrupts reported is large or if the size + * of the user buffer is small. If a count is zero it will be skipped on + * the first time through but if it becomes non-zero on the second time + * through, the output will be corrupted. Similarly if the count is non- + * zero the first time through and zero the second. + * + * A proper fix would require keep better track of where we left off + * between passes. Current that position is remembered only by the + * byte offset into the pseudo-file, f_pos. + */ if (copy.count == 0) { @@ -210,7 +226,7 @@ static int irq_callback(int irq, FAR struct irq_info_s *info, } else { - uint64_t intcount = (uint64_t)intpart * elapsed / TICK_PER_SEC; + uint64_t intcount = ((uint64_t)intpart * elapsed) / TICK_PER_SEC; fracpart = (unsigned int) (((copy.count - intcount) * TICK_PER_SEC * 1000) / elapsed); } @@ -225,7 +241,6 @@ static int irq_callback(int irq, FAR struct irq_info_s *info, { count = (unsigned long)copy.count; } - #else # error Missing logic #endif @@ -270,10 +285,8 @@ static int irq_open(FAR struct file *filep, FAR const char *relpath, finfo("Open '%s'\n", relpath); - /* PROCFS is read-only. Any attempt to open with any kind of write - * access is not permitted. - * - * REVISIT: Write-able proc files could be quite useful. + /* This PROCFS file is read-only. Any attempt to open with write access + * is not permitted. */ if ((oflags & O_WRONLY) != 0 || (oflags & O_RDONLY) == 0) diff --git a/sched/sched/sched_sporadic.c b/sched/sched/sched_sporadic.c index 83349097ed..8b55a3fce0 100644 --- a/sched/sched/sched_sporadic.c +++ b/sched/sched/sched_sporadic.c @@ -140,8 +140,8 @@ static int sporadic_set_lowpriority(FAR struct tcb_s *tcb) * * In order to do this we would need to know the highest priority from * among all tasks waiting for the all semaphores held by the sporadic - * task. Perhaps that information could be retained by the priority - * inheritance logic for use here? + * task. That information could be retained by the priority inheritance + * logic of sem_holder.c for use here. */ if (tcb->sched_priority > tcb->base_priority) -- GitLab From 97937d3d47209d1866ef785fad2c2eb06563fa3d Mon Sep 17 00:00:00 2001 From: Alan Carvalho de Assis Date: Sun, 4 Feb 2018 07:34:31 -0600 Subject: [PATCH 159/228] configs/stm32f103-minimum: Add support to BMP180 on BluePill (stm32f103-minimum) board. --- audio/audio.c | 2 +- configs/stm32f103-minimum/src/Makefile | 4 + configs/stm32f103-minimum/src/stm32_bmp180.c | 105 ++++++++++++++++++ configs/stm32f103-minimum/src/stm32_bringup.c | 9 ++ .../stm32f103-minimum/src/stm32f103_minimum.h | 13 +++ crypto/aes.c | 2 +- 6 files changed, 133 insertions(+), 2 deletions(-) create mode 100644 configs/stm32f103-minimum/src/stm32_bmp180.c diff --git a/audio/audio.c b/audio/audio.c index 6149eb592b..1dde458efd 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -233,9 +233,9 @@ static int audio_close(FAR struct file *filep) lower->ops->shutdown(lower); } + ret = OK; -//errout_with_sem: nxsem_post(&upper->exclsem); errout: diff --git a/configs/stm32f103-minimum/src/Makefile b/configs/stm32f103-minimum/src/Makefile index d2a4afcfbe..90105c8668 100644 --- a/configs/stm32f103-minimum/src/Makefile +++ b/configs/stm32f103-minimum/src/Makefile @@ -69,6 +69,10 @@ ifeq ($(CONFIG_LEDS_APA102),y) CSRCS += stm32_apa102.c endif +ifeq ($(CONFIG_SENSORS_BMP180),y) + CSRCS += stm32_bmp180.c +endif + ifeq ($(CONFIG_LM75_I2C),y) CSRCS += stm32_lm75.c endif diff --git a/configs/stm32f103-minimum/src/stm32_bmp180.c b/configs/stm32f103-minimum/src/stm32_bmp180.c new file mode 100644 index 0000000000..fc5e9964e7 --- /dev/null +++ b/configs/stm32f103-minimum/src/stm32_bmp180.c @@ -0,0 +1,105 @@ +/************************************************************************************ + * configs/stm32f103-minimum/src/stm32_bmp180.c + * + * Copyright (C) 2018 Alan Carvalho de Assis. All rights reserved. + * Author: Alan Carvalho de Assis + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ************************************************************************************/ + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +#include +#include + +#include +#include + +#include "stm32.h" +#include "stm32_i2c.h" +#include "stm32f103_minimum.h" + +#if defined(CONFIG_I2C) && defined(CONFIG_SENSORS_BMP180) + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +#define MPL115A_I2C_PORTNO 1 /* On I2C1 */ + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +/************************************************************************************ + * Name: stm32_bmp180initialize + * + * Description: + * Initialize and register the MPL115A Pressure Sensor driver. + * + * Input parameters: + * devpath - The full path to the driver to register. E.g., "/dev/press0" + * + * Returned Value: + * Zero (OK) on success; a negated errno value on failure. + * + ************************************************************************************/ + +int stm32_bmp180initialize(FAR const char *devpath) +{ + FAR struct i2c_master_s *i2c; + int ret; + + sninfo("Initializing BMP180!\n"); + + /* Initialize I2C */ + + i2c = stm32_i2cbus_initialize(BMP180_I2C_PORTNO); + + if (!i2c) + { + return -ENODEV; + } + + /* Then register the barometer sensor */ + + ret = bmp180_register(devpath, i2c); + if (ret < 0) + { + snerr("ERROR: Error registering BM180\n"); + } + + return ret; +} + +#endif /* CONFIG_I2C && CONFIG_SENSORS_MPL115A && CONFIG_STM32_I2C1 */ diff --git a/configs/stm32f103-minimum/src/stm32_bringup.c b/configs/stm32f103-minimum/src/stm32_bringup.c index dec8bea5e1..e0f3f55972 100644 --- a/configs/stm32f103-minimum/src/stm32_bringup.c +++ b/configs/stm32f103-minimum/src/stm32_bringup.c @@ -176,6 +176,15 @@ int stm32_bringup(void) } #endif +#ifdef CONFIG_SENSORS_BMP180 + ret = stm32_bmp180initialize("/dev/press0"); + if (ret < 0) + { + syslog(LOG_ERR, "Failed to initialize BMP180, error %d\n", ret); + return ret; + } +#endif + #ifdef HAVE_W25 /* Initialize and register the W25 FLASH file system. */ diff --git a/configs/stm32f103-minimum/src/stm32f103_minimum.h b/configs/stm32f103-minimum/src/stm32f103_minimum.h index 8ccae09f3d..69427573d2 100644 --- a/configs/stm32f103-minimum/src/stm32f103_minimum.h +++ b/configs/stm32f103-minimum/src/stm32f103_minimum.h @@ -252,6 +252,19 @@ int stm32_adc_setup(void); int stm32_apds9960initialize(FAR const char *devpath); #endif +/**************************************************************************** + * Name: stm32_bmp180initialize + * + * Description: + * Called to configure an I2C and to register BMP180 for the stm32f4discovery + * board. + * + ****************************************************************************/ + +#ifdef CONFIG_SENSORS_BMP180 +int stm32_bmp180initialize(FAR const char *devpath); +#endif + /************************************************************************************ * Name: stm32_spidev_initialize * diff --git a/crypto/aes.c b/crypto/aes.c index 3927a28360..4aa5cd1c13 100644 --- a/crypto/aes.c +++ b/crypto/aes.c @@ -543,7 +543,7 @@ static void aes_decr(FAR uint8_t *state, FAR const uint8_t *expanded_key) * Public Functions ****************************************************************************/ - /**************************************************************************** +/**************************************************************************** * Name: aes_encrypt * * Description: -- GitLab From 1e59d9dd14caeda4052e9a40918dae2343753744 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sun, 4 Feb 2018 12:22:03 -0600 Subject: [PATCH 160/228] armv7-a, armv7-r, armv7-m: Add atomic read-add-write and read-subtract-write functions. --- arch/Kconfig | 4 + arch/arm/Kconfig | 33 ++- arch/arm/include/spinlock.h | 2 +- arch/arm/src/a1x/Make.defs | 2 +- arch/arm/src/armv7-a/arm_fetchadd.S | 257 ++++++++++++++++++++++++ arch/arm/src/armv7-a/arm_testset.S | 2 +- arch/arm/src/armv7-m/gnu/up_fetchadd.S | 257 ++++++++++++++++++++++++ arch/arm/src/armv7-m/gnu/up_testset.S | 2 +- arch/arm/src/armv7-m/iar/up_fetchadd.S | 238 ++++++++++++++++++++++ arch/arm/src/armv7-m/iar/up_testset.S | 4 +- arch/arm/src/armv7-r/arm_fetchadd.S | 257 ++++++++++++++++++++++++ arch/arm/src/armv7-r/arm_testset.S | 2 +- arch/arm/src/efm32/Make.defs | 2 +- arch/arm/src/imx6/Make.defs | 2 +- arch/arm/src/kinetis/Make.defs | 2 +- arch/arm/src/lpc17xx/Make.defs | 2 +- arch/arm/src/lpc43xx/Make.defs | 2 +- arch/arm/src/lpc54xx/Make.defs | 2 +- arch/arm/src/sam34/Make.defs | 2 +- arch/arm/src/sama5/Make.defs | 2 +- arch/arm/src/samv7/Make.defs | 2 +- arch/arm/src/stm32/Make.defs | 2 +- arch/arm/src/stm32f7/Make.defs | 2 +- arch/arm/src/tiva/Make.defs | 2 +- arch/arm/src/tms570/Make.defs | 2 +- arch/arm/src/xmc4/Make.defs | 2 +- arch/sim/include/spinlock.h | 2 +- arch/sim/src/up_testset.c | 2 +- arch/xtensa/include/spinlock.h | 2 +- arch/xtensa/src/common/xtensa_testset.c | 2 +- include/nuttx/arch.h | 48 +++++ include/nuttx/spinlock.h | 2 +- 32 files changed, 1111 insertions(+), 35 deletions(-) create mode 100644 arch/arm/src/armv7-a/arm_fetchadd.S create mode 100644 arch/arm/src/armv7-m/gnu/up_fetchadd.S create mode 100644 arch/arm/src/armv7-m/iar/up_fetchadd.S create mode 100644 arch/arm/src/armv7-r/arm_fetchadd.S diff --git a/arch/Kconfig b/arch/Kconfig index 1efa5d52c2..65d730dc7f 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -202,6 +202,10 @@ config ARCH_HAVE_RESET bool default n +config ARCH_HAVE_FETCHADD + bool + default n + config ARCH_HAVE_RTC_SUBSECONDS bool default n diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 63ca64635c..642325162d 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -16,6 +16,7 @@ config ARCH_CHIP_A1X select ARCH_HAVE_FPU select ARCH_HAVE_IRQPRIO select ARCH_HAVE_LOWVECTORS + select ARCH_HAVE_FETCHADD select ARCH_HAVE_SDRAM select BOOT_RUNFROMSDRAM select ARCH_HAVE_ADDRENV @@ -51,6 +52,7 @@ config ARCH_CHIP_EFM32 select ARCH_HAVE_CMNVECTOR select ARCH_HAVE_SPI_BITORDER select ARMV7M_CMNVECTOR + select ARCH_HAVE_FETCHADD ---help--- Energy Micro EFM32 microcontrollers (ARM Cortex-M). @@ -69,6 +71,7 @@ config ARCH_CHIP_IMX6 select ARCH_HAVE_FPU select ARCH_HAVE_TRUSTZONE select ARCH_HAVE_LOWVECTORS + select ARCH_HAVE_FETCHADD select ARCH_HAVE_SDRAM select BOOT_RUNFROMSDRAM select ARCH_HAVE_ADDRENV @@ -82,6 +85,7 @@ config ARCH_CHIP_KINETIS select ARCH_HAVE_MPU select ARM_HAVE_MPU_UNIFIED select ARCH_HAVE_FPU + select ARCH_HAVE_FETCHADD select ARCH_HAVE_RAMFUNCS select ARCH_HAVE_CMNVECTOR select ARCH_HAVE_I2CRESET @@ -114,15 +118,6 @@ config ARCH_CHIP_LM ---help--- TI/Luminary Stellaris LMS3 and LM4F architectures (ARM Cortex-M3/4) -config ARCH_CHIP_TIVA - bool "TI Tiva" - select ARCH_HAVE_CMNVECTOR - select ARCH_HAVE_MPU - select ARM_HAVE_MPU_UNIFIED - select ARCH_HAVE_FPU - ---help--- - TI Tiva TM4C architectures (ARM Cortex-M4) - config ARCH_CHIP_LPC11XX bool "NXP LPC11xx" select ARCH_CORTEXM0 @@ -136,6 +131,7 @@ config ARCH_CHIP_LPC17XX select ARCH_HAVE_CMNVECTOR select ARCH_HAVE_MPU select ARM_HAVE_MPU_UNIFIED + select ARCH_HAVE_FETCHADD ---help--- NXP LPC17xx architectures (ARM Cortex-M3) @@ -168,6 +164,7 @@ config ARCH_CHIP_LPC43XX select ARCH_HAVE_MPU select ARM_HAVE_MPU_UNIFIED select ARCH_HAVE_FPU + select ARCH_HAVE_FETCHADD ---help--- NPX LPC43XX architectures (ARM Cortex-M4). @@ -179,6 +176,7 @@ config ARCH_CHIP_LPC54XX select ARCH_HAVE_MPU select ARM_HAVE_MPU_UNIFIED select ARCH_HAVE_FPU + select ARCH_HAVE_FETCHADD ---help--- NPX LPC54XX architectures (ARM Cortex-M4). @@ -203,6 +201,7 @@ config ARCH_CHIP_SAMA5 select ARCH_HAVE_FPU select ARCH_HAVE_IRQPRIO select ARCH_HAVE_LOWVECTORS + select ARCH_HAVE_FETCHADD select ARCH_HAVE_I2CRESET select ARCH_HAVE_TICKLESS select ARCH_HAVE_ADDRENV @@ -229,6 +228,7 @@ config ARCH_CHIP_SAM34 select ARCH_HAVE_CMNVECTOR select ARCH_HAVE_MPU select ARM_HAVE_MPU_UNIFIED + select ARCH_HAVE_FETCHADD select ARCH_HAVE_RAMFUNCS select ARMV7M_HAVE_STACKCHECK ---help--- @@ -239,6 +239,7 @@ config ARCH_CHIP_SAMV7 select ARCH_HAVE_CMNVECTOR select ARCH_CORTEXM7 select ARCH_HAVE_MPU + select ARCH_HAVE_FETCHADD select ARCH_HAVE_RAMFUNCS select ARCH_HAVE_TICKLESS select ARCH_HAVE_I2CRESET @@ -253,6 +254,7 @@ config ARCH_CHIP_STM32 bool "STMicro STM32 F1/F2/F3/F4" select ARCH_HAVE_CMNVECTOR select ARCH_HAVE_MPU + select ARCH_HAVE_FETCHADD select ARCH_HAVE_I2CRESET select ARCH_HAVE_HEAPCHECK select ARCH_HAVE_PROGMEM @@ -276,6 +278,7 @@ config ARCH_CHIP_STM32F7 select ARCH_HAVE_CMNVECTOR select ARCH_CORTEXM7 select ARCH_HAVE_MPU + select ARCH_HAVE_FETCHADD select ARCH_HAVE_I2CRESET select ARCH_HAVE_HEAPCHECK select ARCH_HAVE_SPI_BITORDER @@ -312,17 +315,29 @@ config ARCH_CHIP_TMS570 bool "TI TMS570" select ENDIAN_BIG select ARCH_HAVE_LOWVECTORS + select ARCH_HAVE_FETCHADD select ARCH_HAVE_RAMFUNCS select ARMV7R_MEMINIT select ARMV7R_HAVE_DECODEFIQ ---help--- TI TMS570 family +config ARCH_CHIP_TIVA + bool "TI Tiva" + select ARCH_HAVE_CMNVECTOR + select ARCH_HAVE_MPU + select ARM_HAVE_MPU_UNIFIED + select ARCH_HAVE_FPU + select ARCH_HAVE_FETCHADD + ---help--- + TI Tiva TM4C architectures (ARM Cortex-M4) + config ARCH_CHIP_XMC4 bool "Infineon XMC4xxx" select ARCH_HAVE_CMNVECTOR select ARCH_CORTEXM4 select ARCH_HAVE_MPU + select ARCH_HAVE_FETCHADD select ARCH_HAVE_RAMFUNCS select ARCH_HAVE_I2CRESET select ARM_HAVE_MPU_UNIFIED diff --git a/arch/arm/include/spinlock.h b/arch/arm/include/spinlock.h index 16079cc81a..4a129facca 100644 --- a/arch/arm/include/spinlock.h +++ b/arch/arm/include/spinlock.h @@ -130,7 +130,7 @@ typedef uint8_t spinlock_t; * Description: * Perform an atomic test and set operation on the provided spinlock. * - * This function must be provided via the architecture-specific logoic. + * This function must be provided via the architecture-specific logic. * * Input Parameters: * lock - The address of spinlock object. diff --git a/arch/arm/src/a1x/Make.defs b/arch/arm/src/a1x/Make.defs index 7ffb41537e..2697e5363d 100644 --- a/arch/arm/src/a1x/Make.defs +++ b/arch/arm/src/a1x/Make.defs @@ -55,7 +55,7 @@ endif CMN_ASRCS += arm_vectors.S arm_fpuconfig.S arm_fullcontextrestore.S CMN_ASRCS += arm_saveusercontext.S arm_vectoraddrexcptn.S arm_vfork.S -CMN_ASRCS += arm_testset.S +CMN_ASRCS += arm_testset.S arm_fetchadd.S CMN_ASRCS += cp15_coherent_dcache.S cp15_invalidate_dcache.S CMN_ASRCS += cp15_clean_dcache.S cp15_flush_dcache.S cp15_invalidate_dcache_all.S diff --git a/arch/arm/src/armv7-a/arm_fetchadd.S b/arch/arm/src/armv7-a/arm_fetchadd.S new file mode 100644 index 0000000000..143c38e516 --- /dev/null +++ b/arch/arm/src/armv7-a/arm_fetchadd.S @@ -0,0 +1,257 @@ +/**************************************************************************** + * arch/arm/src/armv7-m/gnu/up_fetchadd.S + * + * Copyright (C) 2018 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + + .syntax unified + .thumb + .file "up_fetchadd.S" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + + .text + +/**************************************************************************** + * Name: up_fetchadd32 + * + * Description: + * Perform an atomic fetch add operation on the provided 32-bit value. + * + * This function must be provided via the architecture-specific logic. + * + * Input Parameters: + * addr - The address of 32-bit value to be incremented. + * value - The 32-bit addend + * + * Returned Value: + * The incremented value (volatile!) + * + ****************************************************************************/ + + .globl up_fetchadd32 + .type up_fetchadd32, %function + +up_fetchadd32: + +1: + ldrex r2, [r0] /* Fetch the value to be incremented */ + add r2, r2, r1 /* Add the addend */ + + strex r3, r2, [r0] /* Attempt to save the result */ + teq r3, #0 /* r2 will be 1 is strex failed */ + bne 1b /* Failed to lock... try again */ + + mov r0, r2 /* Return the incremented value */ + bx lr /* Successful! */ + .size up_fetchadd32, . - up_fetchadd32 + +/**************************************************************************** + * Name: up_fetchsub32 + * + * Description: + * Perform an atomic fetch subtract operation on the provided 32-bit value. + * + * This function must be provided via the architecture-specific logic. + * + * Input Parameters: + * addr - The address of 32-bit value to be decremented. + * value - The 32-bit subtrahend + * + * Returned Value: + * The decremented value (volatile!) + * + ****************************************************************************/ + + .globl up_fetchsub32 + .type up_fetchsub32, %function + +up_fetchsub32: + +1: + ldrex r2, [r0] /* Fetch the value to be decremented */ + sub r2, r2, r1 /* Subtract the subtrahend */ + + strex r3, r2, [r0] /* Attempt to save the result */ + teq r3, #0 /* r2 will be 1 is strex failed */ + bne 1b /* Failed to lock... try again */ + + mov r0, r2 /* Return the decremented value */ + bx lr /* Successful! */ + .size up_fetchsub32, . - up_fetchsub32 + +/**************************************************************************** + * Name: up_fetchadd16 + * + * Description: + * Perform an atomic fetch add operation on the provided 16-bit value. + * + * This function must be provided via the architecture-specific logic. + * + * Input Parameters: + * addr - The address of 16-bit value to be incremented. + * value - The 16-bit addend + * + * Returned Value: + * The incremented value (volatile!) + * + ****************************************************************************/ + + .globl up_fetchadd16 + .type up_fetchadd16, %function + +up_fetchadd16: + +1: + ldrexh r2, [r0] /* Fetch the value to be incremented */ + add r2, r2, r1 /* Add the addend */ + + strexh r3, r2, [r0] /* Attempt to save the result */ + teq r3, #0 /* r2 will be 1 is strexh failed */ + bne 1b /* Failed to lock... try again */ + + mov r0, r2 /* Return the incremented value */ + bx lr /* Successful! */ + .size up_fetchadd16, . - up_fetchadd16 + +/**************************************************************************** + * Name: up_fetchsub16 + * + * Description: + * Perform an atomic fetch subtract operation on the provided 16-bit value. + * + * This function must be provided via the architecture-specific logic. + * + * Input Parameters: + * addr - The address of 16-bit value to be decremented. + * value - The 16-bit subtrahend + * + * Returned Value: + * The decremented value (volatile!) + * + ****************************************************************************/ + + .globl up_fetchsub16 + .type up_fetchsub16, %function + +up_fetchsub16: + +1: + ldrexh r2, [r0] /* Fetch the value to be decremented */ + sub r2, r2, r1 /* Subtract the subtrahend */ + + /* Attempt to save the decremented value */ + + strexh r3, r2, [r0] /* Attempt to save the result */ + teq r3, #0 /* r2 will be 1 is strexh failed */ + bne 1b /* Failed to lock... try again */ + + mov r0, r2 /* Return the decremented value */ + bx lr /* Successful! */ + .size up_fetchsub16, . - up_fetchsub16 + +/**************************************************************************** + * Name: up_fetchadd8 + * + * Description: + * Perform an atomic fetch add operation on the provided 8-bit value. + * + * This function must be provided via the architecture-specific logic. + * + * Input Parameters: + * addr - The address of 8-bit value to be incremented. + * value - The 8-bit addend + * + * Returned Value: + * The incremented value (volatile!) + * + ****************************************************************************/ + + .globl up_fetchadd8 + .type up_fetchadd8, %function + +up_fetchadd8: + +1: + ldrexb r2, [r0] /* Fetch the value to be incremented */ + add r2, r2, r1 /* Add the addend */ + + strexb r3, r2, [r0] /* Attempt to save the result */ + teq r3, #0 /* r2 will be 1 is strexb failed */ + bne 1b /* Failed to lock... try again */ + + mov r0, r2 /* Return the incremented value */ + bx lr /* Successful! */ + .size up_fetchadd8, . - up_fetchadd8 + +/**************************************************************************** + * Name: up_fetchsub8 + * + * Description: + * Perform an atomic fetch subtract operation on the provided 8-bit value. + * + * This function must be provided via the architecture-specific logic. + * + * Input Parameters: + * addr - The address of 8-bit value to be decremented. + * value - The 8-bit subtrahend + * + * Returned Value: + * The decremented value (volatile!) + * + ****************************************************************************/ + + .globl up_fetchsub8 + .type up_fetchsub8, %function + +up_fetchsub8: + +1: + ldrexb r2, [r0] /* Fetch the value to be decremented */ + sub r2, r2, r1 /* Subtract the subtrahend */ + + strexb r3, r2, [r0] /* Attempt to save the result */ + teq r3, #0 /* r2 will be 1 is strexb failed */ + bne 1b /* Failed to lock... try again */ + + mov r0, r2 /* Return the decremented value */ + bx lr /* Successful! */ + .size up_fetchsub8, . - up_fetchsub8 + .end diff --git a/arch/arm/src/armv7-a/arm_testset.S b/arch/arm/src/armv7-a/arm_testset.S index 638736e4d6..feb3ea3df4 100644 --- a/arch/arm/src/armv7-a/arm_testset.S +++ b/arch/arm/src/armv7-a/arm_testset.S @@ -72,7 +72,7 @@ * Description: * Perform an atomic test and set operation on the provided spinlock. * - * This function must be provided via the architecture-specific logoic. + * This function must be provided via the architecture-specific logic. * * Input Parameters: * lock - The address of spinlock object (r0). diff --git a/arch/arm/src/armv7-m/gnu/up_fetchadd.S b/arch/arm/src/armv7-m/gnu/up_fetchadd.S new file mode 100644 index 0000000000..143c38e516 --- /dev/null +++ b/arch/arm/src/armv7-m/gnu/up_fetchadd.S @@ -0,0 +1,257 @@ +/**************************************************************************** + * arch/arm/src/armv7-m/gnu/up_fetchadd.S + * + * Copyright (C) 2018 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + + .syntax unified + .thumb + .file "up_fetchadd.S" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + + .text + +/**************************************************************************** + * Name: up_fetchadd32 + * + * Description: + * Perform an atomic fetch add operation on the provided 32-bit value. + * + * This function must be provided via the architecture-specific logic. + * + * Input Parameters: + * addr - The address of 32-bit value to be incremented. + * value - The 32-bit addend + * + * Returned Value: + * The incremented value (volatile!) + * + ****************************************************************************/ + + .globl up_fetchadd32 + .type up_fetchadd32, %function + +up_fetchadd32: + +1: + ldrex r2, [r0] /* Fetch the value to be incremented */ + add r2, r2, r1 /* Add the addend */ + + strex r3, r2, [r0] /* Attempt to save the result */ + teq r3, #0 /* r2 will be 1 is strex failed */ + bne 1b /* Failed to lock... try again */ + + mov r0, r2 /* Return the incremented value */ + bx lr /* Successful! */ + .size up_fetchadd32, . - up_fetchadd32 + +/**************************************************************************** + * Name: up_fetchsub32 + * + * Description: + * Perform an atomic fetch subtract operation on the provided 32-bit value. + * + * This function must be provided via the architecture-specific logic. + * + * Input Parameters: + * addr - The address of 32-bit value to be decremented. + * value - The 32-bit subtrahend + * + * Returned Value: + * The decremented value (volatile!) + * + ****************************************************************************/ + + .globl up_fetchsub32 + .type up_fetchsub32, %function + +up_fetchsub32: + +1: + ldrex r2, [r0] /* Fetch the value to be decremented */ + sub r2, r2, r1 /* Subtract the subtrahend */ + + strex r3, r2, [r0] /* Attempt to save the result */ + teq r3, #0 /* r2 will be 1 is strex failed */ + bne 1b /* Failed to lock... try again */ + + mov r0, r2 /* Return the decremented value */ + bx lr /* Successful! */ + .size up_fetchsub32, . - up_fetchsub32 + +/**************************************************************************** + * Name: up_fetchadd16 + * + * Description: + * Perform an atomic fetch add operation on the provided 16-bit value. + * + * This function must be provided via the architecture-specific logic. + * + * Input Parameters: + * addr - The address of 16-bit value to be incremented. + * value - The 16-bit addend + * + * Returned Value: + * The incremented value (volatile!) + * + ****************************************************************************/ + + .globl up_fetchadd16 + .type up_fetchadd16, %function + +up_fetchadd16: + +1: + ldrexh r2, [r0] /* Fetch the value to be incremented */ + add r2, r2, r1 /* Add the addend */ + + strexh r3, r2, [r0] /* Attempt to save the result */ + teq r3, #0 /* r2 will be 1 is strexh failed */ + bne 1b /* Failed to lock... try again */ + + mov r0, r2 /* Return the incremented value */ + bx lr /* Successful! */ + .size up_fetchadd16, . - up_fetchadd16 + +/**************************************************************************** + * Name: up_fetchsub16 + * + * Description: + * Perform an atomic fetch subtract operation on the provided 16-bit value. + * + * This function must be provided via the architecture-specific logic. + * + * Input Parameters: + * addr - The address of 16-bit value to be decremented. + * value - The 16-bit subtrahend + * + * Returned Value: + * The decremented value (volatile!) + * + ****************************************************************************/ + + .globl up_fetchsub16 + .type up_fetchsub16, %function + +up_fetchsub16: + +1: + ldrexh r2, [r0] /* Fetch the value to be decremented */ + sub r2, r2, r1 /* Subtract the subtrahend */ + + /* Attempt to save the decremented value */ + + strexh r3, r2, [r0] /* Attempt to save the result */ + teq r3, #0 /* r2 will be 1 is strexh failed */ + bne 1b /* Failed to lock... try again */ + + mov r0, r2 /* Return the decremented value */ + bx lr /* Successful! */ + .size up_fetchsub16, . - up_fetchsub16 + +/**************************************************************************** + * Name: up_fetchadd8 + * + * Description: + * Perform an atomic fetch add operation on the provided 8-bit value. + * + * This function must be provided via the architecture-specific logic. + * + * Input Parameters: + * addr - The address of 8-bit value to be incremented. + * value - The 8-bit addend + * + * Returned Value: + * The incremented value (volatile!) + * + ****************************************************************************/ + + .globl up_fetchadd8 + .type up_fetchadd8, %function + +up_fetchadd8: + +1: + ldrexb r2, [r0] /* Fetch the value to be incremented */ + add r2, r2, r1 /* Add the addend */ + + strexb r3, r2, [r0] /* Attempt to save the result */ + teq r3, #0 /* r2 will be 1 is strexb failed */ + bne 1b /* Failed to lock... try again */ + + mov r0, r2 /* Return the incremented value */ + bx lr /* Successful! */ + .size up_fetchadd8, . - up_fetchadd8 + +/**************************************************************************** + * Name: up_fetchsub8 + * + * Description: + * Perform an atomic fetch subtract operation on the provided 8-bit value. + * + * This function must be provided via the architecture-specific logic. + * + * Input Parameters: + * addr - The address of 8-bit value to be decremented. + * value - The 8-bit subtrahend + * + * Returned Value: + * The decremented value (volatile!) + * + ****************************************************************************/ + + .globl up_fetchsub8 + .type up_fetchsub8, %function + +up_fetchsub8: + +1: + ldrexb r2, [r0] /* Fetch the value to be decremented */ + sub r2, r2, r1 /* Subtract the subtrahend */ + + strexb r3, r2, [r0] /* Attempt to save the result */ + teq r3, #0 /* r2 will be 1 is strexb failed */ + bne 1b /* Failed to lock... try again */ + + mov r0, r2 /* Return the decremented value */ + bx lr /* Successful! */ + .size up_fetchsub8, . - up_fetchsub8 + .end diff --git a/arch/arm/src/armv7-m/gnu/up_testset.S b/arch/arm/src/armv7-m/gnu/up_testset.S index c1888c56a9..10929b0780 100644 --- a/arch/arm/src/armv7-m/gnu/up_testset.S +++ b/arch/arm/src/armv7-m/gnu/up_testset.S @@ -74,7 +74,7 @@ * Description: * Perform an atomic test and set operation on the provided spinlock. * - * This function must be provided via the architecture-specific logoic. + * This function must be provided via the architecture-specific logic. * * Input Parameters: * lock - The address of spinlock object. diff --git a/arch/arm/src/armv7-m/iar/up_fetchadd.S b/arch/arm/src/armv7-m/iar/up_fetchadd.S new file mode 100644 index 0000000000..f5db1837f6 --- /dev/null +++ b/arch/arm/src/armv7-m/iar/up_fetchadd.S @@ -0,0 +1,238 @@ +/**************************************************************************** + * arch/arm/src/armv7-m/iar/up_fetchadd.S + * + * Copyright (C) 2018 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + + MODULE up_testset + SECTION .text:CODE:NOROOT(2) + +/**************************************************************************** + * Public Symbols + ****************************************************************************/ + + PUBLIC up_fetchadd32 + PUBLIC up_fetchsub32 + PUBLIC up_fetchadd16 + PUBLIC up_fetchsub16 + PUBLIC up_fetchadd8 + PUBLIC up_fetchsub8 + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + + THUMB + +/**************************************************************************** + * Name: up_fetchadd32 + * + * Description: + * Perform an atomic fetch add operation on the provided 32-bit value. + * + * This function must be provided via the architecture-specific logic. + * + * Input Parameters: + * addr - The address of 32-bit value to be incremented. + * value - The 32-bit addend + * + * Returned Value: + * The incremented value (volatile!) + * + ****************************************************************************/ + +up_fetchadd32: + + ldrex r2, [r0] /* Fetch the value to be incremented */ + add r2, r2, r1 /* Add the addend */ + + strex r3, r2, [r0] /* Attempt to save the result */ + teq r3, #0 /* r2 will be 1 is strex failed */ + bne up_fetchadd32 /* Failed to lock... try again */ + + mov r0, r2 /* Return the incremented value */ + bx lr /* Successful! */ + +/**************************************************************************** + * Name: up_fetchsub32 + * + * Description: + * Perform an atomic fetch subtract operation on the provided 32-bit value. + * + * This function must be provided via the architecture-specific logic. + * + * Input Parameters: + * addr - The address of 32-bit value to be decremented. + * value - The 32-bit subtrahend + * + * Returned Value: + * The decremented value (volatile!) + * + ****************************************************************************/ + +up_fetchsub32: + + ldrex r2, [r0] /* Fetch the value to be decremented */ + sub r2, r2, r1 /* Subtract the subtrahend */ + + strex r3, r2, [r0] /* Attempt to save the result */ + teq r3, #0 /* r2 will be 1 is strex failed */ + bne up_fetchsub32 /* Failed to lock... try again */ + + mov r0, r2 /* Return the decremented value */ + bx lr /* Successful! */ + +/**************************************************************************** + * Name: up_fetchadd16 + * + * Description: + * Perform an atomic fetch add operation on the provided 16-bit value. + * + * This function must be provided via the architecture-specific logic. + * + * Input Parameters: + * addr - The address of 16-bit value to be incremented. + * value - The 16-bit addend + * + * Returned Value: + * The incremented value (volatile!) + * + ****************************************************************************/ + +up_fetchadd16: + + ldrexh r2, [r0] /* Fetch the value to be incremented */ + add r2, r2, r1 /* Add the addend */ + + strexh r3, r2, [r0] /* Attempt to save the result */ + teq r3, #0 /* r2 will be 1 is strexh failed */ + bne up_fetchadd16 /* Failed to lock... try again */ + + mov r0, r2 /* Return the incremented value */ + bx lr /* Successful! */ + +/**************************************************************************** + * Name: up_fetchsub16 + * + * Description: + * Perform an atomic fetch subtract operation on the provided 16-bit value. + * + * This function must be provided via the architecture-specific logic. + * + * Input Parameters: + * addr - The address of 16-bit value to be decremented. + * value - The 16-bit subtrahend + * + * Returned Value: + * The decremented value (volatile!) + * + ****************************************************************************/ + +up_fetchsub16: + + ldrexh r2, [r0] /* Fetch the value to be decremented */ + sub r2, r2, r1 /* Subtract the subtrahend */ + + /* Attempt to save the decremented value */ + + strexh r3, r2, [r0] /* Attempt to save the result */ + teq r3, #0 /* r2 will be 1 is strexh failed */ + bne up_fetchsub16 /* Failed to lock... try again */ + + mov r0, r2 /* Return the decremented value */ + bx lr /* Successful! */ + +/**************************************************************************** + * Name: up_fetchadd8 + * + * Description: + * Perform an atomic fetch add operation on the provided 8-bit value. + * + * This function must be provided via the architecture-specific logic. + * + * Input Parameters: + * addr - The address of 8-bit value to be incremented. + * value - The 8-bit addend + * + * Returned Value: + * The incremented value (volatile!) + * + ****************************************************************************/ + +up_fetchadd8: + + ldrexb r2, [r0] /* Fetch the value to be incremented */ + add r2, r2, r1 /* Add the addend */ + + strexb r3, r2, [r0] /* Attempt to save the result */ + teq r3, #0 /* r2 will be 1 is strexb failed */ + bne up_fetchadd8 /* Failed to lock... try again */ + + mov r0, r2 /* Return the incremented value */ + bx lr /* Successful! */ + +/**************************************************************************** + * Name: up_fetchsub8 + * + * Description: + * Perform an atomic fetch subtract operation on the provided 8-bit value. + * + * This function must be provided via the architecture-specific logic. + * + * Input Parameters: + * addr - The address of 8-bit value to be decremented. + * value - The 8-bit subtrahend + * + * Returned Value: + * The decremented value (volatile!) + * + ****************************************************************************/ + +up_fetchsub8: + + ldrexb r2, [r0] /* Fetch the value to be decremented */ + sub r2, r2, r1 /* Subtract the subtrahend */ + + strexb r3, r2, [r0] /* Attempt to save the result */ + teq r3, #0 /* r2 will be 1 is strexb failed */ + bne up_fetchsub8 /* Failed to lock... try again */ + + mov r0, r2 /* Return the decremented value */ + bx lr /* Successful! */ + + END diff --git a/arch/arm/src/armv7-m/iar/up_testset.S b/arch/arm/src/armv7-m/iar/up_testset.S index e690aed3de..72874dff33 100644 --- a/arch/arm/src/armv7-m/iar/up_testset.S +++ b/arch/arm/src/armv7-m/iar/up_testset.S @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/armv7-m/gnu/up_testset.S + * arch/arm/src/armv7-m/iar/up_testset.S * * Copyright (C) 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -59,7 +59,7 @@ * Description: * Perform an atomic test and set operation on the provided spinlock. * - * This function must be provided via the architecture-specific logoic. + * This function must be provided via the architecture-specific logic. * * Input Parameters: * lock - The address of spinlock object. diff --git a/arch/arm/src/armv7-r/arm_fetchadd.S b/arch/arm/src/armv7-r/arm_fetchadd.S new file mode 100644 index 0000000000..ccdd42df52 --- /dev/null +++ b/arch/arm/src/armv7-r/arm_fetchadd.S @@ -0,0 +1,257 @@ +/**************************************************************************** + * arch/arm/src/armv7-r/gnu/up_fetchadd.S + * + * Copyright (C) 2018 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + + .syntax unified + .thumb + .file "up_fetchadd.S" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + + .text + +/**************************************************************************** + * Name: up_fetchadd32 + * + * Description: + * Perform an atomic fetch add operation on the provided 32-bit value. + * + * This function must be provided via the architecture-specific logic. + * + * Input Parameters: + * addr - The address of 32-bit value to be incremented. + * value - The 32-bit addend + * + * Returned Value: + * The incremented value (volatile!) + * + ****************************************************************************/ + + .globl up_fetchadd32 + .type up_fetchadd32, %function + +up_fetchadd32: + +1: + ldrex r2, [r0] /* Fetch the value to be incremented */ + add r2, r2, r1 /* Add the addend */ + + strex r3, r2, [r0] /* Attempt to save the result */ + teq r3, #0 /* r2 will be 1 is strex failed */ + bne 1b /* Failed to lock... try again */ + + mov r0, r2 /* Return the incremented value */ + bx lr /* Successful! */ + .size up_fetchadd32, . - up_fetchadd32 + +/**************************************************************************** + * Name: up_fetchsub32 + * + * Description: + * Perform an atomic fetch subtract operation on the provided 32-bit value. + * + * This function must be provided via the architecture-specific logic. + * + * Input Parameters: + * addr - The address of 32-bit value to be decremented. + * value - The 32-bit subtrahend + * + * Returned Value: + * The decremented value (volatile!) + * + ****************************************************************************/ + + .globl up_fetchsub32 + .type up_fetchsub32, %function + +up_fetchsub32: + +1: + ldrex r2, [r0] /* Fetch the value to be decremented */ + sub r2, r2, r1 /* Subtract the subtrahend */ + + strex r3, r2, [r0] /* Attempt to save the result */ + teq r3, #0 /* r2 will be 1 is strex failed */ + bne 1b /* Failed to lock... try again */ + + mov r0, r2 /* Return the decremented value */ + bx lr /* Successful! */ + .size up_fetchsub32, . - up_fetchsub32 + +/**************************************************************************** + * Name: up_fetchadd16 + * + * Description: + * Perform an atomic fetch add operation on the provided 16-bit value. + * + * This function must be provided via the architecture-specific logic. + * + * Input Parameters: + * addr - The address of 16-bit value to be incremented. + * value - The 16-bit addend + * + * Returned Value: + * The incremented value (volatile!) + * + ****************************************************************************/ + + .globl up_fetchadd16 + .type up_fetchadd16, %function + +up_fetchadd16: + +1: + ldrexh r2, [r0] /* Fetch the value to be incremented */ + add r2, r2, r1 /* Add the addend */ + + strexh r3, r2, [r0] /* Attempt to save the result */ + teq r3, #0 /* r2 will be 1 is strexh failed */ + bne 1b /* Failed to lock... try again */ + + mov r0, r2 /* Return the incremented value */ + bx lr /* Successful! */ + .size up_fetchadd16, . - up_fetchadd16 + +/**************************************************************************** + * Name: up_fetchsub16 + * + * Description: + * Perform an atomic fetch subtract operation on the provided 16-bit value. + * + * This function must be provided via the architecture-specific logic. + * + * Input Parameters: + * addr - The address of 16-bit value to be decremented. + * value - The 16-bit subtrahend + * + * Returned Value: + * The decremented value (volatile!) + * + ****************************************************************************/ + + .globl up_fetchsub16 + .type up_fetchsub16, %function + +up_fetchsub16: + +1: + ldrexh r2, [r0] /* Fetch the value to be decremented */ + sub r2, r2, r1 /* Subtract the subtrahend */ + + /* Attempt to save the decremented value */ + + strexh r3, r2, [r0] /* Attempt to save the result */ + teq r3, #0 /* r2 will be 1 is strexh failed */ + bne 1b /* Failed to lock... try again */ + + mov r0, r2 /* Return the decremented value */ + bx lr /* Successful! */ + .size up_fetchsub16, . - up_fetchsub16 + +/**************************************************************************** + * Name: up_fetchadd8 + * + * Description: + * Perform an atomic fetch add operation on the provided 8-bit value. + * + * This function must be provided via the architecture-specific logic. + * + * Input Parameters: + * addr - The address of 8-bit value to be incremented. + * value - The 8-bit addend + * + * Returned Value: + * The incremented value (volatile!) + * + ****************************************************************************/ + + .globl up_fetchadd8 + .type up_fetchadd8, %function + +up_fetchadd8: + +1: + ldrexb r2, [r0] /* Fetch the value to be incremented */ + add r2, r2, r1 /* Add the addend */ + + strexb r3, r2, [r0] /* Attempt to save the result */ + teq r3, #0 /* r2 will be 1 is strexb failed */ + bne 1b /* Failed to lock... try again */ + + mov r0, r2 /* Return the incremented value */ + bx lr /* Successful! */ + .size up_fetchadd8, . - up_fetchadd8 + +/**************************************************************************** + * Name: up_fetchsub8 + * + * Description: + * Perform an atomic fetch subtract operation on the provided 8-bit value. + * + * This function must be provided via the architecture-specific logic. + * + * Input Parameters: + * addr - The address of 8-bit value to be decremented. + * value - The 8-bit subtrahend + * + * Returned Value: + * The decremented value (volatile!) + * + ****************************************************************************/ + + .globl up_fetchsub8 + .type up_fetchsub8, %function + +up_fetchsub8: + +1: + ldrexb r2, [r0] /* Fetch the value to be decremented */ + sub r2, r2, r1 /* Subtract the subtrahend */ + + strexb r3, r2, [r0] /* Attempt to save the result */ + teq r3, #0 /* r2 will be 1 is strexb failed */ + bne 1b /* Failed to lock... try again */ + + mov r0, r2 /* Return the decremented value */ + bx lr /* Successful! */ + .size up_fetchsub8, . - up_fetchsub8 + .end diff --git a/arch/arm/src/armv7-r/arm_testset.S b/arch/arm/src/armv7-r/arm_testset.S index f82837d5fe..703f466b19 100644 --- a/arch/arm/src/armv7-r/arm_testset.S +++ b/arch/arm/src/armv7-r/arm_testset.S @@ -72,7 +72,7 @@ * Description: * Perform an atomic test and set operation on the provided spinlock. * - * This function must be provided via the architecture-specific logoic. + * This function must be provided via the architecture-specific logic. * * Input Parameters: * lock - The address of spinlock object. diff --git a/arch/arm/src/efm32/Make.defs b/arch/arm/src/efm32/Make.defs index e02561c77b..9d24cd2c37 100644 --- a/arch/arm/src/efm32/Make.defs +++ b/arch/arm/src/efm32/Make.defs @@ -39,7 +39,7 @@ CMN_UASRCS = CMN_UCSRCS = CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S -CMN_ASRCS += up_testset.S vfork.S +CMN_ASRCS += up_testset.S up_fetchadd.S vfork.S CMN_CSRCS = up_allocateheap.c up_assert.c up_blocktask.c up_copyfullstate.c CMN_CSRCS += up_createstack.c up_doirq.c up_exit.c up_hardfault.c diff --git a/arch/arm/src/imx6/Make.defs b/arch/arm/src/imx6/Make.defs index c551c22d97..3950f54a98 100644 --- a/arch/arm/src/imx6/Make.defs +++ b/arch/arm/src/imx6/Make.defs @@ -58,7 +58,7 @@ endif CMN_ASRCS += arm_vectors.S arm_fpuconfig.S arm_fullcontextrestore.S CMN_ASRCS += arm_saveusercontext.S arm_vectoraddrexcptn.S arm_vfork.S -CMN_ASRCS += arm_testset.S +CMN_ASRCS += arm_testset.S arm_fetchadd.S CMN_ASRCS += cp15_coherent_dcache.S cp15_invalidate_dcache.S CMN_ASRCS += cp15_clean_dcache.S cp15_flush_dcache.S cp15_invalidate_dcache_all.S diff --git a/arch/arm/src/kinetis/Make.defs b/arch/arm/src/kinetis/Make.defs index 4d9907907e..7e47c09e03 100644 --- a/arch/arm/src/kinetis/Make.defs +++ b/arch/arm/src/kinetis/Make.defs @@ -43,7 +43,7 @@ CMN_UASRCS = CMN_UCSRCS = CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S -CMN_ASRCS += up_testset.S vfork.S +CMN_ASRCS += up_testset.S up_fetchadd.S vfork.S CMN_CSRCS = up_assert.c up_blocktask.c up_copyfullstate.c up_createstack.c CMN_CSRCS += up_mdelay.c up_udelay.c up_exit.c up_initialize.c up_memfault.c diff --git a/arch/arm/src/lpc17xx/Make.defs b/arch/arm/src/lpc17xx/Make.defs index 115a3222a2..c164c95f13 100644 --- a/arch/arm/src/lpc17xx/Make.defs +++ b/arch/arm/src/lpc17xx/Make.defs @@ -47,7 +47,7 @@ CMN_UASRCS = CMN_UCSRCS = CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S -CMN_ASRCS += up_testset.S vfork.S +CMN_ASRCS += up_testset.S up_fetchadd.S vfork.S CMN_CSRCS = up_assert.c up_blocktask.c up_copyfullstate.c up_createstack.c CMN_CSRCS += up_mdelay.c up_udelay.c up_exit.c up_initialize.c up_memfault.c diff --git a/arch/arm/src/lpc43xx/Make.defs b/arch/arm/src/lpc43xx/Make.defs index d5bd891237..744768142c 100644 --- a/arch/arm/src/lpc43xx/Make.defs +++ b/arch/arm/src/lpc43xx/Make.defs @@ -36,7 +36,7 @@ HEAD_ASRC = CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S -CMN_ASRCS += up_testset.S vfork.S +CMN_ASRCS += up_testset.S up_fetchadd.S vfork.S CMN_CSRCS = up_assert.c up_blocktask.c up_copyfullstate.c CMN_CSRCS += up_createstack.c up_mdelay.c up_udelay.c up_exit.c diff --git a/arch/arm/src/lpc54xx/Make.defs b/arch/arm/src/lpc54xx/Make.defs index 4ba8c0d6f8..0df41b51b8 100644 --- a/arch/arm/src/lpc54xx/Make.defs +++ b/arch/arm/src/lpc54xx/Make.defs @@ -36,7 +36,7 @@ HEAD_ASRC = CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S -CMN_ASRCS += up_testset.S vfork.S +CMN_ASRCS += up_testset.S up_fetchadd.S vfork.S CMN_CSRCS = up_assert.c up_blocktask.c up_copyfullstate.c CMN_CSRCS += up_createstack.c up_mdelay.c up_udelay.c up_exit.c diff --git a/arch/arm/src/sam34/Make.defs b/arch/arm/src/sam34/Make.defs index 9ca9457430..12a35528fb 100644 --- a/arch/arm/src/sam34/Make.defs +++ b/arch/arm/src/sam34/Make.defs @@ -47,7 +47,7 @@ CMN_UASRCS = CMN_UCSRCS = CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S -CMN_ASRCS += up_testset.S vfork.S +CMN_ASRCS += up_testset.S up_fetchadd.S vfork.S CMN_CSRCS = up_assert.c up_blocktask.c up_copyfullstate.c up_createstack.c CMN_CSRCS += up_mdelay.c up_udelay.c up_exit.c up_initialize.c diff --git a/arch/arm/src/sama5/Make.defs b/arch/arm/src/sama5/Make.defs index 716f5581d2..3c447aae1f 100644 --- a/arch/arm/src/sama5/Make.defs +++ b/arch/arm/src/sama5/Make.defs @@ -55,7 +55,7 @@ endif CMN_ASRCS += arm_vectors.S arm_fpuconfig.S arm_fullcontextrestore.S CMN_ASRCS += arm_saveusercontext.S arm_vectoraddrexcptn.S arm_vfork.S -CMN_ASRCS += arm_testset.S +CMN_ASRCS += arm_testset.S arm_fetchadd.S CMN_ASRCS += cp15_coherent_dcache.S cp15_invalidate_dcache.S CMN_ASRCS += cp15_clean_dcache.S cp15_flush_dcache.S cp15_invalidate_dcache_all.S diff --git a/arch/arm/src/samv7/Make.defs b/arch/arm/src/samv7/Make.defs index fe5ab20b2c..f7d4f3fb6b 100644 --- a/arch/arm/src/samv7/Make.defs +++ b/arch/arm/src/samv7/Make.defs @@ -44,7 +44,7 @@ CMN_UASRCS = CMN_UCSRCS = CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S -CMN_ASRCS += up_testset.S vfork.S +CMN_ASRCS += up_testset.S up_fetchadd.S vfork.S CMN_CSRCS = up_assert.c up_blocktask.c up_copyfullstate.c up_createstack.c CMN_CSRCS += up_mdelay.c up_udelay.c up_exit.c up_idle.c up_initialize.c CMN_CSRCS += up_initialstate.c up_interruptcontext.c up_memfault.c up_modifyreg8.c diff --git a/arch/arm/src/stm32/Make.defs b/arch/arm/src/stm32/Make.defs index e4402d0bfb..898a6986b1 100644 --- a/arch/arm/src/stm32/Make.defs +++ b/arch/arm/src/stm32/Make.defs @@ -43,7 +43,7 @@ CMN_UASRCS = CMN_UCSRCS = CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S -CMN_ASRCS += up_testset.S vfork.S +CMN_ASRCS += up_testset.S up_fetchadd.S vfork.S CMN_CSRCS = up_assert.c up_blocktask.c up_copyfullstate.c CMN_CSRCS += up_createstack.c up_mdelay.c up_udelay.c up_exit.c diff --git a/arch/arm/src/stm32f7/Make.defs b/arch/arm/src/stm32f7/Make.defs index ccb0fe6654..fb05fecf33 100644 --- a/arch/arm/src/stm32f7/Make.defs +++ b/arch/arm/src/stm32f7/Make.defs @@ -44,7 +44,7 @@ CMN_UASRCS = CMN_UCSRCS = CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S -CMN_ASRCS += up_testset.S vfork.S +CMN_ASRCS += up_testset.S up_fetchadd.S vfork.S CMN_CSRCS = up_assert.c up_blocktask.c up_copyfullstate.c up_createstack.c CMN_CSRCS += up_mdelay.c up_udelay.c up_exit.c up_initialize.c diff --git a/arch/arm/src/tiva/Make.defs b/arch/arm/src/tiva/Make.defs index d65294d6c5..6e5c862d96 100644 --- a/arch/arm/src/tiva/Make.defs +++ b/arch/arm/src/tiva/Make.defs @@ -36,7 +36,7 @@ HEAD_ASRC = tiva_vectors.S CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S -CMN_ASRCS += up_testset.S vfork.S +CMN_ASRCS += up_testset.S up_fetchadd.S vfork.S CMN_CSRCS = up_assert.c up_blocktask.c up_copyfullstate.c up_createstack.c CMN_CSRCS += up_mdelay.c up_udelay.c up_exit.c up_idle.c up_initialize.c diff --git a/arch/arm/src/tms570/Make.defs b/arch/arm/src/tms570/Make.defs index 9d1d32f627..c1103a2f01 100644 --- a/arch/arm/src/tms570/Make.defs +++ b/arch/arm/src/tms570/Make.defs @@ -42,7 +42,7 @@ HEAD_ASRC = arm_vectortab.S CMN_ASRCS += arm_vectors.S arm_head.S arm_fullcontextrestore.S CMN_ASRCS += arm_saveusercontext.S arm_vectoraddrexcptn.S arm_vfork.S -CMN_ASRCS += arm_testset.S +CMN_ASRCS += arm_testset.S arm_fetchadd.S CMN_ASRCS += cp15_coherent_dcache.S cp15_invalidate_dcache.S CMN_ASRCS += cp15_clean_dcache.S cp15_flush_dcache.S CMN_ASRCS += cp15_invalidate_dcache_all.S diff --git a/arch/arm/src/xmc4/Make.defs b/arch/arm/src/xmc4/Make.defs index 76ddb95391..2b6fb0c62c 100644 --- a/arch/arm/src/xmc4/Make.defs +++ b/arch/arm/src/xmc4/Make.defs @@ -43,7 +43,7 @@ CMN_UASRCS = CMN_UCSRCS = CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S -CMN_ASRCS += up_testset.S vfork.S +CMN_ASRCS += up_testset.S up_fetchadd.S vfork.S CMN_CSRCS = up_assert.c up_blocktask.c up_copyfullstate.c up_createstack.c CMN_CSRCS += up_mdelay.c up_udelay.c up_exit.c up_initialize.c up_memfault.c diff --git a/arch/sim/include/spinlock.h b/arch/sim/include/spinlock.h index 85333276b1..9bfc5f40a8 100644 --- a/arch/sim/include/spinlock.h +++ b/arch/sim/include/spinlock.h @@ -69,7 +69,7 @@ typedef bool spinlock_t; * Description: * Perform an atomic test and set operation on the provided spinlock. * - * This function must be provided via the architecture-specific logoic. + * This function must be provided via the architecture-specific logic. * * Input Parameters: * lock - The address of spinlock object. diff --git a/arch/sim/src/up_testset.c b/arch/sim/src/up_testset.c index d1b754bca0..1f825e6415 100644 --- a/arch/sim/src/up_testset.c +++ b/arch/sim/src/up_testset.c @@ -73,7 +73,7 @@ static pthread_mutex_t g_tsmutex = PTHREAD_MUTEX_INITIALIZER; * Description: * Perform an atomic test and set operation on the provided spinlock. * - * This function must be provided via the architecture-specific logoic. + * This function must be provided via the architecture-specific logic. * * Input Parameters: * lock - The address of spinlock object. diff --git a/arch/xtensa/include/spinlock.h b/arch/xtensa/include/spinlock.h index 9d0ef213d0..644253f854 100644 --- a/arch/xtensa/include/spinlock.h +++ b/arch/xtensa/include/spinlock.h @@ -79,7 +79,7 @@ typedef uint32_t spinlock_t; * Description: * Perform an atomic test and set operation on the provided spinlock. * - * This function must be provided via the architecture-specific logoic. + * This function must be provided via the architecture-specific logic. * * Input Parameters: * lock - The address of spinlock object. diff --git a/arch/xtensa/src/common/xtensa_testset.c b/arch/xtensa/src/common/xtensa_testset.c index d8fdec3c00..480a61052f 100644 --- a/arch/xtensa/src/common/xtensa_testset.c +++ b/arch/xtensa/src/common/xtensa_testset.c @@ -91,7 +91,7 @@ static inline uint32_t xtensa_compareset(FAR volatile uint32_t *addr, * Description: * Perform an atomic test and set operation on the provided spinlock. * - * This function must be provided via the architecture-specific logoic. + * This function must be provided via the architecture-specific logic. * * Input Parameters: * lock - The address of spinlock object. diff --git a/include/nuttx/arch.h b/include/nuttx/arch.h index 9e52a6b019..b5ec933ac0 100644 --- a/include/nuttx/arch.h +++ b/include/nuttx/arch.h @@ -1686,6 +1686,54 @@ int up_timer_start(FAR const struct timespec *ts); /* See prototype in include/nuttx/spinlock.h */ +/**************************************************************************** + * Name: up_fetchadd8, up_fetchadd16, and up_fetchadd32 + * + * Description: + * Perform an atomic fetch add operation on the provided 8-, 16-, or 32- + * bit value. + * + * This function must be provided via the architecture-specific logic. + * + * Input Parameters: + * addr - The address of value to be incremented. + * value - The addend + * + * Returned Value: + * The incremented value (volatile!) + * + ****************************************************************************/ + +#ifdef CONFIG_ARCH_HAVE_FETCHADD +int32_t up_fetchadd32(FAR int32_t *addr, int32_t value); +int16_t up_fetchadd16(FAR int16_t *addr, int16_t value); +int8_t up_fetchadd8(FAR int8_t *addr, int8_t value); +#endif + +/**************************************************************************** + * Name: up_fetchsub8 + * + * Description: + * Perform an atomic fetch subtract operation on the provided 8-, 16-, or + * 32-bit value. + * + * This function must be provided via the architecture-specific logic. + * + * Input Parameters: + * addr - The address of value to be decremented. + * value - The subtrahend + * + * Returned Value: + * The decremented value (volatile!) + * + ****************************************************************************/ + +#ifdef CONFIG_ARCH_HAVE_FETCHADD +int32_t up_fetchsub32(FAR int32_t *addr, int32_t value); +int16_t up_fetchsub16(FAR int16_t *addr, int16_t value); +int8_t up_fetchsub8(FAR int8_t *addr, int8_t value); +#endif + /**************************************************************************** * Name: up_cpu_index * diff --git a/include/nuttx/spinlock.h b/include/nuttx/spinlock.h index 7ce1c1594e..dc551e6d2b 100644 --- a/include/nuttx/spinlock.h +++ b/include/nuttx/spinlock.h @@ -122,7 +122,7 @@ struct spinlock_s * Description: * Perform an atomic test and set operation on the provided spinlock. * - * This function must be provided via the architecture-specific logoic. + * This function must be provided via the architecture-specific logic. * * Input Parameters: * lock - The address of spinlock object. -- GitLab From 5c5d19f1c8a6338d3f705cf22c0f2a2d6a7442df Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sun, 4 Feb 2018 12:36:51 -0600 Subject: [PATCH 161/228] Some ommissions from previous commit. --- arch/arm/src/armv7-a/arm_fetchadd.S | 6 ++---- arch/arm/src/armv7-r/arm_fetchadd.S | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/arch/arm/src/armv7-a/arm_fetchadd.S b/arch/arm/src/armv7-a/arm_fetchadd.S index 143c38e516..84b0b7d482 100644 --- a/arch/arm/src/armv7-a/arm_fetchadd.S +++ b/arch/arm/src/armv7-a/arm_fetchadd.S @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/armv7-m/gnu/up_fetchadd.S + * arch/arm/src/armv7-a/arm_fetchadd.S * * Copyright (C) 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -39,9 +39,7 @@ #include - .syntax unified - .thumb - .file "up_fetchadd.S" + .file "arm_fetchadd.S" /**************************************************************************** * Public Functions diff --git a/arch/arm/src/armv7-r/arm_fetchadd.S b/arch/arm/src/armv7-r/arm_fetchadd.S index ccdd42df52..77f661b984 100644 --- a/arch/arm/src/armv7-r/arm_fetchadd.S +++ b/arch/arm/src/armv7-r/arm_fetchadd.S @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/armv7-r/gnu/up_fetchadd.S + * arch/arm/src/armv7-r/up_fetchadd.S * * Copyright (C) 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -39,9 +39,7 @@ #include - .syntax unified - .thumb - .file "up_fetchadd.S" + .file "arm_fetchadd.S" /**************************************************************************** * Public Functions -- GitLab From 5beab6fbf02653d68fa56480bddbeec1d9d5ffe0 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sun, 4 Feb 2018 15:41:22 -0600 Subject: [PATCH 162/228] spin_lock_irqsave() and spin_unlock_irqrestore() are only valid if the CPU supports global disabling of interrupts. --- arch/Kconfig | 4 ++++ arch/arm/Kconfig | 1 + include/nuttx/irq.h | 6 ++++-- sched/irq/Make.defs | 2 ++ sched/irq/irq_spinlock.c | 5 +++++ 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/arch/Kconfig b/arch/Kconfig index 65d730dc7f..e07458d70d 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -210,6 +210,10 @@ config ARCH_HAVE_RTC_SUBSECONDS bool default n +config ARCH_GLOBAL_IRQDISABLE + bool + defautl n + config ARCH_USE_MMU bool "Enable MMU" default n diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 642325162d..337f9910c2 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -107,6 +107,7 @@ config ARCH_CHIP_LC823450 select ARCH_HAVE_HEAPCHECK select ARCH_HAVE_MULTICPU select ARCH_HAVE_I2CRESET + select ARCH_GLOBAL_IRQDISABLE ---help--- ON Semiconductor LC823450 architectures (ARM dual Cortex-M3) diff --git a/include/nuttx/irq.h b/include/nuttx/irq.h index e5674d81c0..56f24ff897 100644 --- a/include/nuttx/irq.h +++ b/include/nuttx/irq.h @@ -247,7 +247,8 @@ void leave_critical_section(irqstate_t flags); * ****************************************************************************/ -#if defined (CONFIG_SMP) && defined (CONFIG_SPINLOCK_IRQ) +#if defined(CONFIG_SMP) && defined(CONFIG_SPINLOCK_IRQ) && \ + defined(CONFIG_ARCH_GLOBAL_IRQDISABLE) irqstate_t spin_lock_irqsave(void); #else # define spin_lock_irqsave(f) enter_critical_section(f) @@ -275,7 +276,8 @@ irqstate_t spin_lock_irqsave(void); * ****************************************************************************/ -#if defined (CONFIG_SMP) && defined (CONFIG_SPINLOCK_IRQ) +#if defined(CONFIG_SMP) && defined(CONFIG_SPINLOCK_IRQ) && \ + defined(CONFIG_ARCH_GLOBAL_IRQDISABLE) void spin_unlock_irqrestore(irqstate_t flags); #else # define spin_unlock_irqrestore(f) leave_critical_section(f) diff --git a/sched/irq/Make.defs b/sched/irq/Make.defs index 8ae2fde5c3..a7223c9d29 100644 --- a/sched/irq/Make.defs +++ b/sched/irq/Make.defs @@ -38,8 +38,10 @@ CSRCS += irq_initialize.c irq_attach.c irq_dispatch.c irq_unexpectedisr.c ifeq ($(CONFIG_SMP),y) CSRCS += irq_csection.c ifeq ($(CONFIG_SPINLOCK_IRQ),y) +ifeq ($(CONFIG_ARCH_GLOBAL_IRQDISABLE),y) CSRCS += irq_spinlock.c endif +endif else ifeq ($(CONFIG_SCHED_INSTRUMENTATION_CSECTION),y) CSRCS += irq_csection.c endif diff --git a/sched/irq/irq_spinlock.c b/sched/irq/irq_spinlock.c index a6f1ee97d1..c0303be119 100644 --- a/sched/irq/irq_spinlock.c +++ b/sched/irq/irq_spinlock.c @@ -45,6 +45,9 @@ #include "sched/sched.h" +#if defined(CONFIG_SMP) && defined (CONFIG_SPINLOCK_IRQ) && \ + defined(CONFIG_ARCH_GLOBAL_IRQDISABLE) + /**************************************************************************** * Public Data ****************************************************************************/ @@ -138,3 +141,5 @@ void spin_unlock_irqrestore(irqstate_t flags) up_irq_restore(flags); } + +#endif /* CONFIG_SMP && CONFIG_SPINLOCK_IRQ && CONFIG_ARCH_GLOBAL_IRQDISABLE */ -- GitLab From 8187858d79028a037212851207ac46a976dcdbad Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sun, 4 Feb 2018 15:53:01 -0600 Subject: [PATCH 163/228] Fix a typo just introduced to a Kconfig file --- arch/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/Kconfig b/arch/Kconfig index e07458d70d..d31542a74d 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -212,7 +212,7 @@ config ARCH_HAVE_RTC_SUBSECONDS config ARCH_GLOBAL_IRQDISABLE bool - defautl n + default n config ARCH_USE_MMU bool "Enable MMU" -- GitLab From 31278bc163a0fe3239a4ac4047e4968fad17fc6e Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sun, 4 Feb 2018 16:32:14 -0600 Subject: [PATCH 164/228] Kconfigs: Add comments and a dependency. --- arch/Kconfig | 5 +++++ sched/Kconfig | 1 + 2 files changed, 6 insertions(+) diff --git a/arch/Kconfig b/arch/Kconfig index d31542a74d..f1bd17077a 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -213,6 +213,11 @@ config ARCH_HAVE_RTC_SUBSECONDS config ARCH_GLOBAL_IRQDISABLE bool default n + ---help--- + Indicates that disabling interrupts on one CPU will either (1) disable + all interrupts globally on all CPUs, or (2) will disable interprocessor + interrupts as well so that no context switches can occur on the CPU + that disabled "local" interrupts. config ARCH_USE_MMU bool "Enable MMU" diff --git a/sched/Kconfig b/sched/Kconfig index 64af6daf10..f6ea30c099 100644 --- a/sched/Kconfig +++ b/sched/Kconfig @@ -252,6 +252,7 @@ config SPINLOCK config SPINLOCK_IRQ bool "Support Spinlocks with IRQ control" default n + depends on ARCH_GLOBAL_IRQDISABLE ---help--- Enables suppport for spinlocks with IRQ control. This feature can be used to protect data in SMP mode. -- GitLab From c8a372702af5d6156b5fa872fdd24a375e129b5c Mon Sep 17 00:00:00 2001 From: Masayuki Ishikawa Date: Sun, 4 Feb 2018 16:59:09 -0600 Subject: [PATCH 165/228] sched/sched: SMP: Fix this_task() to be an atomic operation. In the previous implementation, this_task() was defined in sched.h by using just a macro current_task(this_cpu()). However, I found that this is not atomic and actually sometimes switching CPU happened in executing the macro when we tested audio steaming plus executing commands via telnet. This change resolves this issue by implementing atomic this_task()in sched_thistask.c which is newly introduced. --- arch/arm/src/sam34/Kconfig | 1 + libc/misc/lib_ncompress.c | 985 +++++++++++++++++++++++++++++++++++ sched/sched/Make.defs | 1 + sched/sched/sched.h | 5 +- sched/sched/sched_thistask.c | 99 ++++ 5 files changed, 1090 insertions(+), 1 deletion(-) create mode 100644 libc/misc/lib_ncompress.c create mode 100644 sched/sched/sched_thistask.c diff --git a/arch/arm/src/sam34/Kconfig b/arch/arm/src/sam34/Kconfig index 862b381418..692bfd062f 100644 --- a/arch/arm/src/sam34/Kconfig +++ b/arch/arm/src/sam34/Kconfig @@ -247,6 +247,7 @@ config ARCH_CHIP_SAM4CM default n select ARCH_HAVE_MULTICPU select ARCH_HAVE_TICKLESS + select ARCH_GLOBAL_IRQDISABLE config ARCH_CHIP_SAM4L bool diff --git a/libc/misc/lib_ncompress.c b/libc/misc/lib_ncompress.c new file mode 100644 index 0000000000..8f8b116ebc --- /dev/null +++ b/libc/misc/lib_ncompress.c @@ -0,0 +1,985 @@ + +/**************************************************************************** + * libc/misc/lib_ncompress.c + * File compression ala IEEE Computer, Mar 1992. + * + * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * This is the file compress24.c extracted from the ncompress-4.2.4 release + * and adapted for NuttX. The original code was released into the public + * domain. This NuttX version is re-released under the standard NuttX + * BSD 3-clause license. The original authors are listed below: + * + * Spencer W. Thomas (decvax!harpo!utah-cs!utah-gr!thomas) + * Jim McKie (decvax!mcvax!jim) + * Steve Davies (decvax!vax135!petsd!peora!srd) + * Ken Turkowski (decvax!decwrl!turtlevax!ken) + * James A. Woods (decvax!ihnp4!ames!jaw) + * Joe Orost (decvax!vax135!petsd!joe) + * Dave Mack (csu@alembic.acs.com) + * Peter Jannesen, Network Communication Systems + * (peter@ncs.nl) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define RECURSIVE 1 + +#ifdef __STDC__ +# define ARGS(a) a +#else +# define ARGS(a) () +#endif + +#define LARGS(a) () /* Relay on include files for libary func defs. + */ + +#ifndef SIG_TYPE +# define SIG_TYPE void (*)() +#endif + +#define MARK(a) { asm(" .globl M.a"); asm("M.a:"); } + +#undef min +#define min(a,b) ((a>b) ? b : a) + +#ifndef IBUFSIZ +# define IBUFSIZ BUFSIZ /* Defailt input buffer size */ +#endif +#ifndef OBUFSIZ +# define OBUFSIZ BUFSIZ /* Default output buffer size */ +#endif + +#define MAXPATHLEN 1024 /* MAXPATHLEN - maximum length of a pathname we + * allow */ +#define SIZE_INNER_LOOP 256 /* Size of the inter (fast) compress loop */ + + /* Defines for third byte of header */ +#define MAGIC_1 (char_type)'\037' /* First byte of compressed file */ +#define MAGIC_2 (char_type)'\235' /* Second byte of compressed file */ +#define BIT_MASK 0x1f /* Mask for 'number of compresssion bits' */ + /* Masks 0x20 and 0x40 are free. */ + /* I think 0x20 should mean that there is */ + /* a fourth header byte (for expansion). */ +#define BLOCK_MODE 0x80 /* Block compresssion if table is full and */ + /* compression rate is dropping flush tables */ + + /* the next two codes should not be changed lightly, as they must not */ + /* lie within the contiguous general code space. */ +#define FIRST 257 /* first free entry */ +#define CLEAR 256 /* table clear output code */ + +#define INIT_BITS 9 /* initial number of bits/code */ + +#ifndef SACREDMEM + /* + * SACREDMEM is the amount of physical memory saved for others; compress + * will hog the rest. + */ +# define SACREDMEM 0 +#endif + +#ifndef USERMEM + /* + * Set USERMEM to the maximum amount of physical user memory available + * in bytes. USERMEM is used to determine the maximum BITS that can be used + * for compression. + */ +# define USERMEM 450000 /* default user memory */ +#endif + +#ifndef BYTEORDER +# define BYTEORDER 0000 +#endif + +#ifndef NOALLIGN +# define NOALLIGN 0 +#endif + +/* + * machine variants which require cc -Dmachine: pdp11, z8000, DOS + */ + +#ifdef interdata /* Perkin-Elmer */ +# define SIGNED_COMPARE_SLOW /* signed compare is slower than unsigned */ +#endif + +#ifdef pdp11 /* PDP11: don't forget to compile with -i */ +# define BITS 12 /* max bits/code for 16-bit machine */ +# define NO_UCHAR /* also if "unsigned char" functions as signed + * char */ +#endif /* pdp11 */ + +#ifdef z8000 /* Z8000: */ +# define BITS 12 /* 16-bits processor max 12 bits */ +# undef vax /* weird preprocessor */ +#endif /* z8000 */ + +#ifdef DOS /* PC/XT/AT (8088) processor */ +# define BITS 16 /* 16-bits processor max 12 bits */ +# if BITS == 16 +# define MAXSEG_64K +# endif +# undef BYTEORDER +# define BYTEORDER 4321 +# undef NOALLIGN +# define NOALLIGN 1 +#endif /* DOS */ + +#ifndef O_BINARY +# define O_BINARY 0 /* System has no binary mode */ +#endif + +#ifdef M_XENIX /* Stupid compiler can't handle arrays with */ +# if BITS == 16 /* more than 65535 bytes - so we fake it */ +# define MAXSEG_64K +# else +# if BITS > 13 /* Code only handles BITS = 12, 13, or 16 */ +# define BITS 13 +# endif +# endif +#endif + +#ifndef BITS /* General processor calculate BITS */ +# if USERMEM >= (800000+SACREDMEM) +# define FAST +# else +# if USERMEM >= (433484+SACREDMEM) +# define BITS 16 +# else +# if USERMEM >= (229600+SACREDMEM) +# define BITS 15 +# else +# if USERMEM >= (127536+SACREDMEM) +# define BITS 14 +# else +# if USERMEM >= (73464+SACREDMEM) +# define BITS 13 +# else +# define BITS 12 +# endif +# endif +# endif +# endif +# endif +#endif /* BITS */ + +#ifdef FAST +# define HBITS 17 /* 50% occupancy */ +# define HSIZE (1<>3]) |= ((long)(c))<<((o)&0x7);\ + (o) += (n); \ + } +#else +# ifdef BYTEORDER +# define output(b,o,c,n) { char_type *p = &(b)[(o)>>3]; \ + union bytes i; \ + i.word = ((long)(c))<<((o)&0x7); \ + p[0] |= i.bytes.b1; \ + p[1] |= i.bytes.b2; \ + p[2] |= i.bytes.b3; \ + (o) += (n); \ + } +# else +# define output(b,o,c,n) { char_type *p = &(b)[(o)>>3]; \ + long i = ((long)(c))<<((o)&0x7); \ + p[0] |= (char_type)(i); \ + p[1] |= (char_type)(i>>8); \ + p[2] |= (char_type)(i>>16); \ + (o) += (n); \ + } +# endif +#endif +#if BYTEORDER == 4321 && NOALLIGN == 1 +# define input(b,o,c,n,m){ \ + (c) = (*(long *)(&(b)[(o)>>3])>>((o)&0x7))&(m); \ + (o) += (n); \ + } +#else +# define input(b,o,c,n,m){ char_type *p = &(b)[(o)>>3]; \ + (c) = ((((long)(p[0]))|((long)(p[1])<<8)| \ + ((long)(p[2])<<16))>>((o)&0x7))&(m); \ + (o) += (n); \ + } +#endif + +char *progname; /* Program name */ +int silent = 0; /* don't tell me about errors */ +int quiet = 1; /* don't tell me about compression */ +int do_decomp = 0; /* Decompress mode */ +int force = 0; /* Force overwrite of files and links */ +int nomagic = 0; /* Use a 3-byte magic number header, */ + /* unless old file */ +int block_mode = BLOCK_MODE; /* Block compress mode -C compatible with 2.0 */ +int maxbits = BITS; /* user settable max # bits/code */ +int zcat_flg = 0; /* Write output on stdout, suppress messages */ +int recursive = 0; /* compress directories */ +int exit_code = -1; /* Exitcode of compress (-1 no file compressed) + */ + +char_type inbuf[IBUFSIZ + 64]; /* Input buffer */ +char_type outbuf[OBUFSIZ + 2048]; /* Output buffer */ + +struct stat infstat; /* Input file status */ +char *ifname; /* Input filename */ +int remove_ofname = 0; /* Remove output file on a error */ +char ofname[MAXPATHLEN]; /* Output filename */ +int fgnd_flag = 0; /* Running in background (SIGINT=SIGIGN) */ + +long bytes_in; /* Total number of byte from input */ +long bytes_out; /* Total number of byte to output */ + +/* + * To save much memory, we overlay the table used by compress() with those + * used by decompress(). The tab_prefix table is the same size and type + * as the codetab. The tab_suffix table needs 2**BITS characters. We + * get this from the beginning of htab. The output stack uses the rest + * of htab, and contains characters. There is plenty of room for any + * possible stack (stack used to be 8000 characters). + */ +#ifdef MAXSEG_64K +count_int htab0[8192]; +count_int htab1[8192]; +count_int htab2[8192]; +count_int htab3[8192]; +count_int htab4[8192]; +count_int htab5[8192]; +count_int htab6[8192]; +count_int htab7[8192]; +count_int htab8[HSIZE - 65536]; +count_int *htab[9] = + { htab0, htab1, htab2, htab3, htab4, htab5, htab6, htab7, htab8 }; + +unsigned short code0tab[16384]; +unsigned short code1tab[16384]; +unsigned short code2tab[16384]; +unsigned short code3tab[16384]; +unsigned short code4tab[16384]; +unsigned short *codetab[5] = + { code0tab, code1tab, code2tab, code3tab, code4tab }; + +# define htabof(i) (htab[(i) >> 13][(i) & 0x1fff]) +# define codetabof(i) (codetab[(i) >> 14][(i) & 0x3fff]) +# define tab_prefixof(i) codetabof(i) +# define tab_suffixof(i) ((char_type *)htab[(i)>>15])[(i) & 0x7fff] +# define de_stack ((char_type *)(&htab2[8191])) +void clear_htab() +{ + memset(htab0, -1, sizeof(htab0)); + memset(htab1, -1, sizeof(htab1)); + memset(htab2, -1, sizeof(htab2)); + memset(htab3, -1, sizeof(htab3)); + memset(htab4, -1, sizeof(htab4)); + memset(htab5, -1, sizeof(htab5)); + memset(htab6, -1, sizeof(htab6)); + memset(htab7, -1, sizeof(htab7)); + memset(htab8, -1, sizeof(htab8)); +} + +# define clear_tab_prefixof() memset(code0tab, 0, 256); +#else /* Normal machine */ +count_int htab[HSIZE]; +unsigned short codetab[HSIZE]; + +# define htabof(i) htab[i] +# define codetabof(i) codetab[i] +# define tab_prefixof(i) codetabof(i) +# define tab_suffixof(i) ((char_type *)(htab))[i] +# define de_stack ((char_type *)&(htab[HSIZE-1])) +# define clear_htab() memset(htab, -1, sizeof(htab)) +# define clear_tab_prefixof() memset(codetab, 0, 256); + +# ifdef FAST +int primetab[256] = /* Special secudary hash table. */ +{ + 1013, -1061, 1109, -1181, 1231, -1291, 1361, -1429, + 1481, -1531, 1583, -1627, 1699, -1759, 1831, -1889, + 1973, -2017, 2083, -2137, 2213, -2273, 2339, -2383, + 2441, -2531, 2593, -2663, 2707, -2753, 2819, -2887, + 2957, -3023, 3089, -3181, 3251, -3313, 3361, -3449, + 3511, -3557, 3617, -3677, 3739, -3821, 3881, -3931, + 4013, -4079, 4139, -4219, 4271, -4349, 4423, -4493, + 4561, -4639, 4691, -4783, 4831, -4931, 4973, -5023, + 5101, -5179, 5261, -5333, 5413, -5471, 5521, -5591, + 5659, -5737, 5807, -5857, 5923, -6029, 6089, -6151, + 6221, -6287, 6343, -6397, 6491, -6571, 6659, -6709, + 6791, -6857, 6917, -6983, 7043, -7129, 7213, -7297, + 7369, -7477, 7529, -7577, 7643, -7703, 7789, -7873, + 7933, -8017, 8093, -8171, 8237, -8297, 8387, -8461, + 8543, -8627, 8689, -8741, 8819, -8867, 8963, -9029, + 9109, -9181, 9241, -9323, 9397, -9439, 9511, -9613, + 9677, -9743, 9811, -9871, 9941, -10061, 10111, -10177, + 10259, -10321, 10399, -10477, 10567, -10639, 10711, -10789, + 10867, -10949, 11047, -11113, 11173, -11261, 11329, -11423, + 11491, -11587, 11681, -11777, 11827, -11903, 11959, -12041, + 12109, -12197, 12263, -12343, 12413, -12487, 12541, -12611, + 12671, -12757, 12829, -12917, 12979, -13043, 13127, -13187, + 13291, -13367, 13451, -13523, 13619, -13691, 13751, -13829, + 13901, -13967, 14057, -14153, 14249, -14341, 14419, -14489, + 14557, -14633, 14717, -14767, 14831, -14897, 14983, -15083, + 15149, -15233, 15289, -15359, 15427, -15497, 15583, -15649, + 15733, -15791, 15881, -15937, 16057, -16097, 16189, -16267, + 16363, -16447, 16529, -16619, 16691, -16763, 16879, -16937, + 17021, -17093, 17183, -17257, 17341, -17401, 17477, -17551, + 17623, -17713, 17791, -17891, 17957, -18041, 18097, -18169, + 18233, -18307, 18379, -18451, 18523, -18637, 18731, -18803, + 18919, -19031, 19121, -19211, 19273, -19381, 19429, -19477 +}; +# endif + +/* + * compress fdin to fdout + * + * Algorithm: use open addressing double hashing (no chaining) on the + * prefix code / next character combination. We do a variant of Knuth's + * algorithm D (vol. 3, sec. 6.4) along with G. Knott's relatively-prime + * secondary probe. Here, the modular division first probe is gives way + * to a faster exclusive-or manipulation. Also do block compression with + * an adaptive reset, whereby the code table is cleared when the compression + * ratio decreases, but after the table fills. The variable-length output + * codes are re-sized at this point, and a special CLEAR code is generated + * for the decompressor. Late addition: construct the table according to + * file size for noticeable speed improvement on small files. Please direct + * questions about this implementation to ames!jaw. + */ +void compress(int fdin, int fdout) +{ + long hp; + int rpos; + long fc; + int outbits; + int rlop; + int rsize; + int stcode; + code_int free_ent; + int boff; + int n_bits; + int ratio; + long checkpoint; + code_int extcode; + union + { + long code; + struct + { + char_type c; + unsigned short ent; + } e; + } fcode; + + ratio = 0; + checkpoint = CHECK_GAP; + extcode = MAXCODE(n_bits = INIT_BITS) + 1; + stcode = 1; + free_ent = FIRST; + + memset(outbuf, 0, sizeof(outbuf)); + bytes_out = 0; + bytes_in = 0; + outbuf[0] = MAGIC_1; + outbuf[1] = MAGIC_2; + outbuf[2] = (char)(maxbits | block_mode); + boff = outbits = (3 << 3); + fcode.code = 0; + + clear_htab(); + + while ((rsize = read(fdin, inbuf, IBUFSIZ)) > 0) + { + if (bytes_in == 0) + { + fcode.e.ent = inbuf[0]; + rpos = 1; + } + else + rpos = 0; + + rlop = 0; + + do + { + if (free_ent >= extcode && fcode.e.ent < FIRST) + { + if (n_bits < maxbits) + { + boff = outbits = (outbits - 1) + ((n_bits << 3) - + ((outbits - boff - 1 + + (n_bits << 3)) % + (n_bits << 3))); + if (++n_bits < maxbits) + extcode = MAXCODE(n_bits) + 1; + else + extcode = MAXCODE(n_bits); + } + else + { + extcode = MAXCODE(16) + OBUFSIZ; + stcode = 0; + } + } + + if (!stcode && bytes_in >= checkpoint && fcode.e.ent < FIRST) + { + long int rat; + + checkpoint = bytes_in + CHECK_GAP; + + if (bytes_in > 0x007fffff) + { /* shift will overflow */ + rat = (bytes_out + (outbits >> 3)) >> 8; + + if (rat == 0) /* Don't divide by zero */ + rat = 0x7fffffff; + else + rat = bytes_in / rat; + } + else + rat = (bytes_in << 8) / (bytes_out + (outbits >> 3)); /* 8 + * fractional + * bits + */ + if (rat >= ratio) + ratio = (int)rat; + else + { + ratio = 0; + clear_htab(); + output(outbuf, outbits, CLEAR, n_bits); + boff = outbits = (outbits - 1) + ((n_bits << 3) - + ((outbits - boff - 1 + + (n_bits << 3)) % + (n_bits << 3))); + extcode = MAXCODE(n_bits = INIT_BITS) + 1; + free_ent = FIRST; + stcode = 1; + } + } + + if (outbits >= (OBUFSIZ << 3)) + { + if (write(fdout, outbuf, OBUFSIZ) != OBUFSIZ) + write_error(); + + outbits -= (OBUFSIZ << 3); + boff = -(((OBUFSIZ << 3) - boff) % (n_bits << 3)); + bytes_out += OBUFSIZ; + + memcpy(outbuf, outbuf + OBUFSIZ, (outbits >> 3) + 1); + memset(outbuf + (outbits >> 3) + 1, '\0', OBUFSIZ); + } + + { + int i; + + i = rsize - rlop; + + if ((code_int) i > extcode - free_ent) + i = (int)(extcode - free_ent); + if (i > ((sizeof(outbuf) - 32) * 8 - outbits) / n_bits) + i = ((sizeof(outbuf) - 32) * 8 - outbits) / n_bits; + + if (!stcode && (long)i > checkpoint - bytes_in) + i = (int)(checkpoint - bytes_in); + + rlop += i; + bytes_in += i; + } + + goto next; + hfound:fcode.e.ent = codetabof(hp); + next:if (rpos >= rlop) + goto endlop; + next2:fcode.e.c = inbuf[rpos++]; +# ifndef FAST + { + code_int i; + fc = fcode.code; + + hp = (((long)(fcode.e.c)) << (BITS - 8)) ^ (long)(fcode.e.ent); + + if ((i = htabof(hp)) == fc) + goto hfound; + + if (i != -1) + { + long disp; + + disp = (HSIZE - hp) - 1; /* secondary hash (after G. + * Knott) */ + + do + { + if ((hp -= disp) < 0) + hp += HSIZE; + + if ((i = htabof(hp)) == fc) + goto hfound; + } + while (i != -1); + } + } +# else + { + long i; + long p; + fc = fcode.code; + + hp = ((((long)(fcode.e.c)) << (HBITS - 8)) ^ (long)(fcode.e.ent)); + + if ((i = htabof(hp)) == fc) + goto hfound; + if (i == -1) + goto out; + + p = primetab[fcode.e.c]; + lookup:hp = (hp + p) & HMASK; + if ((i = htabof(hp)) == fc) + goto hfound; + if (i == -1) + goto out; + hp = (hp + p) & HMASK; + if ((i = htabof(hp)) == fc) + goto hfound; + if (i == -1) + goto out; + hp = (hp + p) & HMASK; + if ((i = htabof(hp)) == fc) + goto hfound; + if (i == -1) + goto out; + goto lookup; + } + out:; +# endif + output(outbuf, outbits, fcode.e.ent, n_bits); + + { + long fc = fcode.code; + fcode.e.ent = fcode.e.c; + + if (stcode) + { + codetabof(hp) = (unsigned short)free_ent++; + htabof(hp) = fc; + } + } + + goto next; + + endlop:if (fcode.e.ent >= FIRST && rpos < rsize) + goto next2; + + if (rpos > rlop) + { + bytes_in += rpos - rlop; + rlop = rpos; + } + } + while (rlop < rsize); + } + + if (rsize < 0) + read_error(); + + if (bytes_in > 0) + output(outbuf, outbits, fcode.e.ent, n_bits); + + if (write(fdout, outbuf, (outbits + 7) >> 3) != (outbits + 7) >> 3) + write_error(); + + bytes_out += (outbits + 7) >> 3; + + return; +} + +/* + * Decompress stdin to stdout. This routine adapts to the codes in the + * file building the "string" table on-the-fly; requiring no table to + * be stored in the compressed file. The tables used herein are shared + * with those of the compress() routine. See the definitions above. + */ + +void decompress(int fdin, int fdout) + int fdin; + int fdout; +{ + char_type *stackp; + code_int code; + int finchar; + code_int oldcode; + code_int incode; + int inbits; + int posbits; + int outpos; + int insize; + int bitmask; + code_int free_ent; + code_int maxcode; + code_int maxmaxcode; + int n_bits; + int rsize; + + bytes_in = 0; + bytes_out = 0; + insize = 0; + + while (insize < 3 && (rsize = read(fdin, inbuf + insize, IBUFSIZ)) > 0) + insize += rsize; + + if (insize < 3 || inbuf[0] != MAGIC_1 || inbuf[1] != MAGIC_2) + { + if (rsize < 0) + read_error(); + + if (insize > 0) + { + fprintf(stderr, "%s: not in compressed format\n", + (ifname[0] != '\0' ? ifname : "stdin")); + exit_code = 1; + } + + return; + } + + maxbits = inbuf[2] & BIT_MASK; + block_mode = inbuf[2] & BLOCK_MODE; + + if (maxbits > BITS) + { + fprintf(stderr, + "%s: compressed with %d bits, can only handle %d bits\n", + (*ifname != '\0' ? ifname : "stdin"), maxbits, BITS); + exit_code = 4; + return; + } + + maxmaxcode = MAXCODE(maxbits); + + bytes_in = insize; + maxcode = MAXCODE(n_bits = INIT_BITS) - 1; + bitmask = (1 << n_bits) - 1; + oldcode = -1; + finchar = 0; + outpos = 0; + posbits = 3 << 3; + + free_ent = ((block_mode) ? FIRST : 256); + + clear_tab_prefixof(); /* As above, initialize the first 256 entries + * in the table. */ + + for (code = 255; code >= 0; --code) + tab_suffixof(code) = (char_type) code; + + do + { + resetbuf:; + { + int i; + int e; + int o; + + o = posbits >> 3; + e = o <= insize ? insize - o : 0; + + for (i = 0; i < e; ++i) + inbuf[i] = inbuf[i + o]; + + insize = e; + posbits = 0; + } + + if (insize < sizeof(inbuf) - IBUFSIZ) + { + if ((rsize = read(fdin, inbuf + insize, IBUFSIZ)) < 0) + read_error(); + + insize += rsize; + } + + inbits = ((rsize > 0) ? (insize - insize % n_bits) << 3 : + (insize << 3) - (n_bits - 1)); + + while (inbits > posbits) + { + if (free_ent > maxcode) + { + posbits = ((posbits - 1) + ((n_bits << 3) - + (posbits - 1 + + (n_bits << 3)) % (n_bits << 3))); + + ++n_bits; + if (n_bits == maxbits) + maxcode = maxmaxcode; + else + maxcode = MAXCODE(n_bits) - 1; + + bitmask = (1 << n_bits) - 1; + goto resetbuf; + } + + input(inbuf, posbits, code, n_bits, bitmask); + + if (oldcode == -1) + { + if (code >= 256) + { + fprintf(stderr, "oldcode:-1 code:%i\n", (int)(code)); + fprintf(stderr, "uncompress: corrupt input\n"); + abort_compress(); + } + outbuf[outpos++] = (char_type) (finchar = (int)(oldcode = code)); + continue; + } + + if (code == CLEAR && block_mode) + { + clear_tab_prefixof(); + free_ent = FIRST - 1; + posbits = ((posbits - 1) + ((n_bits << 3) - + (posbits - 1 + + (n_bits << 3)) % (n_bits << 3))); + maxcode = MAXCODE(n_bits = INIT_BITS) - 1; + bitmask = (1 << n_bits) - 1; + goto resetbuf; + } + + incode = code; + stackp = de_stack; + + if (code >= free_ent) /* Special case for KwKwK string. */ + { + if (code > free_ent) + { + char_type *p; + + posbits -= n_bits; + p = &inbuf[posbits >> 3]; + + fprintf(stderr, + "insize:%d posbits:%d inbuf:%02X %02X %02X %02X %02X (%d)\n", + insize, posbits, p[-1], p[0], p[1], p[2], p[3], + (posbits & 07)); + fprintf(stderr, "uncompress: corrupt input\n"); + abort_compress(); + } + + *--stackp = (char_type) finchar; + code = oldcode; + } + + while ((cmp_code_int) code >= (cmp_code_int) 256) + { /* Generate output characters in reverse order */ + *--stackp = tab_suffixof(code); + code = tab_prefixof(code); + } + + *--stackp = (char_type) (finchar = tab_suffixof(code)); + + /* And put them out in forward order */ + + { + int i; + + if (outpos + (i = (de_stack - stackp)) >= OBUFSIZ) + { + do + { + if (i > OBUFSIZ - outpos) + i = OBUFSIZ - outpos; + + if (i > 0) + { + memcpy(outbuf + outpos, stackp, i); + outpos += i; + } + + if (outpos >= OBUFSIZ) + { + if (write(fdout, outbuf, outpos) != outpos) + write_error(); + + outpos = 0; + } + stackp += i; + } + while ((i = (de_stack - stackp)) > 0); + } + else + { + memcpy(outbuf + outpos, stackp, i); + outpos += i; + } + } + + if ((code = free_ent) < maxmaxcode) /* Generate the new entry. */ + { + tab_prefixof(code) = (unsigned short)oldcode; + tab_suffixof(code) = (char_type) finchar; + free_ent = code + 1; + } + + oldcode = incode; /* Remember previous code. */ + } + + bytes_in += rsize; + } + while (rsize > 0); + + if (outpos > 0 && write(fdout, outbuf, outpos) != outpos) + write_error(); +} + +void read_error() +{ + fprintf(stderr, "\nread error on"); + perror((ifname[0] != '\0') ? ifname : "stdin"); + abort_compress(); +} + +void write_error() +{ + fprintf(stderr, "\nwrite error on"); + perror((ofname[0] != '\0') ? ofname : "stdout"); + abort_compress(); +} + +void abort_compress() +{ + if (remove_ofname) + unlink(ofname); + + exit(1); +} + +void prratio(stream, num, den) + FILE *stream; + long int num; + long int den; +{ + int q; + + if (den > 0) + { + if (num > 214748L) + q = (int)(num / (den / 10000L)); /* 2147483647/10000 */ + else + q = (int)(10000L * num / den); /* Long calculations, though */ + } + else + q = 10000; + + if (q < 0) + { + putc('-', stream); + q = -q; + } + + fprintf(stream, "%d.%02d%%", q / 100, q % 100); +} diff --git a/sched/sched/Make.defs b/sched/sched/Make.defs index c9088453c0..7bacba7b0f 100644 --- a/sched/sched/Make.defs +++ b/sched/sched/Make.defs @@ -100,6 +100,7 @@ endif ifeq ($(CONFIG_SMP),y) CSRCS += sched_tasklistlock.c +CSRCS += sched_thistask.c endif # Include sched build support diff --git a/sched/sched/sched.h b/sched/sched/sched.h index 63c081de85..cad10c8d94 100644 --- a/sched/sched/sched.h +++ b/sched/sched/sched.h @@ -72,6 +72,7 @@ /* These are macros to access the current CPU and the current task on a CPU. * These macros are intended to support a future SMP implementation. + * NOTE: this_task() for SMP is implemented in sched_thistask.c */ #ifdef CONFIG_SMP @@ -80,8 +81,8 @@ #else # define current_task(cpu) ((FAR struct tcb_s *)g_readytorun.head) # define this_cpu() (0) +# define this_task() (current_task(this_cpu())) #endif -#define this_task() (current_task(this_cpu())) /* List attribute flags */ @@ -427,6 +428,8 @@ void sched_sporadic_lowpriority(FAR struct tcb_s *tcb); #endif #ifdef CONFIG_SMP +FAR struct tcb_s *this_task(void); + int sched_cpu_select(cpu_set_t affinity); int sched_cpu_pause(FAR struct tcb_s *tcb); diff --git a/sched/sched/sched_thistask.c b/sched/sched/sched_thistask.c new file mode 100644 index 0000000000..59237de3be --- /dev/null +++ b/sched/sched/sched_thistask.c @@ -0,0 +1,99 @@ +/**************************************************************************** + * sched/sched/sched_thistask.c + * + * Copyright (C) 2018 Sony Corporation. All rights reserved. + * Author: Masayuki Ishikawa + * Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +#include +#include + +#include + +#include "sched/sched.h" + +#ifdef CONFIG_SMP + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: this_task + * + * Description: + * The functions will safely obtain the TCB that is currently running + * on the current CPU. In SMP, this must be done by disabling local + * interrupts to avoid CPU switching during access to current_task() + * + * Return Value: + * the TCB that is currently running on the current CPU. + * + ****************************************************************************/ + +FAR struct tcb_s *this_task(void) +{ + irqstate_t flags; + FAR struct tcb_s *tcb; + +#ifdef CONDIF_ARCH_GLOBAL_IRQDISABLE + /* Disable local interrupts to avoid CPU switching */ + + flags = up_irq_save(); +#else + /* Enter a critical section */ + + flags = enter_critical_section(); +#endif + + /* Obtain the TCB which is currently running on this CPU */ + + tcb = current_task(this_cpu()); + + /* Enable local interrupts */ + +#ifdef CONDIF_ARCH_GLOBAL_IRQDISABLE + up_irq_restore(flags); +#else + leave_critical_section(flags); +#endif + return tcb; +} + +#endif /* CONFIG_SMP */ -- GitLab From aaf1079fa7c80f17d21782540fe8df9d4e35539d Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sun, 4 Feb 2018 18:15:45 -0600 Subject: [PATCH 166/228] sched/sched: Fix a typo in the previous commit --- sched/sched/sched_thistask.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sched/sched/sched_thistask.c b/sched/sched/sched_thistask.c index 59237de3be..f65aebb140 100644 --- a/sched/sched/sched_thistask.c +++ b/sched/sched/sched_thistask.c @@ -72,7 +72,7 @@ FAR struct tcb_s *this_task(void) irqstate_t flags; FAR struct tcb_s *tcb; -#ifdef CONDIF_ARCH_GLOBAL_IRQDISABLE +#ifdef CONFIG_ARCH_GLOBAL_IRQDISABLE /* Disable local interrupts to avoid CPU switching */ flags = up_irq_save(); @@ -88,7 +88,7 @@ FAR struct tcb_s *this_task(void) /* Enable local interrupts */ -#ifdef CONDIF_ARCH_GLOBAL_IRQDISABLE +#ifdef CONFIG_ARCH_GLOBAL_IRQDISABLE up_irq_restore(flags); #else leave_critical_section(flags); -- GitLab From 873ffd13bc7a7a26a30326802f3b9685dce87cf8 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sun, 4 Feb 2018 18:18:26 -0600 Subject: [PATCH 167/228] sched/sched: Temporarily comment out some bad logic --- sched/sched/sched_thistask.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sched/sched/sched_thistask.c b/sched/sched/sched_thistask.c index f65aebb140..1c0584db06 100644 --- a/sched/sched/sched_thistask.c +++ b/sched/sched/sched_thistask.c @@ -79,7 +79,7 @@ FAR struct tcb_s *this_task(void) #else /* Enter a critical section */ - flags = enter_critical_section(); + //flags = enter_critical_section(); #endif /* Obtain the TCB which is currently running on this CPU */ @@ -91,7 +91,7 @@ FAR struct tcb_s *this_task(void) #ifdef CONFIG_ARCH_GLOBAL_IRQDISABLE up_irq_restore(flags); #else - leave_critical_section(flags); + //leave_critical_section(flags); #endif return tcb; } -- GitLab From cbd8fa31d1cc8a102dedacd0f3e8b7b54dab029f Mon Sep 17 00:00:00 2001 From: Michael Jung Date: Mon, 5 Feb 2018 06:35:40 -0600 Subject: [PATCH 168/228] configs/stm32f429i-disco: Separate SPI4 from MTD init. I was trying to attach a non-MTD peripheral to an STM32F429I Discovery Board's SPI4 port and was hitting compilation problems, since CONFIG_MTD and thus 'struct mtd_geometry_s' was not defined. This patch separates SPI4 initialization logic from MTD initialization logic. --- configs/stm32f429i-disco/src/stm32_bringup.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configs/stm32f429i-disco/src/stm32_bringup.c b/configs/stm32f429i-disco/src/stm32_bringup.c index 821ddeb199..3ec0651fe9 100644 --- a/configs/stm32f429i-disco/src/stm32_bringup.c +++ b/configs/stm32f429i-disco/src/stm32_bringup.c @@ -103,6 +103,8 @@ int stm32_bringup(void) { #if defined(CONFIG_STM32_SPI4) FAR struct spi_dev_s *spi; +#endif +#if defined(CONFIG_MTD) FAR struct mtd_dev_s *mtd; FAR struct mtd_geometry_s geo; #endif -- GitLab From 8a48031615efd39684b3107897545635e2c5e264 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 5 Feb 2018 07:58:00 -0600 Subject: [PATCH 169/228] Update some comments --- sched/sched/sched_lock.c | 2 +- sched/sched/sched_unlock.c | 2 +- sched/semaphore/spinlock.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sched/sched/sched_lock.c b/sched/sched/sched_lock.c index a7a55ac264..e7cd1016b7 100644 --- a/sched/sched/sched_lock.c +++ b/sched/sched/sched_lock.c @@ -151,7 +151,7 @@ int sched_lock(void) if (rtcb && !up_interrupt_context()) { - /* Catch attempts to increment the lockcount beyound the range of the + /* Catch attempts to increment the lockcount beyond the range of the * integer type. */ diff --git a/sched/sched/sched_unlock.c b/sched/sched/sched_unlock.c index df05975f50..e29cc1d906 100644 --- a/sched/sched/sched_unlock.c +++ b/sched/sched/sched_unlock.c @@ -101,7 +101,7 @@ int sched_unlock(void) if (rtcb->lockcount <= 0) { #ifdef CONFIG_SCHED_INSTRUMENTATION_PREEMPTION - /* Note that we no longer have pre-emption */ + /* Note that we no longer have pre-emption disabled. */ sched_note_premption(rtcb, false); #endif diff --git a/sched/semaphore/spinlock.c b/sched/semaphore/spinlock.c index 2d667c0ed3..6d58dfcc3c 100644 --- a/sched/semaphore/spinlock.c +++ b/sched/semaphore/spinlock.c @@ -468,7 +468,7 @@ void spin_setbit(FAR volatile cpu_set_t *set, unsigned int cpu, irqstate_t flags; /* Disable local interrupts to prevent being re-entered from an interrupt - * on the same CPU. This does not effect the behavior on other CPUs. + * on the same CPU. This may not effect interrupt behavior on other CPUs. */ flags = up_irq_save(); @@ -527,7 +527,7 @@ void spin_clrbit(FAR volatile cpu_set_t *set, unsigned int cpu, irqstate_t flags; /* Disable local interrupts to prevent being re-entered from an interrupt - * on the same CPU. This does not effect the behavior on other CPUs. + * on the same CPU. This may not effect interrupt behavior on other CPUs. */ flags = up_irq_save(); -- GitLab From f51693e36aede710a5945b7387ff3726f1bc8a0c Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 5 Feb 2018 08:31:21 -0600 Subject: [PATCH 170/228] sched/sched: Clean up some logic that I committed yesterday. Add more comments and conditional logic to clarify the issues. --- sched/sched/Make.defs | 2 ++ sched/sched/sched.h | 11 ++++++++++- sched/sched/sched_thistask.c | 19 +++++++++++-------- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/sched/sched/Make.defs b/sched/sched/Make.defs index 7bacba7b0f..e8a67b961a 100644 --- a/sched/sched/Make.defs +++ b/sched/sched/Make.defs @@ -100,8 +100,10 @@ endif ifeq ($(CONFIG_SMP),y) CSRCS += sched_tasklistlock.c +ifeq ($(CONFIG_ARCH_GLOBAL_IRQDISABLE),y) CSRCS += sched_thistask.c endif +endif # Include sched build support diff --git a/sched/sched/sched.h b/sched/sched/sched.h index cad10c8d94..b5ccb7b48b 100644 --- a/sched/sched/sched.h +++ b/sched/sched/sched.h @@ -72,12 +72,19 @@ /* These are macros to access the current CPU and the current task on a CPU. * These macros are intended to support a future SMP implementation. - * NOTE: this_task() for SMP is implemented in sched_thistask.c + * NOTE: this_task() for SMP is implemented in sched_thistask.c if the CPU + * supports disabling of inter-processor interrupts. + * + * REVISIT: A mechanism to provide an atomic this_task() is still required + * for the case where where inter-processor interrupts cannot be disabled! */ #ifdef CONFIG_SMP # define current_task(cpu) ((FAR struct tcb_s *)g_assignedtasks[cpu].head) # define this_cpu() up_cpu_index() +# ifndef CONFIG_ARCH_GLOBAL_IRQDISABLE +# define this_task() (current_task(this_cpu())) +# endif #else # define current_task(cpu) ((FAR struct tcb_s *)g_readytorun.head) # define this_cpu() (0) @@ -428,7 +435,9 @@ void sched_sporadic_lowpriority(FAR struct tcb_s *tcb); #endif #ifdef CONFIG_SMP +#ifdef CONFIG_ARCH_GLOBAL_IRQDISABLE FAR struct tcb_s *this_task(void); +#endif int sched_cpu_select(cpu_set_t affinity); int sched_cpu_pause(FAR struct tcb_s *tcb); diff --git a/sched/sched/sched_thistask.c b/sched/sched/sched_thistask.c index 1c0584db06..d7d17cb9e8 100644 --- a/sched/sched/sched_thistask.c +++ b/sched/sched/sched_thistask.c @@ -69,17 +69,22 @@ FAR struct tcb_s *this_task(void) { - irqstate_t flags; FAR struct tcb_s *tcb; - #ifdef CONFIG_ARCH_GLOBAL_IRQDISABLE - /* Disable local interrupts to avoid CPU switching */ + irqstate_t flags; + + /* If the CPU supports suppression of interprocessor interrupts, then simple + * disabling interrupts will provide sufficient protection for the following + * operations. + */ flags = up_irq_save(); #else - /* Enter a critical section */ - - //flags = enter_critical_section(); + /* REVISIT: Otherwise, there is no protection available. sched_lock() and + * enter_critical section are not viable options here (because both depend + * on this_task()). + */ +# warning "Missing critical section" #endif /* Obtain the TCB which is currently running on this CPU */ @@ -90,8 +95,6 @@ FAR struct tcb_s *this_task(void) #ifdef CONFIG_ARCH_GLOBAL_IRQDISABLE up_irq_restore(flags); -#else - //leave_critical_section(flags); #endif return tcb; } -- GitLab From 37c9b3d54aa82272d9d85a8f7294b53fd8842d43 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 5 Feb 2018 13:12:36 -0600 Subject: [PATCH 171/228] sched/sched: Implements a global scheduler lock capability as part of SMP support. This allows the scheduler to be locked with no knowledge or access to the TCB of the currently running task. This is necessary because accessing the TCB of the currenlty running task is, itself, a non-atomic operation. This global scheduler lock cpability was add just to support that atomic access to the TCB. --- include/nuttx/arch.h | 12 +-- sched/irq/irq_csection.c | 16 ++- sched/sched/Make.defs | 4 +- sched/sched/sched.h | 35 ++++-- sched/sched/sched_addreadytorun.c | 9 +- sched/sched/sched_lock.c | 85 +++++++++++++-- sched/sched/sched_mergepending.c | 4 +- sched/sched/sched_removereadytorun.c | 2 +- sched/sched/sched_roundrobin.c | 2 +- sched/sched/sched_setpriority.c | 2 +- sched/sched/sched_sporadic.c | 6 +- sched/sched/sched_thistask.c | 14 ++- sched/sched/sched_unlock.c | 153 +++++++++++++++++++++++---- 13 files changed, 280 insertions(+), 64 deletions(-) diff --git a/include/nuttx/arch.h b/include/nuttx/arch.h index b5ec933ac0..b1266c0a2e 100644 --- a/include/nuttx/arch.h +++ b/include/nuttx/arch.h @@ -1705,9 +1705,9 @@ int up_timer_start(FAR const struct timespec *ts); ****************************************************************************/ #ifdef CONFIG_ARCH_HAVE_FETCHADD -int32_t up_fetchadd32(FAR int32_t *addr, int32_t value); -int16_t up_fetchadd16(FAR int16_t *addr, int16_t value); -int8_t up_fetchadd8(FAR int8_t *addr, int8_t value); +int32_t up_fetchadd32(FAR volatile int32_t *addr, int32_t value); +int16_t up_fetchadd16(FAR volatile int16_t *addr, int16_t value); +int8_t up_fetchadd8(FAR volatile int8_t *addr, int8_t value); #endif /**************************************************************************** @@ -1729,9 +1729,9 @@ int8_t up_fetchadd8(FAR int8_t *addr, int8_t value); ****************************************************************************/ #ifdef CONFIG_ARCH_HAVE_FETCHADD -int32_t up_fetchsub32(FAR int32_t *addr, int32_t value); -int16_t up_fetchsub16(FAR int16_t *addr, int16_t value); -int8_t up_fetchsub8(FAR int8_t *addr, int8_t value); +int32_t up_fetchsub32(FAR volatile int32_t *addr, int32_t value); +int16_t up_fetchsub16(FAR volatile int16_t *addr, int16_t value); +int8_t up_fetchsub8(FAR volatile int8_t *addr, int8_t value); #endif /**************************************************************************** diff --git a/sched/irq/irq_csection.c b/sched/irq/irq_csection.c index ca75810ca0..a688b8b44c 100644 --- a/sched/irq/irq_csection.c +++ b/sched/irq/irq_csection.c @@ -1,7 +1,7 @@ /**************************************************************************** * sched/irq/irq_csection.c * - * Copyright (C) 2016-2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2016-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -506,7 +506,7 @@ void leave_critical_section(irqstate_t flags) */ cpu = this_cpu(); - DEBUGASSERT(spin_islocked(&g_cpu_irqlock) && + DEBUGASSERT(sched_islocked_global() && (g_cpu_irqset & (1 << cpu)) != 0); /* Check if releasing the lock held by this CPU will unlock the @@ -521,8 +521,7 @@ void leave_critical_section(irqstate_t flags) * because we were within a critical section then. */ - if (g_pendingtasks.head != NULL && - !spin_islocked(&g_cpu_schedlock)) + if (g_pendingtasks.head != NULL && !sched_islocked_global()) { /* Release any ready-to-run tasks that have collected * in g_pendingtasks. NOTE: This operation has a very @@ -616,6 +615,15 @@ bool irq_cpu_locked(int cpu) return false; } +#ifdef CONFIG_ARCH_HAVE_FETCHADD + /* If the global lockcount has been incremented then simply return true */ + + if (g_global_lockcount > 0) + { + return true; + } +#endif + /* Test if g_cpu_irqlock is locked. We don't really need to use check * g_cpu_irqlock to do this, we can use the g_cpu_set. * diff --git a/sched/sched/Make.defs b/sched/sched/Make.defs index e8a67b961a..49056289ad 100644 --- a/sched/sched/Make.defs +++ b/sched/sched/Make.defs @@ -1,7 +1,7 @@ ############################################################################ # sched/sched/Make.defs # -# Copyright (C) 2014 Gregory Nutt. All rights reserved. +# Copyright (C) 2014, 2018 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -102,6 +102,8 @@ ifeq ($(CONFIG_SMP),y) CSRCS += sched_tasklistlock.c ifeq ($(CONFIG_ARCH_GLOBAL_IRQDISABLE),y) CSRCS += sched_thistask.c +else ifeq ($(CONFIG_ARCH_HAVE_FETCHADD),y) +CSRCS += sched_thistask.c endif endif diff --git a/sched/sched/sched.h b/sched/sched/sched.h index b5ccb7b48b..0c1c681e9e 100644 --- a/sched/sched/sched.h +++ b/sched/sched/sched.h @@ -73,16 +73,14 @@ /* These are macros to access the current CPU and the current task on a CPU. * These macros are intended to support a future SMP implementation. * NOTE: this_task() for SMP is implemented in sched_thistask.c if the CPU - * supports disabling of inter-processor interrupts. - * - * REVISIT: A mechanism to provide an atomic this_task() is still required - * for the case where where inter-processor interrupts cannot be disabled! + * supports disabling of inter-processor interrupts or if it supports the + * atomic fetch add operation. */ #ifdef CONFIG_SMP # define current_task(cpu) ((FAR struct tcb_s *)g_assignedtasks[cpu].head) # define this_cpu() up_cpu_index() -# ifndef CONFIG_ARCH_GLOBAL_IRQDISABLE +# if !defined(CONFIG_ARCH_GLOBAL_IRQDISABLE) && !defined(CONFIG_ARCH_HAVE_FETCHADD) # define this_task() (current_task(this_cpu())) # endif #else @@ -376,6 +374,14 @@ extern volatile cpu_set_t g_cpu_lockset SP_SECTION; extern volatile spinlock_t g_cpu_tasklistlock SP_SECTION; +#ifdef CONFIG_ARCH_HAVE_FETCHADD +/* This is part of the sched_lock() logic to handle atomic operations when + * locking the scheduler. + */ + +extern volatile int16_t g_global_lockcount; +#endif + #endif /* CONFIG_SMP */ /**************************************************************************** @@ -435,7 +441,7 @@ void sched_sporadic_lowpriority(FAR struct tcb_s *tcb); #endif #ifdef CONFIG_SMP -#ifdef CONFIG_ARCH_GLOBAL_IRQDISABLE +#if defined(CONFIG_ARCH_GLOBAL_IRQDISABLE) || defined(CONFIG_ARCH_HAVE_FETCHADD) FAR struct tcb_s *this_task(void); #endif @@ -445,11 +451,20 @@ int sched_cpu_pause(FAR struct tcb_s *tcb); irqstate_t sched_tasklist_lock(void); void sched_tasklist_unlock(irqstate_t lock); -# define sched_islocked(tcb) spin_islocked(&g_cpu_schedlock) +#ifdef CONFIG_ARCH_HAVE_FETCHADD +# define sched_islocked_global() \ + (spin_islocked(&g_cpu_schedlock) || g_global_lockcount > 0) +#else +# define sched_islocked_global() \ + spin_islocked(&g_cpu_schedlock) +#endif + +# define sched_islocked_tcb(tcb) sched_islocked_global() + #else -# define sched_cpu_select(a) (0) -# define sched_cpu_pause(t) (-38) /* -ENOSYS */ -# define sched_islocked(tcb) ((tcb)->lockcount > 0) +# define sched_cpu_select(a) (0) +# define sched_cpu_pause(t) (-38) /* -ENOSYS */ +# define sched_islocked_tcb(tcb) ((tcb)->lockcount > 0) #endif /* CPU load measurement support */ diff --git a/sched/sched/sched_addreadytorun.c b/sched/sched/sched_addreadytorun.c index 2f5a7704c9..e24fa2471e 100644 --- a/sched/sched/sched_addreadytorun.c +++ b/sched/sched/sched_addreadytorun.c @@ -1,7 +1,8 @@ /**************************************************************************** * sched/sched/sched_addreadytorun.c * - * Copyright (C) 2007-2009, 2014, 2016-2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2014, 2016-2018 Gregory Nutt. All rights + * reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -194,7 +195,7 @@ bool sched_addreadytorun(FAR struct tcb_s *btcb) cpu = sched_cpu_select(btcb->affinity); } - /* Get the task currently running on the CPU (maybe the IDLE task) */ + /* Get the task currently running on the CPU (may be the IDLE task) */ rtcb = (FAR struct tcb_s *)g_assignedtasks[cpu].head; @@ -240,7 +241,7 @@ bool sched_addreadytorun(FAR struct tcb_s *btcb) */ me = this_cpu(); - if ((spin_islocked(&g_cpu_schedlock) || irq_cpu_locked(me)) && + if ((sched_islocked_global() || irq_cpu_locked(me)) && task_state != TSTATE_TASK_ASSIGNED) { /* Add the new ready-to-run task to the g_pendingtasks task list for @@ -387,7 +388,7 @@ bool sched_addreadytorun(FAR struct tcb_s *btcb) * different CPU the next time that it runs. */ - if (spin_islocked(&g_cpu_schedlock)) + if (sched_islocked_global()) { next->task_state = TSTATE_TASK_PENDING; tasklist = (FAR dq_queue_t *)&g_pendingtasks; diff --git a/sched/sched/sched_lock.c b/sched/sched/sched_lock.c index e7cd1016b7..3722e4a3a1 100644 --- a/sched/sched/sched_lock.c +++ b/sched/sched/sched_lock.c @@ -1,7 +1,7 @@ /**************************************************************************** * sched/sched/sched_lock.c * - * Copyright (C) 2007, 2009, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2009, 2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -116,6 +116,13 @@ volatile spinlock_t g_cpu_schedlock SP_SECTION = SP_UNLOCKED; volatile spinlock_t g_cpu_locksetlock SP_SECTION; volatile cpu_set_t g_cpu_lockset SP_SECTION; +#ifdef CONFIG_ARCH_HAVE_FETCHADD +/* This is part of the sched_lock() logic to handle atomic operations when + * locking the scheduler. + */ + +volatile int16_t g_global_lockcount; +#endif #endif /* CONFIG_SMP */ /**************************************************************************** @@ -140,16 +147,32 @@ volatile cpu_set_t g_cpu_lockset SP_SECTION; * ****************************************************************************/ +#ifdef CONFIG_SMP + int sched_lock(void) { - FAR struct tcb_s *rtcb = this_task(); + FAR struct tcb_s *rtcb; + int cpu; - /* Check for some special cases: (1) rtcb may be NULL only during early - * boot-up phases, and (2) sched_lock() should have no effect if called - * from the interrupt level. + /* The following operation is non-atomic unless CONFIG_ARCH_HAVE_FETCHADD + * defined. */ - if (rtcb && !up_interrupt_context()) +#ifdef CONFIG_ARCH_HAVE_FETCHADD + DEBUGASSERT((uint16_t)g_global_lockcount < INT16_MAX); /* Not atomic! */ + (void)up_fetchadd16(&g_global_lockcount, 1); +#endif + + /* This operation is save if CONFIG_ARCH_HAVE_FETCHADD is defined. NOTE + * we cannot use this_task() because it calls sched_lock(). + */ + + cpu = this_cpu(); + rtcb = current_task(cpu); + + /* rtcb may be NULL only during early boot-up phases. */ + + if (rtcb != NULL) { /* Catch attempts to increment the lockcount beyond the range of the * integer type. @@ -157,7 +180,6 @@ int sched_lock(void) DEBUGASSERT(rtcb->lockcount < MAX_LOCK_COUNT); -#ifdef CONFIG_SMP /* We must hold the lock on this CPU before we increment the lockcount * for the first time. Holding the lock is sufficient to lockout context * switching. @@ -184,7 +206,6 @@ int sched_lock(void) DEBUGASSERT(g_cpu_schedlock == SP_LOCKED && (g_cpu_lockset & (1 << this_cpu())) != 0); } -#endif /* A counter is used to support locking. This allows nested lock * operations on this thread (on any CPU) @@ -192,7 +213,6 @@ int sched_lock(void) rtcb->lockcount++; - #ifdef CONFIG_SCHED_INSTRUMENTATION_PREEMPTION /* Check if we just acquired the lock */ @@ -204,7 +224,6 @@ int sched_lock(void) } #endif -#ifdef CONFIG_SMP /* Move any tasks in the ready-to-run list to the pending task list * where they will not be available to run until the scheduler is * unlocked and sched_mergepending() is called. @@ -213,8 +232,54 @@ int sched_lock(void) sched_mergeprioritized((FAR dq_queue_t *)&g_readytorun, (FAR dq_queue_t *)&g_pendingtasks, TSTATE_TASK_PENDING); + } + +#ifdef CONFIG_ARCH_HAVE_FETCHADD + DEBUGASSERT(g_global_lockcount > 0); + (void)up_fetchsub16(&g_global_lockcount, 1); +#endif + + return OK; +} + +#else /* CONFIG_SMP */ + +int sched_lock(void) +{ + FAR struct tcb_s *rtcb = this_task(); + + /* Check for some special cases: (1) rtcb may be NULL only during early + * boot-up phases, and (2) sched_lock() should have no effect if called + * from the interrupt level. + */ + + if (rtcb != NULL && !up_interrupt_context()) + { + /* Catch attempts to increment the lockcount beyond the range of the + * integer type. + */ + + DEBUGASSERT(rtcb->lockcount < MAX_LOCK_COUNT); + + /* A counter is used to support locking. This allows nested lock + * operations on this thread (on any CPU) + */ + + rtcb->lockcount++; + +#ifdef CONFIG_SCHED_INSTRUMENTATION_PREEMPTION + /* Check if we just acquired the lock */ + + if (rtcb->lockcount == 1) + { + /* Note that we have pre-emption locked */ + + sched_note_premption(rtcb, true); + } #endif } return OK; } + +#endif /* CONFIG_SMP */ diff --git a/sched/sched/sched_mergepending.c b/sched/sched/sched_mergepending.c index 826a0e7833..8a90d41770 100644 --- a/sched/sched/sched_mergepending.c +++ b/sched/sched/sched_mergepending.c @@ -210,7 +210,7 @@ bool sched_mergepending(void) */ me = this_cpu(); - if (!spin_islocked(&g_cpu_schedlock) && !irq_cpu_locked(me)) + if (!sched_islocked_global() && !irq_cpu_locked(me)) { /* Find the CPU that is executing the lowest priority task */ @@ -248,7 +248,7 @@ bool sched_mergepending(void) * Check if that happened. */ - if (spin_islocked(&g_cpu_schedlock) || irq_cpu_locked(me)) + if (sched_islocked_global() || irq_cpu_locked(me)) { /* Yes.. then we may have incorrectly placed some TCBs in the * g_readytorun list (unlikely, but possible). We will have to diff --git a/sched/sched/sched_removereadytorun.c b/sched/sched/sched_removereadytorun.c index 78919d4989..da4c24a352 100644 --- a/sched/sched/sched_removereadytorun.c +++ b/sched/sched/sched_removereadytorun.c @@ -208,7 +208,7 @@ bool sched_removereadytorun(FAR struct tcb_s *rtcb) * REVISIT: What if it is not the IDLE thread? */ - if (!spin_islocked(&g_cpu_schedlock) && !irq_cpu_locked(me)) + if (!sched_islocked_global() && !irq_cpu_locked(me)) { /* Search for the highest priority task that can run on this * CPU. diff --git a/sched/sched/sched_roundrobin.c b/sched/sched/sched_roundrobin.c index 798b4265cf..e19c6377ee 100644 --- a/sched/sched/sched_roundrobin.c +++ b/sched/sched/sched_roundrobin.c @@ -121,7 +121,7 @@ uint32_t sched_roundrobin_process(FAR struct tcb_s *tcb, uint32_t ticks, /* Did decrementing the timeslice counter cause the timeslice to expire? */ ret = tcb->timeslice; - if (tcb->timeslice <= 0 && !sched_islocked(tcb)) + if (tcb->timeslice <= 0 && !sched_islocked_tcb(tcb)) { /* We will also suppress context switches if we were called via one * of the unusual cases handled by sched_timer_reasses(). In that diff --git a/sched/sched/sched_setpriority.c b/sched/sched/sched_setpriority.c index ead70de4fd..d52adb286b 100644 --- a/sched/sched/sched_setpriority.c +++ b/sched/sched/sched_setpriority.c @@ -83,7 +83,7 @@ static FAR struct tcb_s *sched_nexttcb(FAR struct tcb_s *tcb) * then use the 'nxttcb' which will probably be the IDLE thread. */ - if (!spin_islocked(&g_cpu_schedlock) && !irq_cpu_locked(cpu)) + if (!sched_islocked_global() && !irq_cpu_locked(cpu)) { /* Search for the highest priority task that can run on this CPU. */ diff --git a/sched/sched/sched_sporadic.c b/sched/sched/sched_sporadic.c index 8b55a3fce0..d78faaa031 100644 --- a/sched/sched/sched_sporadic.c +++ b/sched/sched/sched_sporadic.c @@ -475,7 +475,7 @@ static void sporadic_budget_expire(int argc, wdparm_t arg1, ...) * this operation is needed. */ - if (sched_islocked(tcb)) + if (sched_islocked_tcb(tcb)) { DEBUGASSERT((mrepl->flags && SPORADIC_FLAG_ALLOCED) != 0 && sporadic->nrepls > 0); @@ -623,7 +623,7 @@ static void sporadic_replenish_expire(int argc, wdparm_t arg1, ...) * this operation is needed. */ - if (sched_islocked(tcb)) + if (sched_islocked_tcb(tcb)) { /* Set the timeslice to the magic value */ @@ -1222,7 +1222,7 @@ uint32_t sched_sporadic_process(FAR struct tcb_s *tcb, uint32_t ticks, /* Does the thread have the scheduler locked? */ sporadic = tcb->sporadic; - if (sched_islocked(tcb)) + if (sched_islocked_tcb(tcb)) { /* Yes... then we have no option but to give the thread more * time at the higher priority. Dropping the priority could diff --git a/sched/sched/sched_thistask.c b/sched/sched/sched_thistask.c index d7d17cb9e8..c1471dfaa5 100644 --- a/sched/sched/sched_thistask.c +++ b/sched/sched/sched_thistask.c @@ -39,12 +39,12 @@ ****************************************************************************/ #include -#include #include #include #include +#include #include "sched/sched.h" @@ -70,7 +70,7 @@ FAR struct tcb_s *this_task(void) { FAR struct tcb_s *tcb; -#ifdef CONFIG_ARCH_GLOBAL_IRQDISABLE +#if defined(CONFIG_ARCH_GLOBAL_IRQDISABLE) irqstate_t flags; /* If the CPU supports suppression of interprocessor interrupts, then simple @@ -79,6 +79,12 @@ FAR struct tcb_s *this_task(void) */ flags = up_irq_save(); +#elif defined(CONFIG_ARCH_HAVE_FETCHADD) + /* Global locking is supported and, hence, sched_lock() will provide the + * necessary protection. + */ + + sched_lock(); #else /* REVISIT: Otherwise, there is no protection available. sched_lock() and * enter_critical section are not viable options here (because both depend @@ -93,8 +99,10 @@ FAR struct tcb_s *this_task(void) /* Enable local interrupts */ -#ifdef CONFIG_ARCH_GLOBAL_IRQDISABLE +#if defined(CONFIG_ARCH_GLOBAL_IRQDISABLE) up_irq_restore(flags); +#elif defined(CONFIG_ARCH_HAVE_FETCHADD) + sched_unlock(); #endif return tcb; } diff --git a/sched/sched/sched_unlock.c b/sched/sched/sched_unlock.c index e29cc1d906..7e95346ba1 100644 --- a/sched/sched/sched_unlock.c +++ b/sched/sched/sched_unlock.c @@ -1,7 +1,8 @@ /**************************************************************************** * sched/sched/sched_unlock.c * - * Copyright (C) 2007, 2009, 2014, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2009, 2014, 2016, 2018 Gregory Nutt. All rights + * reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -64,24 +65,23 @@ * ****************************************************************************/ +#ifdef CONFIG_SMP + int sched_unlock(void) { - FAR struct tcb_s *rtcb = this_task(); -#ifdef CONFIG_SMP + FAR struct tcb_s *rtcb; int cpu; + /* This operation is safe because the scheduler is locked and no context + * switch may occur. + */ + cpu = this_cpu(); rtcb = current_task(cpu); -#else - rtcb = this_task(); -#endif - /* Check for some special cases: (1) rtcb may be NULL only during - * early boot-up phases, and (2) sched_unlock() should have no - * effect if called from the interrupt level. - */ + /* rtcb may be NULL only during early boot-up phases. */ - if (rtcb && !up_interrupt_context()) + if (rtcb != NULL) { /* Prevent context switches throughout the following. */ @@ -109,7 +109,6 @@ int sched_unlock(void) rtcb->lockcount = 0; -#ifdef CONFIG_SMP /* The lockcount has decremented to zero and we need to perform * release our hold on the lock. */ @@ -119,7 +118,6 @@ int sched_unlock(void) spin_clrbit(&g_cpu_lockset, cpu, &g_cpu_locksetlock, &g_cpu_schedlock); -#endif /* Release any ready-to-run tasks that have collected in * g_pendingtasks. @@ -128,7 +126,6 @@ int sched_unlock(void) * this task to be switched out! */ -#ifdef CONFIG_SMP /* In the SMP case, the tasks remains pend(1) if we are * in a critical section, i.e., g_cpu_irqlock is locked by other * CPUs, or (2) other CPUs still have pre-emption disabled, i.e., @@ -147,17 +144,135 @@ int sched_unlock(void) * BEFORE it clears IRQ lock. */ - if (!spin_islocked(&g_cpu_schedlock) && !irq_cpu_locked(cpu) && + if (!sched_islocked_global() && !irq_cpu_locked(cpu) && g_pendingtasks.head != NULL) -#else - /* In the single CPU case, decrementing irqcount to zero is + { + up_release_pending(); + } + +#if CONFIG_RR_INTERVAL > 0 + /* If (1) the task that was running supported round-robin + * scheduling and (2) if its time slice has already expired, but + * (3) it could not slice out because pre-emption was disabled, + * then we need to swap the task out now and reassess the interval + * timer for the next time slice. + */ + + if ((rtcb->flags & TCB_FLAG_POLICY_MASK) == TCB_FLAG_SCHED_RR && + rtcb->timeslice == 0) + { + /* Yes.. that is the situation. But one more thing. The call + * to up_release_pending() above may have actually replaced + * the task at the head of the read-to-run list. In that case, + * we need only to reset the timeslice value back to the + * maximum. + */ + + if (rtcb != this_task()) + { + rtcb->timeslice = MSEC2TICK(CONFIG_RR_INTERVAL); + } +#ifdef CONFIG_SCHED_TICKLESS + else + { + sched_timer_reassess(); + } +#endif + } +#endif + +#ifdef CONFIG_SCHED_SPORADIC +#if CONFIG_RR_INTERVAL > 0 + else +#endif + /* If (1) the task that was running supported sporadic scheduling + * and (2) if its budget slice has already expired, but (3) it + * could not slice out because pre-emption was disabled, then we + * need to swap the task out now and reassess the interval timer + * for the next time slice. + */ + + if ((rtcb->flags & TCB_FLAG_POLICY_MASK) == TCB_FLAG_SCHED_SPORADIC && + rtcb->timeslice < 0) + { + /* Yes.. that is the situation. Force the low-priority state + * now + */ + + sched_sporadic_lowpriority(rtcb); + +#ifdef CONFIG_SCHED_TICKLESS + /* Make sure that the call to up_release_pending() did not + * change the currently active task. + */ + + if (rtcb == this_task()) + { + sched_timer_reassess(); + } +#endif + } +#endif + } + + leave_critical_section(flags); + } + + return OK; +} + +#else /* CONFIG_SMP */ + +int sched_unlock(void) +{ + FAR struct tcb_s *rtcb = this_task(); + + /* Check for some special cases: (1) rtcb may be NULL only during + * early boot-up phases, and (2) sched_unlock() should have no + * effect if called from the interrupt level. + */ + + if (rtcb != NULL && !up_interrupt_context()) + { + /* Prevent context switches throughout the following. */ + + irqstate_t flags = enter_critical_section(); + + /* Decrement the preemption lock counter */ + + if (rtcb->lockcount > 0) + { + rtcb->lockcount--; + } + + /* Check if the lock counter has decremented to zero. If so, + * then pre-emption has been re-enabled. + */ + + if (rtcb->lockcount <= 0) + { +#ifdef CONFIG_SCHED_INSTRUMENTATION_PREEMPTION + /* Note that we no longer have pre-emption disabled. */ + + sched_note_premption(rtcb, false); +#endif + /* Set the lock count to zero */ + + rtcb->lockcount = 0; + + /* Release any ready-to-run tasks that have collected in + * g_pendingtasks. + * + * NOTE: This operation has a very high likelihood of causing + * this task to be switched out! + * + * In the single CPU case, decrementing irqcount to zero is * sufficient to release the pending tasks. Further, in that * configuration, critical sections and pre-emption can operate * fully independently. */ if (g_pendingtasks.head != NULL) -#endif { up_release_pending(); } @@ -232,3 +347,5 @@ int sched_unlock(void) return OK; } + +#endif /* CONFIG_SMP */ -- GitLab From b884fb9fedb33ae4dcbf197e232e5d9d388d4f18 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 5 Feb 2018 13:32:09 -0600 Subject: [PATCH 172/228] sched/sched: Extend the last global lock change to work with the lc823450-xgevk which does not support the atomic fetch add but does support disabling interprocessor interrupts. Disabling interprocessor interrupts will also guarantee that the TCB addres calculation is atomic. --- sched/irq/irq_csection.c | 2 +- sched/sched/sched.h | 4 ++-- sched/sched/sched_lock.c | 38 +++++++++++++++++++++++++++++--------- 3 files changed, 32 insertions(+), 12 deletions(-) diff --git a/sched/irq/irq_csection.c b/sched/irq/irq_csection.c index a688b8b44c..bc32f37f8e 100644 --- a/sched/irq/irq_csection.c +++ b/sched/irq/irq_csection.c @@ -615,7 +615,7 @@ bool irq_cpu_locked(int cpu) return false; } -#ifdef CONFIG_ARCH_HAVE_FETCHADD +#if defined(CONFIG_ARCH_HAVE_FETCHADD) && !defined(CONFIG_ARCH_GLOBAL_IRQDISABLE) /* If the global lockcount has been incremented then simply return true */ if (g_global_lockcount > 0) diff --git a/sched/sched/sched.h b/sched/sched/sched.h index 0c1c681e9e..dca36d1f6c 100644 --- a/sched/sched/sched.h +++ b/sched/sched/sched.h @@ -374,7 +374,7 @@ extern volatile cpu_set_t g_cpu_lockset SP_SECTION; extern volatile spinlock_t g_cpu_tasklistlock SP_SECTION; -#ifdef CONFIG_ARCH_HAVE_FETCHADD +#if defined(CONFIG_ARCH_HAVE_FETCHADD) && !defined(CONFIG_ARCH_GLOBAL_IRQDISABLE) /* This is part of the sched_lock() logic to handle atomic operations when * locking the scheduler. */ @@ -451,7 +451,7 @@ int sched_cpu_pause(FAR struct tcb_s *tcb); irqstate_t sched_tasklist_lock(void); void sched_tasklist_unlock(irqstate_t lock); -#ifdef CONFIG_ARCH_HAVE_FETCHADD +#if defined(CONFIG_ARCH_HAVE_FETCHADD) && !defined(CONFIG_ARCH_GLOBAL_IRQDISABLE) # define sched_islocked_global() \ (spin_islocked(&g_cpu_schedlock) || g_global_lockcount > 0) #else diff --git a/sched/sched/sched_lock.c b/sched/sched/sched_lock.c index 3722e4a3a1..1f2d3b9a15 100644 --- a/sched/sched/sched_lock.c +++ b/sched/sched/sched_lock.c @@ -43,6 +43,9 @@ #include #include +#include + +#include #include #include @@ -116,7 +119,7 @@ volatile spinlock_t g_cpu_schedlock SP_SECTION = SP_UNLOCKED; volatile spinlock_t g_cpu_locksetlock SP_SECTION; volatile cpu_set_t g_cpu_lockset SP_SECTION; -#ifdef CONFIG_ARCH_HAVE_FETCHADD +#if defined(CONFIG_ARCH_HAVE_FETCHADD) && !defined(CONFIG_ARCH_GLOBAL_IRQDISABLE) /* This is part of the sched_lock() logic to handle atomic operations when * locking the scheduler. */ @@ -152,15 +155,30 @@ volatile int16_t g_global_lockcount; int sched_lock(void) { FAR struct tcb_s *rtcb; +#if defined(CONFIG_ARCH_GLOBAL_IRQDISABLE) + irqstate_t flags; +#endif int cpu; - /* The following operation is non-atomic unless CONFIG_ARCH_HAVE_FETCHADD - * defined. + /* The following operation is non-atomic unless CONFIG_ARCH_GLOBAL_IRQDISABLE + * or CONFIG_ARCH_HAVE_FETCHADD is defined. + */ + +#if defined(CONFIG_ARCH_GLOBAL_IRQDISABLE) + /* If the CPU supports suppression of interprocessor interrupts, then simple + * disabling interrupts will provide sufficient protection for the following + * operation. + */ + + flags = up_irq_save(); + +#elif defined(CONFIG_ARCH_HAVE_FETCHADD) + /* If the CPU supports an atomic fetch add operation, then we can use the + * global lockcount to assure that the following operation is atomic. */ -#ifdef CONFIG_ARCH_HAVE_FETCHADD - DEBUGASSERT((uint16_t)g_global_lockcount < INT16_MAX); /* Not atomic! */ - (void)up_fetchadd16(&g_global_lockcount, 1); + DEBUGASSERT((uint16_t)g_global_lockcount < INT16_MAX); /* Not atomic! */ + (void)up_fetchadd16(&g_global_lockcount, 1); #endif /* This operation is save if CONFIG_ARCH_HAVE_FETCHADD is defined. NOTE @@ -234,9 +252,11 @@ int sched_lock(void) TSTATE_TASK_PENDING); } -#ifdef CONFIG_ARCH_HAVE_FETCHADD - DEBUGASSERT(g_global_lockcount > 0); - (void)up_fetchsub16(&g_global_lockcount, 1); +#if defined(CONFIG_ARCH_GLOBAL_IRQDISABLE) + up_irq_restore(flags); +#elif defined(CONFIG_ARCH_HAVE_FETCHADD) + DEBUGASSERT(g_global_lockcount > 0); + (void)up_fetchsub16(&g_global_lockcount, 1); #endif return OK; -- GitLab From 56bb76caca2204fd405dcc77a53ed24c3ab202cd Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 5 Feb 2018 21:13:42 -0600 Subject: [PATCH 173/228] sched/irq: Fix an error in a assertion introduced in commit 37c9b3d54aa82272d9d85a8f7294b53fd8842d43. Noted by Masayuki Ishikawa. --- sched/irq/irq_csection.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sched/irq/irq_csection.c b/sched/irq/irq_csection.c index bc32f37f8e..13697752dd 100644 --- a/sched/irq/irq_csection.c +++ b/sched/irq/irq_csection.c @@ -506,7 +506,7 @@ void leave_critical_section(irqstate_t flags) */ cpu = this_cpu(); - DEBUGASSERT(sched_islocked_global() && + DEBUGASSERT(spin_islocked(&g_cpu_irqlock) && (g_cpu_irqset & (1 << cpu)) != 0); /* Check if releasing the lock held by this CPU will unlock the -- GitLab From fb50c44d08057d2a804aea14e90738316f5f1f2f Mon Sep 17 00:00:00 2001 From: Alan Carvalho de Assis Date: Tue, 6 Feb 2018 09:13:16 -0600 Subject: [PATCH 174/228] Fix various issues noted by Coverity --- libc/semaphore/sem_getvalue.c | 2 +- net/tcp/tcp_send_buffered.c | 2 +- net/tcp/tcp_wrbuffer.c | 11 +++++++++-- sched/mqueue/mq_rcvinternal.c | 2 +- sched/pthread/pthread_getschedparam.c | 22 ++++++++++++---------- sched/pthread/pthread_mutexconsistent.c | 2 +- sched/sched/sched_setscheduler.c | 1 + wireless/ieee802154/ieee802154_primitive.c | 11 ++++++++--- 8 files changed, 34 insertions(+), 19 deletions(-) diff --git a/libc/semaphore/sem_getvalue.c b/libc/semaphore/sem_getvalue.c index d6da1ba4bf..bde910f16e 100644 --- a/libc/semaphore/sem_getvalue.c +++ b/libc/semaphore/sem_getvalue.c @@ -77,7 +77,7 @@ int nxsem_getvalue(FAR sem_t *sem, FAR int *sval) { - if (sem && sval) + if (sem != NULL && sval != NULL) { *sval = sem->semcount; return OK; diff --git a/net/tcp/tcp_send_buffered.c b/net/tcp/tcp_send_buffered.c index b8463b0643..9c6073aa3c 100644 --- a/net/tcp/tcp_send_buffered.c +++ b/net/tcp/tcp_send_buffered.c @@ -1174,7 +1174,7 @@ int psock_tcp_cansend(FAR struct socket *psock) return -ENOTCONN; } - if (tcp_wrbuffer_test()) + if (tcp_wrbuffer_test() < 0) { return -EWOULDBLOCK; } diff --git a/net/tcp/tcp_wrbuffer.c b/net/tcp/tcp_wrbuffer.c index 643d990708..9cd8e798b3 100644 --- a/net/tcp/tcp_wrbuffer.c +++ b/net/tcp/tcp_wrbuffer.c @@ -211,8 +211,15 @@ void tcp_wrbuffer_release(FAR struct tcp_wrbuffer_s *wrb) int tcp_wrbuffer_test(void) { int val = 0; - nxsem_getvalue(&g_wrbuffer.sem, &val); - return val > 0 ? OK : ERROR; + int ret; + + ret = nxsem_getvalue(&g_wrbuffer.sem, &val); + if (ret >= 0) + { + ret = val > 0 ? OK : -ENOSPC; + } + + return ret; } #endif /* CONFIG_NET && CONFIG_NET_TCP && CONFIG_NET_TCP_WRITE_BUFFERS */ diff --git a/sched/mqueue/mq_rcvinternal.c b/sched/mqueue/mq_rcvinternal.c index 78479314ff..00ab85e373 100644 --- a/sched/mqueue/mq_rcvinternal.c +++ b/sched/mqueue/mq_rcvinternal.c @@ -302,7 +302,7 @@ ssize_t nxmq_do_receive(mqd_t mqdes, FAR struct mqueue_msg_s *mqmsg, * time the task is unblocked */ - DEBUGASSERT(btcb); + DEBUGASSERT(btcb != NULL); btcb->msgwaitq = NULL; msgq->nwaitnotfull--; diff --git a/sched/pthread/pthread_getschedparam.c b/sched/pthread/pthread_getschedparam.c index fa3e030a45..64d4f86063 100644 --- a/sched/pthread/pthread_getschedparam.c +++ b/sched/pthread/pthread_getschedparam.c @@ -104,22 +104,24 @@ int pthread_getschedparam(pthread_t thread, FAR int *policy, /* Get the scheduler parameters of the thread. */ ret = nxsched_getparam((pid_t)thread, param); - if (ret < 0) - { - ret = -ret; - } - - /* Get the scheduler policy. */ - - ret = nxsched_getscheduler((pid_t)thread); if (ret < 0) { ret = -ret; } else { - *policy = ret; - ret = OK; + /* Get the scheduler policy. */ + + ret = nxsched_getscheduler((pid_t)thread); + if (ret < 0) + { + ret = -ret; + } + else + { + *policy = ret; + ret = OK; + } } } diff --git a/sched/pthread/pthread_mutexconsistent.c b/sched/pthread/pthread_mutexconsistent.c index eb37d1fb6d..d4b2b246a9 100644 --- a/sched/pthread/pthread_mutexconsistent.c +++ b/sched/pthread/pthread_mutexconsistent.c @@ -153,10 +153,10 @@ int pthread_mutex_consistent(FAR pthread_mutex_t *mutex) #ifdef CONFIG_PTHREAD_MUTEX_TYPES mutex->nlocks = 0; #endif + ret = OK; } sched_unlock(); - ret = OK; } sinfo("Returning %d\n", ret); diff --git a/sched/sched/sched_setscheduler.c b/sched/sched/sched_setscheduler.c index e2f733cfd6..2147ea8217 100644 --- a/sched/sched/sched_setscheduler.c +++ b/sched/sched/sched_setscheduler.c @@ -141,6 +141,7 @@ int nxsched_setscheduler(pid_t pid, int policy, { default: DEBUGPANIC(); + break; case SCHED_FIFO: { diff --git a/wireless/ieee802154/ieee802154_primitive.c b/wireless/ieee802154/ieee802154_primitive.c index 4b3e14d594..e13c4a3133 100644 --- a/wireless/ieee802154/ieee802154_primitive.c +++ b/wireless/ieee802154/ieee802154_primitive.c @@ -309,12 +309,17 @@ FAR struct ieee802154_primitive_s *ieee802154_primitive_allocate(void) /* Check if we allocated the primitive structure */ - if (prim != NULL) + if (prim == NULL) { - /* Yes... remember that this primitive structure was dynamically allocated */ + /* No.. memory not available */ - pool = POOL_PRIMITIVE_DYNAMIC; + wlerr("ERROR: Failed to allocate primitive.\n"); + return NULL; } + + /* Remember that this primitive structure was dynamically allocated */ + + pool = POOL_PRIMITIVE_DYNAMIC; } } -- GitLab From 0ba78530164814360eb09ed9805137b934c6f03b Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 6 Feb 2018 09:17:28 -0600 Subject: [PATCH 175/228] sched/irq: Fix a infinite recursion problem that a recent change introduced into the i.MX6 SMP implementation. --- configs/sabre-6quad/README.txt | 45 ++++++++++++++++++++++------------ sched/irq/irq_csection.c | 23 ++++++++++++----- 2 files changed, 46 insertions(+), 22 deletions(-) diff --git a/configs/sabre-6quad/README.txt b/configs/sabre-6quad/README.txt index 9d2b498107..482e07c542 100644 --- a/configs/sabre-6quad/README.txt +++ b/configs/sabre-6quad/README.txt @@ -115,11 +115,11 @@ Status 2016-11-28: SMP is unusable until the SCU cache coherency logic is fixed. I do not know how to do that now. -2016-12-01: I committed a completely untest SPI driver. This was taken +2016-12-01: I committed a completely untested SPI driver. This was taken directly from the i.MX1 and is most certainly not ready for use yet. 2016-12-07: Just a note to remind myself. The PL310 L2 cache has *not* - yet been enbled. + yet been enabled. Platform Features ================= @@ -329,7 +329,7 @@ could do would be put the nuttx.bin file on that partition, then boot like: MX6Q SABRESD U-Boot > fatload mmc 2:4 0x10800000 nuttx.bin SD Card Image Copy (Successful Attempt #5) -------------------------------------- +------------------------------------------ You can use the 'dd' command to copy the first couple of megabytes from the 8GB SD card and copy that to another SD card. You then have to use 'fdisk' @@ -386,7 +386,7 @@ Debugging the NuttX image on the SD card the terminal window. Stop the U-Boot countdown to get to the U-Boot prompt. -2. Start the Segger GDB server: +3. Start the Segger GDB server: Target: MCIMX6Q6 Target Interface: JTAG @@ -396,7 +396,7 @@ Debugging the NuttX image on the SD card Waiting for GDB Connection -3. In another Xterm terminal window, start arm-none-eabi-gdb and connect to +4. In another Xterm terminal window, start arm-none-eabi-gdb and connect to the GDB server. From the Xterm Window: @@ -409,7 +409,7 @@ Debugging the NuttX image on the SD card gdb> target connect localhost:2331 gdb> mon halt -4. Start U-boot under GDB control: +5. Start U-boot under GDB control: From GDB: gdb> mon reset @@ -417,12 +417,12 @@ Debugging the NuttX image on the SD card Again stop the U-Boot countdown to get to the U-Boot prompt. -5. Load NuttX from the SD card into RAM +6. Load NuttX from the SD card into RAM From U-Boot: MX6Q SABRESD U-Boot > fatload mmc 2:1 0x10800000 nuttx.bin -6. Load symbols and set a breakpoint +7. Load symbols and set a breakpoint From GDB: gdb> mon halt @@ -434,12 +434,12 @@ Debugging the NuttX image on the SD card of course, use a different symbol if you want to start debugging later in the boot sequence. -7. Start NuttX +8. Start NuttX From U-Boot: MX6Q SABRESD U-Boot > go 0x10800040 -8. You should hit the breakpoint that you set above and be off and +9. You should hit the breakpoint that you set above and be off and debugging. Debugging a Different NuttX Image @@ -449,10 +449,20 @@ Q: What if I want do run a different version of nuttx than the nuttx.bin file on the SD card. I just want to build and debug without futzing with the SD card. Can I do that? -A: Yes with the following modifications to the prodecure above. +A: Yes with the following modifications to the procedure above. - - Skip step 5, don't bother to load NuttX into RAM - - In step 6, load NuttX into RAM like this: + - Follow steps 1-5, i.e., + + 1. Connect the J-Link to the 20-pin JTAG connector. + 2. Connect the "USB TO UART" USB VCOM port to the host PC and start a + terminal emulation program. + 3. Start the Segger GDB server. + 4. Start arm-none-eabi-gdb and connect to the GDB server. + 5. Start U-boot under GDB control, stopping the countdown to get + the U-boot prompt. + + - Skip step 6, don't bother to load NuttX into RAM + - In step 7, load NuttX into RAM like this: gdb> mon halt gdb> load nuttx <-- Loads NuttX into RAM at 0x010800000 @@ -469,14 +479,17 @@ A: Yes with the following modifications to the prodecure above. gdb> mon halt gdb> load nuttx <-- Loads NuttX into RAM at 0x010800000 gdb> file nuttx - gdb> mon set pc 0x10800040 + gdb> mon reg pc 0x10800040 gdb> s The final single will then step into the freshly loaded program. - You can then forget about steps 7 and 8. + You can then forget about steps 8 and 9. This is, in fact, my preferred way to debug. + NOTE: Setting the PC to 0x10800040 is a superstituous step. The PC + will be set 0x10800040 by the 'load nuttx' command. + You can restart the debug session at any time at the gdb> prompt by: gdb> mon reset @@ -665,7 +678,7 @@ Configuration sub-directories NOTES: - 1. See the notest for the nsh configuration. Since this configuration + 1. See the notes for the nsh configuration. Since this configuration is essentially the same all of those comments apply. 2. SMP is not fully functional. See the STATUS and SMP sections above diff --git a/sched/irq/irq_csection.c b/sched/irq/irq_csection.c index 13697752dd..2fdd82d313 100644 --- a/sched/irq/irq_csection.c +++ b/sched/irq/irq_csection.c @@ -123,7 +123,7 @@ volatile uint8_t g_cpu_nestcount[CONFIG_SMP_NCPUS]; static inline bool irq_waitlock(int cpu) { #ifdef CONFIG_SCHED_INSTRUMENTATION_SPINLOCKS - FAR struct tcb_s *tcb = this_task(); + FAR struct tcb_s *tcb = current_task(cpu); /* Notify that we are waiting for a spinlock */ @@ -309,11 +309,16 @@ try_again: else { /* Normal tasking environment. */ - /* Do we already have interrupts disabled? */ + /* Get the TCB of the currently executing task on this CPU (avoid + * using this_task() which can recurse. + */ - rtcb = this_task(); + cpu = this_cpu(); + rtcb = current_task(cpu); DEBUGASSERT(rtcb != NULL); + /* Do we already have interrupts disabled? */ + if (rtcb->irqcount > 0) { /* Yes... make sure that the spinlock is set and increment the @@ -463,7 +468,7 @@ void leave_critical_section(irqstate_t flags) DEBUGASSERT(spin_islocked(&g_cpu_irqlock) && g_cpu_nestcount[cpu] == 1); - FAR struct tcb_s *rtcb = this_task(); + FAR struct tcb_s *rtcb = current_task(cpu); DEBUGASSERT(rtcb != NULL); if (rtcb->irqcount <= 0) @@ -477,7 +482,14 @@ void leave_critical_section(irqstate_t flags) } else { - FAR struct tcb_s *rtcb = this_task(); + FAR struct tcb_s *rtcb; + + /* Get the TCB of the currently executing task on this CPU (avoid + * using this_task() which can recurse. + */ + + cpu = this_cpu(); + rtcb = current_task(cpu); DEBUGASSERT(rtcb != NULL && rtcb->irqcount > 0); /* Normal tasking context. We need to coordinate with other @@ -505,7 +517,6 @@ void leave_critical_section(irqstate_t flags) * released, then unlock the spinlock. */ - cpu = this_cpu(); DEBUGASSERT(spin_islocked(&g_cpu_irqlock) && (g_cpu_irqset & (1 << cpu)) != 0); -- GitLab From 8aa15385060bf705bbca2c22a5682128740e55a8 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 6 Feb 2018 10:33:28 -0600 Subject: [PATCH 176/228] arch/arm/src/armv7-a: Found some additional places were the new this_task() function cannot be called in the i.MX6 SMP configuration. --- arch/arm/src/armv7-a/arm_blocktask.c | 25 +++++++++++++++++++++-- arch/arm/src/armv7-a/arm_unblocktask.c | 25 +++++++++++++++++++++-- configs/sabre-6quad/README.txt | 28 ++++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 4 deletions(-) diff --git a/arch/arm/src/armv7-a/arm_blocktask.c b/arch/arm/src/armv7-a/arm_blocktask.c index 61cce48de2..8fdbef00a3 100644 --- a/arch/arm/src/armv7-a/arm_blocktask.c +++ b/arch/arm/src/armv7-a/arm_blocktask.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/armv7-a/up_blocktask.c * - * Copyright (C) 2013-2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2013-2015, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -76,8 +76,21 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state) { - struct tcb_s *rtcb = this_task(); + struct tcb_s *rtcb; bool switch_needed; +#ifdef CONFIG_SMP + int cpu; + + /* Get the TCB of the currently executing task on this CPU (avoid using + * this_task() because the TCBs may be in an inappropriate state right + * now). + */ + + cpu = this_cpu(); + rtcb = current_task(cpu); +#else + rtcb = this_task(); +#endif /* Verify that the context switch can be performed */ @@ -128,7 +141,11 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state) * of the ready-to-run task list. */ +#ifdef CONFIG_SMP + rtcb = current_task(cpu); +#else rtcb = this_task(); +#endif /* Reset scheduler parameters */ @@ -152,7 +169,11 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state) * of the ready-to-run task list. */ +#ifdef CONFIG_SMP + rtcb = current_task(cpu); +#else rtcb = this_task(); +#endif #ifdef CONFIG_ARCH_ADDRENV /* Make sure that the address environment for the previously diff --git a/arch/arm/src/armv7-a/arm_unblocktask.c b/arch/arm/src/armv7-a/arm_unblocktask.c index a9b0da6d2f..906d33796b 100644 --- a/arch/arm/src/armv7-a/arm_unblocktask.c +++ b/arch/arm/src/armv7-a/arm_unblocktask.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/armv7-a/arm_unblocktask.c * - * Copyright (C) 2013-2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2013-2015, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -71,7 +71,20 @@ void up_unblock_task(struct tcb_s *tcb) { - struct tcb_s *rtcb = this_task(); + struct tcb_s *rtcb; +#ifdef CONFIG_SMP + int cpu; + + /* Get the TCB of the currently executing task on this CPU (avoid using + * this_task() because the TCBs may be in an inappropriate state right + * now). + */ + + cpu = this_cpu(); + rtcb = current_task(cpu); +#else + rtcb = this_task(); +#endif /* Verify that the context switch can be performed */ @@ -110,7 +123,11 @@ void up_unblock_task(struct tcb_s *tcb) * of the ready-to-run task list. */ +#ifdef CONFIG_SMP + rtcb = current_task(cpu); +#else rtcb = this_task(); +#endif /* Update scheduler parameters */ @@ -136,7 +153,11 @@ void up_unblock_task(struct tcb_s *tcb) * ready-to-run task list. */ +#ifdef CONFIG_SMP + rtcb = current_task(cpu); +#else rtcb = this_task(); +#endif #ifdef CONFIG_ARCH_ADDRENV /* Make sure that the address environment for the previously diff --git a/configs/sabre-6quad/README.txt b/configs/sabre-6quad/README.txt index 482e07c542..462ffeffed 100644 --- a/configs/sabre-6quad/README.txt +++ b/configs/sabre-6quad/README.txt @@ -121,6 +121,34 @@ Status 2016-12-07: Just a note to remind myself. The PL310 L2 cache has *not* yet been enabled. +2018-02-06: Revisited SMP to see how has been broken due to bit rot. + Several fixes were needed mostly due to: (1) The new version of + this_task() that calls sched_lock() and sched_unlock(), and (2) to + deferred setting g_cpu_irqlock(). That latter setting is now deferred + until sched_resume_scheduler() runs. This means several changes similar + to the following were necessary in order to get things working from: + + struct tcb_s *rtcb = this_task(); + + To: + + struct tcb_s *rtcb; + #ifdef CONFIG_SMP + int cpu; + + /* Get the TCB of the currently executing task on this CPU (avoid using + * this_task() because the TCBs may be in an inappropriate state right + * now). + */ + + cpu = this_cpu(); + rtcb = current_task(cpu); + #else + rtcb = this_task(); + #endif + + At present, the NSH prompt does come up but there there still hangs that + must be addressed. Platform Features ================= -- GitLab From de34b4523fc33c6f2f20619349af8fa081a3bfcd Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 6 Feb 2018 11:17:33 -0600 Subject: [PATCH 177/228] sched/ and arch/arm/src/armv7-a: Replace a few more occurrences of this_task() with current_task(cpu) in an effort to get the i.MX6 working in SMP mode again. It does not yet work, sadly. --- arch/arm/src/armv7-a/arm_releasepending.c | 32 ++++++++++++++++++---- arch/arm/src/armv7-a/arm_reprioritizertr.c | 23 +++++++++++++++- configs/sabre-6quad/README.txt | 1 + sched/sched/sched_unlock.c | 4 +-- 4 files changed, 51 insertions(+), 9 deletions(-) diff --git a/arch/arm/src/armv7-a/arm_releasepending.c b/arch/arm/src/armv7-a/arm_releasepending.c index 7afc6989a7..b4a811f7d2 100644 --- a/arch/arm/src/armv7-a/arm_releasepending.c +++ b/arch/arm/src/armv7-a/arm_releasepending.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/armv7-a/arm_releasepending.c * - * Copyright (C) 2013-2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2013-2015, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -56,16 +56,28 @@ * Name: up_release_pending * * Description: - * Release and ready-to-run tasks that have - * collected in the pending task list. This can call a - * context switch if a new task is placed at the head of - * the ready to run list. + * Release and ready-to-run tasks that have collected in the pending task + * list. This can call a context switch if a new task is placed at the + * head of the ready to run list. * ****************************************************************************/ void up_release_pending(void) { - struct tcb_s *rtcb = this_task(); + struct tcb_s *rtcb; +#ifdef CONFIG_SMP + int cpu; + + /* Get the TCB of the currently executing task on this CPU (avoid using + * this_task() because the TCBs may be in an inappropriate state right + * now). + */ + + cpu = this_cpu(); + rtcb = current_task(cpu); +#else + rtcb = this_task(); +#endif sinfo("From TCB=%p\n", rtcb); @@ -96,7 +108,11 @@ void up_release_pending(void) * of the ready-to-run task list. */ +#ifdef CONFIG_SMP + rtcb = current_task(cpu); +#else rtcb = this_task(); +#endif /* Update scheduler parameters */ @@ -121,7 +137,11 @@ void up_release_pending(void) * of the ready-to-run task list. */ +#ifdef CONFIG_SMP + rtcb = current_task(cpu); +#else rtcb = this_task(); +#endif #ifdef CONFIG_ARCH_ADDRENV /* Make sure that the address environment for the previously diff --git a/arch/arm/src/armv7-a/arm_reprioritizertr.c b/arch/arm/src/armv7-a/arm_reprioritizertr.c index eb1a4d2e6a..359392e990 100644 --- a/arch/arm/src/armv7-a/arm_reprioritizertr.c +++ b/arch/arm/src/armv7-a/arm_reprioritizertr.c @@ -92,8 +92,21 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority) } else { - struct tcb_s *rtcb = this_task(); + struct tcb_s *rtcb; bool switch_needed; +#ifdef CONFIG_SMP + int cpu; + + /* Get the TCB of the currently executing task on this CPU (avoid + * using this_task() because the TCBs may be in an inappropriate + * state right now). + */ + + cpu = this_cpu(); + rtcb = current_task(cpu); +#else + rtcb = this_task(); +#endif sinfo("TCB=%p PRI=%d\n", tcb, priority); @@ -150,7 +163,11 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority) * of the ready-to-run task list. */ +#ifdef CONFIG_SMP + rtcb = current_task(cpu); +#else rtcb = this_task(); +#endif /* Update scheduler parameters */ @@ -174,7 +191,11 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority) * of the ready-to-run task list. */ +#ifdef CONFIG_SMP + rtcb = current_task(cpu); +#else rtcb = this_task(); +#endif #ifdef CONFIG_ARCH_ADDRENV /* Make sure that the address environment for the previously diff --git a/configs/sabre-6quad/README.txt b/configs/sabre-6quad/README.txt index 462ffeffed..9966f1eccc 100644 --- a/configs/sabre-6quad/README.txt +++ b/configs/sabre-6quad/README.txt @@ -149,6 +149,7 @@ Status At present, the NSH prompt does come up but there there still hangs that must be addressed. + Platform Features ================= diff --git a/sched/sched/sched_unlock.c b/sched/sched/sched_unlock.c index 7e95346ba1..73feb87cdb 100644 --- a/sched/sched/sched_unlock.c +++ b/sched/sched/sched_unlock.c @@ -168,7 +168,7 @@ int sched_unlock(void) * maximum. */ - if (rtcb != this_task()) + if (rtcb != current_task(cpu)) { rtcb->timeslice = MSEC2TICK(CONFIG_RR_INTERVAL); } @@ -206,7 +206,7 @@ int sched_unlock(void) * change the currently active task. */ - if (rtcb == this_task()) + if (rtcb == current_task(cpu)) { sched_timer_reassess(); } -- GitLab From cce21bef3292a40dcd97b6176ea016e2b559de8b Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 6 Feb 2018 13:49:21 -0600 Subject: [PATCH 178/228] sched/sched: sched_lock() and sched_unlock().. back out some changes I made recently. The seemed correct but apparently not. Also reorder to logic so that g_global_lockcount is incremented for the very minimum amount of time. --- configs/sabre-6quad/README.txt | 35 ++++++++++++++-------------------- sched/sched/sched_lock.c | 30 ++++++++++++++++++++--------- sched/sched/sched_unlock.c | 7 +++++-- 3 files changed, 40 insertions(+), 32 deletions(-) diff --git a/configs/sabre-6quad/README.txt b/configs/sabre-6quad/README.txt index 9966f1eccc..c62244f4db 100644 --- a/configs/sabre-6quad/README.txt +++ b/configs/sabre-6quad/README.txt @@ -121,34 +121,27 @@ Status 2016-12-07: Just a note to remind myself. The PL310 L2 cache has *not* yet been enabled. -2018-02-06: Revisited SMP to see how has been broken due to bit rot. +2018-02-06: Revisited SMP to see how much has been broken due to bit rot. Several fixes were needed mostly due to: (1) The new version of this_task() that calls sched_lock() and sched_unlock(), and (2) to deferred setting g_cpu_irqlock(). That latter setting is now deferred - until sched_resume_scheduler() runs. This means several changes similar - to the following were necessary in order to get things working from: + until sched_resume_scheduler() runs. These commits were made: - struct tcb_s *rtcb = this_task(); + commit de34b4523fc33c6f2f20619349af8fa081a3bfcd + sched/ and arch/arm/src/armv7-a: Replace a few more occurrences + of this_task() with current_task(cpu) in an effort to get the i.MX6 + working in SMP mode again. It does not yet work, sadly. - To: + commit 8aa15385060bf705bbca2c22a5682128740e55a8 + arch/arm/src/armv7-a: Found some additional places were the new + this_task() function cannot be called in the i.MX6 SMP configuration. - struct tcb_s *rtcb; - #ifdef CONFIG_SMP - int cpu; + commit 0ba78530164814360eb09ed9805137b934c6f03b + sched/irq: Fix a infinite recursion problem that a recent change + introduced into the i.MX6 SMP implementation. - /* Get the TCB of the currently executing task on this CPU (avoid using - * this_task() because the TCBs may be in an inappropriate state right - * now). - */ - - cpu = this_cpu(); - rtcb = current_task(cpu); - #else - rtcb = this_task(); - #endif - - At present, the NSH prompt does come up but there there still hangs that - must be addressed. + With these changes, basic SMP functionality is restored. Insufficient + stress testing has been done to prove that the solution is stable, however. Platform Features ================= diff --git a/sched/sched/sched_lock.c b/sched/sched/sched_lock.c index 1f2d3b9a15..dbe20c0634 100644 --- a/sched/sched/sched_lock.c +++ b/sched/sched/sched_lock.c @@ -188,9 +188,21 @@ int sched_lock(void) cpu = this_cpu(); rtcb = current_task(cpu); - /* rtcb may be NULL only during early boot-up phases. */ + /* Check for some special cases: (1) rtcb may be NULL only during early + * boot-up phases, and (2) sched_lock() should have no effect if called + * from the interrupt level. + */ - if (rtcb != NULL) + if (rtcb == NULL || up_interrupt_context()) + { +#if defined(CONFIG_ARCH_GLOBAL_IRQDISABLE) + up_irq_restore(flags); +#elif defined(CONFIG_ARCH_HAVE_FETCHADD) + DEBUGASSERT(g_global_lockcount > 0); + (void)up_fetchsub16(&g_global_lockcount, 1); +#endif + } + else { /* Catch attempts to increment the lockcount beyond the range of the * integer type. @@ -231,6 +243,13 @@ int sched_lock(void) rtcb->lockcount++; +#if defined(CONFIG_ARCH_GLOBAL_IRQDISABLE) + up_irq_restore(flags); +#elif defined(CONFIG_ARCH_HAVE_FETCHADD) + DEBUGASSERT(g_global_lockcount > 0); + (void)up_fetchsub16(&g_global_lockcount, 1); +#endif + #ifdef CONFIG_SCHED_INSTRUMENTATION_PREEMPTION /* Check if we just acquired the lock */ @@ -252,13 +271,6 @@ int sched_lock(void) TSTATE_TASK_PENDING); } -#if defined(CONFIG_ARCH_GLOBAL_IRQDISABLE) - up_irq_restore(flags); -#elif defined(CONFIG_ARCH_HAVE_FETCHADD) - DEBUGASSERT(g_global_lockcount > 0); - (void)up_fetchsub16(&g_global_lockcount, 1); -#endif - return OK; } diff --git a/sched/sched/sched_unlock.c b/sched/sched/sched_unlock.c index 73feb87cdb..88140cb375 100644 --- a/sched/sched/sched_unlock.c +++ b/sched/sched/sched_unlock.c @@ -79,9 +79,12 @@ int sched_unlock(void) cpu = this_cpu(); rtcb = current_task(cpu); - /* rtcb may be NULL only during early boot-up phases. */ + /* Check for some special cases: (1) rtcb may be NULL only during + * early boot-up phases, and (2) sched_unlock() should have no + * effect if called from the interrupt level. + */ - if (rtcb != NULL) + if (rtcb != NULL && !up_interrupt_context()) { /* Prevent context switches throughout the following. */ -- GitLab From 50ab5d638a37b539775d1e60085f182bf26be57f Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 6 Feb 2018 19:06:33 -0600 Subject: [PATCH 179/228] sched/task: It is not appropriate for logic in task_exit() to call the new version of this_task(). sched/irq: Remove redundant fetch of CPU index; configs/sabre-6qguad: update README. --- configs/sabre-6quad/README.txt | 25 ++++++++++++++++--------- sched/irq/irq_csection.c | 1 - sched/task/task_exit.c | 27 +++++++++++++++++++++++++-- 3 files changed, 41 insertions(+), 12 deletions(-) diff --git a/configs/sabre-6quad/README.txt b/configs/sabre-6quad/README.txt index c62244f4db..8f7f6c9794 100644 --- a/configs/sabre-6quad/README.txt +++ b/configs/sabre-6quad/README.txt @@ -127,21 +127,28 @@ Status deferred setting g_cpu_irqlock(). That latter setting is now deferred until sched_resume_scheduler() runs. These commits were made: - commit de34b4523fc33c6f2f20619349af8fa081a3bfcd - sched/ and arch/arm/src/armv7-a: Replace a few more occurrences - of this_task() with current_task(cpu) in an effort to get the i.MX6 - working in SMP mode again. It does not yet work, sadly. + commit 0ba78530164814360eb09ed9805137b934c6f03b + sched/irq: Fix a infinite recursion problem that a recent change + introduced into the i.MX6 SMP implementation. commit 8aa15385060bf705bbca2c22a5682128740e55a8 arch/arm/src/armv7-a: Found some additional places were the new this_task() function cannot be called in the i.MX6 SMP configuration. - commit 0ba78530164814360eb09ed9805137b934c6f03b - sched/irq: Fix a infinite recursion problem that a recent change - introduced into the i.MX6 SMP implementation. + commit de34b4523fc33c6f2f20619349af8fa081a3bfcd + sched/ and arch/arm/src/armv7-a: Replace a few more occurrences + of this_task() with current_task(cpu) in an effort to get the i.MX6 + working in SMP mode again. It does not yet work, sadly. + + commit cce21bef3292a40dcd97b6176ea016e2b559de8b + sched/sched: sched_lock() and sched_unlock().. back out some changes + I made recently. The seemed correct but apparently not. Also + reorder to logic so that g_global_lockcount is incremented for the very + minimum amount of time. - With these changes, basic SMP functionality is restored. Insufficient - stress testing has been done to prove that the solution is stable, however. + With these changes, basic SMP functionality is restored and there are no + known issues. Insufficient stress testing has been done to prove that the + solution is stable, however. Platform Features ================= diff --git a/sched/irq/irq_csection.c b/sched/irq/irq_csection.c index 2fdd82d313..9d7943cbf6 100644 --- a/sched/irq/irq_csection.c +++ b/sched/irq/irq_csection.c @@ -342,7 +342,6 @@ try_again: * the spinlock. */ - cpu = this_cpu(); DEBUGASSERT((g_cpu_irqset & (1 << cpu)) == 0); if (!irq_waitlock(cpu)) diff --git a/sched/task/task_exit.c b/sched/task/task_exit.c index a7e8522f4f..5972051f9b 100644 --- a/sched/task/task_exit.c +++ b/sched/task/task_exit.c @@ -1,7 +1,8 @@ /**************************************************************************** * sched/task/task_exit.c * - * Copyright (C) 2008-2009, 2012-2014, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009, 2012-2014, 2016, 2018 Gregory Nutt. All + * rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -82,9 +83,24 @@ int task_exit(void) { - FAR struct tcb_s *dtcb = this_task(); + FAR struct tcb_s *dtcb; FAR struct tcb_s *rtcb; int ret; +#ifdef CONFIG_SMP + int cpu; + + /* Get the current CPU. By assumption, we are within a critical section + * and, hence, the CPU index will remain stable. + * + * Avoid using this_task() because it may assume a state that is not + * appropriate for an exiting task. + */ + + cpu = this_cpu(); + dtcb = current_task(cpu); +#else + dtcb = this_task(); +#endif /* Remove the TCB of the current task from the ready-to-run list. A context * switch will definitely be necessary -- that must be done by the @@ -95,7 +111,14 @@ int task_exit(void) */ (void)sched_removereadytorun(dtcb); + + /* Get the new task at the head of the ready to run list */ + +#ifdef CONFIG_SMP + rtcb = current_task(cpu); +#else rtcb = this_task(); +#endif #ifdef CONFIG_SMP /* Because clearing the global IRQ control in sched_removereadytorun() -- GitLab From 6c58eac6abf9b90456f15f2f21f3ed1a27d3bcb3 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 7 Feb 2018 08:57:01 -0600 Subject: [PATCH 180/228] configs/sabre-6quad: Update README. --- configs/sabre-6quad/README.txt | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/configs/sabre-6quad/README.txt b/configs/sabre-6quad/README.txt index 8f7f6c9794..331867888d 100644 --- a/configs/sabre-6quad/README.txt +++ b/configs/sabre-6quad/README.txt @@ -127,7 +127,12 @@ Status deferred setting g_cpu_irqlock(). That latter setting is now deferred until sched_resume_scheduler() runs. These commits were made: - commit 0ba78530164814360eb09ed9805137b934c6f03b + commit 50ab5d638a37b539775d1e60085f182bf26be57f + sched/task: It is not appropriate for logic in task_exit() to call + the new version of this_task(). sched/irq: Remove redundant fetch + of CPU index; configs/sabre-6quad: update README. + + commit 0ba78530164814360eb09ed9805137b934c6f03b sched/irq: Fix a infinite recursion problem that a recent change introduced into the i.MX6 SMP implementation. @@ -147,8 +152,11 @@ Status minimum amount of time. With these changes, basic SMP functionality is restored and there are no - known issues. Insufficient stress testing has been done to prove that the - solution is stable, however. + known issues (Configuration smp with 4 CPUs and data cache disabled). It + is likely, however, that additional changes similar to the above will be + required in other areas of the OS, but none such are known as of this + writing. Insufficient stress testing has been done to prove that the + solution is stable. Platform Features ================= @@ -562,7 +570,7 @@ Open Issues: This will cause the interrupt handlers on other CPUs to spin until leave_critical_section() is called. More verification is needed. -2. Cache Concurency. Cache coherency in SMP configurations is managed by the +2. Cache Concurrency. Cache coherency in SMP configurations is managed by the MPCore snoop control unit (SCU). But I don't think I have the set up correctly yet. @@ -613,6 +621,15 @@ index eedf179..1db2092 100644 #endif +3. Recent redesigns to SMP of another ARMv7-M platform have made changes to the OS + SMP support. There are no known problem but the changes have not been verified + fully (see STATUS above for 2019-02-06). + +4. I have a sense that there may be some performance issues that need to be worked + out. I have made no measurements so perhaps that is an unfounded concern but + you should be aware even of my unfounded concerns if you want to work with i.MX6 + SMP. + Configurations ============== -- GitLab From 42720a54733fcd191b34c76b922e29749e11ba44 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 7 Feb 2018 14:55:56 -0600 Subject: [PATCH 181/228] Update README --- configs/sabre-6quad/README.txt | 119 ++++++++++++++++++++++++++++++--- 1 file changed, 108 insertions(+), 11 deletions(-) diff --git a/configs/sabre-6quad/README.txt b/configs/sabre-6quad/README.txt index 331867888d..f16dc76113 100644 --- a/configs/sabre-6quad/README.txt +++ b/configs/sabre-6quad/README.txt @@ -152,9 +152,9 @@ Status minimum amount of time. With these changes, basic SMP functionality is restored and there are no - known issues (Configuration smp with 4 CPUs and data cache disabled). It - is likely, however, that additional changes similar to the above will be - required in other areas of the OS, but none such are known as of this + known issues (Configuration 'smp' with 4 CPUs and data cache disabled). + It is possible, however, that additional changes similar to the above will + be required in other areas of the OS, but none such are known as of this writing. Insufficient stress testing has been done to prove that the solution is stable. @@ -625,11 +625,6 @@ index eedf179..1db2092 100644 SMP support. There are no known problem but the changes have not been verified fully (see STATUS above for 2019-02-06). -4. I have a sense that there may be some performance issues that need to be worked - out. I have made no measurements so perhaps that is an unfounded concern but - you should be aware even of my unfounded concerns if you want to work with i.MX6 - SMP. - Configurations ============== @@ -720,12 +715,114 @@ Configuration sub-directories smp --- This is a configuration of testing the SMP configuration. It is - essentially equivalent to the SMP configuration except has SMP enabled. + essentially equivalent to the nsh configuration except has SMP enabled + and supports apps/examples/smp. + + Sample output of the SMP test is show below (Configuration all 4 CPUs + but with data cache disabled): + + NuttShell (NSH) NuttX-7.23 + nsh> smp + Main[0]: Running on CPU0 + Main[0]: Initializing barrier + Thread[1]: Started + Main[0]: Thread 1 created + Thread[1]: Running on CPU0 + Main[0]: Now running on CPU1 + Thread[2]: Started + Main[0]: Thread 2 created + Thread[2]: Running on CPU1 + Main[0]: Now running on CPU2 + Thread[3]: Started + Main[0]: Thread 3 created + Thread[3]: Running on CPU2 + Main[0]: Now running on CPU3 + Thread[4]: Started + Thread[4]: Running on CPU3 + Main[0]: Thread 4 created + Main[0]: Now running on CPU0 + Thread[5]: Started + Thread[5]: Running on CPU0 + Main[0]: Thread 5 created + Thread[6]: Started + Thread[6]: Running on CPU0 + Main[0]: Thread 6 created + Thread[7]: Started + Thread[7]: Running on CPU0 + Main[0]: Thread 7 created + Thread[8]: Started + Thread[8]: Running on CPU0 + Main[0]: Thread 8 created + Thread[2]: Now running on CPU0 + Thread[3]: Now running on CPU0 + Thread[4]: Now running on CPU0 + Thread[3]: Now running on CPU2 + Thread[3]: Now running on CPU0 + Thread[5]: Now running on CPU1 + Thread[5]: Now running on CPU0 + Thread[6]: Calling pthread_barrier_wait() + Thread[8]: Calling pthread_barrier_wait() + Thread[3]: Calling pthread_barrier_wait() + Thread[5]: Calling pthread_barrier_wait() + Thread[1]: Calling pthread_barrier_wait() + Thread[2]: Now running on CPU2 + Thread[2]: Calling pthread_barrier_wait() + Thread[7]: Now running on CPU3 + Thread[4]: Now running on CPU1 + Thread[4]: Calling pthread_barrier_wait() + Thread[7]: Calling pthread_barrier_wait() + Thread[7]: Back with ret=PTHREAD_BARRIER_SERIAL_THREAD (I AM SPECIAL) + Thread[6]: Back with ret=0 (I am not special) + Thread[8]: Back with ret=0 (I am not special) + Thread[3]: Back with ret=0 (I am not special) + Thread[5]: Back with ret=0 (I am not special) + Thread[1]: Back with ret=0 (I am not special) + Thread[2]: Back with ret=0 (I am not special) + Thread[4]: Back with ret=0 (I am not special) + Thread[7]: Now running on CPU1 + Thread[6]: Now running on CPU2 + Thread[3]: Now running on CPU1 + Thread[5]: Now running on CPU2 + Thread[1]: Now running on CPU1 + Thread[4]: Now running on CPU3 + Thread[2]: Now running on CPU0 + Thread[7]: Now running on CPU0 + Thread[6]: Now running on CPU0 + Thread[3]: Now running on CPU0 + Thread[4]: Now running on CPU0 + Thread[1]: Now running on CPU0 + Thread[5]: Now running on CPU0 + Thread[3]: Now running on CPU3 + Thread[3]: Now running on CPU0 + Thread[4]: Now running on CPU2 + Thread[3]: Done + Thread[4]: Now running on CPU0 + Thread[4]: Done + Thread[7]: Done + Thread[2]: Done + Thread[5]: Now running on CPU2 + Thread[8]: Now running on CPU1 + Thread[8]: Done + Thread[6]: Now running on CPU3 + Thread[5]: Done + Thread[1]: Done + Main[0]: Now running on CPU1 + Main[0]: Thread 1 completed with result=0 + Main[0]: Thread 2 completed with result=0 + Main[0]: Thread 3 completed with result=0 + Main[0]: Thread 4 completed with result=0 + Main[0]: Thread 5 completed with result=0 + Thread[6]: Done + Main[0]: Now running on CPU0 + Main[0]: Thread 6 completed with result=0 + Main[0]: Thread 7 completed with result=0 + Main[0]: Thread 8 completed with result=0 + nsh> NOTES: 1. See the notes for the nsh configuration. Since this configuration is essentially the same all of those comments apply. - 2. SMP is not fully functional. See the STATUS and SMP sections above - for detailed SMP-related issues. + 2. See the STATUS and SMP sections above for detailed SMP-related + issues. -- GitLab From 970bcef197028a362fc8e450858e5334cae5855d Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 8 Feb 2018 10:06:43 -0600 Subject: [PATCH 182/228] configs/flipnclick-pic32mz: Add support for PROCFS file system. --- configs/flipnclick-pic32mz/nsh/defconfig | 6 ++---- configs/flipnclick-pic32mz/src/pic32mz_bringup.c | 13 +++++++++++++ configs/flipnclick-sam3x/nsh/defconfig | 2 +- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/configs/flipnclick-pic32mz/nsh/defconfig b/configs/flipnclick-pic32mz/nsh/defconfig index 93cfe3849c..0533b276c7 100644 --- a/configs/flipnclick-pic32mz/nsh/defconfig +++ b/configs/flipnclick-pic32mz/nsh/defconfig @@ -1,6 +1,4 @@ # CONFIG_ARCH_RAMFUNCS is not set -# CONFIG_NSH_DISABLE_IFCONFIG is not set -# CONFIG_NSH_DISABLE_PS is not set CONFIG_ARCH_BOARD_FLIPNCLICK_PIC32MZ=y CONFIG_ARCH_BOARD="flipnclick-pic32mz" CONFIG_ARCH_CHIP_PIC32MZ=y @@ -11,11 +9,11 @@ CONFIG_ARCH_STACKDUMP=y CONFIG_ARCH="mips" CONFIG_BOARD_LOOPSPERMSEC=7245 CONFIG_BUILTIN=y -CONFIG_DISABLE_POLL=y CONFIG_EXAMPLES_NSH=y CONFIG_FAT_LCNAMES=y CONFIG_FAT_LFN=y CONFIG_FS_FAT=y +CONFIG_FS_PROCFS=y CONFIG_HOST_WINDOWS=y CONFIG_IDLETHREAD_STACKSIZE=2048 CONFIG_INTELHEX_BINARY=y @@ -29,6 +27,7 @@ CONFIG_NFILE_DESCRIPTORS=8 CONFIG_NFILE_STREAMS=8 CONFIG_NSH_ARCHINIT=y CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_DISABLE_IFUPDOWN=y CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_LINELEN=64 CONFIG_NSH_READLINE=y @@ -45,7 +44,6 @@ CONFIG_SDCLONE_DISABLE=y CONFIG_START_DAY=7 CONFIG_START_MONTH=3 CONFIG_START_YEAR=2012 -CONFIG_TASK_NAME_SIZE=0 CONFIG_UART4_SERIAL_CONSOLE=y CONFIG_USER_ENTRYPOINT="nsh_main" CONFIG_WDOG_INTRESERVE=1 diff --git a/configs/flipnclick-pic32mz/src/pic32mz_bringup.c b/configs/flipnclick-pic32mz/src/pic32mz_bringup.c index 3ce4337fe4..68247177b3 100644 --- a/configs/flipnclick-pic32mz/src/pic32mz_bringup.c +++ b/configs/flipnclick-pic32mz/src/pic32mz_bringup.c @@ -40,6 +40,8 @@ #include #include +#include +#include #include "flipnclick-pic32mz.h" @@ -59,6 +61,17 @@ int pic32mz_bringup(void) { int ret; +#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 + UNUSED(ret); return OK; } diff --git a/configs/flipnclick-sam3x/nsh/defconfig b/configs/flipnclick-sam3x/nsh/defconfig index 68e1421dc1..545918a2cf 100644 --- a/configs/flipnclick-sam3x/nsh/defconfig +++ b/configs/flipnclick-sam3x/nsh/defconfig @@ -38,7 +38,7 @@ CONFIG_SDCLONE_DISABLE=y CONFIG_START_DAY=28 CONFIG_START_MONTH=6 CONFIG_START_YEAR=2013 -CONFIG_TASK_NAME_SIZE=32 +CONFIG_TASK_NAME_SIZE=31 CONFIG_USART0_SERIAL_CONSOLE=y CONFIG_USER_ENTRYPOINT="nsh_main" CONFIG_WDOG_INTRESERVE=0 -- GitLab From da051fb3d9a9db0f5f975a91124c7c8c18d1ab78 Mon Sep 17 00:00:00 2001 From: hg42 Date: Thu, 8 Feb 2018 22:37:58 +0000 Subject: [PATCH 183/228] Merged in hg42/nuttx/lpc17-disable-FDR (pull request #591) disable LPC17 FDR when not used * disable LPC17 FDR when not used if a boot loader set the fractional divider (FDR) the baud rate in nuttx will be wrong (multiplied by this fraction). So if it is not used, it should be disabled. LPC176x docs say: " DIVADDVAL Baud-rate generation pre-scaler divisor value. If this field is 0, fractional baud-rate generator will not impact the UARTn baudrate. MULVAL Baud-rate pre-scaler multiplier value. This field must be greater or equal 1 for UARTn to operate properly, regardless of whether the fractional baud-rate generator is used or not. " So DIVADDVAL is set to 0 and MULVAL is set to 1. * symbols found and added Approved-by: Gregory Nutt --- arch/arm/src/lpc17xx/lpc17_serial.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm/src/lpc17xx/lpc17_serial.c b/arch/arm/src/lpc17xx/lpc17_serial.c index f6a7fabbb9..dbaf3acc70 100644 --- a/arch/arm/src/lpc17xx/lpc17_serial.c +++ b/arch/arm/src/lpc17xx/lpc17_serial.c @@ -920,6 +920,10 @@ static int up_setup(struct uart_dev_s *dev) lcr |= (UART_LCR_PE | UART_LCR_PS_EVEN); } + /* Disable FDR (fractional divider, not used by baudrate settings -> has to be disabled) */ + + up_serialout(priv, LPC17_UART_FDR_OFFSET, (1< Date: Thu, 8 Feb 2018 16:34:57 -0600 Subject: [PATCH 184/228] Update README --- configs/flipnclick-pic32mz/README.txt | 55 +++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 4 deletions(-) diff --git a/configs/flipnclick-pic32mz/README.txt b/configs/flipnclick-pic32mz/README.txt index 72afa5a2ed..2a833c319a 100644 --- a/configs/flipnclick-pic32mz/README.txt +++ b/configs/flipnclick-pic32mz/README.txt @@ -11,6 +11,7 @@ Contents Port Status On Board Debug Support + Using the mikroProg Creating Compatible NuttX HEX files Tool Issues Serial Console @@ -26,8 +27,12 @@ Port Status 2018-01-08: Created the basic board configuration for the Mikroe Flip&Click PIC32MZ board. No testing has yet been performed. At this point, I have not even figured out how I am going to load and debug - new firmware. I need understand how the memory map is set up when used - with the mikroBootloader. + new firmware. + 2018-02-08: I received a mikroProg PIC32 debugger (Thanks go to John Legg + of the Debug Shop!). At this point I have loaded code and can see the + NSH prompt coming from the Flip&Click connect via an RS-232 Click board + in mikroBUS slot A. But there is no response to serial input to the + board. Sounds like a pin configuration issue. On Board Debug Support ====================== @@ -64,6 +69,47 @@ On Board Debug Support would, most likely, clobber the USB HID bootloader (and possibly the Arduino support as well). +Using the mikroProg +=================== + + Hardware setup + -------------- + You will need to add a five pin header to the mikroProg connector between + the A and D mikroBUS sockets. + + Connect the mikroProg to the outer 5 pins of the mikroProg's 10-pin + connector to the 5-pin header, respecting the pin 1 position: The + colored wire on the ribbon cable should be on the same side as the tiny + arrow on the board indicating pin 1. + + Connect the mikroProg to your computer with the provided USB cable; also power the Flip'n'Clip board with another USB cable connected to the computer. Either USB + port will provide power. + + Installing the Software + ----------------------- + From the mikroProg website https://www.mikroe.com/mikroprog-pic-dspic-pic32 + Download: + + Drivers for mikroProg Suite + https://download.mikroe.com/setups/drivers/mikroprog/pic-dspic-pic32/mikroprog-pic-dspic-pic32-drivers.zip + + mikroProg Suite for PIC, dsPIC, PIC32 v260 + + https://download.mikroe.com/setups/programming-software/mikroprog/pic-dspic-pic32/mikroprog-suite-pic-dspic-pic32-programming-software-setup-v260.zip + + Install the mikroProg Suite. From things I have read, I gather that you + must be Administrator when installing the tool The instructions say that + it will automatically install the drivers. It did not for me. + + To install the drivers... You will find several directories under mikroprog-pic-dspic-pic32-drivers/. Select the correct directory and run + the .EXE file you find there. + + When I started the mikroProg suite, it could not find the USB driver. + After a few frustrating hours of struggling with the drivers, I found + that if I start the mikroProg suite as a normal user, it does not find + the driver. But if I instead start the mikroProg suite as Administrator... + There it is! A little awkward but works just fine. + Creating Compatible NuttX HEX files =================================== @@ -92,7 +138,8 @@ Creating Compatible NuttX HEX files cd tools/pic32mx make - Now you will have an excecutable file call mkpichex (or mkpichex.exe on + Now you will have an executable + file call mkpichex (or mkpichex.exe on Cygwin). This program will take the nutt.hex file as an input, it will convert all of the KSEG0 and KSEG1 addresses to physical address, and it will write the modified file, replacing the original nuttx.hex. @@ -102,7 +149,7 @@ Creating Compatible NuttX HEX files export PATH=??? # Add the NuttX tools/pic32mx directory to your # PATH variable make # Build nuttx and nuttx.hex - mkpichex $PWD # Convert addresses in nuttx.hex. $PWD is the path + mkpichex $PWD # Convert addresses in nuttx.hex. $PWD is the path # to the top-level build directory. It is the only # required input to mkpichex. -- GitLab From 0e6ef003ffd5cfa768f0cc09c2976e31452647cc Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 8 Feb 2018 16:42:21 -0600 Subject: [PATCH 185/228] Fix some coding standard violations in the last PR. --- arch/arm/src/lpc17xx/lpc17_serial.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/arch/arm/src/lpc17xx/lpc17_serial.c b/arch/arm/src/lpc17xx/lpc17_serial.c index dbaf3acc70..10fd17865c 100644 --- a/arch/arm/src/lpc17xx/lpc17_serial.c +++ b/arch/arm/src/lpc17xx/lpc17_serial.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/lpc17xx/lpc17_serial.c * - * Copyright (C) 2010-2013, 2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2010-2013, 2017-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -920,9 +920,12 @@ static int up_setup(struct uart_dev_s *dev) lcr |= (UART_LCR_PE | UART_LCR_PS_EVEN); } - /* Disable FDR (fractional divider, not used by baudrate settings -> has to be disabled) */ + /* Disable FDR (fractional divider, not used by baudrate settings -> has + * to be disabled) + */ - up_serialout(priv, LPC17_UART_FDR_OFFSET, (1< Date: Fri, 9 Feb 2018 11:11:44 -0600 Subject: [PATCH 186/228] arch/mips/src/mips32: In up_idle, the kludge that was conditionally enabled if the work queue was enable appears to be needed even when he work queue is not enabled on the PIC32MZ. arch/mips/src/pic32mz: Fix some typos in debug instrumentation in pic32mz-gpio.c; fix some types releated to UART5 configuration in pic32mz-serial.c. configs/flipnclick-pic32mz/nsh: Switch serial console to UART3. There is some problem with the UART4 RX pin documentation or configuration. --- arch/mips/src/common/up_idle.c | 26 ++++++++++-------------- arch/mips/src/pic32mz/pic32mz-gpio.c | 10 ++++----- arch/mips/src/pic32mz/pic32mz-serial.c | 16 +++++++-------- configs/flipnclick-pic32mz/nsh/defconfig | 6 ++++-- 4 files changed, 28 insertions(+), 30 deletions(-) diff --git a/arch/mips/src/common/up_idle.c b/arch/mips/src/common/up_idle.c index bee134392f..601a0cd5e3 100644 --- a/arch/mips/src/common/up_idle.c +++ b/arch/mips/src/common/up_idle.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/mips/src/common/up_idle.c * - * Copyright (C) 2011-2012, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2011-2012, 2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -69,27 +69,23 @@ void up_idle(void) sched_process_timer(); #else + irqstate_t flags; /* This would be an appropriate place to put some MCU-specific logic to * sleep in a reduced power mode until an interrupt occurs to save power */ - /* This is a kludge that I still don't understand. The call to kmm_trysemaphore() - * in the os_start.c IDLE loop seems necessary for the good health of the IDLE - * loop. When the work queue is enabled, this logic is removed from the IDLE - * loop and it appears that we are somehow left idling with interrupts non- - * functional. The following should be no-op, it just disables then re-enables - * interrupts. But it fixes the problem and will stay here until I understand - * the problem/fix better. + /* This is a kludge that I still don't understand. It appears that we are + * somehow left idling with interrupts non-functional. The following should + * be no-op, it just disables then re-enables interrupts. But it fixes the + * problem and will stay here until I understand the problem/fix better. * - * And no, the contents of the CP0 status register are not incorrect. But for - * some reason the status register needs to be re-written again on this thread - * for it to take effect. This might be a PIC32-only issue? + * And no, the contents of the CP0 status register are not incorrect. But + * for some reason the status register needs to be re-written again on this + * thread for it to take effect. This might be a PIC32-only issue? */ -#ifdef CONFIG_SCHED_WORKQUEUE - irqstate_t flags = enter_critical_section(); - leave_critical_section(flags); -#endif + flags = up_irq_save(); + up_irq_restore(flags); #endif } diff --git a/arch/mips/src/pic32mz/pic32mz-gpio.c b/arch/mips/src/pic32mz/pic32mz-gpio.c index 3d247edc5b..0ec2c44fec 100644 --- a/arch/mips/src/pic32mz/pic32mz-gpio.c +++ b/arch/mips/src/pic32mz/pic32mz-gpio.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/mips/src/pic32mz/pic32mz-gpio.c * - * Copyright (C) 2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2015, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -332,10 +332,10 @@ void pic32mz_dumpgpio(uint32_t pinset, const char *msg) getreg32(base + PIC32MZ_IOPORT_PORT_OFFSET), getreg32(base + PIC32MZ_IOPORT_LAT_OFFSET), getreg32(base + PIC32MZ_IOPORT_ODC_OFFSET)); - gpioinfo(" CNCON: %08x CNEN: %08x CNPUE: %08x\n", - getreg32(PIC32MZ_IOPORT_CNCON), - getreg32(PIC32MZ_IOPORT_CNEN), - getreg32(PIC32MZ_IOPORT_CNPUE)); + gpioinfo(" CNCON: %08x CNEN: %08x CNPU: %08x\n", + getreg32(base + PIC32MZ_IOPORT_CNCON_OFFSET), + getreg32(base + PIC32MZ_IOPORT_CNEN_OFFSET), + getreg32(base + PIC32MZ_IOPORT_CNPU_OFFSET)); sched_unlock(); } } diff --git a/arch/mips/src/pic32mz/pic32mz-serial.c b/arch/mips/src/pic32mz/pic32mz-serial.c index cfce690614..b4d6e8e791 100644 --- a/arch/mips/src/pic32mz/pic32mz-serial.c +++ b/arch/mips/src/pic32mz/pic32mz-serial.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/mips/src/pic32mz/pic32mz-serial.c * - * Copyright (C) 2015, 2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2015, 2017-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -96,10 +96,10 @@ # define CONSOLE_DEV g_uart4port /* UART4 is console */ # define TTYS0_DEV g_uart4port /* UART4 is ttyS0 */ # define UART4_ASSIGNED 1 -#elif defined(CONFIG_UART4_SERIAL_CONSOLE) -# define CONSOLE_DEV g_uart5port /* UART4 is console */ -# define TTYS0_DEV g_uart5port /* UART4 is ttyS0 */ -# define UART4_ASSIGNED 1 +#elif defined(CONFIG_UART5_SERIAL_CONSOLE) +# define CONSOLE_DEV g_uart5port /* UART5 is console */ +# define TTYS0_DEV g_uart5port /* UART5 is ttyS0 */ +# define UART5_ASSIGNED 1 #elif defined(CONFIG_UART6_SERIAL_CONSOLE) # define CONSOLE_DEV g_uart6port /* UART6 is console */ # define TTYS5_DEV g_uart6port /* UART6 is ttyS0 */ @@ -118,9 +118,9 @@ # elif defined(CONFIG_PIC32MZ_UART4) # define TTYS0_DEV g_uart4port /* UART4 is ttyS0 */ # define UART4_ASSIGNED 1 -# elif defined(CONFIG_PIC32MZ_UART4) -# define TTYS0_DEV g_uart5port /* UART4 is ttyS0 */ -# define UART4_ASSIGNED 1 +# elif defined(CONFIG_PIC32MZ_UART5) +# define TTYS0_DEV g_uart5port /* UART5 is ttyS0 */ +# define UART5_ASSIGNED 1 # elif defined(CONFIG_PIC32MZ_UART6) # define TTYS0_DEV g_uart6port /* UART6 is ttyS0 */ # define UART6_ASSIGNED 1 diff --git a/configs/flipnclick-pic32mz/nsh/defconfig b/configs/flipnclick-pic32mz/nsh/defconfig index 0533b276c7..7087220d9f 100644 --- a/configs/flipnclick-pic32mz/nsh/defconfig +++ b/configs/flipnclick-pic32mz/nsh/defconfig @@ -1,4 +1,6 @@ # CONFIG_ARCH_RAMFUNCS is not set +# CONFIG_PIC32MZ_DEBUGGER_ENABLE is not set +# CONFIG_PIC32MZ_TRACE_ENABLE is not set CONFIG_ARCH_BOARD_FLIPNCLICK_PIC32MZ=y CONFIG_ARCH_BOARD="flipnclick-pic32mz" CONFIG_ARCH_CHIP_PIC32MZ=y @@ -32,7 +34,7 @@ CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_LINELEN=64 CONFIG_NSH_READLINE=y CONFIG_PIC32MZ_ICESEL_CH2=y -CONFIG_PIC32MZ_UART4=y +CONFIG_PIC32MZ_UART3=y CONFIG_PREALLOC_MQ_MSGS=4 CONFIG_PREALLOC_TIMERS=4 CONFIG_PREALLOC_WDOGS=8 @@ -44,6 +46,6 @@ CONFIG_SDCLONE_DISABLE=y CONFIG_START_DAY=7 CONFIG_START_MONTH=3 CONFIG_START_YEAR=2012 -CONFIG_UART4_SERIAL_CONSOLE=y +CONFIG_UART3_SERIAL_CONSOLE=y CONFIG_USER_ENTRYPOINT="nsh_main" CONFIG_WDOG_INTRESERVE=1 -- GitLab From ee46bf4d291ca844b0f48f45180d296ba84d3020 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 9 Feb 2018 11:15:00 -0600 Subject: [PATCH 187/228] Update README --- configs/flipnclick-pic32mz/README.txt | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/configs/flipnclick-pic32mz/README.txt b/configs/flipnclick-pic32mz/README.txt index 2a833c319a..79e86c00d3 100644 --- a/configs/flipnclick-pic32mz/README.txt +++ b/configs/flipnclick-pic32mz/README.txt @@ -72,6 +72,9 @@ On Board Debug Support Using the mikroProg =================== + WARNING: This will most certainly overwrite the bootloader that was factory + installed in FLASH! + Hardware setup -------------- You will need to add a five pin header to the mikroProg connector between @@ -194,6 +197,14 @@ Serial Console transceiver to get the signals to RS232 levels (or connect to the USB virtual COM port in the case of UART0). + STATUS: I have been unable to get the RS-232 Click to work in the mikroBUS + A slot. The PIC32MZ does not receive serial input. It appears that there + is an error in the some documentation: Either RG9 is not connect to + UART4_RX or the PPS bit definitions are documented incorrectly for UART4. + + Switching to UART3 eliminates the problem and the serial console is fully + functional. + SPI === @@ -339,9 +350,9 @@ Where is one of the following: NOTES: - 1. Serial Console. UART 4 is configured as the Serial Console. This + 1. Serial Console. UART3 is configured as the Serial Console. This assumes that you will be using a Mikroe RS-232 Click card in the - mikroBUS A slot. Other serial consoles may be selected by re- + mikroBUS B slot. Other serial consoles may be selected by re- configuring (see the section "Serial Consoles" above). 2. Toolchain -- GitLab From b793c7040a3c2db8877cde269fbd3984e3832fb1 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 9 Feb 2018 12:59:33 -0600 Subject: [PATCH 188/228] Update README --- configs/flipnclick-pic32mz/README.txt | 30 +++++++++++++++++---------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/configs/flipnclick-pic32mz/README.txt b/configs/flipnclick-pic32mz/README.txt index 79e86c00d3..52a3c0a33e 100644 --- a/configs/flipnclick-pic32mz/README.txt +++ b/configs/flipnclick-pic32mz/README.txt @@ -72,8 +72,15 @@ On Board Debug Support Using the mikroProg =================== - WARNING: This will most certainly overwrite the bootloader that was factory - installed in FLASH! + WARNINGS: + 1. Following there steps will most certainly overwrite the bootloader + that was factory installed in FLASH! + 2. Due to the position and orientation of the mikroProg connector you + may lose functionality: If you attach mikroProg to the red side of + the board, you will not be able to use the Arduino Shield Connector + while the mikroProg connected. If you attach mikroProg to the white + side of the board, you will similarly lose access to mikroBUS + connectors A and D. Hardware setup -------------- @@ -85,8 +92,9 @@ Using the mikroProg colored wire on the ribbon cable should be on the same side as the tiny arrow on the board indicating pin 1. - Connect the mikroProg to your computer with the provided USB cable; also power the Flip'n'Clip board with another USB cable connected to the computer. Either USB - port will provide power. + Connect the mikroProg to your computer with the provided USB cable; also + power the Flip'n'Clip board with another USB cable connected to the + computer. Either USB port will provide power. Installing the Software ----------------------- @@ -97,14 +105,14 @@ Using the mikroProg https://download.mikroe.com/setups/drivers/mikroprog/pic-dspic-pic32/mikroprog-pic-dspic-pic32-drivers.zip mikroProg Suite for PIC, dsPIC, PIC32 v260 - https://download.mikroe.com/setups/programming-software/mikroprog/pic-dspic-pic32/mikroprog-suite-pic-dspic-pic32-programming-software-setup-v260.zip Install the mikroProg Suite. From things I have read, I gather that you must be Administrator when installing the tool The instructions say that it will automatically install the drivers. It did not for me. - To install the drivers... You will find several directories under mikroprog-pic-dspic-pic32-drivers/. Select the correct directory and run + To install the drivers... You will find several directories under + mikroprog-pic-dspic-pic32-drivers/. Select the correct directory and run the .EXE file you find there. When I started the mikroProg suite, it could not find the USB driver. @@ -194,16 +202,16 @@ Serial Console will leave that as an exercise for the interested reader. The outputs from these pins is 3.3V. You will need to connect RS232 - transceiver to get the signals to RS232 levels (or connect to the - USB virtual COM port in the case of UART0). + transceiver to get the signals to RS-232 levels. The simplest options are + an expensive Arduino RS-232 shield or a Mikroe RS-232 Click board. STATUS: I have been unable to get the RS-232 Click to work in the mikroBUS - A slot. The PIC32MZ does not receive serial input. It appears that there - is an error in the some documentation: Either RG9 is not connect to + A slot. The PIC32MZ did not receive serial input. It appears that there + is an error in the some documentation: Either RG9 is not connected to UART4_RX or the PPS bit definitions are documented incorrectly for UART4. Switching to UART3 eliminates the problem and the serial console is fully - functional. + functional. I have not tried the other options of UART1, 2, or 5. SPI === -- GitLab From 9e4cd2f720db12f54dbbe72b92d73afcc34b1931 Mon Sep 17 00:00:00 2001 From: Alan Carvalho de Assis Date: Fri, 9 Feb 2018 13:00:20 -0600 Subject: [PATCH 189/228] arch/arm/src/xmc4/: Fix USIC_BRG_SCLKCFG definition --- arch/arm/src/xmc4/chip/xmc4_usic.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/arm/src/xmc4/chip/xmc4_usic.h b/arch/arm/src/xmc4/chip/xmc4_usic.h index 0ca992d548..af43e11f90 100644 --- a/arch/arm/src/xmc4/chip/xmc4_usic.h +++ b/arch/arm/src/xmc4/chip/xmc4_usic.h @@ -465,7 +465,12 @@ # define USIC_BRG_PDIV(n) ((uint32_t)(n) << USIC_BRG_PDIV_SHIFT) #define USIC_BRG_SCLKOSEL (1 << 28) /* Bit 28: Shift Clock Output Select */ #define USIC_BRG_MCLKCFG (1 << 29) /* Bit 29: Master Clock Configuration */ -#define USIC_BRG_SCLKCFG (1 << 30) /* Bit 30: Shift Clock Output Configuration */ +#define USIC_BRG_SCLKCFG_SHIFT 30 /* Bits 30-31: Shift Clock Output Configuration */ +#define USIC_BRG_SCLKCFG_MASK (3 << USIC_BRG_SCLKCFG_SHIFT) +# define USIC_BRG_SCLKCFG_NOINVNODLY (0 << USIC_BRG_SCLKCFG_SHIFT) /* No inverted signal and no delay */ +# define USIC_BRG_SCLKCFG_INVNODLY (1 << USIC_BRG_SCLKCFG_SHIFT) /* Inverted signal and no delay */ +# define USIC_BRG_SCLKCFG_NOINVDLY (2 << USIC_BRG_SCLKCFG_SHIFT) /* No inverted signal and 1/2 delay */ +# define USIC_BRG_SCLKCFG_INVDLY (3 << USIC_BRG_SCLKCFG_SHIFT) /* Inverted signal and 1/2 delay */ /* Interrupt Node Pointer Register */ -- GitLab From 642d7e3ce2997167809e571ad28d350307b7c45e Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 10 Feb 2018 09:43:12 -0600 Subject: [PATCH 190/228] Squashed commit of the following: configs/flipnclick-pic32mz: Add an nxlines configuration for use in testing the custom HiletGo Click board. arch/mips/src/pic32mz: Correct some SPI-related typos. configs/flipnclick-pic32mz: Finishes integration of HiletGo OLED. drivers/lcd: Finish support for HiletGo OLED. drivers/lcd: Add configuration support for HiletGo OLED. configs/flipnclick-pic32mz: Add board support for HiletGo OLED. --- arch/mips/src/pic32mz/chip/pic32mz-spi.h | 10 +- arch/mips/src/pic32mz/pic32mz-spi.h | 52 ++++++ configs/flipnclick-pic32mz/Kconfig | 29 ++- configs/flipnclick-pic32mz/README.txt | 48 +++++ configs/flipnclick-pic32mz/nxlines/defconfig | 62 +++++++ configs/flipnclick-pic32mz/src/Makefile | 4 + .../src/flipnclick-pic32mz.h | 99 ++++++++++ .../flipnclick-pic32mz/src/pic32mz_bringup.c | 9 + .../flipnclick-pic32mz/src/pic32mz_hiletgo.c | 172 ++++++++++++++++++ configs/flipnclick-pic32mz/src/pic32mz_spi.c | 128 +++++++++++-- drivers/lcd/Kconfig | 14 +- drivers/lcd/ssd1306.h | 10 +- libnx/nxfonts/.gitignore | 2 +- 13 files changed, 615 insertions(+), 24 deletions(-) create mode 100644 configs/flipnclick-pic32mz/nxlines/defconfig create mode 100644 configs/flipnclick-pic32mz/src/pic32mz_hiletgo.c diff --git a/arch/mips/src/pic32mz/chip/pic32mz-spi.h b/arch/mips/src/pic32mz/chip/pic32mz-spi.h index d4f5fe42a5..42d7fdf7a1 100644 --- a/arch/mips/src/pic32mz/chip/pic32mz-spi.h +++ b/arch/mips/src/pic32mz/chip/pic32mz-spi.h @@ -110,7 +110,7 @@ #define PIC32MZ_SPI1_CON2SET (PIC32MZ_SPI1_K1BASE+PIC32MZ_SPI_CON2SET_OFFSET) #define PIC32MZ_SPI1_CON2INV (PIC32MZ_SPI1_K1BASE+PIC32MZ_SPI_CON2INV_OFFSET) -#if PIC32MZ_NSPI > 1 +#if CHIP_NSPI > 1 # define PIC32MZ_SPI2_CON (PIC32MZ_SPI2_K1BASE+PIC32MZ_SPI_CON_OFFSET) # define PIC32MZ_SPI2_CONCLR (PIC32MZ_SPI2_K1BASE+PIC32MZ_SPI_CONCLR_OFFSET) # define PIC32MZ_SPI2_CONSET (PIC32MZ_SPI2_K1BASE+PIC32MZ_SPI_CONSET_OFFSET) @@ -128,7 +128,7 @@ # define PIC32MZ_SPI2_CON2INV (PIC32MZ_SPI2_K1BASE+PIC32MZ_SPI_CON2INV_OFFSET) #endif -#if PIC32MZ_NSPI > 2 +#if CHIP_NSPI > 2 # define PIC32MZ_SPI3_CON (PIC32MZ_SPI3_K1BASE+PIC32MZ_SPI_CON_OFFSET) # define PIC32MZ_SPI3_CONCLR (PIC32MZ_SPI3_K1BASE+PIC32MZ_SPI_CONCLR_OFFSET) # define PIC32MZ_SPI3_CONSET (PIC32MZ_SPI3_K1BASE+PIC32MZ_SPI_CONSET_OFFSET) @@ -145,7 +145,7 @@ # define PIC32MZ_SPI3_CON2INV (PIC32MZ_SPI3_K1BASE+PIC32MZ_SPI_CON2INV_OFFSET) #endif -#if PIC32MZ_NSPI > 3 +#if CHIP_NSPI > 3 # define PIC32MZ_SPI4_CON (PIC32MZ_SPI4_K1BASE+PIC32MZ_SPI_CON_OFFSET) # define PIC32MZ_SPI4_CONCLR (PIC32MZ_SPI4_K1BASE+PIC32MZ_SPI_CONCLR_OFFSET) # define PIC32MZ_SPI4_CONSET (PIC32MZ_SPI4_K1BASE+PIC32MZ_SPI_CONSET_OFFSET) @@ -162,7 +162,7 @@ # define PIC32MZ_SPI4_CON2INV (PIC32MZ_SPI4_K1BASE+PIC32MZ_SPI_CON2INV_OFFSET) #endif -#if PIC32MZ_NSPI > 4 +#if CHIP_NSPI > 4 # define PIC32MZ_SPI5_CON (PIC32MZ_SPI5_K1BASE+PIC32MZ_SPI_CON_OFFSET) # define PIC32MZ_SPI5_CONCLR (PIC32MZ_SPI5_K1BASE+PIC32MZ_SPI_CONCLR_OFFSET) # define PIC32MZ_SPI5_CONSET (PIC32MZ_SPI5_K1BASE+PIC32MZ_SPI_CONSET_OFFSET) @@ -179,7 +179,7 @@ # define PIC32MZ_SPI5_CON2INV (PIC32MZ_SPI5_K1BASE+PIC32MZ_SPI_CON2INV_OFFSET) #endif -#if PIC32MZ_NSPI > 5 +#if CHIP_NSPI > 5 # define PIC32MZ_SPI6_CON (PIC32MZ_SPI6_K1BASE+PIC32MZ_SPI_CON_OFFSET) # define PIC32MZ_SPI6_CONCLR (PIC32MZ_SPI6_K1BASE+PIC32MZ_SPI_CONCLR_OFFSET) # define PIC32MZ_SPI6_CONSET (PIC32MZ_SPI6_K1BASE+PIC32MZ_SPI_CONSET_OFFSET) diff --git a/arch/mips/src/pic32mz/pic32mz-spi.h b/arch/mips/src/pic32mz/pic32mz-spi.h index 4770661d3f..e8a11d3f04 100644 --- a/arch/mips/src/pic32mz/pic32mz-spi.h +++ b/arch/mips/src/pic32mz/pic32mz-spi.h @@ -170,6 +170,58 @@ int pic32mz_spi6cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd); #endif #endif +/**************************************************************************** + * Name: pic32mz_spi1/2/...register + * + * Description: + * If the board supports a card detect callback to inform the SPI-based + * MMC/SD driver when an SD card is inserted or removed, then + * CONFIG_SPI_CALLBACK should be defined and the following function(s) + * must be implemented. These functions implements the registercallback + * method of the SPI interface (see include/nuttx/spi/spi.h for details) + * + * Input Parameters: + * dev - Device-specific state data + * callback - The function to call on the media change + * arg - A caller provided value to return with the callback + * + * Returned Value: + * 0 on success; negated errno on failure. + * + ****************************************************************************/ + +#ifdef CONFIG_SPI_CALLBACK +#ifdef CONFIG_PIC32MZ_SPI1 +int pic32mz_spi1register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, + FAR void *arg); +#endif + +#ifdef CONFIG_PIC32MZ_SPI2 +int pic32mz_spi2register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, + FAR void *arg); +#endif + +#ifdef CONFIG_PIC32MZ_SPI3 +int pic32mz_spi3register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, + FAR void *arg); +#endif + +#ifdef CONFIG_PIC32MZ_SPI4 +int pic32mz_spi4register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, + FAR void *arg); +#endif + +#ifdef CONFIG_PIC32MZ_SPI5 +int pic32mz_spi5register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, + FAR void *arg); +#endif + +#ifdef CONFIG_PIC32MZ_SPI6 +int pic32mz_spi6register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, + FAR void *arg); +#endif +#endif /* CONFIG_SPI_CALLBACK */ + #undef EXTERN #if defined(__cplusplus) } diff --git a/configs/flipnclick-pic32mz/Kconfig b/configs/flipnclick-pic32mz/Kconfig index 109d9a47f3..072527993f 100644 --- a/configs/flipnclick-pic32mz/Kconfig +++ b/configs/flipnclick-pic32mz/Kconfig @@ -4,4 +4,31 @@ # if ARCH_BOARD_FLIPNCLICK_PIC32MZ -endif + + +config FLIPNCLICK_PIC32MZ_HILETGO + bool "HiletGo Click Present" + default n + depends on LCD_HILETGO + select NXSTART_EXTERNINIT if NX + +choice + prompt "HiletGo mikroBUS" + default FLIPNCLICK_PIC32MZ_HILETGO_MBA + depends on FLIPNCLICK_PIC32MZ_HILETGO + +config FLIPNCLICK_PIC32MZ_HILETGO_MBA + bool "mikroBUS A" + +config FLIPNCLICK_PIC32MZ_HILETGO_MBB + bool "mikroBUS B" + +config FLIPNCLICK_PIC32MZ_HILETGO_MBC + bool "mikroBUS C" + +config FLIPNCLICK_PIC32MZ_HILETGO_MBD + bool "mikroBUS D" + +endchoice # HiletGo mikroBUS + +endif # ARCH_BOARD_FLIPNCLICK_PIC32MZ diff --git a/configs/flipnclick-pic32mz/README.txt b/configs/flipnclick-pic32mz/README.txt index 52a3c0a33e..913235f3c5 100644 --- a/configs/flipnclick-pic32mz/README.txt +++ b/configs/flipnclick-pic32mz/README.txt @@ -17,6 +17,7 @@ Contents Serial Console SPI LEDs + HiletGo OLED Configurations Port Status @@ -309,6 +310,30 @@ LEDs and Buttons The switches have external pull-up resistors. The switches are pulled high (+3.3V) and grounded when pressed. +HiletGo OLED +============ + + Hardware + -------- + The HiletGo is a 128x64 OLED that can be driven either via SPI or I2C (SPI + is the default and is what is used here). I have mounted the OLED on a + proto click board. The OLED is connected as follows: + + OLED ALIAS DESCRIPTION PROTO CLICK + ----- ----------- ------------- ----------------- + GND Ground GND + VCC Power Supply 5V (3-5V) + D0 SCL,CLK,SCK Clock SCK + D1 SDA,MOSI Data MOSI,SDI + RES RST,RESET Reset RST (GPIO OUTPUT) + DC AO Data/Command INT (GPIO OUTPUT) + CS Chip Select CS (GPIO OUTPUT) + + NOTE that this is a write-only display (MOSI only)! + + Configuration + ------------- + Configurations ============== @@ -374,3 +399,26 @@ Where is one of the following: CONFIG_PIC32MZ_DEBUGGER_ENABLE=n : Debugger is disabled CONFIG_PIC32MZ_TRACE_ENABLE=n : Trace is disabled CONFIG_PIC32MZ_JTAG_ENABLE=n : JTAG is disabled + + nxlines + + This is an NSH configuration that supports the NX graphics example at + apps/examples/nxlines as a built-in application. + + NOTES: + + 1. This configuration derives from the nsh configuration. All of the + notes there apply here as well. + + 2. The default configuration assumes there is the custom HiletGo OLED + in the mikroBUS A slot (and a Mikroe RS-232 Click card in the + mikroBUS B slot). That is easily changed by reconfiguring, however. + See the section entitled "HiletGo OLED" for information about this + custom click card. + + STATUS: + + 2018-02-10: The debug output indicates that the nxlines example is + running with no errors, however, nothing appears on the OLED display. + This suggests either a problem with the pin configuration or else I + have bungled the wiring of the custom card. diff --git a/configs/flipnclick-pic32mz/nxlines/defconfig b/configs/flipnclick-pic32mz/nxlines/defconfig new file mode 100644 index 0000000000..647db81d0b --- /dev/null +++ b/configs/flipnclick-pic32mz/nxlines/defconfig @@ -0,0 +1,62 @@ +# CONFIG_ARCH_RAMFUNCS is not set +# CONFIG_NX_DISABLE_1BPP is not set +# CONFIG_PIC32MZ_DEBUGGER_ENABLE is not set +# CONFIG_PIC32MZ_TRACE_ENABLE is not set +CONFIG_ARCH_BOARD_FLIPNCLICK_PIC32MZ=y +CONFIG_ARCH_BOARD="flipnclick-pic32mz" +CONFIG_ARCH_CHIP_PIC32MZ=y +CONFIG_ARCH_CHIP_PIC32MZ2048EFH=y +CONFIG_ARCH_CHIP_PIC32MZEF=y +CONFIG_ARCH_MIPS=y +CONFIG_ARCH_STACKDUMP=y +CONFIG_ARCH="mips" +CONFIG_BOARD_LOOPSPERMSEC=7245 +CONFIG_BUILTIN=y +CONFIG_EXAMPLES_NSH=y +CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=4 +CONFIG_EXAMPLES_NXLINES_BPP=1 +CONFIG_EXAMPLES_NXLINES_LINEWIDTH=4 +CONFIG_EXAMPLES_NXLINES=y +CONFIG_FLIPNCLICK_PIC32MZ_HILETGO=y +CONFIG_FS_PROCFS=y +CONFIG_HOST_WINDOWS=y +CONFIG_IDLETHREAD_STACKSIZE=2048 +CONFIG_INTELHEX_BINARY=y +CONFIG_LCD_HILETGO=y +CONFIG_LCD_MAXCONTRAST=255 +CONFIG_LCD=y +CONFIG_MAX_TASKS=16 +CONFIG_MAX_WDOGPARMS=2 +CONFIG_MIPS_MICROMIPS=y +CONFIG_MIPS32_TOOLCHAIN_PINGUINOW=y +CONFIG_MMCSD=y +CONFIG_MQ_MAXMSGSIZE=64 +CONFIG_MTD=y +CONFIG_NFILE_DESCRIPTORS=8 +CONFIG_NFILE_STREAMS=8 +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_DISABLE_IFUPDOWN=y +CONFIG_NSH_FILEIOSIZE=512 +CONFIG_NSH_LINELEN=64 +CONFIG_NSH_READLINE=y +CONFIG_NX_BLOCKING=y +CONFIG_NX=y +CONFIG_NXFONT_TOM_THUMB_4X6=y +CONFIG_NXTK_BORDERWIDTH=2 +CONFIG_PIC32MZ_ICESEL_CH2=y +CONFIG_PIC32MZ_SPI2=y +CONFIG_PIC32MZ_UART3=y +CONFIG_PREALLOC_MQ_MSGS=8 +CONFIG_PREALLOC_TIMERS=4 +CONFIG_PREALLOC_WDOGS=8 +CONFIG_RAM_SIZE=131072 +CONFIG_RAM_START=0xa0000000 +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_WAITPID=y +CONFIG_SDCLONE_DISABLE=y +CONFIG_START_DAY=10 +CONFIG_START_MONTH=2 +CONFIG_UART3_SERIAL_CONSOLE=y +CONFIG_USER_ENTRYPOINT="nsh_main" +CONFIG_WDOG_INTRESERVE=1 diff --git a/configs/flipnclick-pic32mz/src/Makefile b/configs/flipnclick-pic32mz/src/Makefile index c8226dc95e..646415e87c 100644 --- a/configs/flipnclick-pic32mz/src/Makefile +++ b/configs/flipnclick-pic32mz/src/Makefile @@ -50,4 +50,8 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += pic32mz_buttons.c endif +ifeq ($(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO),y) +CSRCS += pic32mz_hiletgo.c +endif + include $(TOPDIR)/configs/Board.mk diff --git a/configs/flipnclick-pic32mz/src/flipnclick-pic32mz.h b/configs/flipnclick-pic32mz/src/flipnclick-pic32mz.h index ec514893eb..59e58a5c65 100644 --- a/configs/flipnclick-pic32mz/src/flipnclick-pic32mz.h +++ b/configs/flipnclick-pic32mz/src/flipnclick-pic32mz.h @@ -48,6 +48,18 @@ ****************************************************************************/ /* Configuration ************************************************************/ +#define HAVE_HILETGO 1 + +/* The HiletGo LCD must be selected, installed on the Flip&Click, and must + * be configured to use the SPI interface. + */ + +#if !defined(CONFIG_LCD_HILETGO) || \ + !defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO) || \ + !defined(CONFIG_LCD_SSD1306_SPI) +# undef HAVE_HILETGO +#endif + /* LEDs *********************************************************************/ /* There are four LEDs on the top, red side of the board. Only one can be * controlled by software: @@ -126,6 +138,78 @@ #define GPIO_MBC_CS (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORTD | GPIO_PIN12) #define GPIO_MBD_CS (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORTD | GPIO_PIN13) +/* HiletGo OLED + * + * The HiletGo is a 128x64 OLED that can be driven either via SPI or I2C (SPI + * is the default and is what is used here). I have mounted the OLED on a + * proto click board. The OLED is connected as follows: + * + * OLED ALIAS DESCRIPTION PROTO CLICK + * ----- ----------- ------------- ----------------- + * GND Ground GND + * VCC Power Supply 5V (3-5V) + * D0 SCL,CLK,SCK Clock SCK + * D1 SDA,MOSI Data MOSI,SDI + * RES RST,RESET Reset RST (GPIO OUTPUT) + * DC AO Data/Command INT (GPIO OUTPUT) + * CS Chip Select CS (GPIO OUTPUT) + * + * NOTE that this is a write-only display (MOSI only)! + * + * MikroBUS A: MikroBUS B: + * Pin Board Signal PIC32MZ Pin Board Signal PIC32MZ + * ---- ------------ ------- ---- ------------ ------- + * RST RST4 RE2 RST RST3 RG13 + * DC INT4 RD9 DC INT3 RG1 + * + * MikroBUS C: MikroBUS D: + * Pin Board Signal PIC32MZ Pin Board Signal PIC32MZ + * ---- ------------ ------- ---- ------------ ------- + * RST RST1 RG14 RST RST2 RG12 + * DC INT1 RD5 DC INT2 RD4 + */ + +#if defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBA) +# ifndef CONFIG_PIC32MZ_SPI2 +# error "The OLED driver requires CONFIG_PIC32MZ_SPI2 in the configuration" +# endif + +# define HILETGO_SPI_BUS 2 +# define GPIO_HILETGO_CS GPIO_MBA_CS +# define GPIO_HILETGO_RST (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTE | GPIO_PIN2) +# define GPIO_HILETGO_DC (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTD | GPIO_PIN9) + +#elif defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBB) +# ifndef CONFIG_PIC32MZ_SPI2 +# error "The OLED driver requires CONFIG_PIC32MZ_SPI2 in the configuration" +# endif + +# define HILETGO_SPI_BUS 2 +# define GPIO_HILETGO_CS GPIO_MBB_CS +# define GPIO_HILETGO_RST (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTG | GPIO_PIN13) +# define GPIO_HILETGO_DC (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTG | GPIO_PIN1) + +#elif defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBC) +# ifndef CONFIG_PIC32MZ_SPI1 +# error "The OLED driver requires CONFIG_PIC32MZ_SPI1 in the configuration" +# endif + +# define HILETGO_SPI_BUS 1 +# define GPIO_HILETGO_CS GPIO_MBC_CS +# define GPIO_HILETGO_RST (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTG | GPIO_PIN14) +# define GPIO_HILETGO_DC (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTD | GPIO_PIN5) + +#elif defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBD) +# ifndef CONFIG_PIC32MZ_SPI1 +# error "The OLED driver requires CONFIG_PIC32MZ_SPI1 in the configuration" +# endif + +# define HILETGO_SPI_BUS 1 +# define GPIO_HILETGO_CS GPIO_MBD_CS +# define GPIO_HILETGO_RST (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTG | GPIO_PIN12) +# define GPIO_HILETGO_DC (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTD | GPIO_PIN4) +#endif + /**************************************************************************** * Public Types ****************************************************************************/ @@ -182,6 +266,21 @@ void pic32mz_led_initialize(void); int pic32mz_bringup(void); +/**************************************************************************** + * Name: pic32mz_graphics_setup + * + * Description: + * Called by either NX initialization logic (via board_graphics_setup) or + * directly from the board bring-up logic in order to configure the + * HiletGo OLED. + * + ****************************************************************************/ + +#ifdef HAVE_HILETGO +struct lcd_dev_s; /* Forward reference3 */ +FAR struct lcd_dev_s *pic32mz_graphics_setup(unsigned int devno); +#endif + #undef EXTERN #ifdef __cplusplus } diff --git a/configs/flipnclick-pic32mz/src/pic32mz_bringup.c b/configs/flipnclick-pic32mz/src/pic32mz_bringup.c index 68247177b3..0837956dd5 100644 --- a/configs/flipnclick-pic32mz/src/pic32mz_bringup.c +++ b/configs/flipnclick-pic32mz/src/pic32mz_bringup.c @@ -72,6 +72,15 @@ int pic32mz_bringup(void) } #endif +#if defined(HAVE_HILETGO) && !defined(CONFIG_NXSTART_EXTERNINIT) + /* Configure the HiletGo OLED */ + + if (pic32mz_graphics_setup(0) == NULL) + { + syslog(LOG_ERR,"ERROR: Failed to configure the HiletGo OLEDn"); + } +#endif + UNUSED(ret); return OK; } diff --git a/configs/flipnclick-pic32mz/src/pic32mz_hiletgo.c b/configs/flipnclick-pic32mz/src/pic32mz_hiletgo.c new file mode 100644 index 0000000000..24e10f889c --- /dev/null +++ b/configs/flipnclick-pic32mz/src/pic32mz_hiletgo.c @@ -0,0 +1,172 @@ +/**************************************************************************** + * config/flipnclick-pic32mz/src/pic32mz_hiletgo.c + * + * Copyright (C) 2018 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/* HiletGo OLED + * + * The HiletGo is a 128x64 OLED that can be driven either via SPI or I2C (SPI + * is the default and is what is used here). I have mounted the OLED on a + * proto click board. The OLED is connected as follows: + * + * OLED ALIAS DESCRIPTION PROTO CLICK + * ----- ----------- ------------- ----------------- + * GND Ground GND + * VCC Power Supply 5V (3-5V) + * D0 SCL,CLK,SCK Clock SCK + * D1 SDA,MOSI Data MOSI,SDI + * RES RST,RESET Reset RST (GPIO OUTPUT) + * DC AO Data/Command INT (GPIO OUTPUT) + * CS Chip Select CS (GPIO OUTPUT) + */ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include + +#include +#include +#include +#include + +#if defined(CONFIG_VIDEO_FB) && defined(CONFIG_LCD_FRAMEBUFFER) +# include +#endif + +#include "pic32mz-gpio.h" +#include "pic32mz-spi.h" + +#include "flipnclick-pic32mz.h" + +#ifdef HAVE_HILETGO + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ +/* Configuration ************************************************************/ + +#ifndef CONFIG_SPI_CMDDATA +# error "The OLED driver requires CONFIG_SPI_CMDDATA in the configuration" +#endif + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: pic32mz_graphics_setup + * + * Description: + * Called by either NX initialization logic (via board_graphics_setup) or + * directly from the board bring-up logic in order to configure the + * HiletGo OLED. + * + ****************************************************************************/ + +FAR struct lcd_dev_s *pic32mz_graphics_setup(unsigned int devno) +{ + FAR struct spi_dev_s *spi; + FAR struct lcd_dev_s *dev; + + /* Configure the OLED GPIOs. This initial configuration is RESET low, + * putting the OLED into reset state. + */ + + (void)pic32mz_configgpio(GPIO_HILETGO_RST); + + /* Wait a bit then release the OLED from the reset state */ + + up_mdelay(20); + pic32mz_gpiowrite(GPIO_HILETGO_RST, true); + + /* Get the SPI1 port interface */ + + spi = pic32mz_spibus_initialize(HILETGO_SPI_BUS); + if (!spi) + { + lcderr("ERROR: Failed to initialize SPI port 1\n"); + } + else + { + /* Bind the SPI port to the OLED */ + + dev = ssd1306_initialize(spi, NULL, devno); + if (!dev) + { + lcderr("ERROR: Failed to bind SPI port 1 to OLED %d: %d\n", devno); + } + else + { + lcdinfo("Bound SPI port 1 to OLED %d\n", devno); + + /* And turn the OLED on */ + + (void)dev->setpower(dev, CONFIG_LCD_MAXPOWER); + +#if defined(CONFIG_VIDEO_FB) && defined(CONFIG_LCD_FRAMEBUFFER) + /* Initialize and register the simulated framebuffer driver */ + + ret = fb_register(0, 0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: fb_register() failed: %d\n", ret); + } +#endif + + return dev; + } + } + + return NULL; +} + +/**************************************************************************** + * Name: board_graphics_setup + * + * Description: + * Called by NX initialization logic to configure the OLED. + * + ****************************************************************************/ + +#ifdef CONFIG_NXSTART_EXTERNINIT +FAR struct lcd_dev_s *board_graphics_setup(unsigned int devno) +{ + return pic32mz_graphics_setup(devno); +} +#endif + +#endif /* HAVE_HILETGO */ diff --git a/configs/flipnclick-pic32mz/src/pic32mz_spi.c b/configs/flipnclick-pic32mz/src/pic32mz_spi.c index c1387b8054..765535f897 100644 --- a/configs/flipnclick-pic32mz/src/pic32mz_spi.c +++ b/configs/flipnclick-pic32mz/src/pic32mz_spi.c @@ -43,9 +43,12 @@ #include #include +#include + #include #include "up_arch.h" +#include "pic32mz-gpio.h" #include "flipnclick-pic32mz.h" @@ -67,7 +70,10 @@ void weak_function pic32mz_spidev_initialize(void) { /* Configure the SPI chip select GPIOs */ -#warning "Missing logic" +#ifdef CONFIG_LCD_HILETGO + (void)pic32mz_configgpio(GPIO_HILETGO_CS); + (void)pic32mz_configgpio(GPIO_HILETGO_DC); +#endif } /************************************************************************************ @@ -104,19 +110,32 @@ struct spi_dev_s; void pic32mz_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) { spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); -#warning "Missing logic" + +#if defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBA) || \ + defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBB) + if (devid == SPIDEV_DISPLAY(0)) + { + pic32mz_gpiowrite(GPIO_HILETGO_CS, !selected); + } +#endif } uint8_t pic32mz_spi1status(FAR struct spi_dev_s *dev, uint32_t devid) { spiinfo("Returning nothing\n"); -#warning "Missing logic" return 0; } #ifdef CONFIG_SPI_CMDDATA int pic32mz_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) { -#warning "Missing logic" +#if defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBA) || \ + defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBB) + if (devid == SPIDEV_DISPLAY(0)) + { + pic32mz_gpiowrite(GPIO_HILETGO_CS, !cmd); + } +#endif + return 0; } #endif @@ -126,19 +145,31 @@ int pic32mz_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) void pic32mz_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) { spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); -#warning "Missing logic" + +#if defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBC) || \ + defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBD) + if (devid == SPIDEV_DISPLAY(0)) + { + pic32mz_gpiowrite(GPIO_HILETGO_CS, !selected); + } +#endif } uint8_t pic32mz_spi2status(FAR struct spi_dev_s *dev, uint32_t devid) { spiinfo("Returning nothing\n"); -#warning "Missing logic" return 0; } #ifdef CONFIG_SPI_CMDDATA int pic32mz_spi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) { -#warning "Missing logic" +#if defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBC) || \ + defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBD) + if (devid == SPIDEV_DISPLAY(0)) + { + pic32mz_gpiowrite(GPIO_HILETGO_CS, !cmd); + } +#endif return 0; } #endif @@ -148,19 +179,16 @@ int pic32mz_spi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) void pic32mz_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) { spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); -#warning "Missing logic" } uint8_t pic32mz_spi3status(FAR struct spi_dev_s *dev, uint32_t devid) { spiinfo("Returning nothing\n"); -#warning "Missing logic" return 0; } #ifdef CONFIG_SPI_CMDDATA int pic32mz_spi3cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) { -#warning "Missing logic" return 0; } #endif @@ -170,19 +198,16 @@ int pic32mz_spi3cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) void pic32mz_spi4select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) { spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); -#warning "Missing logic" } uint8_t pic32mz_spi4status(FAR struct spi_dev_s *dev, uint32_t devid) { spiinfo("Returning nothing\n"); -#warning "Missing logic" return 0; } #ifdef CONFIG_SPI_CMDDATA int pic32mz_spi4cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) { -#warning "Missing logic" return 0; } #endif @@ -192,7 +217,6 @@ int pic32mz_spi4cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) void pic32mz_spi5select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) { spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); -#warning "Missing logic" } uint8_t pic32mz_spi5status(FAR struct spi_dev_s *dev, uint32_t devid) @@ -232,4 +256,80 @@ int pic32mz_spi6cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) #endif #endif +/**************************************************************************** + * Name: pic32mz_spi1/2/...register + * + * Description: + * If the board supports a card detect callback to inform the SPI-based + * MMC/SD driver when an SD card is inserted or removed, then + * CONFIG_SPI_CALLBACK should be defined and the following function(s) + * must be implemented. These functions implements the registercallback + * method of the SPI interface (see include/nuttx/spi/spi.h for details) + * + * Input Parameters: + * dev - Device-specific state data + * callback - The function to call on the media change + * arg - A caller provided value to return with the callback + * + * Returned Value: + * 0 on success; negated errno on failure. + * + ****************************************************************************/ + +#ifdef CONFIG_SPI_CALLBACK +#ifdef CONFIG_PIC32MZ_SPI1 +int pic32mz_spi1register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, + FAR void *arg) +{ +#warning Missing logic + return -ENOSYS; +} +#endif + +#ifdef CONFIG_PIC32MZ_SPI2 +int pic32mz_spi2register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, + FAR void *arg) +{ +#warning Missing logic + return -ENOSYS; +} +#endif + +#ifdef CONFIG_PIC32MZ_SPI3 +int pic32mz_spi3register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, + FAR void *arg) +{ +#warning Missing logic + return -ENOSYS; +} +#endif + +#ifdef CONFIG_PIC32MZ_SPI4 +int pic32mz_spi4register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, + FAR void *arg) +{ +#warning Missing logic + return -ENOSYS; +} +#endif + +#ifdef CONFIG_PIC32MZ_SPI5 +int pic32mz_spi5register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, + FAR void *arg) +{ +#warning Missing logic + return -ENOSYS; +} +#endif + +#ifdef CONFIG_PIC32MZ_SPI6 +int pic32mz_spi6register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, + FAR void *arg) +{ +#warning Missing logic + return -ENOSYS; +} +#endif +#endif /* CONFIG_SPI_CALLBACK */ + #endif /* CONFIG_PIC32MZ_SPI */ diff --git a/drivers/lcd/Kconfig b/drivers/lcd/Kconfig index 3cb4769d14..279bf9dfe1 100644 --- a/drivers/lcd/Kconfig +++ b/drivers/lcd/Kconfig @@ -395,7 +395,6 @@ config LCD_UG2864HSWEG01 config LCD_UG2832HSWEG04 bool "UG-2832HSWEG04 OLED Display Module (SSD1306)" default n - depends on !LCD_UG2864HSWEG01 select LCD_SSD1306 ---help--- OLED Display Module, UG-UG2832HSWEG04, Univision Technology Inc @@ -412,7 +411,6 @@ config LCD_UG2832HSWEG04 config LCD_DD12864WO4A bool "DD-12864WO-4A OLED Display Module" default n - depends on !LCD_UG2864HSWEG01 && !LCD_UG2832HSWEG04 select LCD_SSD1306 select SPI_CMDDATA ---help--- @@ -427,6 +425,18 @@ config LCD_DD12864WO4A Required SPI driver settings: SPI_CMDDATA - Include support for cmd/data selection. +config LCD_HILETGO + bool "HiletGO 128x64 OLED" + default n + select LCD_SSD1306 + select SPI_CMDDATA + ---help--- + HiletGo 129x64 OLED Display Module, featuring an SSD1306. + + Required LCD driver settings: + LCD_MAXCONTRAST should be 255, but any value >0 and <=255 will be accepted. + LCD_MAXPOWER should be 1: 0=off, 1=on + config LCD_SSD1306 bool diff --git a/drivers/lcd/ssd1306.h b/drivers/lcd/ssd1306.h index 415f0cf949..105e84d098 100644 --- a/drivers/lcd/ssd1306.h +++ b/drivers/lcd/ssd1306.h @@ -65,7 +65,8 @@ #endif #if !defined(CONFIG_LCD_SH1106_OLED_132) && !defined(CONFIG_LCD_UG2864HSWEG01) && \ - !defined(CONFIG_LCD_UG2832HSWEG04) && !defined(CONFIG_LCD_DD12864WO4A) + !defined(CONFIG_LCD_UG2832HSWEG04) && !defined(CONFIG_LCD_DD12864WO4A) && \ + !defined(CONFIG_LCD_HILETGO) # error "Unknown and unsupported SSD1306 LCD" #endif @@ -171,6 +172,13 @@ # define SSD1306_DEV_PAGES 8 /* 8 pages */ # define SSD1306_DEV_CMNPAD 0x12 /* COM configuration */ # undef IS_SSD1309 +#elif defined(CONFIG_LCD_HILETGO) +# define SSD1306_DEV_NATIVE_XRES 128 /* Only 128 of 132 columns supported */ +# define SSD1306_DEV_NATIVE_YRES 64 /* 8 pages each 8 rows */ +# define SSD1306_DEV_XOFFSET 0 /* Offset to logical column 0 */ +# define SSD1306_DEV_PAGES 8 /* 8 pages */ +# define SSD1306_DEV_CMNPAD 0x12 /* COM configuration */ +# undef IS_SSD1309 #elif defined(CONFIG_LCD_DD12864WO4A) # define SSD1306_DEV_NATIVE_XRES 128 /* 128 of 128 columns used */ # define SSD1306_DEV_NATIVE_YRES 64 /* 8 pages each 8 rows */ diff --git a/libnx/nxfonts/.gitignore b/libnx/nxfonts/.gitignore index 707a097d91..9046607726 100644 --- a/libnx/nxfonts/.gitignore +++ b/libnx/nxfonts/.gitignore @@ -1,4 +1,4 @@ nxfonts_convert_*bpp.c nxfonts_bitmaps_*.c - +nxfonts_tom-thumb-4x6.c -- GitLab From dd56cc87bee94a54e8afa7c8330196cb1e1f45f7 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 10 Feb 2018 11:45:12 -0600 Subject: [PATCH 191/228] configs/flipnclick-pic32mz: Fix some SPI bus confusion; update README. --- configs/flipnclick-pic32mz/README.txt | 20 ++++++--- configs/flipnclick-pic32mz/src/pic32mz_spi.c | 44 ++++++++++---------- 2 files changed, 36 insertions(+), 28 deletions(-) diff --git a/configs/flipnclick-pic32mz/README.txt b/configs/flipnclick-pic32mz/README.txt index 913235f3c5..e23cb11f4a 100644 --- a/configs/flipnclick-pic32mz/README.txt +++ b/configs/flipnclick-pic32mz/README.txt @@ -30,10 +30,17 @@ Port Status point, I have not even figured out how I am going to load and debug new firmware. 2018-02-08: I received a mikroProg PIC32 debugger (Thanks go to John Legg - of the Debug Shop!). At this point I have loaded code and can see the - NSH prompt coming from the Flip&Click connect via an RS-232 Click board - in mikroBUS slot A. But there is no response to serial input to the - board. Sounds like a pin configuration issue. + of the Debug Shop!). + 2018-02-09: The NSH configuration is now functional, but only with the + RS-232 Click in mikroBUS slot B. There is, apparently, some mis- + information about how UART4 RX is connected in mikroBUS slot A; I + cannot receive serial there. But life is good in slot B. + 2018-02-10: Added the nxlines configuration to test the custom HiletGo + OLED on a Click proto board. Debug output indicates that the example is + running error free yet nothing appears on the OLED in mikroBUS slot A. + It looks like all of the signals are present at the mikroBUS A slot and + the proto click ohms out okay so this must be a software driver issue. + Write only LCDs are tough to debug! On Board Debug Support ====================== @@ -420,5 +427,6 @@ Where is one of the following: 2018-02-10: The debug output indicates that the nxlines example is running with no errors, however, nothing appears on the OLED display. - This suggests either a problem with the pin configuration or else I - have bungled the wiring of the custom card. + It looks like all of the signals are present at the mikroBUS A slot and + the proto click ohms out okay so this must be a software driver issue. + Write only LCDs are tough to debug! diff --git a/configs/flipnclick-pic32mz/src/pic32mz_spi.c b/configs/flipnclick-pic32mz/src/pic32mz_spi.c index 765535f897..6a0dd95f6f 100644 --- a/configs/flipnclick-pic32mz/src/pic32mz_spi.c +++ b/configs/flipnclick-pic32mz/src/pic32mz_spi.c @@ -111,8 +111,8 @@ void pic32mz_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selecte { spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); -#if defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBA) || \ - defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBB) +#if defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBC) || \ + defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBD) if (devid == SPIDEV_DISPLAY(0)) { pic32mz_gpiowrite(GPIO_HILETGO_CS, !selected); @@ -128,26 +128,26 @@ uint8_t pic32mz_spi1status(FAR struct spi_dev_s *dev, uint32_t devid) #ifdef CONFIG_SPI_CMDDATA int pic32mz_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) { -#if defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBA) || \ - defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBB) +#if defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBC) || \ + defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBD) if (devid == SPIDEV_DISPLAY(0)) { - pic32mz_gpiowrite(GPIO_HILETGO_CS, !cmd); + pic32mz_gpiowrite(GPIO_HILETGO_DC, !cmd); } #endif return 0; } #endif -#endif +#endif /* CONFIG_PIC32MZ_SPI1 */ #ifdef CONFIG_PIC32MZ_SPI2 void pic32mz_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) { spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); -#if defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBC) || \ - defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBD) +#if defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBA) || \ + defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBB) if (devid == SPIDEV_DISPLAY(0)) { pic32mz_gpiowrite(GPIO_HILETGO_CS, !selected); @@ -163,17 +163,17 @@ uint8_t pic32mz_spi2status(FAR struct spi_dev_s *dev, uint32_t devid) #ifdef CONFIG_SPI_CMDDATA int pic32mz_spi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) { -#if defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBC) || \ - defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBD) +#if defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBA) || \ + defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBB) if (devid == SPIDEV_DISPLAY(0)) { - pic32mz_gpiowrite(GPIO_HILETGO_CS, !cmd); + pic32mz_gpiowrite(GPIO_HILETGO_DC, !cmd); } #endif return 0; } #endif -#endif +#endif /* CONFIG_PIC32MZ_SPI2 */ #ifdef CONFIG_PIC32MZ_SPI3 void pic32mz_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) @@ -192,7 +192,7 @@ int pic32mz_spi3cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) return 0; } #endif -#endif +#endif /* CONFIG_PIC32MZ_SPI3 */ #ifdef CONFIG_PIC32MZ_SPI4 void pic32mz_spi4select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) @@ -211,7 +211,7 @@ int pic32mz_spi4cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) return 0; } #endif -#endif +#endif /* CONFIG_PIC32MZ_SPI4 */ #ifdef CONFIG_PIC32MZ_SPI5 void pic32mz_spi5select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) @@ -232,7 +232,7 @@ int pic32mz_spi5cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) return 0; } #endif -#endif +#endif /* CONFIG_PIC32MZ_SPI5 */ #ifdef CONFIG_PIC32MZ_SPI6 void pic32mz_spi6select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) @@ -254,7 +254,7 @@ int pic32mz_spi6cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) return 0; } #endif -#endif +#endif /* CONFIG_PIC32MZ_SPI6 */ /**************************************************************************** * Name: pic32mz_spi1/2/...register @@ -284,7 +284,7 @@ int pic32mz_spi1register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, #warning Missing logic return -ENOSYS; } -#endif +#endif /* CONFIG_PIC32MZ_SPI1 */ #ifdef CONFIG_PIC32MZ_SPI2 int pic32mz_spi2register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, @@ -293,7 +293,7 @@ int pic32mz_spi2register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, #warning Missing logic return -ENOSYS; } -#endif +#endif /* CONFIG_PIC32MZ_SPI2 */ #ifdef CONFIG_PIC32MZ_SPI3 int pic32mz_spi3register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, @@ -302,7 +302,7 @@ int pic32mz_spi3register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, #warning Missing logic return -ENOSYS; } -#endif +#endif /* CONFIG_PIC32MZ_SPI3 */ #ifdef CONFIG_PIC32MZ_SPI4 int pic32mz_spi4register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, @@ -311,7 +311,7 @@ int pic32mz_spi4register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, #warning Missing logic return -ENOSYS; } -#endif +#endif /* CONFIG_PIC32MZ_SPI4 */ #ifdef CONFIG_PIC32MZ_SPI5 int pic32mz_spi5register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, @@ -320,7 +320,7 @@ int pic32mz_spi5register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, #warning Missing logic return -ENOSYS; } -#endif +#endif /* CONFIG_PIC32MZ_SPI5 */ #ifdef CONFIG_PIC32MZ_SPI6 int pic32mz_spi6register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, @@ -329,7 +329,7 @@ int pic32mz_spi6register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, #warning Missing logic return -ENOSYS; } -#endif +#endif /* CONFIG_PIC32MZ_SPI6 */ #endif /* CONFIG_SPI_CALLBACK */ #endif /* CONFIG_PIC32MZ_SPI */ -- GitLab From 8f8ee5009d6b10dc7ff75c9cdba2fcaca9d52485 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 10 Feb 2018 17:05:25 -0600 Subject: [PATCH 192/228] Update some C comments. --- configs/flipnclick-pic32mz/src/pic32mz_spi.c | 16 ++++++++++++++++ drivers/lcd/pcd8544.h | 1 - 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/configs/flipnclick-pic32mz/src/pic32mz_spi.c b/configs/flipnclick-pic32mz/src/pic32mz_spi.c index 6a0dd95f6f..cf9efb6a5f 100644 --- a/configs/flipnclick-pic32mz/src/pic32mz_spi.c +++ b/configs/flipnclick-pic32mz/src/pic32mz_spi.c @@ -115,6 +115,10 @@ void pic32mz_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selecte defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBD) if (devid == SPIDEV_DISPLAY(0)) { + /* Low: the display is selected + * High: the display is deselected + */ + pic32mz_gpiowrite(GPIO_HILETGO_CS, !selected); } #endif @@ -132,6 +136,10 @@ int pic32mz_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBD) if (devid == SPIDEV_DISPLAY(0)) { + /* High: the inputs are treated as display data. + * Low: the inputs are transferred to the command registers. + */ + pic32mz_gpiowrite(GPIO_HILETGO_DC, !cmd); } #endif @@ -150,6 +158,10 @@ void pic32mz_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selecte defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBB) if (devid == SPIDEV_DISPLAY(0)) { + /* Low: the display is selected + * High: the display is deselected + */ + pic32mz_gpiowrite(GPIO_HILETGO_CS, !selected); } #endif @@ -167,6 +179,10 @@ int pic32mz_spi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBB) if (devid == SPIDEV_DISPLAY(0)) { + /* High: the inputs are treated as display data. + * Low: the inputs are transferred to the command registers. + */ + pic32mz_gpiowrite(GPIO_HILETGO_DC, !cmd); } #endif diff --git a/drivers/lcd/pcd8544.h b/drivers/lcd/pcd8544.h index 9b03af9407..8bbf36c0e1 100644 --- a/drivers/lcd/pcd8544.h +++ b/drivers/lcd/pcd8544.h @@ -1,6 +1,5 @@ /************************************************************************************** * drivers/lcd/pcd8544.h - * * Definitions for the PCD8544 LCD Display * * Copyright (C) 2017 Alan Carvalho de Assis. All rights reserved. -- GitLab From db0510771183c7f3ab2f68307dc8e055ad2063e9 Mon Sep 17 00:00:00 2001 From: Matt Thompson Date: Sat, 10 Feb 2018 23:20:42 +0000 Subject: [PATCH 193/228] Merged in extent3d/nuttx/clockconfig (pull request #592) SAMDL: Added FDPLL clock support. Fixed sequence of OSC32K calibration setup * SAMDL: Added FDPLL clock support. Fixed sequence of OSC32K calibration setup * fixed code style Approved-by: Gregory Nutt --- arch/arm/src/samdl/samd_clockconfig.c | 107 +++++++++++++++++++++++++- 1 file changed, 105 insertions(+), 2 deletions(-) diff --git a/arch/arm/src/samdl/samd_clockconfig.c b/arch/arm/src/samdl/samd_clockconfig.c index a17c30235c..20aedae751 100644 --- a/arch/arm/src/samdl/samd_clockconfig.c +++ b/arch/arm/src/samdl/samd_clockconfig.c @@ -453,11 +453,10 @@ static inline void sam_osc32k_config(void) regval = getreg32(SYSCTRL_FUSES_OSC32KCAL_ADDR); calib = (regval & SYSCTRL_FUSES_OSC32KCAL_MASK) >> SYSCTRL_FUSES_OSC32KCAL_SHIFT; - regval = calib << SYSCTRL_OSC32K_CALIB_SHIFT; /* Configure OSC32K */ - regval |= BOARD_OSC32K_STARTUPTIME; + regval = BOARD_OSC32K_STARTUPTIME; #ifdef BOARD_OSC32K_EN1KHZ regval |= SYSCTRL_OSC32K_EN1K; @@ -481,6 +480,19 @@ static inline void sam_osc32k_config(void) regval |= SYSCTRL_OSC32K_ENABLE; putreg32(regval, SAM_SYSCTRL_OSC32K); + + /* From the datasheet on page 157: + * "When writing to the Calibration bits, the user must wait for the + * PCLKSR.OSC32KRDY bit to go high before the value is committed + * to the oscillator." + */ + + while ((getreg32(SAM_SYSCTRL_PCLKSR) & SYSCTRL_INT_OSC32KRDY) == 0); + + regval = getreg32(SAM_SYSCTRL_OSC32K); + regval |= calib << SYSCTRL_OSC32K_CALIB_SHIFT; + putreg32(regval, SAM_SYSCTRL_OSC32K); + } #else # define sam_osc32k_config() @@ -556,6 +568,91 @@ static inline void sam_osc8m_config(void) putreg32(regval, SAM_SYSCTRL_OSC8M); } +#ifdef BOARD_DPLL_ENABLE +static inline void sam_dpll_config(void) +{ + uint8_t ctrla; + uint32_t ctrlb; + uint32_t ratio; + + ctrla = SYSCTRL_DPLLCTRLA_ENABLE; /* Enable the FDPLL */ + ctrlb = 0; + ratio = 0; + +#ifdef BOARD_DPLL_RUNINSTANDBY + ctrla |= SYSCTRL_DPLLCTRLA_RUNSTDBY; /* Run in standby */ +#endif + +#ifdef BOARD_DPLL_ONDEMAND + ctrla |= SYSCTRL_DPLLCTRLA_ONDEMAND; /* On demand mode */ +#endif + +#ifdef BOARD_DPLL_DIV + ctrlb |= SYSCTRL_DPLLCTRLB_DIV(BOARD_DPLL_DIV); +#endif + +#ifdef BOARD_DPLL_LBYPASS + ctrlb |= SYSCTRL_DPLLCTRLB_LBYPASS; +#endif + +#ifdef BOARD_DPLL_LTIME + ctrlb |= BOARD_DPLL_LTIME; +#endif + +#ifdef BOARD_DPLL_REFCLK + ctrlb |= BOARD_DPLL_REFCLK; + ratio = SYSCTRL_DPLLRATIO_LDR(BOARD_DPLL_LDR); +#ifdef BOARD_DPLL_LDRFRAC + ratio |= SYSCTRL_DPLLRATIO_LDRFRAC(BOARD_DPLL_LDRFRAC); +#endif + + /* If a GCLK reference was requested, we must initialize the GCLK first */ + + if (BOARD_DPLL_REFCLK == SYSCTRL_DPLLCTRLB_REFCLK_GCLKDPLL) + { + putreg16(GCLK_CLKCTRL_ID_DPLL | GCLK_CLKCTRL_GEN(2) | GCLK_CLKCTRL_CLKEN, SAM_GCLK_CLKCTRL); + } + + putreg32(ratio, SAM_SYSCTRL_DPLLRATIO); +#else + + /* If no reference clock was specified, default to using + * the external 32KHz crystal and output of 96MHz + */ + + ctrlb |= SYSCTRL_DPLLCTRLB_REFCLK_XOSC32; + ratio = SYSCTRL_DPLLRATIO_LDR(3000); + putreg32(ratio, SAM_SYSCTRL_DPLLRATIO); +#endif + +#ifdef BOARD_DPLL_WUF + ctrlb |= BOARD_DPLL_WUF; +#endif + +#ifdef BOARD_DPLL_LPEN + ctrlb |= BOARD_DPLL_LPEN; +#endif + +#ifdef BOARD_DPLL_FILTER + ctrlb |= BOARD_DPLL_FILTER; +#endif + + /* Write Control B register */ + + putreg32(ctrlb, SAM_SYSCTRL_DPLLCTRLB); + + /* Write Control A register */ + + putreg8(ctrla, SAM_SYSCTRL_DPLLCTRLA); + + /* Wait for the DPLL to synchronize */ + + while ((getreg8(SAM_SYSCTRL_DPLLSTATUS) & SYSCTRL_DPLLSTATUS_CLKRDY) == 0); +} +#else +# define sam_dpll_config() +#endif + /**************************************************************************** * Name: sam_dfll_config * @@ -866,10 +963,12 @@ void sam_clockconfig(void) /* Configure XOSC */ + putreg16(0, SAM_SYSCTRL_XOSC); sam_xosc_config(); /* Configure XOSC32K */ + putreg16(0, SAM_SYSCTRL_XOSC32K); sam_xosc32k_config(); /* Configure OSCK32K */ @@ -884,6 +983,10 @@ void sam_clockconfig(void) sam_osc8m_config(); + /* Configure DPLL */ + + sam_dpll_config(); + /* Configure GCLK(s) */ sam_config_gclks(); -- GitLab From 399d59028f2f99565969f72242e7b5814b28bb6e Mon Sep 17 00:00:00 2001 From: Matt Thompson Date: Sat, 10 Feb 2018 23:24:06 +0000 Subject: [PATCH 194/228] Merged in extent3d/nuttx/eic-edge (pull request #593) SAMDL: Fix EIC interrupt edge sensitivity for pin numbers > 8 Approved-by: Gregory Nutt --- arch/arm/src/samdl/sam_eic.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/arch/arm/src/samdl/sam_eic.c b/arch/arm/src/samdl/sam_eic.c index ff73950cc0..95a20504cb 100644 --- a/arch/arm/src/samdl/sam_eic.c +++ b/arch/arm/src/samdl/sam_eic.c @@ -228,12 +228,36 @@ int sam_eic_config(uint8_t eirq, port_pinset_t pinset) else if (eirq < 16) { reg = SAM_EIC_CONFIG1; - val = EIC_CONFIG1_FILTEN(eirq) | EIC_CONFIG1_SENSE_FALL(eirq); + + val = EIC_CONFIG1_SENSE_BOTH(eirq); + if (pinset & PORT_INT_RISING) + { + val = EIC_CONFIG1_SENSE_RISE(eirq); + } + + if (pinset & PORT_INT_FALLING) + { + val = EIC_CONFIG1_SENSE_FALL(eirq); + } + + val |= EIC_CONFIG1_FILTEN(eirq); } else { reg = SAM_EIC_CONFIG2; - val = EIC_CONFIG2_FILTEN(eirq) | EIC_CONFIG2_SENSE_FALL(eirq); + + val = EIC_CONFIG2_SENSE_BOTH(eirq); + if (pinset & PORT_INT_RISING) + { + val = EIC_CONFIG2_SENSE_RISE(eirq); + } + + if (pinset & PORT_INT_FALLING) + { + val = EIC_CONFIG2_SENSE_FALL(eirq); + } + + val |= EIC_CONFIG2_FILTEN(eirq); } /* Write the new config to the CONFIGn register */ -- GitLab From 2bb5795e5443726e8446c8d3b575c1381b2e8b51 Mon Sep 17 00:00:00 2001 From: Matt Thompson Date: Sun, 11 Feb 2018 13:10:19 +0000 Subject: [PATCH 195/228] Merged in extent3d/nuttx/usb-calibration (pull request #594) SAMDL: Added loading factory USB calibration data from NVRAM Approved-by: Gregory Nutt --- arch/arm/src/samdl/sam_usb.c | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/arch/arm/src/samdl/sam_usb.c b/arch/arm/src/samdl/sam_usb.c index 2ed2fa2ff4..f1f2a7cd3d 100644 --- a/arch/arm/src/samdl/sam_usb.c +++ b/arch/arm/src/samdl/sam_usb.c @@ -107,17 +107,13 @@ #include "up_arch.h" #include "up_internal.h" -#if defined(CONFIG_ARCH_FAMILY_SAMD20) || defined(CONFIG_ARCH_FAMILY_SAMD21) - #include "samd_periphclks.h" -#elif defined(CONFIG_ARCH_FAMILY_SAML21) - #include "saml_periphclks.h" -#endif - #include "sam_gclk.h" #include "chip.h" #include "sam_port.h" #include "sam_pinmap.h" #include "sam_usb.h" +#include "sam_fuses.h" +#include "sam_periphclks.h" #if defined(CONFIG_USBHOST) && defined(CONFIG_SAMDL_USB) # error USBHOST mode not yet implemented! @@ -2476,8 +2472,6 @@ static void sam_ep0_dispatch(struct sam_usbdev_s *priv) static void sam_setdevaddr(struct sam_usbdev_s *priv, uint8_t address) { - uint32_t regval; - DEBUGASSERT(address <= 0x7f); if (address) { @@ -3435,6 +3429,8 @@ static int sam_usb_interrupt(int irq, void *context, void *arg) uwarn("WARNING: Unhandled_EP:0x%X\n", pendingep); } #endif + + return OK; } void up_usbuninitialize(void) @@ -3782,6 +3778,10 @@ static void sam_hw_setup(struct sam_usbdev_s *priv) uint16_t regval; uint32_t padcalib; + uint8_t calib_transn; + uint8_t calib_transp; + uint8_t calib_trim; + /* To use the USB, the programmer must first configure the USB clock * input, */ @@ -3792,11 +3792,21 @@ static void sam_hw_setup(struct sam_usbdev_s *priv) sam_ctrla_write(USB_CTRLA_SWRST); - /* TODO: load PAD calibration from NVM or ... - * now using default values - */ + /* Load USB factory calibration values from NVRAM */ + + calib_transn = getreg32(SYSCTRL_FUSES_USBTRANSN_ADDR) & + SYSCTRL_FUSES_USBTRANSN_MASK >> SYSCTRL_FUSES_USBTRANSN_SHIFT; + + calib_transp = getreg32(SYSCTRL_FUSES_USBTRANSP_ADDR) & + SYSCTRL_FUSES_USBTRANSP_MASK >> SYSCTRL_FUSES_USBTRANSP_SHIFT; + + calib_trim = getreg32(SYSCTRL_FUSES_USBTRIM_ADDR) & + SYSCTRL_FUSES_USBTRIM_MASK >> SYSCTRL_FUSES_USBTRIM_SHIFT; + + padcalib = USB_PADCAL_TRANSP(calib_transp) | + USB_PADCAL_TRANSN(calib_transn) | + USB_PADCAL_TRIM(calib_trim); - padcalib = USB_PADCAL_TRANSP(29) | USB_PADCAL_TRANSN(5) | USB_PADCAL_TRIM(3); sam_putreg32(padcalib, SAM_USB_PADCAL); /* set config @@ -3866,8 +3876,6 @@ static void sam_hw_setup(struct sam_usbdev_s *priv) static void sam_hw_shutdown(struct sam_usbdev_s *priv) { - uint16_t regval; - priv->usbdev.speed = USB_SPEED_UNKNOWN; /* Disable all interrupts */ -- GitLab From 118e97ff3709102ba3066c2d3c0ec714802b4035 Mon Sep 17 00:00:00 2001 From: Mateusz Szafoni Date: Sun, 11 Feb 2018 13:12:00 +0000 Subject: [PATCH 196/228] Merged in raiden00/nuttx (pull request #595) Master stm32_hritm: add interface to set timer frequency, fix slave timers reset configuration, change POWER_INFO to TIMER_INFO Approved-by: Gregory Nutt --- arch/arm/src/stm32/chip/stm32f33xxx_hrtim.h | 10 +- arch/arm/src/stm32/stm32_hrtim.c | 420 +++++++++++++++++--- arch/arm/src/stm32/stm32_hrtim.h | 100 +++-- drivers/power/powerled.c | 2 +- drivers/power/smps.c | 2 +- 5 files changed, 442 insertions(+), 92 deletions(-) diff --git a/arch/arm/src/stm32/chip/stm32f33xxx_hrtim.h b/arch/arm/src/stm32/chip/stm32f33xxx_hrtim.h index 32dff07659..0e8a707e8b 100644 --- a/arch/arm/src/stm32/chip/stm32f33xxx_hrtim.h +++ b/arch/arm/src/stm32/chip/stm32f33xxx_hrtim.h @@ -818,7 +818,7 @@ #define HRTIM_TIMARST_TIMCCMP4 (1 << 24) /* Bit 24 */ #define HRTIM_TIMARST_TIMDCMP1 (1 << 25) /* Bit 25 */ #define HRTIM_TIMARST_TIMDCMP2 (1 << 26) /* Bit 26 */ -#define HRTIM_TIMARST_TIMDCMP3 (1 << 27) /* Bit 27 */ +#define HRTIM_TIMARST_TIMDCMP4 (1 << 27) /* Bit 27 */ #define HRTIM_TIMARST_TIMECMP1 (1 << 28) /* Bit 28 */ #define HRTIM_TIMARST_TIMECMP2 (1 << 29) /* Bit 29 */ #define HRTIM_TIMARST_TIMECMP4 (1 << 30) /* Bit 30 */ @@ -849,7 +849,7 @@ #define HRTIM_TIMBRST_TIMCCMP4 (1 << 24) /* Bit 24 */ #define HRTIM_TIMBRST_TIMDCMP1 (1 << 25) /* Bit 25 */ #define HRTIM_TIMBRST_TIMDCMP2 (1 << 26) /* Bit 26 */ -#define HRTIM_TIMBRST_TIMDCMP3 (1 << 27) /* Bit 27 */ +#define HRTIM_TIMBRST_TIMDCMP4 (1 << 27) /* Bit 27 */ #define HRTIM_TIMBRST_TIMECMP1 (1 << 28) /* Bit 28 */ #define HRTIM_TIMBRST_TIMECMP2 (1 << 29) /* Bit 29 */ #define HRTIM_TIMBRST_TIMECMP4 (1 << 30) /* Bit 30 */ @@ -880,7 +880,7 @@ #define HRTIM_TIMCRST_TIMBCMP4 (1 << 24) /* Bit 24 */ #define HRTIM_TIMCRST_TIMDCMP1 (1 << 25) /* Bit 25 */ #define HRTIM_TIMCRST_TIMDCMP2 (1 << 26) /* Bit 26 */ -#define HRTIM_TIMCRST_TIMDCMP3 (1 << 27) /* Bit 27 */ +#define HRTIM_TIMCRST_TIMDCMP4 (1 << 27) /* Bit 27 */ #define HRTIM_TIMCRST_TIMECMP1 (1 << 28) /* Bit 28 */ #define HRTIM_TIMCRST_TIMECMP2 (1 << 29) /* Bit 29 */ #define HRTIM_TIMCRST_TIMECMP4 (1 << 30) /* Bit 30 */ @@ -911,7 +911,7 @@ #define HRTIM_TIMDRST_TIMBCMP4 (1 << 24) /* Bit 24 */ #define HRTIM_TIMDRST_TIMCCMP1 (1 << 25) /* Bit 25 */ #define HRTIM_TIMDRST_TIMCCMP2 (1 << 26) /* Bit 26 */ -#define HRTIM_TIMDRST_TIMCCMP3 (1 << 27) /* Bit 27 */ +#define HRTIM_TIMDRST_TIMCCMP4 (1 << 27) /* Bit 27 */ #define HRTIM_TIMDRST_TIMECMP1 (1 << 28) /* Bit 28 */ #define HRTIM_TIMDRST_TIMECMP2 (1 << 29) /* Bit 29 */ #define HRTIM_TIMDRST_TIMECMP4 (1 << 30) /* Bit 30 */ @@ -942,7 +942,7 @@ #define HRTIM_TIMERST_TIMBCMP4 (1 << 24) /* Bit 24 */ #define HRTIM_TIMERST_TIMCCMP1 (1 << 25) /* Bit 25 */ #define HRTIM_TIMERST_TIMCCMP2 (1 << 26) /* Bit 26 */ -#define HRTIM_TIMERST_TIMCCMP3 (1 << 27) /* Bit 27 */ +#define HRTIM_TIMERST_TIMCCMP4 (1 << 27) /* Bit 27 */ #define HRTIM_TIMERST_TIMDCMP1 (1 << 28) /* Bit 28 */ #define HRTIM_TIMERST_TIMDCMP2 (1 << 29) /* Bit 29 */ #define HRTIM_TIMERST_TIMDCMP4 (1 << 30) /* Bit 30 */ diff --git a/arch/arm/src/stm32/stm32_hrtim.c b/arch/arm/src/stm32/stm32_hrtim.c index a8069194bb..3f40ca0e8e 100644 --- a/arch/arm/src/stm32/stm32_hrtim.c +++ b/arch/arm/src/stm32/stm32_hrtim.c @@ -117,9 +117,10 @@ # endif #endif #if defined(CONFIG_STM32_HRTIM_INTERRUPTS) -#if !defined(CONFIG_STM32_HRTIM_TIMA_IRQ) && !defined(CONFIG_STM32_HRTIM_TIMB_IRQ) && \ - !defined(CONFIG_STM32_HRTIM_TIMC_IRQ) && !defined(CONFIG_STM32_HRTIM_TIMD_IRQ) && \ - !defined(CONFIG_STM32_HRTIM_TIME_IRQ) +#if !defined(CONFIG_STM32_HRTIM_MASTER_IRQ) && !defined(CONFIG_STM32_HRTIM_TIMA_IRQ) && \ + !defined(CONFIG_STM32_HRTIM_TIMB_IRQ) && !defined(CONFIG_STM32_HRTIM_TIMC_IRQ) && \ + !defined(CONFIG_STM32_HRTIM_TIMD_IRQ) && !defined(CONFIG_STM32_HRTIM_TIME_IRQ) && \ + !defined(CONFIG_STM32_HRTIM_COMMON_IRQ) # warning "CONFIG_STM32_HRTIM_INTERRUPTS enabled but no timer selected" # endif #endif @@ -224,17 +225,13 @@ # define HRTIM_HAVE_ADC_TRG4 #endif -#ifdef CONFIG_STM32_HRTIM_INTERRUPTS -# error HRTIM Interrupts not supported yet -#endif - /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ /* HRTIM default configuration **********************************************/ -#ifndef HRTIM_TIMER_MASTER +#ifndef HRTIM_MASTER_PRESCALER # warning "HRTIM_MASTER_PRESCALER is not set. Set the default value HRTIM_PRESCALER_2" # define HRTIM_MASTER_PRESCALER HRTIM_PRESCALER_2 #endif @@ -447,7 +444,7 @@ struct stm32_hrtim_slave_priv_s #endif #endif uint16_t update; /* Update configuration */ - uint32_t reset; /* Timer reset events */ + uint64_t reset; /* Timer reset events */ #ifdef CONFIG_STM32_HRTIM_PWM struct stm32_hrtim_pwm_s pwm; /* PWM configuration */ #endif @@ -636,7 +633,7 @@ static void hrtim_tim_putreg(FAR struct stm32_hrtim_s *priv, uint8_t timer, static void hrtim_tim_modifyreg(FAR struct stm32_hrtim_s *priv, uint8_t timer, uint32_t offset, uint32_t clrbits, uint32_t setbits); -#ifdef CONFIG_DEBUG_POWER_INFO +#ifdef CONFIG_DEBUG_TIMER_INFO static void hrtim_dumpregs(FAR struct stm32_hrtim_s *priv, uint8_t timer, FAR const char *msg); #else @@ -725,7 +722,8 @@ static int hrtim_eev_cfg(FAR struct stm32_hrtim_s *priv, uint8_t index); #endif #ifdef CONFIG_STM32_HRTIM_INTERRUPTS static int hrtim_irq_config(FAR struct stm32_hrtim_s *priv); -static void hrtim_irq_ack(FAR struct hrtim_dev_s *dev, uint8_t timer, int source); +static uint16_t hrtim_irq_get(FAR struct hrtim_dev_s *dev, uint8_t timer); +static int hrtim_irq_ack(FAR struct hrtim_dev_s *dev, uint8_t timer, int source); #endif static int hrtim_cmp_update(FAR struct hrtim_dev_s *dev, uint8_t timer, uint8_t index, uint16_t cmp); @@ -735,11 +733,14 @@ static uint16_t hrtim_per_get(FAR struct hrtim_dev_s *dev, uint8_t timer); static uint16_t hrtim_cmp_get(FAR struct hrtim_dev_s *dev, uint8_t timer, uint8_t index); static uint64_t hrtim_fclk_get(FAR struct hrtim_dev_s *dev, uint8_t timer); +static int hrtim_soft_update(FAR struct hrtim_dev_s *dev, uint8_t timer); +static int hrtim_tim_freq_set(FAR struct hrtim_dev_s *hrtim, uint8_t timer, + uint64_t freq); static int hrtim_tim_reset_set(FAR struct stm32_hrtim_s *priv, uint8_t timer, - uint32_t reset); + uint64_t reset); static int hrtim_reset_config(FAR struct stm32_hrtim_s *priv); static int hrtim_tim_update_set(FAR struct stm32_hrtim_s *priv, uint8_t timer, - uint32_t update); + uint16_t update); static int hrtim_update_config(FAR struct stm32_hrtim_s *priv); static void hrtim_tim_mode_set(FAR struct stm32_hrtim_s *priv, uint8_t timer, @@ -1526,7 +1527,7 @@ static struct stm32_hrtim_s g_hrtim1priv = #ifdef CONFIG_STM32_HRTIM_BURST .burst = &g_burst, #endif -#ifdef CONFIG_STM32_HRTIM_INTERRUPTS +#ifdef CONFIG_STM32_HRTIM_COMMON_IRQ .irq = HRTIM_IRQ_COMMON, #endif }; @@ -1540,8 +1541,11 @@ static const struct stm32_hrtim_ops_s g_hrtim1ops = .per_get = hrtim_per_get, .cmp_get = hrtim_cmp_get, .fclk_get = hrtim_fclk_get, + .soft_update = hrtim_soft_update, + .freq_set = hrtim_tim_freq_set, #ifdef CONFIG_STM32_HRTIM_INTERRUPTS .irq_ack = hrtim_irq_ack, + .irq_get = hrtim_irq_get, #endif #ifdef CONFIG_STM32_HRTIM_PWM .outputs_enable = hrtim_outputs_enable, @@ -1985,32 +1989,32 @@ static void hrtim_tim_modifyreg(FAR struct stm32_hrtim_s *priv, uint8_t timer, (hrtim_tim_getreg(priv, timer, offset) & ~clrbits) | setbits); } -#ifdef CONFIG_DEBUG_POWER_INFO +#ifdef CONFIG_DEBUG_TIMER_INFO static void hrtim_dumpregs(FAR struct stm32_hrtim_s *priv, uint8_t timer, FAR const char *msg) { - pwrinfo("%s:\n", msg); + tmrinfo("%s:\n", msg); switch (timer) { case HRTIM_TIMER_MASTER: { - pwrinfo("\tCR:\t0x%08x\tISR:\t0x%08x\tICR:\t0x%08x\n", + tmrinfo("\tCR:\t0x%08x\tISR:\t0x%08x\tICR:\t0x%08x\n", hrtim_tim_getreg(priv, timer, STM32_HRTIM_TIM_CR_OFFSET), hrtim_tim_getreg(priv, timer, STM32_HRTIM_TIM_ISR_OFFSET), hrtim_tim_getreg(priv, timer, STM32_HRTIM_TIM_ICR_OFFSET)); - pwrinfo("\tDIER:\t0x%08x\tCNTR:\t0x%08x\tPER:\t0x%08x\n", + tmrinfo("\tDIER:\t0x%08x\tCNTR:\t0x%08x\tPER:\t0x%08x\n", hrtim_tim_getreg(priv, timer, STM32_HRTIM_TIM_DIER_OFFSET), hrtim_tim_getreg(priv, timer, STM32_HRTIM_TIM_CNTR_OFFSET), hrtim_tim_getreg(priv, timer, STM32_HRTIM_TIM_PER_OFFSET)); - pwrinfo("\tREP:\t0x%08x\tCMP1:\t0x%08x\tCMP2:\t0x%08x\n", + tmrinfo("\tREP:\t0x%08x\tCMP1:\t0x%08x\tCMP2:\t0x%08x\n", hrtim_tim_getreg(priv, timer, STM32_HRTIM_TIM_REPR_OFFSET), hrtim_tim_getreg(priv, timer, STM32_HRTIM_TIM_CMP1R_OFFSET), hrtim_tim_getreg(priv, timer, STM32_HRTIM_TIM_CMP2R_OFFSET)); - pwrinfo("\tCMP3:\t0x%08x\tCMP4:\t0x%08x\n", + tmrinfo("\tCMP3:\t0x%08x\tCMP4:\t0x%08x\n", hrtim_tim_getreg(priv, timer, STM32_HRTIM_TIM_CMP3R_OFFSET), hrtim_tim_getreg(priv, timer, STM32_HRTIM_TIM_CMP4R_OFFSET)); break; @@ -2032,47 +2036,47 @@ static void hrtim_dumpregs(FAR struct stm32_hrtim_s *priv, uint8_t timer, case HRTIM_TIMER_TIME: #endif { - pwrinfo("\tCR:\t0x%08x\tISR:\t0x%08x\tICR:\t0x%08x\n", + tmrinfo("\tCR:\t0x%08x\tISR:\t0x%08x\tICR:\t0x%08x\n", hrtim_tim_getreg(priv, timer, STM32_HRTIM_TIM_CR_OFFSET), hrtim_tim_getreg(priv, timer, STM32_HRTIM_TIM_ISR_OFFSET), hrtim_tim_getreg(priv, timer, STM32_HRTIM_TIM_ICR_OFFSET)); - pwrinfo("\tDIER:\t0x%08x\tCNTR:\t0x%08x\tPER:\t0x%08x\n", + tmrinfo("\tDIER:\t0x%08x\tCNTR:\t0x%08x\tPER:\t0x%08x\n", hrtim_tim_getreg(priv, timer, STM32_HRTIM_TIM_DIER_OFFSET), hrtim_tim_getreg(priv, timer, STM32_HRTIM_TIM_CNTR_OFFSET), hrtim_tim_getreg(priv, timer, STM32_HRTIM_TIM_PER_OFFSET)); - pwrinfo("\tREP:\t0x%08x\tCMP1:\t0x%08x\tCMP1C:\t0x%08x\n", + tmrinfo("\tREP:\t0x%08x\tCMP1:\t0x%08x\tCMP1C:\t0x%08x\n", hrtim_tim_getreg(priv, timer, STM32_HRTIM_TIM_REPR_OFFSET), hrtim_tim_getreg(priv, timer, STM32_HRTIM_TIM_CMP1R_OFFSET), hrtim_tim_getreg(priv, timer, STM32_HRTIM_TIM_CMP1CR_OFFSET)); - pwrinfo("\tCMP2:\t0x%08x\tCMP3:\t0x%08x\tCMP4:\t0x%08x\n", + tmrinfo("\tCMP2:\t0x%08x\tCMP3:\t0x%08x\tCMP4:\t0x%08x\n", hrtim_tim_getreg(priv, timer, STM32_HRTIM_TIM_CMP2R_OFFSET), hrtim_tim_getreg(priv, timer, STM32_HRTIM_TIM_CMP3R_OFFSET), hrtim_tim_getreg(priv, timer, STM32_HRTIM_TIM_CMP4R_OFFSET)); - pwrinfo("\tCPT1:\t0x%08x\tCPT2:\t0x%08x\tDTR:\t0x%08x\n", + tmrinfo("\tCPT1:\t0x%08x\tCPT2:\t0x%08x\tDTR:\t0x%08x\n", hrtim_tim_getreg(priv, timer, STM32_HRTIM_TIM_CPT1R_OFFSET), hrtim_tim_getreg(priv, timer, STM32_HRTIM_TIM_CPT2R_OFFSET), hrtim_tim_getreg(priv, timer, STM32_HRTIM_TIM_DTR_OFFSET)); - pwrinfo("\tSET1:\t0x%08x\tRST1:\t0x%08x\tSET2:\t0x%08x\n", + tmrinfo("\tSET1:\t0x%08x\tRST1:\t0x%08x\tSET2:\t0x%08x\n", hrtim_tim_getreg(priv, timer, STM32_HRTIM_TIM_SET1R_OFFSET), hrtim_tim_getreg(priv, timer, STM32_HRTIM_TIM_RST1R_OFFSET), hrtim_tim_getreg(priv, timer, STM32_HRTIM_TIM_SET2R_OFFSET)); - pwrinfo("\tRST2:\t0x%08x\tEEF1:\t0x%08x\tEEF2:\t0x%08x\n", + tmrinfo("\tRST2:\t0x%08x\tEEF1:\t0x%08x\tEEF2:\t0x%08x\n", hrtim_tim_getreg(priv, timer, STM32_HRTIM_TIM_RST2R_OFFSET), hrtim_tim_getreg(priv, timer, STM32_HRTIM_TIM_EEFR1_OFFSET), hrtim_tim_getreg(priv, timer, STM32_HRTIM_TIM_EEFR2_OFFSET)); - pwrinfo("\tRSTR:\t0x%08x\tCHPR:\t0x%08x\tCPT1C:\t0x%08x\n", + tmrinfo("\tRSTR:\t0x%08x\tCHPR:\t0x%08x\tCPT1C:\t0x%08x\n", hrtim_tim_getreg(priv, timer, STM32_HRTIM_TIM_RSTR_OFFSET), hrtim_tim_getreg(priv, timer, STM32_HRTIM_TIM_CHPR_OFFSET), hrtim_tim_getreg(priv, timer, STM32_HRTIM_TIM_CPT1CR_OFFSET)); - pwrinfo("\tCPT2C:\t0x%08x\tOUT:\t0x%08x\tFLT:\t0x%08x\n", + tmrinfo("\tCPT2C:\t0x%08x\tOUT:\t0x%08x\tFLT:\t0x%08x\n", hrtim_tim_getreg(priv, timer, STM32_HRTIM_TIM_CPT2CR_OFFSET), hrtim_tim_getreg(priv, timer, STM32_HRTIM_TIM_OUTR_OFFSET), hrtim_tim_getreg(priv, timer, STM32_HRTIM_TIM_FLTR_OFFSET)); @@ -2082,47 +2086,47 @@ static void hrtim_dumpregs(FAR struct stm32_hrtim_s *priv, uint8_t timer, case HRTIM_TIMER_COMMON: { - pwrinfo("\tCR1:\t0x%08x\tCR2:\t0x%08x\tISR:\t0x%08x\n", + tmrinfo("\tCR1:\t0x%08x\tCR2:\t0x%08x\tISR:\t0x%08x\n", hrtim_cmn_getreg(priv, STM32_HRTIM_CMN_CR1_OFFSET), hrtim_cmn_getreg(priv, STM32_HRTIM_CMN_CR2_OFFSET), hrtim_cmn_getreg(priv, STM32_HRTIM_CMN_ISR_OFFSET)); - pwrinfo("\tICR:\t0x%08x\tIER:\t0x%08x\tOENR:\t0x%08x\n", + tmrinfo("\tICR:\t0x%08x\tIER:\t0x%08x\tOENR:\t0x%08x\n", hrtim_cmn_getreg(priv, STM32_HRTIM_CMN_ICR_OFFSET), hrtim_cmn_getreg(priv, STM32_HRTIM_CMN_IER_OFFSET), hrtim_cmn_getreg(priv, STM32_HRTIM_CMN_OENR_OFFSET)); - pwrinfo("\tODISR:\t0x%08x\tODSR:\t0x%08x\tBMCR:\t0x%08x\n", + tmrinfo("\tODISR:\t0x%08x\tODSR:\t0x%08x\tBMCR:\t0x%08x\n", hrtim_cmn_getreg(priv, STM32_HRTIM_CMN_ODISR_OFFSET), hrtim_cmn_getreg(priv, STM32_HRTIM_CMN_ODSR_OFFSET), hrtim_cmn_getreg(priv, STM32_HRTIM_CMN_BMCR_OFFSET)); - pwrinfo("\tBMTRG:\t0x%08x\tBMCMPR:\t0x%08x\tBMPER:\t0x%08x\n", + tmrinfo("\tBMTRG:\t0x%08x\tBMCMPR:\t0x%08x\tBMPER:\t0x%08x\n", hrtim_cmn_getreg(priv, STM32_HRTIM_CMN_BMTRGR_OFFSET), hrtim_cmn_getreg(priv, STM32_HRTIM_CMN_BMCMPR_OFFSET), hrtim_cmn_getreg(priv, STM32_HRTIM_CMN_BMPER_OFFSET)); - pwrinfo("\tADC1R:\t0x%08x\tADC2R:\t0x%08x\tADC3R:\t0x%08x\n", + tmrinfo("\tADC1R:\t0x%08x\tADC2R:\t0x%08x\tADC3R:\t0x%08x\n", hrtim_cmn_getreg(priv, STM32_HRTIM_CMN_ADC1R_OFFSET), hrtim_cmn_getreg(priv, STM32_HRTIM_CMN_ADC2R_OFFSET), hrtim_cmn_getreg(priv, STM32_HRTIM_CMN_ADC3R_OFFSET)); - pwrinfo("\tADC4R:\t0x%08x\tDLLCR:\t0x%08x\tFLTIN1:\t0x%08x\n", + tmrinfo("\tADC4R:\t0x%08x\tDLLCR:\t0x%08x\tFLTIN1:\t0x%08x\n", hrtim_cmn_getreg(priv, STM32_HRTIM_CMN_ADC4R_OFFSET), hrtim_cmn_getreg(priv, STM32_HRTIM_CMN_DLLCR_OFFSET), hrtim_cmn_getreg(priv, STM32_HRTIM_CMN_FLTINR1_OFFSET)); - pwrinfo("\tFLTIN2:\t0x%08x\tBDMUPD:\t0x%08x\tBDTAUP:\t0x%08x\n", + tmrinfo("\tFLTIN2:\t0x%08x\tBDMUPD:\t0x%08x\tBDTAUP:\t0x%08x\n", hrtim_cmn_getreg(priv, STM32_HRTIM_CMN_FLTINR2_OFFSET), hrtim_cmn_getreg(priv, STM32_HRTIM_CMN_BDMUPDR_OFFSET), hrtim_cmn_getreg(priv, STM32_HRTIM_CMN_BDTAUPR_OFFSET)); - pwrinfo("\tBDTBUP: 0x%08x\tBDTCUP:\t0x%08x\tBDTDUP:\t0x%08x\n", + tmrinfo("\tBDTBUP: 0x%08x\tBDTCUP:\t0x%08x\tBDTDUP:\t0x%08x\n", hrtim_cmn_getreg(priv, STM32_HRTIM_CMN_BDTBUPR_OFFSET), hrtim_cmn_getreg(priv, STM32_HRTIM_CMN_BDTCUPR_OFFSET), hrtim_cmn_getreg(priv, STM32_HRTIM_CMN_BDTDUPR_OFFSET)); - pwrinfo("\tBDTEUP:\t0x%08x\tBDMAD:\t0x%08x\n", + tmrinfo("\tBDTEUP:\t0x%08x\tBDMAD:\t0x%08x\n", hrtim_cmn_getreg(priv, STM32_HRTIM_CMN_BDTEUPR_OFFSET), hrtim_cmn_getreg(priv, STM32_HRTIM_CMN_BDMADR_OFFSET)); @@ -4483,6 +4487,30 @@ static int hrtim_events_config(FAR struct stm32_hrtim_s *priv) } #endif /* CONFIG_STM32_HRTIM_FAULTS */ + +#ifdef CONFIG_STM32_HRTIM_INTERRUPTS + +/**************************************************************************** + * Name: hrtim_irq_cfg + ****************************************************************************/ + +static int hrtim_irq_cfg(FAR struct stm32_hrtim_s *priv, uint8_t timer, uint16_t irq) +{ + int ret = OK; + + if (timer == HRTIM_TIMER_COMMON) + { + hrtim_cmn_putreg(priv, STM32_HRTIM_CMN_IER_OFFSET, irq); + } + else + { + hrtim_tim_putreg(priv, timer, STM32_HRTIM_TIM_DIER_OFFSET, irq); + } + +errout: + return ret; +} + /**************************************************************************** * Name: hrtim_irq_config * @@ -4497,16 +4525,86 @@ static int hrtim_events_config(FAR struct stm32_hrtim_s *priv) * ****************************************************************************/ -#ifdef CONFIG_STM32_HRTIM_INTERRUPTS static int hrtim_irq_config(FAR struct stm32_hrtim_s *priv) { -#warning "hrtim_irq_config: missing logic" +#ifdef CONFIG_STM32_HRTIM_MASTER_IRQ + hrtim_irq_cfg(priv, HRTIM_TIMER_MASTER, priv->master->tim.irq); +#endif + +#ifdef CONFIG_STM32_HRTIM_TIMA_IRQ + hrtim_irq_cfg(priv, HRTIM_TIMER_TIMA, priv->tima->tim.irq); +#endif + +#ifdef CONFIG_STM32_HRTIM_TIMB_IRQ + hrtim_irq_cfg(priv, HRTIM_TIMER_TIMB, priv->timb->tim.irq); +#endif + +#ifdef CONFIG_STM32_HRTIM_TIMB_IRQ + hrtim_irq_cfg(priv, HRTIM_TIMER_TIMB, priv->timc->tim.irq); +#endif + +#ifdef CONFIG_STM32_HRTIM_TIMB_IRQ + hrtim_irq_cfg(priv, HRTIM_TIMER_TIMB, priv->timd->tim.irq); +#endif + +#ifdef CONFIG_STM32_HRTIM_TIMB_IRQ + hrtim_irq_cfg(priv, HRTIM_TIMER_TIMB, priv->time->tim.irq); +#endif + +#ifdef CONFIG_STM32_HRTIM_COMMON_IRQ + hrtim_irq_cfg(priv, HRTIM_TIMER_COMMON, priv->irq); +#endif + return OK; } -void hrtim_irq_ack(FAR struct hrtim_dev_s *dev, uint8_t timer, int source); +/**************************************************************************** + * Name: hrtim_irq_ack + ****************************************************************************/ + +static int hrtim_irq_ack(FAR struct hrtim_dev_s *dev, uint8_t timer, int source) { -#warning "hrtim_irq_ack: missing logic" + FAR struct stm32_hrtim_s *priv = (FAR struct stm32_hrtim_s *)dev->hd_priv; + + if (timer == HRTIM_TIMER_COMMON) + { + /* Write to the HRTIM common clear interrupt register */ + + hrtim_cmn_putreg(priv, STM32_HRTIM_CMN_ICR_OFFSET, source); + } + else + { + /* Each timer has its own ICR register */ + + hrtim_tim_putreg(priv, timer, STM32_HRTIM_TIM_ICR_OFFSET, source); + } + + return OK; +} + +/**************************************************************************** + * Name: hrtim_irq_get + ****************************************************************************/ + +static uint16_t hrtim_irq_get(FAR struct hrtim_dev_s *dev, uint8_t timer) +{ + FAR struct stm32_hrtim_s *priv = (FAR struct stm32_hrtim_s *)dev->hd_priv; + uint32_t regval = 0; + + if (timer == HRTIM_TIMER_COMMON) + { + /* Get HRTIM common status interrupt register */ + + regval = hrtim_cmn_getreg(priv, STM32_HRTIM_CMN_ISR_OFFSET); + } + else + { + /* Each timer has its own ISR register */ + + regval = hrtim_tim_getreg(priv, timer, STM32_HRTIM_TIM_ISR_OFFSET); + } + + return (uint16_t)regval; } #endif /* CONFIG_STM32_HRTIM_INTERRUPTS */ @@ -4564,7 +4662,6 @@ static void hrtim_tim_mode_set(FAR struct stm32_hrtim_s *priv, uint8_t timer, /* Write register */ hrtim_tim_putreg(priv, timer, STM32_HRTIM_TIM_CR_OFFSET, regval); - } /**************************************************************************** @@ -4883,7 +4980,7 @@ static uint64_t hrtim_fclk_get(FAR struct hrtim_dev_s *dev, uint8_t timer) FAR struct stm32_hrtim_tim_s *tim; uint64_t fclk = 0; - /* Get Slave Timer data structure */ + /* Get Timer data structure */ tim = hrtim_tim_get(priv, timer); if (tim == NULL) @@ -4898,6 +4995,91 @@ errout: return fclk; } +/**************************************************************************** + * Name: hrtim_soft_update + * + * Description: + * HRTIM Timer software update. + * This is bulk operation, so we can update many registers at the same time. + * + * Input Parameters: + * dev - HRTIM device structure + * timer - HRTIM Timer indexes + * + * Returned Value: + * 0 on success; a negated errno value on failure + * + ****************************************************************************/ + +static int hrtim_soft_update(FAR struct hrtim_dev_s *dev, uint8_t timer) +{ + FAR struct stm32_hrtim_s *priv = (FAR struct stm32_hrtim_s *)dev->hd_priv; + uint32_t regval = 0; + + regval |= (timer & HRTIM_TIMER_MASTER ? HRTIM_CR2_MSWU : 0); +#ifdef CONFIG_STM32_HRTIM_TIMA + regval |= (timer & HRTIM_TIMER_TIMA ? HRTIM_CR2_TASWU : 0); +#endif +#ifdef CONFIG_STM32_HRTIM_TIMB + regval |= (timer & HRTIM_TIMER_TIMB ? HRTIM_CR2_TBSWU : 0); +#endif +#ifdef CONFIG_STM32_HRTIM_TIMC + regval |= (timer & HRTIM_TIMER_TIMC ? HRTIM_CR2_TCSWU : 0); +#endif +#ifdef CONFIG_STM32_HRTIM_TIMD + regval |= (timer & HRTIM_TIMER_TIMD ? HRTIM_CR2_TDSWU : 0); +#endif +#ifdef CONFIG_STM32_HRTIM_TIME + regval |= (timer & HRTIM_TIMER_TIME ? HRTIM_CR2_TESWU : 0); +#endif + + /* Bits in HRTIM CR2 common register are automatically reset, + * so we can just write to it. + */ + + hrtim_cmn_putreg(priv, STM32_HRTIM_CMN_CR2_OFFSET, regval); + + return OK; +} + +/**************************************************************************** + * Name: hrtim_tim_freq_set + * + * Description: + * Set HRTIM Timer frequency + * + * Returned Value: + * 0 on success, a negated errno value on failure + * + ****************************************************************************/ + +static int hrtim_tim_freq_set(FAR struct hrtim_dev_s *hrtim, uint8_t timer, + uint64_t freq) +{ + uint64_t per = 0; + uint64_t fclk = 0; + int ret = OK; + + /* Get Timer period value for given frequency */ + + fclk = HRTIM_FCLK_GET(hrtim, timer); + per = fclk/freq; + if (per > HRTIM_PER_MAX) + { + tmrerr("ERROR: can not achieve timer pwm freq=%u if fclk=%llu\n", + (uint32_t)freq, (uint64_t)fclk); + ret = -EINVAL; + goto errout; + } + + /* Set Timer period value */ + + HRTIM_PER_SET(hrtim, timer, (uint16_t)per); + + errout: + return ret; +} + /**************************************************************************** * Name: hrtim_tim_reset_set * @@ -4915,9 +5097,10 @@ errout: ****************************************************************************/ static int hrtim_tim_reset_set(FAR struct stm32_hrtim_s *priv, uint8_t timer, - uint32_t reset) + uint64_t reset) { int ret = OK; + uint32_t regval = 0; /* Sanity checking */ @@ -4927,7 +5110,122 @@ static int hrtim_tim_reset_set(FAR struct stm32_hrtim_s *priv, uint8_t timer, goto errout; } - hrtim_tim_putreg(priv, timer, STM32_HRTIM_TIM_RSTR_OFFSET, reset); + /* First 18 bits can be written directly */ + + regval |= (reset & 0x3FFFF); + + /* TimerX reset events differ for individual timers */ + + switch(timer) + { +#ifdef CONFIG_STM32_HRTIM_TIMA + case HRTIM_TIMER_TIMA: + { + regval |= ((reset & HRTIM_RST_TBCMP1) ? HRTIM_TIMARST_TIMBCMP1 : 0); + regval |= ((reset & HRTIM_RST_TBCMP2) ? HRTIM_TIMARST_TIMBCMP2 : 0); + regval |= ((reset & HRTIM_RST_TBCMP4) ? HRTIM_TIMARST_TIMBCMP4 : 0); + regval |= ((reset & HRTIM_RST_TCCMP1) ? HRTIM_TIMARST_TIMCCMP1 : 0); + regval |= ((reset & HRTIM_RST_TCCMP2) ? HRTIM_TIMARST_TIMCCMP2 : 0); + regval |= ((reset & HRTIM_RST_TCCMP4) ? HRTIM_TIMARST_TIMCCMP4 : 0); + regval |= ((reset & HRTIM_RST_TDCMP1) ? HRTIM_TIMARST_TIMDCMP1 : 0); + regval |= ((reset & HRTIM_RST_TDCMP2) ? HRTIM_TIMARST_TIMDCMP2 : 0); + regval |= ((reset & HRTIM_RST_TDCMP4) ? HRTIM_TIMARST_TIMDCMP4 : 0); + regval |= ((reset & HRTIM_RST_TECMP1) ? HRTIM_TIMARST_TIMECMP1 : 0); + regval |= ((reset & HRTIM_RST_TECMP2) ? HRTIM_TIMARST_TIMECMP2 : 0); + regval |= ((reset & HRTIM_RST_TECMP4) ? HRTIM_TIMARST_TIMECMP4 : 0); + + break; + } +#endif + +#ifdef CONFIG_STM32_HRTIM_TIMB + case HRTIM_TIMER_TIMB: + { + regval |= ((reset & HRTIM_RST_TACMP1) ? HRTIM_TIMBRST_TIMACMP1 : 0); + regval |= ((reset & HRTIM_RST_TACMP2) ? HRTIM_TIMBRST_TIMACMP2 : 0); + regval |= ((reset & HRTIM_RST_TACMP4) ? HRTIM_TIMBRST_TIMACMP4 : 0); + regval |= ((reset & HRTIM_RST_TCCMP1) ? HRTIM_TIMBRST_TIMCCMP1 : 0); + regval |= ((reset & HRTIM_RST_TCCMP2) ? HRTIM_TIMBRST_TIMCCMP2 : 0); + regval |= ((reset & HRTIM_RST_TCCMP4) ? HRTIM_TIMBRST_TIMCCMP4 : 0); + regval |= ((reset & HRTIM_RST_TDCMP1) ? HRTIM_TIMBRST_TIMDCMP1 : 0); + regval |= ((reset & HRTIM_RST_TDCMP2) ? HRTIM_TIMBRST_TIMDCMP2 : 0); + regval |= ((reset & HRTIM_RST_TDCMP4) ? HRTIM_TIMBRST_TIMDCMP4 : 0); + regval |= ((reset & HRTIM_RST_TECMP1) ? HRTIM_TIMBRST_TIMECMP1 : 0); + regval |= ((reset & HRTIM_RST_TECMP2) ? HRTIM_TIMBRST_TIMECMP2 : 0); + regval |= ((reset & HRTIM_RST_TECMP4) ? HRTIM_TIMBRST_TIMECMP4 : 0); + + break; + } +#endif + +#ifdef CONFIG_STM32_HRTIM_TIMC + case HRTIM_TIMER_TIMC: + { + regval |= ((reset & HRTIM_RST_TACMP1) ? HRTIM_TIMCRST_TIMACMP1 : 0); + regval |= ((reset & HRTIM_RST_TACMP2) ? HRTIM_TIMCRST_TIMACMP2 : 0); + regval |= ((reset & HRTIM_RST_TACMP4) ? HRTIM_TIMCRST_TIMACMP4 : 0); + regval |= ((reset & HRTIM_RST_TBCMP1) ? HRTIM_TIMCRST_TIMBCMP1 : 0); + regval |= ((reset & HRTIM_RST_TBCMP2) ? HRTIM_TIMCRST_TIMBCMP2 : 0); + regval |= ((reset & HRTIM_RST_TBCMP4) ? HRTIM_TIMCRST_TIMBCMP4 : 0); + regval |= ((reset & HRTIM_RST_TDCMP1) ? HRTIM_TIMCRST_TIMDCMP1 : 0); + regval |= ((reset & HRTIM_RST_TDCMP2) ? HRTIM_TIMCRST_TIMDCMP2 : 0); + regval |= ((reset & HRTIM_RST_TDCMP4) ? HRTIM_TIMCRST_TIMDCMP4 : 0); + regval |= ((reset & HRTIM_RST_TECMP1) ? HRTIM_TIMCRST_TIMECMP1 : 0); + regval |= ((reset & HRTIM_RST_TECMP2) ? HRTIM_TIMCRST_TIMECMP2 : 0); + regval |= ((reset & HRTIM_RST_TECMP4) ? HRTIM_TIMCRST_TIMECMP4 : 0); + + break; + } +#endif + +#ifdef CONFIG_STM32_HRTIM_TIMD + case HRTIM_TIMER_TIMD: + { + regval |= ((reset & HRTIM_RST_TACMP1) ? HRTIM_TIMDRST_TIMACMP1 : 0); + regval |= ((reset & HRTIM_RST_TACMP2) ? HRTIM_TIMDRST_TIMACMP2 : 0); + regval |= ((reset & HRTIM_RST_TACMP4) ? HRTIM_TIMDRST_TIMACMP4 : 0); + regval |= ((reset & HRTIM_RST_TBCMP1) ? HRTIM_TIMDRST_TIMBCMP1 : 0); + regval |= ((reset & HRTIM_RST_TBCMP2) ? HRTIM_TIMDRST_TIMBCMP2 : 0); + regval |= ((reset & HRTIM_RST_TBCMP4) ? HRTIM_TIMDRST_TIMBCMP4 : 0); + regval |= ((reset & HRTIM_RST_TCCMP1) ? HRTIM_TIMDRST_TIMCCMP1 : 0); + regval |= ((reset & HRTIM_RST_TCCMP2) ? HRTIM_TIMDRST_TIMCCMP2 : 0); + regval |= ((reset & HRTIM_RST_TCCMP4) ? HRTIM_TIMDRST_TIMCCMP4 : 0); + regval |= ((reset & HRTIM_RST_TECMP1) ? HRTIM_TIMDRST_TIMECMP1 : 0); + regval |= ((reset & HRTIM_RST_TECMP2) ? HRTIM_TIMDRST_TIMECMP2 : 0); + regval |= ((reset & HRTIM_RST_TECMP4) ? HRTIM_TIMDRST_TIMECMP4 : 0); + + break; + } +#endif + +#ifdef CONFIG_STM32_HRTIM_TIME + case HRTIM_TIMER_TIME: + { + regval |= ((reset & HRTIM_RST_TACMP1) ? HRTIM_TIMERST_TIMACMP1 : 0); + regval |= ((reset & HRTIM_RST_TACMP2) ? HRTIM_TIMERST_TIMACMP2 : 0); + regval |= ((reset & HRTIM_RST_TACMP4) ? HRTIM_TIMERST_TIMACMP4 : 0); + regval |= ((reset & HRTIM_RST_TBCMP1) ? HRTIM_TIMERST_TIMBCMP1 : 0); + regval |= ((reset & HRTIM_RST_TBCMP2) ? HRTIM_TIMERST_TIMBCMP2 : 0); + regval |= ((reset & HRTIM_RST_TBCMP4) ? HRTIM_TIMERST_TIMBCMP4 : 0); + regval |= ((reset & HRTIM_RST_TCCMP1) ? HRTIM_TIMERST_TIMCCMP1 : 0); + regval |= ((reset & HRTIM_RST_TCCMP2) ? HRTIM_TIMERST_TIMCCMP2 : 0); + regval |= ((reset & HRTIM_RST_TCCMP4) ? HRTIM_TIMERST_TIMCCMP4 : 0); + regval |= ((reset & HRTIM_RST_TDCMP1) ? HRTIM_TIMERST_TIMDCMP1 : 0); + regval |= ((reset & HRTIM_RST_TDCMP2) ? HRTIM_TIMERST_TIMDCMP2 : 0); + regval |= ((reset & HRTIM_RST_TDCMP4) ? HRTIM_TIMERST_TIMDCMP4 : 0); + + break; + } +#endif + + default: + { + ret = -EINVAL; + goto errout; + } + } + + hrtim_tim_putreg(priv, timer, STM32_HRTIM_TIM_RSTR_OFFSET, regval); errout: return ret; @@ -4966,13 +5264,37 @@ static int hrtim_reset_config(FAR struct stm32_hrtim_s *priv) } static int hrtim_tim_update_set(FAR struct stm32_hrtim_s *priv, uint8_t timer, - uint32_t update) + uint16_t update) { uint32_t regval = 0; regval = hrtim_tim_getreg(priv, timer, STM32_HRTIM_TIM_CR_OFFSET); - /* TODO: Configure update events */ + /* Configure update events */ + + regval |= (update & HRTIM_UPDATE_MSTU ? HRTIM_TIMCR_MSTU : 0); + regval |= (update & HRTIM_UPDATE_RSTU ? HRTIM_TIMCR_RSTU : 0); + regval |= (update & HRTIM_UPDATE_REPU ? HRTIM_TIMCR_REPU : 0); + +#ifdef CONFIG_STM32_HRTIM_TIMA + regval |= (update & HRTIM_UPDATE_TAU ? HRTIM_TIMCR_TAU : 0); +#endif + +#ifdef CONFIG_STM32_HRTIM_TIMB + regval |= (update & HRTIM_UPDATE_TBU ? HRTIM_TIMCR_TBU : 0); +#endif + +#ifdef CONFIG_STM32_HRTIM_TIMC + regval |= (update & HRTIM_UPDATE_TCU ? HRTIM_TIMCR_TCU : 0); +#endif + +#ifdef CONFIG_STM32_HRTIM_TIMD + regval |= (update & HRTIM_UPDATE_TDU ? HRTIM_TIMCR_TDU : 0); +#endif + +#ifdef CONFIG_STM32_HRTIM_TIME + regval |= (update & HRTIM_UPDATE_TEU ? HRTIM_TIMCR_TEU : 0); +#endif /* TODO: Configure update gating */ @@ -5171,7 +5493,7 @@ static int stm32_hrtimconfig(FAR struct stm32_hrtim_s *priv) /* Configure interrupts */ -#ifdef CONFIG_STM32_HRTIM_INTERRUTPS +#ifdef CONFIG_STM32_HRTIM_INTERRUPTS ret = hrtim_irq_config(priv); if (ret != OK) { diff --git a/arch/arm/src/stm32/stm32_hrtim.h b/arch/arm/src/stm32/stm32_hrtim.h index ee021a9d82..323488ae30 100644 --- a/arch/arm/src/stm32/stm32_hrtim.h +++ b/arch/arm/src/stm32/stm32_hrtim.h @@ -216,6 +216,14 @@ (hrtim)->hd_ops->per_get(hrtim, tim) #define HRTIM_FCLK_GET(hrtim, tim) \ (hrtim)->hd_ops->fclk_get(hrtim, tim) +#define HRTIM_IRQ_GET(hrtim, irq) \ + (hrtim)->hd_ops->irq_get(hrtim, irq) +#define HRTIM_IRQ_ACK(hrtim, irq, ack) \ + (hrtim)->hd_ops->irq_ack(hrtim, irq, ack) +#define HRTIM_SOFT_UPDATE(hrtim, timer) \ + (hrtim)->hd_ops->soft_update(hrtim, timer) +#define HRTIM_FREQ_SET(hrtim, timer,freq) \ + (hrtim)->hd_ops->freq_set(hrtim, timer, freq) #define HRTIM_OUTPUTS_ENABLE(hrtim, outputs, state) \ (hrtim)->hd_ops->outputs_enable(hrtim, outputs, state) #define HRTIM_OUTPUT_SET_SET(hrtim, output, set) \ @@ -349,48 +357,48 @@ enum stm32_hrtim_tim_rst_e { /* Timer owns events */ - HRTIM_RST_UPDT, - HRTIM_RST_CMP4, - HRTIM_RST_CMP2, + HRTIM_RST_UPDT = (1<<1), + HRTIM_RST_CMP4 = (1<<2), + HRTIM_RST_CMP2 = (1<<3), /* Master Timer Events */ - HRTIM_RST_MSTCMP4, - HRTIM_RST_MSTCMP3, - HRTIM_RST_MSTCMP2, - HRTIM_RST_MSTCMP1, - HRTIM_RST_MSTPER, + HRTIM_RST_MSTPER = (1<<4), + HRTIM_RST_MSTCMP1 = (1<<5), + HRTIM_RST_MSTCMP2 = (1<<6), + HRTIM_RST_MSTCMP3 = (1<<7), + HRTIM_RST_MSTCMP4 = (1<<8), - /* TimerX events */ + /* External Events */ - HRTIM_RST_TECMP4, - HRTIM_RST_TECMP2, - HRTIM_RST_TECMP1, - HRTIM_RST_TDCMP4, - HRTIM_RST_TDCMP2, - HRTIM_RST_TDCMP1, - HRTIM_RST_TCCMP4, - HRTIM_RST_TCCMP2, - HRTIM_RST_TCCMP1, - HRTIM_RST_TBCMP4, - HRTIM_RST_TBCMP2, - HRTIM_RST_TBCMP1, - HRTIM_RST_TACMP4, - HRTIM_RST_TACMP2, - HRTIM_RST_TACMP1, + HRTIM_RST_EXTEVNT1 = (1<<9), + HRTIM_RST_EXTEVNT2 = (1<<10), + HRTIM_RST_EXTEVNT3 = (1<<11), + HRTIM_RST_EXTEVNT4 = (1<<12), + HRTIM_RST_EXTEVNT5 = (1<<13), + HRTIM_RST_EXTEVNT6 = (1<<14), + HRTIM_RST_EXTEVNT7 = (1<<15), + HRTIM_RST_EXTEVNT8 = (1<<16), + HRTIM_RST_EXTEVNT9 = (1<<17), + HRTIM_RST_EXTEVNT10 = (1<<18), - /* External Events */ + /* TimerX events */ - HRTIM_RST_EXTEVNT10, - HRTIM_RST_EXTEVNT9, - HRTIM_RST_EXTEVNT8, - HRTIM_RST_EXTEVNT7, - HRTIM_RST_EXTEVNT6, - HRTIM_RST_EXTEVNT5, - HRTIM_RST_EXTEVNT4, - HRTIM_RST_EXTEVNT3, - HRTIM_RST_EXTEVNT2, - HRTIM_RST_EXTEVNT1 + HRTIM_RST_TACMP1 = (1<<19), + HRTIM_RST_TACMP2 = (1<<20), + HRTIM_RST_TACMP4 = (1<<21), + HRTIM_RST_TBCMP1 = (1<<22), + HRTIM_RST_TBCMP2 = (1<<23), + HRTIM_RST_TBCMP4 = (1<<24), + HRTIM_RST_TCCMP1 = (1<<25), + HRTIM_RST_TCCMP2 = (1<<26), + HRTIM_RST_TCCMP4 = (1<<27), + HRTIM_RST_TDCMP1 = (1<<28), + HRTIM_RST_TDCMP2 = (1<<29), + HRTIM_RST_TDCMP4 = (1<<30), + HRTIM_RST_TECMP1 = (1<<31), + HRTIM_RST_TECMP2 = (1<<32), + HRTIM_RST_TECMP4 = (1<<33), }; /* HRTIM Timer X prescaler */ @@ -772,6 +780,21 @@ enum stm32_hrtim_dac_e HRTIM_DAC_TRIG3 = 3 }; +/* HRTIM Timer update events */ + +enum stm32_tim_update_e +{ + HRTIM_UPDATE_NONE = 0, + HRTIM_UPDATE_MSTU = (1 << 0), + HRTIM_UPDATE_TAU = (1 << 2), + HRTIM_UPDATE_TBU = (1 << 3), + HRTIM_UPDATE_TCU = (1 << 4), + HRTIM_UPDATE_TDU = (1 << 5), + HRTIM_UPDATE_TEU = (1 << 6), + HRTIM_UPDATE_RSTU = (1 << 7), + HRTIM_UPDATE_REPU = (1 << 8), +}; + /* HRTIM Master Timer interrupts */ enum stm32_irq_master_e @@ -981,8 +1004,13 @@ struct stm32_hrtim_ops_s uint16_t (*cmp_get)(FAR struct hrtim_dev_s *dev, uint8_t timer, uint8_t index); uint64_t (*fclk_get)(FAR struct hrtim_dev_s *dev, uint8_t timer); + int (*soft_update)(FAR struct hrtim_dev_s *dev, uint8_t timer); + int (*freq_set)(FAR struct hrtim_dev_s *hrtim, uint8_t timer, + uint64_t freq); + #ifdef CONFIG_STM32_HRTIM_INTERRUPTS - void (*irq_ack)(FAR struct hrtim_dev_s *dev, uint8_t timer, int source); + int (*irq_ack)(FAR struct hrtim_dev_s *dev, uint8_t timer, int source); + uint16_t (*irq_get)(FAR struct hrtim_dev_s *dev, uint8_t timer); #endif #ifdef CONFIG_STM32_HRTIM_PWM int (*outputs_enable)(FAR struct hrtim_dev_s *dev, uint16_t outputs, diff --git a/drivers/power/powerled.c b/drivers/power/powerled.c index 52996d4919..a915fc0a55 100644 --- a/drivers/power/powerled.c +++ b/drivers/power/powerled.c @@ -413,7 +413,7 @@ int powerled_register(FAR const char *path, FAR struct powerled_dev_s *dev, FAR DEBUGASSERT(dev->ops->fault_clean != NULL); DEBUGASSERT(dev->ops->ioctl != NULL); - /* Initialize the HRTIM device structure */ + /* Initialize the powerled device structure */ dev->ocount = 0; diff --git a/drivers/power/smps.c b/drivers/power/smps.c index f019949d72..3eb040fedc 100644 --- a/drivers/power/smps.c +++ b/drivers/power/smps.c @@ -506,7 +506,7 @@ int smps_register(FAR const char *path, FAR struct smps_dev_s *dev, FAR void *lo DEBUGASSERT(dev->ops->fault_clean != NULL); DEBUGASSERT(dev->ops->ioctl != NULL); - /* Initialize the HRTIM device structure */ + /* Initialize the SMPS device structure */ dev->ocount = 0; -- GitLab From a524b33f2c684d77d11f3a6cd709b74a1b5d0f24 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sun, 11 Feb 2018 09:16:16 -0600 Subject: [PATCH 197/228] Update some comments --- arch/arm/src/samdl/samd_clockconfig.c | 3 +-- arch/mips/src/pic32mz/chip/pic32mz-spi.h | 1 + configs/flipnclick-pic32mz/README.txt | 4 ++-- configs/flipnclick-pic32mz/include/board.h | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/arm/src/samdl/samd_clockconfig.c b/arch/arm/src/samdl/samd_clockconfig.c index 20aedae751..87f9bfd0d9 100644 --- a/arch/arm/src/samdl/samd_clockconfig.c +++ b/arch/arm/src/samdl/samd_clockconfig.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/samdl/samd_clockconfig.c * - * Copyright (C) 2014-2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2014-2015, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * References: @@ -492,7 +492,6 @@ static inline void sam_osc32k_config(void) regval = getreg32(SAM_SYSCTRL_OSC32K); regval |= calib << SYSCTRL_OSC32K_CALIB_SHIFT; putreg32(regval, SAM_SYSCTRL_OSC32K); - } #else # define sam_osc32k_config() diff --git a/arch/mips/src/pic32mz/chip/pic32mz-spi.h b/arch/mips/src/pic32mz/chip/pic32mz-spi.h index 42d7fdf7a1..c2359c0ae4 100644 --- a/arch/mips/src/pic32mz/chip/pic32mz-spi.h +++ b/arch/mips/src/pic32mz/chip/pic32mz-spi.h @@ -275,6 +275,7 @@ #define SPI_STAT_SPIRBF (1 << 0) /* Bit 0: SPI receive buffer full status */ #define SPI_STAT_SPITBF (1 << 1) /* Bit 1: SPI transmit buffer full status */ + /* Bit 2: Reserved */ #define SPI_STAT_SPITBE (1 << 3) /* Bit 3: SPI transmit buffer empty status */ /* Bit 4: Reserved */ #define SPI_STAT_SPIRBE (1 << 5) /* Bit 5: RX FIFO Empty */ diff --git a/configs/flipnclick-pic32mz/README.txt b/configs/flipnclick-pic32mz/README.txt index e23cb11f4a..3d3c4522e1 100644 --- a/configs/flipnclick-pic32mz/README.txt +++ b/configs/flipnclick-pic32mz/README.txt @@ -230,8 +230,8 @@ SPI Pin J1 Board Signal PIC32MZ --- -- ------------ ------- D10 8 SPI3_SCK RB14 - D10 7 SPI3_MISO RB9 - D11 6 SPI3_MOSI RB10 + D11 7 SPI3_MISO RB9 + D12 6 SPI3_MOSI RB10 D13 5 SPI3_SS RB9 SPI1 and SPI2 are also available on the mikroBUS Click connectors (in diff --git a/configs/flipnclick-pic32mz/include/board.h b/configs/flipnclick-pic32mz/include/board.h index 87e48bc000..9fa460dd5d 100644 --- a/configs/flipnclick-pic32mz/include/board.h +++ b/configs/flipnclick-pic32mz/include/board.h @@ -310,8 +310,8 @@ * Pin J1 Board Signal PIC32MZ * --- -- ------------ ------- * D10 8 SPI3_SCK RB14 - * D10 7 SPI3_MISO RB9 - * D11 6 SPI3_MOSI RB10 + * D11 7 SPI3_MISO RB9 + * D12 6 SPI3_MOSI RB10 * D13 5 SPI3_SS RB9 * * SPI1 and SPI2 are also available on the mikroBUS Click connectors (in -- GitLab From 3648563ed87b7a10f255d96c3410a68e0a3d2985 Mon Sep 17 00:00:00 2001 From: Alan Carvalho de Assis Date: Sun, 11 Feb 2018 10:30:24 -0600 Subject: [PATCH 198/228] configs/stm32f103-minimum: Add zerocross support to STM32F103-Minimum board --- configs/stm32f103-minimum/src/Makefile | 4 + configs/stm32f103-minimum/src/stm32_bringup.c | 11 + .../stm32f103-minimum/src/stm32_zerocross.c | 194 ++++++++++++++++++ .../stm32f103-minimum/src/stm32f103_minimum.h | 16 ++ 4 files changed, 225 insertions(+) create mode 100644 configs/stm32f103-minimum/src/stm32_zerocross.c diff --git a/configs/stm32f103-minimum/src/Makefile b/configs/stm32f103-minimum/src/Makefile index 90105c8668..0e21166bce 100644 --- a/configs/stm32f103-minimum/src/Makefile +++ b/configs/stm32f103-minimum/src/Makefile @@ -65,6 +65,10 @@ ifeq ($(CONFIG_PWM),y) CSRCS += stm32_pwm.c endif +ifeq ($(CONFIG_SENSORS_ZEROCROSS),y) + CSRCS += stm32_zerocross.c +endif + ifeq ($(CONFIG_LEDS_APA102),y) CSRCS += stm32_apa102.c endif diff --git a/configs/stm32f103-minimum/src/stm32_bringup.c b/configs/stm32f103-minimum/src/stm32_bringup.c index e0f3f55972..2c47270fc7 100644 --- a/configs/stm32f103-minimum/src/stm32_bringup.c +++ b/configs/stm32f103-minimum/src/stm32_bringup.c @@ -167,6 +167,17 @@ int stm32_bringup(void) } #endif +#ifdef CONFIG_SENSORS_ZEROCROSS + /* Configure the zero-crossing driver */ + + ret = stm32_zerocross_initialize(); + if (ret < 0) + { + syslog(LOG_ERR, "Failed to initialize Zero-Cross, error %d\n", ret); + return ret; + } +#endif + #ifdef CONFIG_MMCSD ret = stm32_mmcsd_initialize(MMCSD_MINOR); if (ret < 0) diff --git a/configs/stm32f103-minimum/src/stm32_zerocross.c b/configs/stm32f103-minimum/src/stm32_zerocross.c new file mode 100644 index 0000000000..da6fda354e --- /dev/null +++ b/configs/stm32f103-minimum/src/stm32_zerocross.c @@ -0,0 +1,194 @@ +/**************************************************************************** + * configs/stm32f4discovery/src/stm32_zerocross.c + * + * Copyright (C) 2018 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +#include +#include +#include + +#include "stm32_gpio.h" +#include "stm32f103_minimum.h" + +#ifdef CONFIG_SENSORS_ZEROCROSS + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +static void zcross_enable(FAR const struct zc_lowerhalf_s *lower, + zc_interrupt_t handler, FAR void *arg); + +static void zcross_disable(void); +static int zcross_interrupt(int irq, FAR void *context, FAR void *arg); + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/* Current interrupt handler and argument */ + +static zc_interrupt_t g_zcrosshandler; +static FAR void *g_zcrossarg; + +/* This is the zero cross lower half driver interface */ + +static struct zc_lowerhalf_s g_zcrosslower = +{ + .zc_enable = zcross_enable, +}; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: zcross_enable + * + * Description: + * Enable interrupts on the selected zero cross pin. And empty + * set will disable all interrupts. + * + ****************************************************************************/ + +static void zcross_enable(FAR const struct zc_lowerhalf_s *lower, + zc_interrupt_t handler, FAR void *arg) +{ + irqstate_t flags; + bool rising = false; + bool falling = true; + + /* Start with all interrupts disabled */ + + flags = enter_critical_section(); + zcross_disable(); + + sninfo("handler: %p arg: %p\n", handler, arg); + + if (handler) + { + g_zcrosshandler = handler; + g_zcrossarg = arg; + } + + (void)stm32_gpiosetevent(GPIO_ZEROCROSS, rising, falling, + true, zcross_interrupt, NULL); + + leave_critical_section(flags); +} + +/**************************************************************************** + * Name: zcross_disable + * + * Description: + * Disable all joystick interrupts + * + ****************************************************************************/ + +static void zcross_disable(void) +{ + irqstate_t flags; + + /* Disable zero cross pin interrupt */ + + flags = enter_critical_section(); + + (void)stm32_gpiosetevent(GPIO_ZEROCROSS, false, false, false, NULL, NULL); + + leave_critical_section(flags); + + /* Nullify the handler and argument */ + + g_zcrosshandler = NULL; + g_zcrossarg = NULL; +} + +/**************************************************************************** + * Name: zcross_interrupt + * + * Description: + * Zero Cross interrupt handler + * + ****************************************************************************/ + +static int zcross_interrupt(int irq, FAR void *context, FAR void *arg) +{ + DEBUGASSERT(g_zcrosshandler != NULL); + if (g_zcrosshandler) + { + g_zcrosshandler(&g_zcrosslower, g_zcrossarg); + } + + return OK; +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: stm32_zerocross_initialize + * + * Description: + * Initialize and register the zero cross driver + * + ****************************************************************************/ + +int stm32_zerocross_initialize(void) +{ + /* Configure the GPIO pin as input. NOTE: This is unnecessary for + * interrupting pins since it will also be done by stm32_gpiosetevent(). + */ + + stm32_configgpio(GPIO_ZEROCROSS); + + /* Make sure that all interrupts are disabled */ + + zcross_disable(); + + /* Register the zero cross device as /dev/zc0 */ + + return zc_register("/dev/zc0", &g_zcrosslower); +} + +#endif /* CONFIG_SENSORS_ZEROCROSS */ + diff --git a/configs/stm32f103-minimum/src/stm32f103_minimum.h b/configs/stm32f103-minimum/src/stm32f103_minimum.h index 69427573d2..9841a5a4c7 100644 --- a/configs/stm32f103-minimum/src/stm32f103_minimum.h +++ b/configs/stm32f103-minimum/src/stm32f103_minimum.h @@ -110,6 +110,10 @@ #define MAX_IRQBUTTON BUTTON_USER2 #define NUM_IRQBUTTONS (BUTTON_USER1 - BUTTON_USER2 + 1) +/* ZERO CROSS pin definiton */ + +#define GPIO_ZEROCROSS (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_PORTA|GPIO_PIN0) + /* Pins config to use with HC-SR04 sensor */ #define GPIO_HCSR04_INT (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_PORTA|GPIO_PIN0) @@ -228,6 +232,18 @@ int stm32_bringup(void); int stm32_gpio_initialize(void); #endif +/**************************************************************************** + * Name: stm32_zerocross_initialize + * + * Description: + * Initialize and register the zero cross driver + * + ****************************************************************************/ + +#ifdef CONFIG_SENSORS_ZEROCROSS +int stm32_zerocross_initialize(void); +#endif + /************************************************************************************ * Name: stm32_adc_setup * -- GitLab From d5522704b1e584f35adb2dfbd4281d4ab52c3865 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sun, 11 Feb 2018 10:57:35 -0600 Subject: [PATCH 199/228] configs/flipnclick-sam3x: Adds basic board support for the HiletGo OLED. --- configs/flipnclick-pic32mz/Kconfig | 1 - configs/flipnclick-pic32mz/README.txt | 17 +- configs/flipnclick-pic32mz/src/Makefile | 2 +- .../src/flipnclick-pic32mz.h | 7 +- .../flipnclick-pic32mz/src/pic32mz_bringup.c | 2 +- configs/flipnclick-pic32mz/src/pic32mz_spi.c | 5 +- configs/flipnclick-sam3x/Kconfig | 26 +++ configs/flipnclick-sam3x/README.txt | 49 +++- configs/flipnclick-sam3x/include/board.h | 2 +- configs/flipnclick-sam3x/nxlines/defconfig | 58 +++++ configs/flipnclick-sam3x/src/Makefile | 8 + .../flipnclick-sam3x/src/flipnclick-sam3x.h | 118 ++++++++++ configs/flipnclick-sam3x/src/sam_bringup.c | 9 + configs/flipnclick-sam3x/src/sam_hiletgo.c | 172 ++++++++++++++ configs/flipnclick-sam3x/src/sam_spi0.c | 220 ++++++++++++++++++ 15 files changed, 679 insertions(+), 17 deletions(-) create mode 100644 configs/flipnclick-sam3x/nxlines/defconfig create mode 100644 configs/flipnclick-sam3x/src/sam_hiletgo.c create mode 100644 configs/flipnclick-sam3x/src/sam_spi0.c diff --git a/configs/flipnclick-pic32mz/Kconfig b/configs/flipnclick-pic32mz/Kconfig index 072527993f..1e8fe4a895 100644 --- a/configs/flipnclick-pic32mz/Kconfig +++ b/configs/flipnclick-pic32mz/Kconfig @@ -5,7 +5,6 @@ if ARCH_BOARD_FLIPNCLICK_PIC32MZ - config FLIPNCLICK_PIC32MZ_HILETGO bool "HiletGo Click Present" default n diff --git a/configs/flipnclick-pic32mz/README.txt b/configs/flipnclick-pic32mz/README.txt index 3d3c4522e1..709430c39a 100644 --- a/configs/flipnclick-pic32mz/README.txt +++ b/configs/flipnclick-pic32mz/README.txt @@ -38,9 +38,10 @@ Port Status 2018-02-10: Added the nxlines configuration to test the custom HiletGo OLED on a Click proto board. Debug output indicates that the example is running error free yet nothing appears on the OLED in mikroBUS slot A. - It looks like all of the signals are present at the mikroBUS A slot and - the proto click ohms out okay so this must be a software driver issue. - Write only LCDs are tough to debug! + I tried slot D with same result. I also ported the configuration to + the Flip&Click SAM3X and got the same result. There could be SPI issues + on the PIC32MX, but more likely that there is an error in my custom + HiletGo Click. Damn! On Board Debug Support ====================== @@ -338,9 +339,6 @@ HiletGo OLED NOTE that this is a write-only display (MOSI only)! - Configuration - ------------- - Configurations ============== @@ -427,6 +425,7 @@ Where is one of the following: 2018-02-10: The debug output indicates that the nxlines example is running with no errors, however, nothing appears on the OLED display. - It looks like all of the signals are present at the mikroBUS A slot and - the proto click ohms out okay so this must be a software driver issue. - Write only LCDs are tough to debug! + I tried slot D with same result. I also ported the configuration to + the Flip&Click SAM3X and got the same result. There could be SPI issues + on the PIC32MX, but more likely that there is an error in my custom + HiletGo Click. Damn! diff --git a/configs/flipnclick-pic32mz/src/Makefile b/configs/flipnclick-pic32mz/src/Makefile index 646415e87c..262dcf3051 100644 --- a/configs/flipnclick-pic32mz/src/Makefile +++ b/configs/flipnclick-pic32mz/src/Makefile @@ -1,7 +1,7 @@ ############################################################################ # configs/flipnclick-pic32mz/src/Makefile # -# Copyright (C) 2015 Gregory Nutt. All rights reserved. +# Copyright (C) 2018 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without diff --git a/configs/flipnclick-pic32mz/src/flipnclick-pic32mz.h b/configs/flipnclick-pic32mz/src/flipnclick-pic32mz.h index 59e58a5c65..b1c68aacab 100644 --- a/configs/flipnclick-pic32mz/src/flipnclick-pic32mz.h +++ b/configs/flipnclick-pic32mz/src/flipnclick-pic32mz.h @@ -58,6 +58,11 @@ !defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO) || \ !defined(CONFIG_LCD_SSD1306_SPI) # undef HAVE_HILETGO +# undef CONFIG_FLIPNCLICK_PIC32MZ_HILETGO +# undef CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBA +# undef CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBB +# undef CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBC +# undef CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBD #endif /* LEDs *********************************************************************/ @@ -277,7 +282,7 @@ int pic32mz_bringup(void); ****************************************************************************/ #ifdef HAVE_HILETGO -struct lcd_dev_s; /* Forward reference3 */ +struct lcd_dev_s; /* Forward reference */ FAR struct lcd_dev_s *pic32mz_graphics_setup(unsigned int devno); #endif diff --git a/configs/flipnclick-pic32mz/src/pic32mz_bringup.c b/configs/flipnclick-pic32mz/src/pic32mz_bringup.c index 0837956dd5..fae43551d9 100644 --- a/configs/flipnclick-pic32mz/src/pic32mz_bringup.c +++ b/configs/flipnclick-pic32mz/src/pic32mz_bringup.c @@ -77,7 +77,7 @@ int pic32mz_bringup(void) if (pic32mz_graphics_setup(0) == NULL) { - syslog(LOG_ERR,"ERROR: Failed to configure the HiletGo OLEDn"); + syslog(LOG_ERR,"ERROR: Failed to configure the HiletGo OLED\n"); } #endif diff --git a/configs/flipnclick-pic32mz/src/pic32mz_spi.c b/configs/flipnclick-pic32mz/src/pic32mz_spi.c index cf9efb6a5f..6daee5f589 100644 --- a/configs/flipnclick-pic32mz/src/pic32mz_spi.c +++ b/configs/flipnclick-pic32mz/src/pic32mz_spi.c @@ -68,9 +68,9 @@ void weak_function pic32mz_spidev_initialize(void) { - /* Configure the SPI chip select GPIOs */ +#ifdef HAVE_HILETGO + /* Configure the HiletGo chip select and command/data GPIOs */ -#ifdef CONFIG_LCD_HILETGO (void)pic32mz_configgpio(GPIO_HILETGO_CS); (void)pic32mz_configgpio(GPIO_HILETGO_DC); #endif @@ -186,6 +186,7 @@ int pic32mz_spi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) pic32mz_gpiowrite(GPIO_HILETGO_DC, !cmd); } #endif + return 0; } #endif diff --git a/configs/flipnclick-sam3x/Kconfig b/configs/flipnclick-sam3x/Kconfig index 166b712c2a..bbabfcbbbf 100644 --- a/configs/flipnclick-sam3x/Kconfig +++ b/configs/flipnclick-sam3x/Kconfig @@ -4,4 +4,30 @@ # if ARCH_BOARD_FLIPNCLICK_SAM3X + +config FLIPNCLICK_SAM3X_HILETGO + bool "HiletGo Click Present" + default n + depends on LCD_HILETGO + select NXSTART_EXTERNINIT if NX + +choice + prompt "HiletGo mikroBUS" + default FLIPNCLICK_SAM3X_HILETGO_MBA + depends on FLIPNCLICK_SAM3X_HILETGO + +config FLIPNCLICK_SAM3X_HILETGO_MBA + bool "mikroBUS A" + +config FLIPNCLICK_SAM3X_HILETGO_MBB + bool "mikroBUS B" + +config FLIPNCLICK_SAM3X_HILETGO_MBC + bool "mikroBUS C" + +config FLIPNCLICK_SAM3X_HILETGO_MBD + bool "mikroBUS D" + +endchoice # HiletGo mikroBUS + endif diff --git a/configs/flipnclick-sam3x/README.txt b/configs/flipnclick-sam3x/README.txt index 564002f3d3..1b8cadb610 100644 --- a/configs/flipnclick-sam3x/README.txt +++ b/configs/flipnclick-sam3x/README.txt @@ -16,6 +16,7 @@ Contents - Serial Consoles - SPI - I2C + - HiletGo OLED - Loading Code - Flip&Click SAM3X-specific Configuration Options - Configurations @@ -29,6 +30,11 @@ STATUS 2018-01-24: I ordered a JTAG connector and soldered that to the Flip'n'Click and I am now successfully able to load code. The NSH configuration appears to be fully functional. + 2018-02-11: Added the nxlines configuration to test the custom HiletGo + OLED on a Click proto board. This is the same logic from the Flip&Click + PIC32MZ and the result is the same: No complaints from the software, but + nothing appears on the OLED. There is, most likely, an error in my custom + HiletGo Click. Damn! Buttons and LEDs ================ @@ -182,6 +188,27 @@ I2C SCL I2C1_SCL PB13 SCL I2C1_SCL PB13 SDA I2C1_SDA PB12 SDA I2C1_SDA PB12 +HiletGo OLED +============ + + Hardware + -------- + The HiletGo is a 128x64 OLED that can be driven either via SPI or I2C (SPI + is the default and is what is used here). I have mounted the OLED on a + proto click board. The OLED is connected as follows: + + OLED ALIAS DESCRIPTION PROTO CLICK + ----- ----------- ------------- ----------------- + GND Ground GND + VCC Power Supply 5V (3-5V) + D0 SCL,CLK,SCK Clock SCK + D1 SDA,MOSI Data MOSI,SDI + RES RST,RESET Reset RST (GPIO OUTPUT) + DC AO Data/Command INT (GPIO OUTPUT) + CS Chip Select CS (GPIO OUTPUT) + + NOTE that this is a write-only display (MOSI only)! + Loading Code ============ @@ -514,7 +541,7 @@ Flip&Click SAM3X-specific Configuration Options CONFIG_SAM34_GPIOF_IRQ Configurations -^^^^^^^^^^^^^^ +============== Each Flip&Click SAM3X configuration is maintained in a sub-directory and can be selected as follow: @@ -587,3 +614,23 @@ Configuration sub-directories Application Configuration: CONFIG_NSH_BUILTIN_APPS=y : Enable starting apps from NSH command line + + nxlines + + This is an NSH configuration that supports the NX graphics example at + apps/examples/nxlines as a built-in application. + + NOTES: + + 1. This configuration derives from the nsh configuration. All of the + notes there apply here as well. + + 2. The default configuration assumes there is the custom HiletGo OLED + in the mikroBUS B slot (and a Mikroe RS-232 Click card in the + mikroBUS A slot). That is easily changed by reconfiguring, however. + See the section entitled "HiletGo OLED" for information about this + custom click card. + + STATUS: + 2018-02-11: No complaints from the software, but nothing appears on the + OLED. There is, most likely, an error in my custom HiletGo Click. Damn! diff --git a/configs/flipnclick-sam3x/include/board.h b/configs/flipnclick-sam3x/include/board.h index f69677b409..2c648e7bcd 100644 --- a/configs/flipnclick-sam3x/include/board.h +++ b/configs/flipnclick-sam3x/include/board.h @@ -290,7 +290,7 @@ * Chip select pin definitions are provided in * configs/flipnclick-sam3x/src/flipnclick-3x.h. * - * There are no alternative pin selections for SPI0_MSIO and SPIO_MOSI. + * There are no alternative pin selections for SPI0_MISO and SPIO_MOSI. */ #define GPIO_SPI0_SPCK GPIO_SPI0_SPCK_1 diff --git a/configs/flipnclick-sam3x/nxlines/defconfig b/configs/flipnclick-sam3x/nxlines/defconfig new file mode 100644 index 0000000000..8fec5ed9ea --- /dev/null +++ b/configs/flipnclick-sam3x/nxlines/defconfig @@ -0,0 +1,58 @@ +# CONFIG_ARCH_RAMFUNCS is not set +# CONFIG_NX_DISABLE_1BPP is not set +# CONFIG_SAM34_UART0 is not set +CONFIG_ARCH_BOARD_FLIPNCLICK_SAM3X=y +CONFIG_ARCH_BOARD="flipnclick-sam3x" +CONFIG_ARCH_CHIP_ATSAM3X8E=y +CONFIG_ARCH_CHIP_SAM34=y +CONFIG_ARCH_CHIP_SAM3X=y +CONFIG_ARCH_STACKDUMP=y +CONFIG_ARCH="arm" +CONFIG_BOARD_LOOPSPERMSEC=6965 +CONFIG_BUILTIN=y +CONFIG_EXAMPLES_NSH_CXXINITIALIZE=y +CONFIG_EXAMPLES_NSH=y +CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=4 +CONFIG_EXAMPLES_NXLINES_BPP=1 +CONFIG_EXAMPLES_NXLINES_LINEWIDTH=4 +CONFIG_EXAMPLES_NXLINES=y +CONFIG_FLIPNCLICK_SAM3X_HILETGO_MBB=y +CONFIG_FLIPNCLICK_SAM3X_HILETGO=y +CONFIG_FS_PROCFS=y +CONFIG_HAVE_CXX=y +CONFIG_HAVE_CXXINITIALIZE=y +CONFIG_HOST_WINDOWS=y +CONFIG_LCD_HILETGO=y +CONFIG_LCD_MAXCONTRAST=255 +CONFIG_LCD=y +CONFIG_MAX_TASKS=16 +CONFIG_MAX_WDOGPARMS=2 +CONFIG_MM_REGIONS=3 +CONFIG_MQ_MAXMSGSIZE=64 +CONFIG_NFILE_DESCRIPTORS=8 +CONFIG_NFILE_STREAMS=8 +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_DISABLE_IFUPDOWN=y +CONFIG_NSH_FILEIOSIZE=512 +CONFIG_NSH_READLINE=y +CONFIG_NX_BLOCKING=y +CONFIG_NX=y +CONFIG_NXFONT_TOM_THUMB_4X6=y +CONFIG_NXTK_BORDERWIDTH=2 +CONFIG_PREALLOC_MQ_MSGS=8 +CONFIG_PREALLOC_TIMERS=4 +CONFIG_PREALLOC_WDOGS=4 +CONFIG_RAM_SIZE=65536 +CONFIG_RAM_START=0x20000000 +CONFIG_RAW_BINARY=y +CONFIG_RR_INTERVAL=200 +CONFIG_SAM34_SPI0=y +CONFIG_SAM34_USART0=y +CONFIG_SCHED_WAITPID=y +CONFIG_SDCLONE_DISABLE=y +CONFIG_START_DAY=11 +CONFIG_START_MONTH=2 +CONFIG_USART0_SERIAL_CONSOLE=y +CONFIG_USER_ENTRYPOINT="nsh_main" +CONFIG_WDOG_INTRESERVE=0 diff --git a/configs/flipnclick-sam3x/src/Makefile b/configs/flipnclick-sam3x/src/Makefile index b2e781f6a9..99781462b0 100644 --- a/configs/flipnclick-sam3x/src/Makefile +++ b/configs/flipnclick-sam3x/src/Makefile @@ -48,4 +48,12 @@ ifeq ($(CONFIG_LIB_BOARDCTL),y) CSRCS += sam_appinit.c endif +ifeq ($(CONFIG_SAM34_SPI0),y) +CSRCS += sam_spi0.c +endif + +ifeq ($(CONFIG_FLIPNCLICK_SAM3X_HILETGO),y) +CSRCS += sam_hiletgo.c +endif + include $(TOPDIR)/configs/Board.mk diff --git a/configs/flipnclick-sam3x/src/flipnclick-sam3x.h b/configs/flipnclick-sam3x/src/flipnclick-sam3x.h index 0b07395f19..f26d0c5f81 100644 --- a/configs/flipnclick-sam3x/src/flipnclick-sam3x.h +++ b/configs/flipnclick-sam3x/src/flipnclick-sam3x.h @@ -53,6 +53,25 @@ /************************************************************************************ * Pre-processor Definitions ************************************************************************************/ +/* Configuration ************************************************************/ + +#define HAVE_HILETGO 1 + +/* The HiletGo LCD must be selected, installed on the Flip&Click, and must + * be configured to use the SPI interface. + */ + +#if !defined(CONFIG_LCD_HILETGO) || \ + !defined(CONFIG_FLIPNCLICK_SAM3X_HILETGO) || \ + !defined(CONFIG_LCD_SSD1306_SPI) +# undef HAVE_HILETGO +# undef CONFIG_FLIPNCLICK_SAM3X_HILETGO +# undef CONFIG_FLIPNCLICK_SAM3X_HILETGO_MBA +# undef CONFIG_FLIPNCLICK_SAM3X_HILETGO_MBB +# undef CONFIG_FLIPNCLICK_SAM3X_HILETGO_MBC +# undef CONFIG_FLIPNCLICK_SAM3X_HILETGO_MBD +#endif + /* There are four LEDs on the top, blue side of the board. Only one can be * controlled by software: * @@ -128,6 +147,90 @@ GPIO_PORT_PIOB | GPIO_PIN23) #define MBD_CSNUM 3 +/* HiletGo OLED + * + * The HiletGo is a 128x64 OLED that can be driven either via SPI or I2C (SPI + * is the default and is what is used here). I have mounted the OLED on a + * proto click board. The OLED is connected as follows: + * + * OLED ALIAS DESCRIPTION PROTO CLICK + * ----- ----------- ------------- ----------------- + * GND Ground GND + * VCC Power Supply 5V (3-5V) + * D0 SCL,CLK,SCK Clock SCK + * D1 SDA,MOSI Data MOSI,SDI + * RES RST,RESET Reset RST (GPIO OUTPUT) + * DC AO Data/Command INT (GPIO OUTPUT) + * CS Chip Select CS (GPIO OUTPUT) + * + * NOTE that this is a write-only display (MOSI only)! + * + * MikroBUS A: MikroBUS B: + * Pin Board Signal SAM3X Pin Board Signal SAM3X + * ---- ------------ ----- ---- ------------ ------- + * RST RSTA PC1 RST RSTB PC2 + * DC INTA PD1 DC INTB PD2 + * + * MikroBUS C: MikroBUS D: + * Pin Board Signal SAM3X Pin Board Signal SAM3X + * ---- ------------ ----- ---- ------------ ------- + * RST RSTC PC3 RST RSTD PC4 + * DC INTC PD3 DC INTD PD6 + */ + +#if defined(CONFIG_FLIPNCLICK_SAM3X_HILETGO_MBA) +# ifndef CONFIG_SAM34_SPI0 +# error "The OLED driver requires CONFIG_SAM34_SPI0 in the configuration" +# endif + +# define HILETGO_SPI_BUS 0 +# define HILETGO_CSNUM MBA_CSNUM +# define GPIO_HILETGO_CS GPIO_MBA_CS +# define GPIO_HILETGO_RST (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ + GPIO_PORT_PIOC | GPIO_PIN1) +# define GPIO_HILETGO_DC (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ + GPIO_PORT_PIOD | GPIO_PIN1) + +#elif defined(CONFIG_FLIPNCLICK_SAM3X_HILETGO_MBB) +# ifndef CONFIG_SAM34_SPI0 +# error "The OLED driver requires CONFIG_SAM34_SPI0 in the configuration" +# endif + +# define HILETGO_SPI_BUS 0 +# define HILETGO_CSNUM MBB_CSNUM +# define GPIO_HILETGO_CS GPIO_MBB_CS +# define GPIO_HILETGO_RST (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ + GPIO_PORT_PIOC | GPIO_PIN2) +# define GPIO_HILETGO_DC (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ + GPIO_PORT_PIOD | GPIO_PIN2) + +#elif defined(CONFIG_FLIPNCLICK_SAM3X_HILETGO_MBC) +# ifndef CONFIG_SAM34_SPI0 +# error "The OLED driver requires CONFIG_SAM34_SPI0 in the configuration" +# endif + +# define HILETGO_SPI_BUS 0 +# define HILETGO_CSNUM MBC_CSNUM +# define GPIO_HILETGO_CS GPIO_MBC_CS +# define GPIO_HILETGO_RST (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ + GPIO_PORT_PIOC | GPIO_PIN3) +# define GPIO_HILETGO_DC (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ + GPIO_PORT_PIOD | GPIO_PIN3) + +#elif defined(CONFIG_FLIPNCLICK_SAM3X_HILETGO_MBD) +# ifndef CONFIG_SAM34_SPI0 +# error "The OLED driver requires CONFIG_SAM34_SPI0 in the configuration" +# endif + +# define HILETGO_SPI_BUS 0 +# define HILETGO_CSNUM MBD_CSNUM +# define GPIO_HILETGO_CS GPIO_MBD_CS +# define GPIO_HILETGO_RST (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ + GPIO_PORT_PIOC | GPIO_PIN4) +# define GPIO_HILETGO_DC (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ + GPIO_PORT_PIOD | GPIO_PIN6) +#endif + /************************************************************************************ * Public Types ************************************************************************************/ @@ -158,6 +261,21 @@ int sam_bringup(void); +/**************************************************************************** + * Name: sam_graphics_setup + * + * Description: + * Called by either NX initialization logic (via board_graphics_setup) or + * directly from the board bring-up logic in order to configure the + * HiletGo OLED. + * + ****************************************************************************/ + +#ifdef HAVE_HILETGO +struct lcd_dev_s; /* Forward reference */ +FAR struct lcd_dev_s *sam_graphics_setup(unsigned int devno); +#endif + #endif /* __ASSEMBLY__ */ #endif /* __CONFIGS_FLIPNCLICK_SAM3X_SRC_FLIPNCLICK_SAM3X_H */ diff --git a/configs/flipnclick-sam3x/src/sam_bringup.c b/configs/flipnclick-sam3x/src/sam_bringup.c index 28a9d42735..155139bf7a 100644 --- a/configs/flipnclick-sam3x/src/sam_bringup.c +++ b/configs/flipnclick-sam3x/src/sam_bringup.c @@ -84,6 +84,15 @@ int sam_bringup(void) } #endif +#if defined(HAVE_HILETGO) && !defined(CONFIG_NXSTART_EXTERNINIT) + /* Configure the HiletGo OLED */ + + if (sam_graphics_setup(0) == NULL) + { + syslog(LOG_ERR,"ERROR: Failed to configure the HiletGo OLED\n"); + } +#endif + UNUSED(ret); return OK; } diff --git a/configs/flipnclick-sam3x/src/sam_hiletgo.c b/configs/flipnclick-sam3x/src/sam_hiletgo.c new file mode 100644 index 0000000000..31013e5022 --- /dev/null +++ b/configs/flipnclick-sam3x/src/sam_hiletgo.c @@ -0,0 +1,172 @@ +/**************************************************************************** + * config/flipnclick-sam3x/src/sam_hiletgo.c + * + * Copyright (C) 2018 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/* HiletGo OLED + * + * The HiletGo is a 128x64 OLED that can be driven either via SPI or I2C (SPI + * is the default and is what is used here). I have mounted the OLED on a + * proto click board. The OLED is connected as follows: + * + * OLED ALIAS DESCRIPTION PROTO CLICK + * ----- ----------- ------------- ----------------- + * GND Ground GND + * VCC Power Supply 5V (3-5V) + * D0 SCL,CLK,SCK Clock SCK + * D1 SDA,MOSI Data MOSI,SDI + * RES RST,RESET Reset RST (GPIO OUTPUT) + * DC AO Data/Command INT (GPIO OUTPUT) + * CS Chip Select CS (GPIO OUTPUT) + */ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include + +#include +#include +#include +#include + +#if defined(CONFIG_VIDEO_FB) && defined(CONFIG_LCD_FRAMEBUFFER) +# include +#endif + +#include "sam_gpio.h" +#include "sam_spi.h" + +#include "flipnclick-sam3x.h" + +#ifdef HAVE_HILETGO + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ +/* Configuration ************************************************************/ + +#ifndef CONFIG_SPI_CMDDATA +# error "The OLED driver requires CONFIG_SPI_CMDDATA in the configuration" +#endif + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: sam_graphics_setup + * + * Description: + * Called by either NX initialization logic (via board_graphics_setup) or + * directly from the board bring-up logic in order to configure the + * HiletGo OLED. + * + ****************************************************************************/ + +FAR struct lcd_dev_s *sam_graphics_setup(unsigned int devno) +{ + FAR struct spi_dev_s *spi; + FAR struct lcd_dev_s *dev; + + /* Configure the OLED GPIOs. This initial configuration is RESET low, + * putting the OLED into reset state. + */ + + sam_configgpio(GPIO_HILETGO_RST); + + /* Wait a bit then release the OLED from the reset state */ + + up_mdelay(20); + sam_gpiowrite(GPIO_HILETGO_RST, true); + + /* Get the SPI1 port interface */ + + spi = sam_spibus_initialize(GPIO_HILETGO_CS); + if (!spi) + { + lcderr("ERROR: Failed to initialize SPI port 1\n"); + } + else + { + /* Bind the SPI port to the OLED */ + + dev = ssd1306_initialize(spi, NULL, devno); + if (!dev) + { + lcderr("ERROR: Failed to bind SPI port 1 to OLED %d: %d\n", devno); + } + else + { + lcdinfo("Bound SPI port 1 to OLED %d\n", devno); + + /* And turn the OLED on */ + + (void)dev->setpower(dev, CONFIG_LCD_MAXPOWER); + +#if defined(CONFIG_VIDEO_FB) && defined(CONFIG_LCD_FRAMEBUFFER) + /* Initialize and register the simulated framebuffer driver */ + + ret = fb_register(0, 0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: fb_register() failed: %d\n", ret); + } +#endif + + return dev; + } + } + + return NULL; +} + +/**************************************************************************** + * Name: board_graphics_setup + * + * Description: + * Called by NX initialization logic to configure the OLED. + * + ****************************************************************************/ + +#ifdef CONFIG_NXSTART_EXTERNINIT +FAR struct lcd_dev_s *board_graphics_setup(unsigned int devno) +{ + return sam_graphics_setup(devno); +} +#endif + +#endif /* HAVE_HILETGO */ diff --git a/configs/flipnclick-sam3x/src/sam_spi0.c b/configs/flipnclick-sam3x/src/sam_spi0.c new file mode 100644 index 0000000000..e910621003 --- /dev/null +++ b/configs/flipnclick-sam3x/src/sam_spi0.c @@ -0,0 +1,220 @@ +/************************************************************************************ + * configs/flipnclick-sam3x/src/sam_spi0.c + * + * Copyright (C) 2018 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ************************************************************************************/ + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +#include +#include +#include +#include + +#include +#include + +#include "up_arch.h" +#include "chip.h" +#include "sam_gpio.h" +#include "sam_spi.h" + +#include "flipnclick-sam3x.h" + +#ifdef CONFIG_SAM34_SPI0 + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +/************************************************************************************ + * Name: sam_spidev_initialize + * + * Description: + * Called to configure SPI chip select GPIO pins for the SAM4E-EK board. + * + ************************************************************************************/ + +void weak_function sam_spidev_initialize(void) +{ +#ifdef HAVE_HILETGO + /* Configure the HiletGo chip select and command/data GPIOs */ + + sam_configgpio(GPIO_HILETGO_CS); + sam_configgpio(GPIO_HILETGO_DC); +#endif +} + +/**************************************************************************** + * Name: sam_spi0select, sam_spi0status, and sam_spic0mddata + * + * Description: + * These external functions must be provided by board-specific logic. They + * include: + * + * o sam_spi0select is a functions tomanage the board-specific chip selects + * o sam_spi0status and sam_spic0mddata: Implementations of the status + * and cmddata methods of the SPI interface defined by struct spi_ops_ + * (see include/nuttx/spi/spi.h). All other methods including + * sam_spibus_initialize()) are provided by common SAM3/4 logic. + * + * To use this common SPI logic on your board: + * + * 1. Provide logic in sam_boardinitialize() to configure SPI chip select + * pins. + * 2. Provide sam_spi0select() and sam_spi0status() functions in your board- + * specific logic. These functions will perform chip selection and + * status operations using GPIOs in the way your board is configured. + * 2. If CONFIG_SPI_CMDDATA is defined in the NuttX configuration, provide + * sam_spic0mddata() functions in your board-specific logic. This + * function will perform cmd/data selection operations using GPIOs in + * the way your board is configured. + * 3. Add a call to sam_spibus_initialize() in your low level application + * initialization logic + * 4. The handle returned by sam_spibus_initialize() may then be used to bind the + * SPI driver to higher level logic (e.g., calling + * mmcsd_spislotinitialize(), for example, will bind the SPI driver to + * the SPI MMC/SD driver). + * + ****************************************************************************/ + +/**************************************************************************** + * Name: sam_spi0select + * + * Description: + * PIO chip select pins may be programmed by the board specific logic in + * one of two different ways. First, the pins may be programmed as SPI + * peripherals. In that case, the pins are completely controlled by the + * SPI driver. This method still needs to be provided, but it may be only + * a stub. + * + * An alternative way to program the PIO chip select pins is as a normal + * GPIO output. In that case, the automatic control of the CS pins is + * bypassed and this function must provide control of the chip select. + * NOTE: In this case, the GPIO output pin does *not* have to be the + * same as the NPCS pin normal associated with the chip select number. + * + * Input Parameters: + * devid - Identifies the (logical) device + * selected - TRUE:Select the device, FALSE:De-select the device + * + * Returned Value: + * None + * + ****************************************************************************/ + +void sam_spi0select(uint32_t devid, bool selected) +{ + spiinfo("devid: %08x CS: %s\n", + (unsigned int)devid, selected ? "assert" : "de-assert"); + +#ifdef HAVE_HILETGO + if (devid == SPIDEV_DISPLAY(0)) + { + /* Low: the display is selected + * High: the display is deselected + */ + + sam_gpiowrite(GPIO_HILETGO_CS, !selected); + } +#endif +} + +/**************************************************************************** + * Name: sam_spi0status + * + * Description: + * Return status information associated with the SPI device. + * + * Input Parameters: + * devid - Identifies the (logical) device + * + * Returned Value: + * Bit-encoded SPI status (see include/nuttx/spi/spi.h. + * + ****************************************************************************/ + +uint8_t sam_spi0status(FAR struct spi_dev_s *dev, uint32_t devid) +{ + spiinfo("Returning nothing\n"); + return 0; +} +/**************************************************************************** + * Name: sam_spi0cmddata + * + * Description: + * Some SPI devices require an additional control to determine if the SPI + * data being sent is a command or is data. If CONFIG_SPI_CMDDATA then + * this function will be called to different be command and data transfers. + * + * This is often needed, for example, by LCD drivers. Some LCD hardware + * may be configured to use 9-bit data transfers with the 9th bit + * indicating command or data. That same hardware may be configurable, + * instead, to use 8-bit data but to require an additional, board- + * specific PIO control to distinguish command and data. This function + * would be needed in that latter case. + * + * Input Parameters: + * dev - SPI device info + * devid - Identifies the (logical) device + * + * Returned Value: + * Zero on success; a negated errno on failure. + * + ****************************************************************************/ + +#ifdef CONFIG_SPI_CMDDATA +int sam_spi0cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) +{ + spiinfo("devid: %08x %s\n", (unsigned int)devid, cmd ? "cmd" : "data"); + +#ifdef HAVE_HILETGO + if (devid == SPIDEV_DISPLAY(0)) + { + /* High: the inputs are treated as display data. + * Low: the inputs are transferred to the command registers. + */ + + sam_gpiowrite(GPIO_HILETGO_DC, !cmd); + } +#endif + + return 0; + +} +#endif + +#endif /* CONFIG_SAM34_SPI0 */ -- GitLab From 3a029ed1858e67503c8359b9f7b1c00a036c5b5d Mon Sep 17 00:00:00 2001 From: Harald Gutsche Date: Sun, 11 Feb 2018 21:24:47 +0000 Subject: [PATCH 200/228] Merged in hg42/nuttx/lpc17-disable-FDR-2 (pull request #596) disable LPC17 FDR when not used (second fix) if a boot loader sets the fractional divider (FDR) the baud rate in nuttx will be wrong (multiplied by this fraction). This also has to be added to lpc17_lowputc.c Unfortunately the constant used for shifting the bits was wrong in the header file, so it took some time to realize this... Approved-by: Gregory Nutt --- arch/arm/src/lpc17xx/chip/lpc17_uart.h | 2 +- arch/arm/src/lpc17xx/lpc17_lowputc.c | 7 +++++++ arch/arm/src/lpc17xx/lpc17_serial.c | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/arch/arm/src/lpc17xx/chip/lpc17_uart.h b/arch/arm/src/lpc17xx/chip/lpc17_uart.h index d7706561cd..478c18b70a 100644 --- a/arch/arm/src/lpc17xx/chip/lpc17_uart.h +++ b/arch/arm/src/lpc17xx/chip/lpc17_uart.h @@ -342,7 +342,7 @@ #define UART_FDR_DIVADDVAL_SHIFT (0) /* Bits 0-3: Baud-rate generation pre-scaler divisor value */ #define UART_FDR_DIVADDVAL_MASK (15 << UART_FDR_DIVADDVAL_SHIFT) -#define UART_FDR_MULVAL_SHIFT (3) /* Bits 4-7 Baud-rate pre-scaler multiplier value */ +#define UART_FDR_MULVAL_SHIFT (4) /* Bits 4-7 Baud-rate pre-scaler multiplier value */ #define UART_FDR_MULVAL_MASK (15 << UART_FDR_MULVAL_SHIFT) /* Bits 8-31: Reserved */ /* TER Transmit Enable Register (all) */ diff --git a/arch/arm/src/lpc17xx/lpc17_lowputc.c b/arch/arm/src/lpc17xx/lpc17_lowputc.c index 3670014588..8f163f3440 100644 --- a/arch/arm/src/lpc17xx/lpc17_lowputc.c +++ b/arch/arm/src/lpc17xx/lpc17_lowputc.c @@ -389,6 +389,13 @@ void lpc17_lowsetup(void) putreg32(UART_FCR_FIFOEN | UART_FCR_RXTRIGGER_8, CONSOLE_BASE + LPC17_UART_FCR_OFFSET); + /* Disable FDR (fractional divider), + * ignored by baudrate calculation => has to be disabled + */ + + putreg32((1 << UART_FDR_MULVAL_SHIFT) + (0 << UART_FDR_DIVADDVAL_SHIFT), + CONSOLE_BASE + LPC17_UART_FDR_OFFSET); + /* Set up the LCR and set DLAB=1 */ putreg32(CONSOLE_LCR_VALUE | UART_LCR_DLAB, diff --git a/arch/arm/src/lpc17xx/lpc17_serial.c b/arch/arm/src/lpc17xx/lpc17_serial.c index 10fd17865c..c321e23eb2 100644 --- a/arch/arm/src/lpc17xx/lpc17_serial.c +++ b/arch/arm/src/lpc17xx/lpc17_serial.c @@ -920,8 +920,8 @@ static int up_setup(struct uart_dev_s *dev) lcr |= (UART_LCR_PE | UART_LCR_PS_EVEN); } - /* Disable FDR (fractional divider, not used by baudrate settings -> has - * to be disabled) + /* Disable FDR (fractional divider), + * ignored by baudrate calculation => has to be disabled */ up_serialout(priv, LPC17_UART_FDR_OFFSET, -- GitLab From 10de81ebdfdea5f7d8612d8056aa3b6e349d5e85 Mon Sep 17 00:00:00 2001 From: Matt Thompson Date: Sun, 11 Feb 2018 22:07:18 +0000 Subject: [PATCH 201/228] Merged in extent3d/nuttx/dma (pull request #597) SAMDL DMA fixes and experimental SPI support * SAMDL: Fix DMA controller support * SAMDL: Added experimental DMA support to SPI driver. spi_exchange() uses a pair of DMA channels for TX and RX Approved-by: Gregory Nutt --- arch/arm/src/samdl/Kconfig | 15 ++++ arch/arm/src/samdl/sam_dmac.c | 66 ++++++++++++----- arch/arm/src/samdl/sam_spi.c | 134 +++++++++++++++++++++++++++++++++- 3 files changed, 195 insertions(+), 20 deletions(-) diff --git a/arch/arm/src/samdl/Kconfig b/arch/arm/src/samdl/Kconfig index 9813e7192d..fc76c2290b 100644 --- a/arch/arm/src/samdl/Kconfig +++ b/arch/arm/src/samdl/Kconfig @@ -488,6 +488,20 @@ config SAMDL_DMAC select ARCH_DMA depends on SAMDL_HAVE_DMAC && EXPERIMENTAL +if SAMDL_DMAC && EXPERIMENTAL + +menu "DMA options" + +config SAMDL_SPI_DMA + bool "SPI DMA" + default n + depends on (SAMDL_HAVE_SPI) + ---help--- + Use DMA for SPI SERCOM peripherals. +endmenu + +endif + config SAMDL_EVSYS bool "Event System" default n @@ -767,3 +781,4 @@ config SAMDL_USB_REGDEBUG CONFIG_DEBUG_USB_INFO. endif # SAMDL_HAVE_USB + diff --git a/arch/arm/src/samdl/sam_dmac.c b/arch/arm/src/samdl/sam_dmac.c index cf4d495b3a..2f1f88dadb 100644 --- a/arch/arm/src/samdl/sam_dmac.c +++ b/arch/arm/src/samdl/sam_dmac.c @@ -145,15 +145,19 @@ static sem_t g_dsem; static struct sam_dmach_s g_dmach[SAMDL_NDMACHAN]; -/* DMA descriptor tables positioned in LPRAM. In this use case, it is - * acceptable for the writeback descriptors to overlap the base - * descriptors since the base descriptors are always initialized prior - * to starting each DMA transaction. +/* + * NOTE: Using the same address as the base descriptors for writeback descriptors + * causes TERR and FERR interrupts to be raised immediately after starting DMA. + * This was tested on SAMD21G18A, and it would appear that the writeback + * buffer must be located at a different memory address. + * + * - Matt Thompson */ static struct dma_desc_s g_base_desc[SAMDL_NDMACHAN] __attribute__ ((section(".lpram"), aligned(16))); -#define g_writeback_desc g_base_desc +static struct dma_desc_s g_writeback_desc[SAMDL_NDMACHAN] + __attribute__ ((section(".lpram"), aligned(16))); #if CONFIG_SAMDL_DMAC_NDESC > 0 /* Additional DMA descriptors for (optional) multi-block transfer support. @@ -291,9 +295,10 @@ static int sam_dmainterrupt(int irq, void *context, FAR void *arg) unsigned int chndx; uint16_t intpend; + /* Process all pending channel interrupts */ - while (((intpend = getreg16(SAM_DMAC_INTPEND)) & DMAC_INTPEND_PEND) != 0) + while ((intpend = getreg16(SAM_DMAC_INTPEND)) != 0) { /* Get the channel that generated the interrupt */ @@ -322,10 +327,17 @@ static int sam_dmainterrupt(int irq, void *context, FAR void *arg) sam_dmaterminate(dmach, OK); } + else if ((intpend & DMAC_INTPEND_TERR) != 0) + { + dmaerr("Invalid descriptor. Channel %d\n", chndx); + sam_dmaterminate(dmach, -EIO); + } + /* Check for channel suspend interrupt */ else if ((intpend & DMAC_INTPEND_SUSP) != 0) { + dmaerr("Channel suspended. Channel %d\n", chndx); /* REVISIT: Do we want to do anything here? */ } } @@ -392,6 +404,7 @@ static struct dma_desc_s *sam_alloc_desc(struct sam_dmach_s *dmach) /* Yes, return a pointer to the base descriptor */ desc->srcaddr = (uint32_t)-1; /* Any non-zero value */ + return desc; } #if CONFIG_SAMDL_DMAC_NDESC > 0 @@ -406,6 +419,7 @@ static struct dma_desc_s *sam_alloc_desc(struct sam_dmach_s *dmach) sam_takedsem(); + /* Examine each list entry to find an available one -- i.e., one * with srcaddr == 0. That srcaddr field is set to zero by the DMA * transfer complete interrupt handler. The following should be safe @@ -472,7 +486,7 @@ static struct dma_desc_s *sam_append_desc(struct sam_dmach_s *dmach, /* Allocate a DMA descriptor */ desc = sam_alloc_desc(dmach); - if (desc == NULL) + if (desc != NULL) { /* We have it. Initialize the new descriptor list entry */ @@ -509,6 +523,10 @@ static struct dma_desc_s *sam_append_desc(struct sam_dmach_s *dmach, dmach->dc_tail = desc; #endif } + else + { + dmaerr("Failed to allocate descriptor\n"); + } return desc; } @@ -556,9 +574,11 @@ static void sam_free_desc(struct sam_dmach_s *dmach) next = (struct dma_desc_s *)desc->descaddr; memset(desc, 0, sizeof(struct dma_desc_s)); + sam_givedsem(); } #endif + } /**************************************************************************** @@ -604,7 +624,7 @@ static uint16_t sam_bytes2beats(struct sam_dmach_s *dmach, size_t nbytes) /* The number of beats is then the ceiling of the division */ - mask = (1 < beatsize) - 1; + mask = (1 << beatsize) - 1; nbeats = (nbytes + mask) >> beatsize; DEBUGASSERT(nbeats <= UINT16_MAX); return (uint16_t)nbeats; @@ -653,14 +673,25 @@ static int sam_txbuffer(struct sam_dmach_s *dmach, uint32_t paddr, tmp = (dmach->dc_flags & DMACH_FLAG_BEATSIZE_MASK) >> DMACH_FLAG_BEATSIZE_SHIFT; btctrl |= tmp << LPSRAM_BTCTRL_BEATSIZE_SHIFT; + /* See Addressing on page 264 of the datasheet. + * When increment is used, we have to adjust the address in the descriptor + * based on the beat count remaining in the block + */ + + /* Set up the Block Transfer Count Register configuration */ + + btcnt = sam_bytes2beats(dmach, nbytes); + if ((dmach->dc_flags & DMACH_FLAG_MEM_INCREMENT) != 0) { btctrl |= LPSRAM_BTCTRL_SRCINC; + maddr += nbytes; } if ((dmach->dc_flags & DMACH_FLAG_PERIPH_INCREMENT) != 0) { btctrl |= LPSRAM_BTCTRL_DSTINC; + paddr += nbytes; } if ((dmach->dc_flags & DMACH_FLAG_STEPSEL) == DMACH_FLAG_STEPSEL_PERIPH) @@ -671,10 +702,6 @@ static int sam_txbuffer(struct sam_dmach_s *dmach, uint32_t paddr, tmp = (dmach->dc_flags & DMACH_FLAG_STEPSIZE_MASK) >> LPSRAM_BTCTRL_STEPSIZE_SHIFT; btctrl |= tmp << LPSRAM_BTCTRL_STEPSIZE_SHIFT; - /* Set up the Block Transfer Count Register configuration */ - - btcnt = sam_bytes2beats(dmach, nbytes); - /* Add the new descriptor list entry */ if (!sam_append_desc(dmach, btctrl, btcnt, maddr, paddr)) @@ -729,14 +756,20 @@ static int sam_rxbuffer(struct sam_dmach_s *dmach, uint32_t paddr, tmp = (dmach->dc_flags & DMACH_FLAG_BEATSIZE_MASK) >> DMACH_FLAG_BEATSIZE_SHIFT; btctrl |= tmp << LPSRAM_BTCTRL_BEATSIZE_SHIFT; + /* Set up the Block Transfer Count Register configuration */ + + btcnt = sam_bytes2beats(dmach, nbytes); + if ((dmach->dc_flags & DMACH_FLAG_PERIPH_INCREMENT) != 0) { btctrl |= LPSRAM_BTCTRL_SRCINC; + paddr += nbytes; } if ((dmach->dc_flags & DMACH_FLAG_MEM_INCREMENT) != 0) { btctrl |= LPSRAM_BTCTRL_DSTINC; + maddr += nbytes; } if ((dmach->dc_flags & DMACH_FLAG_STEPSEL) == DMACH_FLAG_STEPSEL_MEM) @@ -747,10 +780,6 @@ static int sam_rxbuffer(struct sam_dmach_s *dmach, uint32_t paddr, tmp = (dmach->dc_flags & DMACH_FLAG_STEPSIZE_MASK) >> LPSRAM_BTCTRL_STEPSIZE_SHIFT; btctrl |= tmp << LPSRAM_BTCTRL_STEPSIZE_SHIFT; - /* Set up the Block Transfer Count Register configuration */ - - btcnt = sam_bytes2beats(dmach, nbytes); - /* Add the new descriptor list entry */ if (!sam_append_desc(dmach, btctrl, btcnt, paddr, maddr)) @@ -785,6 +814,7 @@ void weak_function up_dmainitialize(void) /* Initialize global semaphores */ nxsem_init(&g_chsem, 0, 1); + #if CONFIG_SAMDL_DMAC_NDESC > 0 nxsem_init(&g_dsem, 0, CONFIG_SAMDL_DMAC_NDESC); #endif @@ -1183,7 +1213,7 @@ int sam_dmastart(DMA_HANDLE handle, dma_callback_t callback, void *arg) } chctrlb |= tmp << DMAC_CHCTRLB_TRIGSRC_SHIFT; - putreg8(chctrlb, SAM_DMAC_CHCTRLB); + putreg32(chctrlb, SAM_DMAC_CHCTRLB); /* Setup the Quality of Service Control Register * @@ -1330,7 +1360,7 @@ void sam_dmadump(DMA_HANDLE handle, const struct sam_dmaregs_s *regs, regs->ctrl, regs->crcctrl, regs->crcdatain, regs->crcchksum); dmainfo(" CRCSTATUS: %02x DBGCTRL: %02x QOSCTRL: %02x SWTRIGCTRL: %08x\n", regs->crcstatus, regs->dbgctrl, regs->qosctrl, regs->swtrigctrl); - dmainfo(" PRICTRL0: %08x INTPEND: %04x INSTSTATUS: %08x BUSYCH: %08x\n", + dmainfo(" PRICTRL0: %08x INTPEND: %04x INTSTATUS: %08x BUSYCH: %08x\n", regs->prictrl0, regs->intpend, regs->intstatus, regs->busych); dmainfo(" PENDCH: %08x ACTIVE: %08x BASEADDR: %08x WRBADDR: %08x\n", regs->pendch, regs->active, regs->baseaddr, regs->wrbaddr); diff --git a/arch/arm/src/samdl/sam_spi.c b/arch/arm/src/samdl/sam_spi.c index 9f398fd9e9..5ee4f10d31 100644 --- a/arch/arm/src/samdl/sam_spi.c +++ b/arch/arm/src/samdl/sam_spi.c @@ -69,6 +69,10 @@ #include "sam_sercom.h" #include "sam_spi.h" +#ifdef CONFIG_SAMDL_SPI_DMA +#include "sam_dmac.h" +#endif + #include #ifdef SAMDL_HAVE_SPI @@ -118,6 +122,16 @@ struct sam_spidev_s uint8_t mode; /* Mode 0,1,2,3 */ uint8_t nbits; /* Width of word in bits (8 to 16) */ +#ifdef CONFIG_SAMDL_SPI_DMA + /* DMA */ + + uint8_t dma_tx_trig; /* DMA TX trigger source to use */ + uint8_t dma_rx_trig; /* DMA RX trigger source to use */ + DMA_HANDLE dma_tx; /* DMA TX channel handle */ + DMA_HANDLE dma_rx; /* DMA RX channel handle */ + sem_t dmasem; /* Transfer wait semaphore */ +#endif + /* Debug stuff */ #ifdef CONFIG_SAMDL_SPI_REGDEBUG @@ -154,6 +168,10 @@ static uint32_t spi_getreg32(struct sam_spidev_s *priv, static void spi_putreg32(struct sam_spidev_s *priv, uint32_t regval, unsigned int offset); +#ifdef CONFIG_SAMDL_SPI_DMA +static void spi_dma_setup(struct sam_spidev_s *priv); +#endif + #ifdef CONFIG_DEBUG_SPI_INFO static void spi_dumpregs(struct sam_spidev_s *priv, const char *msg); #else @@ -237,6 +255,10 @@ static struct sam_spidev_s g_spi0dev = .srcfreq = BOARD_SERCOM0_FREQUENCY, .base = SAM_SERCOM0_BASE, .spilock = SEM_INITIALIZER(1), +#ifdef CONFIG_SAMDL_SPI_DMA + .dma_tx_trig = DMAC_TRIGSRC_SERCOM0_TX, + .dma_rx_trig = DMAC_TRIGSRC_SERCOM0_RX, +#endif }; #endif @@ -283,6 +305,10 @@ static struct sam_spidev_s g_spi1dev = .srcfreq = BOARD_SERCOM1_FREQUENCY, .base = SAM_SERCOM1_BASE, .spilock = SEM_INITIALIZER(1), +#ifdef CONFIG_SAMDL_SPI_DMA + .dma_tx_trig = DMAC_TRIGSRC_SERCOM1_TX, + .dma_rx_trig = DMAC_TRIGSRC_SERCOM1_RX, +#endif }; #endif @@ -329,6 +355,10 @@ static struct sam_spidev_s g_spi2dev = .srcfreq = BOARD_SERCOM2_FREQUENCY, .base = SAM_SERCOM2_BASE, .spilock = SEM_INITIALIZER(1), +#ifdef CONFIG_SAMDL_SPI_DMA + .dma_tx_trig = DMAC_TRIGSRC_SERCOM2_TX, + .dma_rx_trig = DMAC_TRIGSRC_SERCOM2_RX, +#endif }; #endif @@ -375,6 +405,10 @@ static struct sam_spidev_s g_spi3dev = .srcfreq = BOARD_SERCOM3_FREQUENCY, .base = SAM_SERCOM3_BASE, .spilock = SEM_INITIALIZER(1), +#ifdef CONFIG_SAMDL_SPI_DMA + .dma_tx_trig = DMAC_TRIGSRC_SERCOM3_TX, + .dma_rx_trig = DMAC_TRIGSRC_SERCOM3_RX, +#endif }; #endif @@ -421,6 +455,10 @@ static struct sam_spidev_s g_spi4dev = .srcfreq = BOARD_SERCOM4_FREQUENCY, .base = SAM_SERCOM4_BASE, .spilock = SEM_INITIALIZER(1), +#ifdef CONFIG_SAMDL_SPI_DMA + .dma_tx_trig = DMAC_TRIGSRC_SERCOM4_TX, + .dma_rx_trig = DMAC_TRIGSRC_SERCOM4_RX, +#endif }; #endif @@ -467,6 +505,10 @@ static struct sam_spidev_s g_spi5dev = .srcfreq = BOARD_SERCOM5_FREQUENCY, .base = SAM_SERCOM5_BASE, .spilock = SEM_INITIALIZER(1), +#ifdef CONFIG_SAMDL_SPI_DMA + .dma_tx_trig = DMAC_TRIGSRC_SERCOM5_TX, + .dma_rx_trig = DMAC_TRIGSRC_SERCOM5_RX, +#endif }; #endif @@ -1061,6 +1103,30 @@ static uint16_t spi_send(struct spi_dev_s *dev, uint16_t wd) return (uint16_t)rxbyte; } +#ifdef CONFIG_SAMDL_SPI_DMA +static void spi_dma_callback(DMA_HANDLE dma, void *arg, int result) +{ + struct sam_spidev_s *priv = (struct sam_spidev_s *)arg; + + if(dma == priv->dma_rx) + { + + /* Notify the blocked spi_exchange() call that the transaction + * has completed by posting to the semaphore + */ + + nxsem_post(&priv->dmasem); + } + else if(dma == priv->dma_tx) + { + if(result != OK) + { + spierr("DMA transmission failed\n"); + } + } +} +#endif + /**************************************************************************** * Name: spi_exchange * @@ -1089,14 +1155,51 @@ static void spi_exchange(struct spi_dev_s *dev, const void *txbuffer, void *rxbuffer, size_t nwords) { struct sam_spidev_s *priv = (struct sam_spidev_s *)dev; + + spiinfo("txbuffer=%p rxbuffer=%p nwords=%d\n", txbuffer, rxbuffer, nwords); + +#ifdef CONFIG_SAMDL_SPI_DMA + int ret; + uint32_t regval; + + /* Disable SPI while we configure new DMA descriptors */ + + regval = spi_getreg32(priv, SAM_SPI_CTRLA_OFFSET); + regval &= ~SPI_CTRLA_ENABLE; + spi_putreg32(priv, regval, SAM_SPI_CTRLA_OFFSET); + spi_wait_synchronization(priv); + + /* Setup RX and TX DMA channels */ + + sam_dmatxsetup(priv->dma_tx, priv->base + SAM_SPI_DATA_OFFSET, txbuffer, nwords); + sam_dmarxsetup(priv->dma_rx, priv->base + SAM_SPI_DATA_OFFSET, rxbuffer, nwords); + + /* Start RX and TX DMA channels */ + + sam_dmastart(priv->dma_tx, spi_dma_callback, (void *)priv); + sam_dmastart(priv->dma_rx, spi_dma_callback, (void *)priv); + + /* Enable SPI to trigger the TX DMA channel */ + + regval = spi_getreg32(priv, SAM_SPI_CTRLA_OFFSET); + regval |= SPI_CTRLA_ENABLE; + spi_putreg32(priv, regval, SAM_SPI_CTRLA_OFFSET); + spi_wait_synchronization(priv); + + do + { + /* Wait for the DMA callback to notify us that the transfer is complete */ + + ret = nxsem_wait(&priv->dmasem); + } + while (ret < 0 && ret == -EINTR); +#else const uint16_t *ptx16; const uint8_t *ptx8; uint16_t *prx16; uint8_t *prx8; uint16_t data; - spiinfo("txbuffer=%p rxbuffer=%p nwords=%d\n", txbuffer, rxbuffer, nwords); - /* Set up data receive and transmit pointers */ if (priv->nbits > 8) @@ -1203,6 +1306,7 @@ static void spi_exchange(struct spi_dev_s *dev, const void *txbuffer, *prx16++ = (uint16_t)data; } } +#endif } /**************************************************************************** @@ -1312,6 +1416,28 @@ static void spi_pad_configure(struct sam_spidev_s *priv) } } +#ifdef CONFIG_SAMDL_SPI_DMA +static void spi_dma_setup(struct sam_spidev_s *priv) +{ + + /* Allocate a pair of DMA channels */ + + priv->dma_rx = sam_dmachannel(DMACH_FLAG_BEATSIZE_BYTE | + DMACH_FLAG_MEM_INCREMENT | + DMACH_FLAG_PERIPH_RXTRIG(priv->dma_rx_trig)); + + priv->dma_tx = sam_dmachannel(DMACH_FLAG_BEATSIZE_BYTE | + DMACH_FLAG_MEM_INCREMENT | + DMACH_FLAG_PERIPH_TXTRIG(priv->dma_tx_trig)); + + /* Initialize the samaphore used to notify when DMA is complete */ + + nxsem_init(&priv->dmasem, 0, 0); + nxsem_setprotocol(&priv->dmasem, SEM_PRIO_NONE); +} + +#endif + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -1398,6 +1524,10 @@ struct spi_dev_s *sam_spibus_initialize(int port) return NULL; } +#ifdef CONFIG_SAMDL_SPI_DMA + spi_dma_setup(priv); +#endif + /* Enable clocking to the SERCOM module in PM */ flags = enter_critical_section(); -- GitLab From 4e32861c3cd1f1d2996eb9505c3d7903e8175792 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sun, 11 Feb 2018 16:42:37 -0600 Subject: [PATCH 202/228] Changes from review of last PR + some updated comments. --- arch/arm/src/samdl/Kconfig | 36 ++-- arch/arm/src/samdl/sam_dmac.c | 9 +- arch/arm/src/samdl/sam_spi.c | 251 ++++++++++++++------------ configs/flipnclick-pic32mz/README.txt | 8 + configs/flipnclick-sam3x/README.txt | 4 +- 5 files changed, 165 insertions(+), 143 deletions(-) diff --git a/arch/arm/src/samdl/Kconfig b/arch/arm/src/samdl/Kconfig index fc76c2290b..3026bc9fcb 100644 --- a/arch/arm/src/samdl/Kconfig +++ b/arch/arm/src/samdl/Kconfig @@ -488,20 +488,6 @@ config SAMDL_DMAC select ARCH_DMA depends on SAMDL_HAVE_DMAC && EXPERIMENTAL -if SAMDL_DMAC && EXPERIMENTAL - -menu "DMA options" - -config SAMDL_SPI_DMA - bool "SPI DMA" - default n - depends on (SAMDL_HAVE_SPI) - ---help--- - Use DMA for SPI SERCOM peripherals. -endmenu - -endif - config SAMDL_EVSYS bool "Event System" default n @@ -734,7 +720,15 @@ config SAMDL_HAVE_SPI bool select SPI -if SAMDL_HAVE_SPI +menu "SPI options" + depends on SAMDL_HAVE_SPI + +config SAMDL_SPI_DMA + bool "SPI DMA" + default n + depends on SAMDL_DMAC && EXPERIMENTAL + ---help--- + Use DMA for SPI SERCOM peripherals. config SAMDL_SPI_REGDEBUG bool "SPI register-Level Debug" @@ -743,13 +737,14 @@ config SAMDL_SPI_REGDEBUG ---help--- Enable very low-level register access debug. Depends on DEBUG_SPI. -endif # SAMDL_HAVE_SPI +endmenu # SPI options config SAMDL_HAVE_I2C bool select I2C -if SAMDL_HAVE_I2C +menu "I2C options" + depends on SAMDL_HAVE_I2C config SAMDL_I2C_REGDEBUG bool "I2C register-Level Debug" @@ -758,9 +753,10 @@ config SAMDL_I2C_REGDEBUG ---help--- Enable very low-level register access debug. Depends on DEBUG_I2C. -endif # SAMDL_HAVE_I2C +endmenu # I2C options -if SAMDL_HAVE_USB +menu "USB options" + depends on SAMDL_HAVE_USB config SAMDL_USB_ENABLE_PPEP bool "Enable Ping-Pong Endpoints" @@ -780,5 +776,5 @@ config SAMDL_USB_REGDEBUG Enable very low-level register access debug. Depends on CONFIG_DEBUG_USB_INFO. -endif # SAMDL_HAVE_USB +endmenu # USB options diff --git a/arch/arm/src/samdl/sam_dmac.c b/arch/arm/src/samdl/sam_dmac.c index 2f1f88dadb..0b354a0390 100644 --- a/arch/arm/src/samdl/sam_dmac.c +++ b/arch/arm/src/samdl/sam_dmac.c @@ -145,8 +145,7 @@ static sem_t g_dsem; static struct sam_dmach_s g_dmach[SAMDL_NDMACHAN]; -/* - * NOTE: Using the same address as the base descriptors for writeback descriptors +/* NOTE: Using the same address as the base descriptors for writeback descriptors * causes TERR and FERR interrupts to be raised immediately after starting DMA. * This was tested on SAMD21G18A, and it would appear that the writeback * buffer must be located at a different memory address. @@ -295,7 +294,6 @@ static int sam_dmainterrupt(int irq, void *context, FAR void *arg) unsigned int chndx; uint16_t intpend; - /* Process all pending channel interrupts */ while ((intpend = getreg16(SAM_DMAC_INTPEND)) != 0) @@ -404,7 +402,6 @@ static struct dma_desc_s *sam_alloc_desc(struct sam_dmach_s *dmach) /* Yes, return a pointer to the base descriptor */ desc->srcaddr = (uint32_t)-1; /* Any non-zero value */ - return desc; } #if CONFIG_SAMDL_DMAC_NDESC > 0 @@ -419,7 +416,6 @@ static struct dma_desc_s *sam_alloc_desc(struct sam_dmach_s *dmach) sam_takedsem(); - /* Examine each list entry to find an available one -- i.e., one * with srcaddr == 0. That srcaddr field is set to zero by the DMA * transfer complete interrupt handler. The following should be safe @@ -574,11 +570,9 @@ static void sam_free_desc(struct sam_dmach_s *dmach) next = (struct dma_desc_s *)desc->descaddr; memset(desc, 0, sizeof(struct dma_desc_s)); - sam_givedsem(); } #endif - } /**************************************************************************** @@ -814,7 +808,6 @@ void weak_function up_dmainitialize(void) /* Initialize global semaphores */ nxsem_init(&g_chsem, 0, 1); - #if CONFIG_SAMDL_DMAC_NDESC > 0 nxsem_init(&g_dsem, 0, CONFIG_SAMDL_DMAC_NDESC); #endif diff --git a/arch/arm/src/samdl/sam_spi.c b/arch/arm/src/samdl/sam_spi.c index 5ee4f10d31..ab75f1f4b3 100644 --- a/arch/arm/src/samdl/sam_spi.c +++ b/arch/arm/src/samdl/sam_spi.c @@ -70,7 +70,7 @@ #include "sam_spi.h" #ifdef CONFIG_SAMDL_SPI_DMA -#include "sam_dmac.h" +# include "sam_dmac.h" #endif #include @@ -181,7 +181,7 @@ static void spi_dumpregs(struct sam_spidev_s *priv, const char *msg); /* Interrupt handling */ #if 0 /* Not used */ -static int spi_interrupt(int irq, void *context, FAR void *arg); +static int spi_interrupt(int irq, void *context, FAR void *arg); #endif /* SPI methods */ @@ -240,24 +240,24 @@ static const struct spi_ops_s g_spi0ops = static struct sam_spidev_s g_spi0dev = { - .ops = &g_spi0ops, - .sercom = 0, + .ops = &g_spi0ops, + .sercom = 0, #if 0 /* Not used */ - .irq = SAM_IRQ_SERCOM0, -#endif - .gclkgen = BOARD_SERCOM0_GCLKGEN, - .slowgen = BOARD_SERCOM0_SLOW_GCLKGEN, - .pad0 = BOARD_SERCOM0_PINMAP_PAD0, - .pad1 = BOARD_SERCOM0_PINMAP_PAD1, - .pad2 = BOARD_SERCOM0_PINMAP_PAD2, - .pad3 = BOARD_SERCOM0_PINMAP_PAD3, - .muxconfig = BOARD_SERCOM0_MUXCONFIG, - .srcfreq = BOARD_SERCOM0_FREQUENCY, - .base = SAM_SERCOM0_BASE, - .spilock = SEM_INITIALIZER(1), + .irq = SAM_IRQ_SERCOM0, +#endif + .gclkgen = BOARD_SERCOM0_GCLKGEN, + .slowgen = BOARD_SERCOM0_SLOW_GCLKGEN, + .pad0 = BOARD_SERCOM0_PINMAP_PAD0, + .pad1 = BOARD_SERCOM0_PINMAP_PAD1, + .pad2 = BOARD_SERCOM0_PINMAP_PAD2, + .pad3 = BOARD_SERCOM0_PINMAP_PAD3, + .muxconfig = BOARD_SERCOM0_MUXCONFIG, + .srcfreq = BOARD_SERCOM0_FREQUENCY, + .base = SAM_SERCOM0_BASE, + .spilock = SEM_INITIALIZER(1), #ifdef CONFIG_SAMDL_SPI_DMA - .dma_tx_trig = DMAC_TRIGSRC_SERCOM0_TX, - .dma_rx_trig = DMAC_TRIGSRC_SERCOM0_RX, + .dma_tx_trig = DMAC_TRIGSRC_SERCOM0_TX, + .dma_rx_trig = DMAC_TRIGSRC_SERCOM0_RX, #endif }; #endif @@ -290,24 +290,24 @@ static const struct spi_ops_s g_spi1ops = static struct sam_spidev_s g_spi1dev = { - .ops = &g_spi1ops, - .sercom = 1, + .ops = &g_spi1ops, + .sercom = 1, #if 0 /* Not used */ - .irq = SAM_IRQ_SERCOM1, -#endif - .gclkgen = BOARD_SERCOM1_GCLKGEN, - .slowgen = BOARD_SERCOM1_SLOW_GCLKGEN, - .pad0 = BOARD_SERCOM1_PINMAP_PAD0, - .pad1 = BOARD_SERCOM1_PINMAP_PAD1, - .pad2 = BOARD_SERCOM1_PINMAP_PAD2, - .pad3 = BOARD_SERCOM1_PINMAP_PAD3, - .muxconfig = BOARD_SERCOM1_MUXCONFIG, - .srcfreq = BOARD_SERCOM1_FREQUENCY, - .base = SAM_SERCOM1_BASE, - .spilock = SEM_INITIALIZER(1), + .irq = SAM_IRQ_SERCOM1, +#endif + .gclkgen = BOARD_SERCOM1_GCLKGEN, + .slowgen = BOARD_SERCOM1_SLOW_GCLKGEN, + .pad0 = BOARD_SERCOM1_PINMAP_PAD0, + .pad1 = BOARD_SERCOM1_PINMAP_PAD1, + .pad2 = BOARD_SERCOM1_PINMAP_PAD2, + .pad3 = BOARD_SERCOM1_PINMAP_PAD3, + .muxconfig = BOARD_SERCOM1_MUXCONFIG, + .srcfreq = BOARD_SERCOM1_FREQUENCY, + .base = SAM_SERCOM1_BASE, + .spilock = SEM_INITIALIZER(1), #ifdef CONFIG_SAMDL_SPI_DMA - .dma_tx_trig = DMAC_TRIGSRC_SERCOM1_TX, - .dma_rx_trig = DMAC_TRIGSRC_SERCOM1_RX, + .dma_tx_trig = DMAC_TRIGSRC_SERCOM1_TX, + .dma_rx_trig = DMAC_TRIGSRC_SERCOM1_RX, #endif }; #endif @@ -340,24 +340,24 @@ static const struct spi_ops_s g_spi2ops = static struct sam_spidev_s g_spi2dev = { - .ops = &g_spi2ops, - .sercom = 2, + .ops = &g_spi2ops, + .sercom = 2, #if 0 /* Not used */ - .irq = SAM_IRQ_SERCOM2, -#endif - .gclkgen = BOARD_SERCOM2_GCLKGEN, - .slowgen = BOARD_SERCOM2_SLOW_GCLKGEN, - .pad0 = BOARD_SERCOM2_PINMAP_PAD0, - .pad1 = BOARD_SERCOM2_PINMAP_PAD1, - .pad2 = BOARD_SERCOM2_PINMAP_PAD2, - .pad3 = BOARD_SERCOM2_PINMAP_PAD3, - .muxconfig = BOARD_SERCOM2_MUXCONFIG, - .srcfreq = BOARD_SERCOM2_FREQUENCY, - .base = SAM_SERCOM2_BASE, - .spilock = SEM_INITIALIZER(1), + .irq = SAM_IRQ_SERCOM2, +#endif + .gclkgen = BOARD_SERCOM2_GCLKGEN, + .slowgen = BOARD_SERCOM2_SLOW_GCLKGEN, + .pad0 = BOARD_SERCOM2_PINMAP_PAD0, + .pad1 = BOARD_SERCOM2_PINMAP_PAD1, + .pad2 = BOARD_SERCOM2_PINMAP_PAD2, + .pad3 = BOARD_SERCOM2_PINMAP_PAD3, + .muxconfig = BOARD_SERCOM2_MUXCONFIG, + .srcfreq = BOARD_SERCOM2_FREQUENCY, + .base = SAM_SERCOM2_BASE, + .spilock = SEM_INITIALIZER(1), #ifdef CONFIG_SAMDL_SPI_DMA - .dma_tx_trig = DMAC_TRIGSRC_SERCOM2_TX, - .dma_rx_trig = DMAC_TRIGSRC_SERCOM2_RX, + .dma_tx_trig = DMAC_TRIGSRC_SERCOM2_TX, + .dma_rx_trig = DMAC_TRIGSRC_SERCOM2_RX, #endif }; #endif @@ -390,24 +390,24 @@ static const struct spi_ops_s g_spi3ops = static struct sam_spidev_s g_spi3dev = { - .ops = &g_spi3ops, - .sercom = 3, + .ops = &g_spi3ops, + .sercom = 3, #if 0 /* Not used */ - .irq = SAM_IRQ_SERCOM3, -#endif - .gclkgen = BOARD_SERCOM3_GCLKGEN, - .slowgen = BOARD_SERCOM3_SLOW_GCLKGEN, - .pad0 = BOARD_SERCOM3_PINMAP_PAD0, - .pad1 = BOARD_SERCOM3_PINMAP_PAD1, - .pad2 = BOARD_SERCOM3_PINMAP_PAD2, - .pad3 = BOARD_SERCOM3_PINMAP_PAD3, - .muxconfig = BOARD_SERCOM3_MUXCONFIG, - .srcfreq = BOARD_SERCOM3_FREQUENCY, - .base = SAM_SERCOM3_BASE, - .spilock = SEM_INITIALIZER(1), + .irq = SAM_IRQ_SERCOM3, +#endif + .gclkgen = BOARD_SERCOM3_GCLKGEN, + .slowgen = BOARD_SERCOM3_SLOW_GCLKGEN, + .pad0 = BOARD_SERCOM3_PINMAP_PAD0, + .pad1 = BOARD_SERCOM3_PINMAP_PAD1, + .pad2 = BOARD_SERCOM3_PINMAP_PAD2, + .pad3 = BOARD_SERCOM3_PINMAP_PAD3, + .muxconfig = BOARD_SERCOM3_MUXCONFIG, + .srcfreq = BOARD_SERCOM3_FREQUENCY, + .base = SAM_SERCOM3_BASE, + .spilock = SEM_INITIALIZER(1), #ifdef CONFIG_SAMDL_SPI_DMA - .dma_tx_trig = DMAC_TRIGSRC_SERCOM3_TX, - .dma_rx_trig = DMAC_TRIGSRC_SERCOM3_RX, + .dma_tx_trig = DMAC_TRIGSRC_SERCOM3_TX, + .dma_rx_trig = DMAC_TRIGSRC_SERCOM3_RX, #endif }; #endif @@ -440,24 +440,24 @@ static const struct spi_ops_s g_spi4ops = static struct sam_spidev_s g_spi4dev = { - .ops = &g_spi4ops, - .sercom = 4, + .ops = &g_spi4ops, + .sercom = 4, #if 0 /* Not used */ - .irq = SAM_IRQ_SERCOM4, -#endif - .gclkgen = BOARD_SERCOM4_GCLKGEN, - .slowgen = BOARD_SERCOM4_SLOW_GCLKGEN, - .pad0 = BOARD_SERCOM4_PINMAP_PAD0, - .pad1 = BOARD_SERCOM4_PINMAP_PAD1, - .pad2 = BOARD_SERCOM4_PINMAP_PAD2, - .pad3 = BOARD_SERCOM4_PINMAP_PAD3, - .muxconfig = BOARD_SERCOM4_MUXCONFIG, - .srcfreq = BOARD_SERCOM4_FREQUENCY, - .base = SAM_SERCOM4_BASE, - .spilock = SEM_INITIALIZER(1), + .irq = SAM_IRQ_SERCOM4, +#endif + .gclkgen = BOARD_SERCOM4_GCLKGEN, + .slowgen = BOARD_SERCOM4_SLOW_GCLKGEN, + .pad0 = BOARD_SERCOM4_PINMAP_PAD0, + .pad1 = BOARD_SERCOM4_PINMAP_PAD1, + .pad2 = BOARD_SERCOM4_PINMAP_PAD2, + .pad3 = BOARD_SERCOM4_PINMAP_PAD3, + .muxconfig = BOARD_SERCOM4_MUXCONFIG, + .srcfreq = BOARD_SERCOM4_FREQUENCY, + .base = SAM_SERCOM4_BASE, + .spilock = SEM_INITIALIZER(1), #ifdef CONFIG_SAMDL_SPI_DMA - .dma_tx_trig = DMAC_TRIGSRC_SERCOM4_TX, - .dma_rx_trig = DMAC_TRIGSRC_SERCOM4_RX, + .dma_tx_trig = DMAC_TRIGSRC_SERCOM4_TX, + .dma_rx_trig = DMAC_TRIGSRC_SERCOM4_RX, #endif }; #endif @@ -490,24 +490,24 @@ static const struct spi_ops_s g_spi5ops = static struct sam_spidev_s g_spi5dev = { - .ops = &g_spi5ops, - .sercom = 5, + .ops = &g_spi5ops, + .sercom = 5, #if 0 /* Not used */ - .irq = SAM_IRQ_SERCOM5, -#endif - .gclkgen = BOARD_SERCOM5_GCLKGEN, - .slowgen = BOARD_SERCOM5_SLOW_GCLKGEN, - .pad0 = BOARD_SERCOM5_PINMAP_PAD0, - .pad1 = BOARD_SERCOM5_PINMAP_PAD1, - .pad2 = BOARD_SERCOM5_PINMAP_PAD2, - .pad3 = BOARD_SERCOM5_PINMAP_PAD3, - .muxconfig = BOARD_SERCOM5_MUXCONFIG, - .srcfreq = BOARD_SERCOM5_FREQUENCY, - .base = SAM_SERCOM5_BASE, - .spilock = SEM_INITIALIZER(1), + .irq = SAM_IRQ_SERCOM5, +#endif + .gclkgen = BOARD_SERCOM5_GCLKGEN, + .slowgen = BOARD_SERCOM5_SLOW_GCLKGEN, + .pad0 = BOARD_SERCOM5_PINMAP_PAD0, + .pad1 = BOARD_SERCOM5_PINMAP_PAD1, + .pad2 = BOARD_SERCOM5_PINMAP_PAD2, + .pad3 = BOARD_SERCOM5_PINMAP_PAD3, + .muxconfig = BOARD_SERCOM5_MUXCONFIG, + .srcfreq = BOARD_SERCOM5_FREQUENCY, + .base = SAM_SERCOM5_BASE, + .spilock = SEM_INITIALIZER(1), #ifdef CONFIG_SAMDL_SPI_DMA - .dma_tx_trig = DMAC_TRIGSRC_SERCOM5_TX, - .dma_rx_trig = DMAC_TRIGSRC_SERCOM5_RX, + .dma_tx_trig = DMAC_TRIGSRC_SERCOM5_TX, + .dma_rx_trig = DMAC_TRIGSRC_SERCOM5_RX, #endif }; #endif @@ -1103,26 +1103,41 @@ static uint16_t spi_send(struct spi_dev_s *dev, uint16_t wd) return (uint16_t)rxbyte; } +/**************************************************************************** + * Name: spi_dma_callback + * + * Description: + * DMA completion callback + * + * Input Parameters: + * dma - Allocate DMA handle + * arg - User argument provided with callback + * result - The result of the DMA operation + * + * Returned Value: + * None + * + ****************************************************************************/ + #ifdef CONFIG_SAMDL_SPI_DMA static void spi_dma_callback(DMA_HANDLE dma, void *arg, int result) { struct sam_spidev_s *priv = (struct sam_spidev_s *)arg; - if(dma == priv->dma_rx) + if (dma == priv->dma_rx) { - /* Notify the blocked spi_exchange() call that the transaction * has completed by posting to the semaphore */ nxsem_post(&priv->dmasem); } - else if(dma == priv->dma_tx) + else if (dma == priv->dma_tx) { - if(result != OK) - { - spierr("DMA transmission failed\n"); - } + if (result != OK) + { + spierr("ERROR: DMA transmission failed: %d\n", result); + } } } #endif @@ -1156,11 +1171,11 @@ static void spi_exchange(struct spi_dev_s *dev, const void *txbuffer, { struct sam_spidev_s *priv = (struct sam_spidev_s *)dev; - spiinfo("txbuffer=%p rxbuffer=%p nwords=%d\n", txbuffer, rxbuffer, nwords); - #ifdef CONFIG_SAMDL_SPI_DMA - int ret; uint32_t regval; + int ret; + + spiinfo("txbuffer=%p rxbuffer=%p nwords=%d\n", txbuffer, rxbuffer, nwords); /* Disable SPI while we configure new DMA descriptors */ @@ -1171,8 +1186,10 @@ static void spi_exchange(struct spi_dev_s *dev, const void *txbuffer, /* Setup RX and TX DMA channels */ - sam_dmatxsetup(priv->dma_tx, priv->base + SAM_SPI_DATA_OFFSET, txbuffer, nwords); - sam_dmarxsetup(priv->dma_rx, priv->base + SAM_SPI_DATA_OFFSET, rxbuffer, nwords); + sam_dmatxsetup(priv->dma_tx, priv->base + SAM_SPI_DATA_OFFSET, + (uint32_t)txbuffer, nwords); + sam_dmarxsetup(priv->dma_rx, priv->base + SAM_SPI_DATA_OFFSET, + (uint32_t)rxbuffer, nwords); /* Start RX and TX DMA channels */ @@ -1200,6 +1217,8 @@ static void spi_exchange(struct spi_dev_s *dev, const void *txbuffer, uint8_t *prx8; uint16_t data; + spiinfo("txbuffer=%p rxbuffer=%p nwords=%d\n", txbuffer, rxbuffer, nwords); + /* Set up data receive and transmit pointers */ if (priv->nbits > 8) @@ -1416,10 +1435,17 @@ static void spi_pad_configure(struct sam_spidev_s *priv) } } +/**************************************************************************** + * Name: spi_dma_setup + * + * Description: + * Configure the SPI DMA operation. + * + ****************************************************************************/ + #ifdef CONFIG_SAMDL_SPI_DMA static void spi_dma_setup(struct sam_spidev_s *priv) { - /* Allocate a pair of DMA channels */ priv->dma_rx = sam_dmachannel(DMACH_FLAG_BEATSIZE_BYTE | @@ -1430,12 +1456,11 @@ static void spi_dma_setup(struct sam_spidev_s *priv) DMACH_FLAG_MEM_INCREMENT | DMACH_FLAG_PERIPH_TXTRIG(priv->dma_tx_trig)); - /* Initialize the samaphore used to notify when DMA is complete */ + /* Initialize the semaphore used to notify when DMA is complete */ nxsem_init(&priv->dmasem, 0, 0); nxsem_setprotocol(&priv->dmasem, SEM_PRIO_NONE); } - #endif /**************************************************************************** diff --git a/configs/flipnclick-pic32mz/README.txt b/configs/flipnclick-pic32mz/README.txt index 709430c39a..7321abd27c 100644 --- a/configs/flipnclick-pic32mz/README.txt +++ b/configs/flipnclick-pic32mz/README.txt @@ -82,8 +82,10 @@ Using the mikroProg =================== WARNINGS: + 1. Following there steps will most certainly overwrite the bootloader that was factory installed in FLASH! + 2. Due to the position and orientation of the mikroProg connector you may lose functionality: If you attach mikroProg to the red side of the board, you will not be able to use the Arduino Shield Connector @@ -91,8 +93,13 @@ Using the mikroProg side of the board, you will similarly lose access to mikroBUS connectors A and D. + Hindsight is 20/20 and in retrospect I would look for a right handler + header to priven the mikroProg connector from interfering with the + Arduino connection. + Hardware setup -------------- + You will need to add a five pin header to the mikroProg connector between the A and D mikroBUS sockets. @@ -107,6 +114,7 @@ Using the mikroProg Installing the Software ----------------------- + From the mikroProg website https://www.mikroe.com/mikroprog-pic-dspic-pic32 Download: diff --git a/configs/flipnclick-sam3x/README.txt b/configs/flipnclick-sam3x/README.txt index 1b8cadb610..393b83d00a 100644 --- a/configs/flipnclick-sam3x/README.txt +++ b/configs/flipnclick-sam3x/README.txt @@ -33,7 +33,7 @@ STATUS 2018-02-11: Added the nxlines configuration to test the custom HiletGo OLED on a Click proto board. This is the same logic from the Flip&Click PIC32MZ and the result is the same: No complaints from the software, but - nothing appears on the OLED. There is, most likely, an error in my custom + nothing appears on the OLED. There is, most likely, an error in my custom HiletGo Click. Damn! Buttons and LEDs @@ -633,4 +633,4 @@ Configuration sub-directories STATUS: 2018-02-11: No complaints from the software, but nothing appears on the - OLED. There is, most likely, an error in my custom HiletGo Click. Damn! + OLED. There is, most likely, an error in my custom HiletGo Click. Damn! -- GitLab From d3ddf2e05fef931c475a83a18e56abeedb987cc1 Mon Sep 17 00:00:00 2001 From: Alan Carvalho de Assis Date: Sun, 11 Feb 2018 16:48:38 -0600 Subject: [PATCH 203/228] configs/stm32f103-minimum: Add OLED SSD1306 support to STM332F103-Minimum --- configs/stm32f103-minimum/include/board.h | 6 - configs/stm32f103-minimum/src/Makefile | 4 + configs/stm32f103-minimum/src/stm32_ssd1306.c | 135 ++++++++++++++++++ 3 files changed, 139 insertions(+), 6 deletions(-) create mode 100644 configs/stm32f103-minimum/src/stm32_ssd1306.c diff --git a/configs/stm32f103-minimum/include/board.h b/configs/stm32f103-minimum/include/board.h index f71653a447..6764eaa60b 100644 --- a/configs/stm32f103-minimum/include/board.h +++ b/configs/stm32f103-minimum/include/board.h @@ -46,12 +46,6 @@ # include #endif -#ifdef __KERNEL__ -# include "stm32_rcc.h" -# include "stm32_sdio.h" -# include "stm32.h" -#endif - /************************************************************************************ * Pre-processor Definitions ************************************************************************************/ diff --git a/configs/stm32f103-minimum/src/Makefile b/configs/stm32f103-minimum/src/Makefile index 0e21166bce..e10ac85e96 100644 --- a/configs/stm32f103-minimum/src/Makefile +++ b/configs/stm32f103-minimum/src/Makefile @@ -123,6 +123,10 @@ ifeq ($(CONFIG_INPUT_NUNCHUCK),y) CSRCS += stm32_nunchuck.c endif +ifeq ($(CONFIG_LCD_SSD1306_I2C),y) +CSRCS += stm32_ssd1306.c +endif + ifeq ($(CONFIG_LCD_ST7567),y) CSRCS += stm32_lcd.c endif diff --git a/configs/stm32f103-minimum/src/stm32_ssd1306.c b/configs/stm32f103-minimum/src/stm32_ssd1306.c new file mode 100644 index 0000000000..3c1cbf5487 --- /dev/null +++ b/configs/stm32f103-minimum/src/stm32_ssd1306.c @@ -0,0 +1,135 @@ +/**************************************************************************** + * config/stm32f103-minimum/src/sam_ug2832hsweg04.c + * + * Copyright (C) 2014 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include + +#include +#include +#include +#include + +#include "stm32.h" +#include "stm32_i2c.h" +#include "stm32f103_minimum.h" + +#ifdef CONFIG_NX_LCDDRIVER + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ +/* Configuration ************************************************************/ + +#ifndef CONFIG_LCD_SSD1306 +# error "The OLED driver requires CONFIG_LCD_SSD1306 in the configuration" +#endif + +#ifndef CONFIG_LCD_MAXPOWER +# define CONFIG_LCD_MAXPOWER 1 +#endif + +#define OLED_I2C_PORT 1 /* OLED display connected to I2C1 */ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +FAR struct i2c_master_s *g_i2c; +FAR struct lcd_dev_s *g_lcddev; + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: board_lcd_initialize + ****************************************************************************/ + +int board_lcd_initialize(void) +{ + /* Initialize I2C */ + + g_i2c = stm32_i2cbus_initialize(OLED_I2C_PORT); + if (!g_i2c) + { + lcderr("ERROR: Failed to initialize I2C port %d\n", OLED_I2C_PORT); + return 0; + } + + return 1; +} + +/**************************************************************************** + * Name: board_lcd_getdev + ****************************************************************************/ + +FAR struct lcd_dev_s *board_lcd_getdev(int devno) +{ + /* Bind the I2C port to the OLED */ + + g_lcddev = ssd1306_initialize(g_i2c, NULL, devno); + if (!g_lcddev) + { + lcderr("ERROR: Failed to bind SPI port 1 to OLED %d: %d\n", devno); + } + else + { + lcdinfo("Bound I2C port %d to OLED %d\n", OLED_I2C_PORT, devno); + + /* And turn the OLED on */ + + (void)g_lcddev->setpower(g_lcddev, CONFIG_LCD_MAXPOWER); + return g_lcddev; + } + + return NULL; +} + +/**************************************************************************** + * Name: board_lcd_uninitialize + ****************************************************************************/ + +void board_lcd_uninitialize(void) +{ + /* TO-FIX */ +} + +#endif /* CONFIG_NX_LCDDRIVER */ + -- GitLab From 1247828e74e9a4ed25e8f21870a37e696b39ed29 Mon Sep 17 00:00:00 2001 From: Alan Carvalho de Assis Date: Sun, 11 Feb 2018 16:56:20 -0600 Subject: [PATCH 204/228] drivers/lcd: Fix the default I2C address of SSD1306 OLED display (7- vs 8-bit addressing) --- drivers/lcd/Kconfig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/lcd/Kconfig b/drivers/lcd/Kconfig index 279bf9dfe1..7bcf4c5e62 100644 --- a/drivers/lcd/Kconfig +++ b/drivers/lcd/Kconfig @@ -492,9 +492,10 @@ if LCD_SSD1306_I2C config SSD1306_I2CADDR int "SSD1306 I2C Address" - default 120 + default 60 ---help--- - I2C Address of SSD1306 + 7-bit I2C Address of SSD1306. Typical addresses are 0x3C (60) or + 0x7A (61). config SSD1306_I2CFREQ int "SSD1306 I2C Frequency" -- GitLab From 4a36c946e188814cd9d94368842d25d0abfc31ba Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 12 Feb 2018 14:46:40 -0600 Subject: [PATCH 205/228] Trivial update to some comments. --- arch/arm/src/sam34/sam_spi.c | 20 +++++++++++++------- arch/arm/src/samdl/sam_serial.c | 3 +-- arch/arm/src/samdl/sam_usb.c | 1 - arch/arm/src/samdl/saml_clockconfig.c | 2 ++ drivers/lcd/Kconfig | 5 +++-- 5 files changed, 19 insertions(+), 12 deletions(-) diff --git a/arch/arm/src/sam34/sam_spi.c b/arch/arm/src/sam34/sam_spi.c index 212293b26d..df2be89716 100644 --- a/arch/arm/src/sam34/sam_spi.c +++ b/arch/arm/src/sam34/sam_spi.c @@ -79,6 +79,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ /* When SPI DMA is enabled, small DMA transfers will still be performed by * polling logic. But we need a threshold value to determine what is small. @@ -193,7 +194,7 @@ struct sam_spics_s typedef void (*select_t)(uint32_t devid, bool selected); -/* Chip select register offsetrs */ +/* Chip select register offsets */ /* The overall state of one SPI controller */ @@ -1002,7 +1003,8 @@ static uint32_t spi_setfrequency(struct spi_dev_s *dev, uint32_t frequency) return spics->actual; } - /* Configure SPI to a frequency as close as possible to the requested frequency. + /* Configure SPI to a frequency as close as possible to the requested + * frequency. * * SPCK frequency = SPI_CLK / SCBR, or SCBR = SPI_CLK / frequency */ @@ -1110,7 +1112,7 @@ static void spi_setmode(struct spi_dev_s *dev, enum spi_mode_e mode) * 3 1 0 */ - offset = (unsigned int)g_csroffset[spics->cs]; + offset = (unsigned int)g_csroffset[spics->cs]; regval = spi_getreg(spi, offset); regval &= ~(SPI_CSR_CPOL | SPI_CSR_NCPHA); @@ -1184,7 +1186,9 @@ static void spi_setbits(struct spi_dev_s *dev, int nbits) spiinfo("csr[offset=%02x]=%08x\n", offset, regval); - /* Save the selection so the subsequence re-configurations will be faster */ + /* Save the selection so the subsequence re-configurations will be + * faster. + */ spics->nbits = nbits; } @@ -1233,7 +1237,7 @@ static uint16_t spi_send(struct spi_dev_s *dev, uint16_t wd) * that performs DMA SPI transfers, but only when a larger block of * data is being transferred. And (2) another version that does polled * SPI transfers. When CONFIG_SAM34_SPI_DMA=n the latter is the only - * version avaialable; when CONFIG_SAM34_SPI_DMA=y, this version is only + * version available; when CONFIG_SAM34_SPI_DMA=y, this version is only * used for short SPI transfers and gets renamed as spi_exchange_nodma). * * Input Parameters: @@ -1268,7 +1272,8 @@ static void spi_exchange(struct spi_dev_s *dev, const void *txbuffer, uint8_t *rxptr8; uint8_t *txptr8; - spiinfo("txbuffer=%p rxbuffer=%p nwords=%d\n", txbuffer, rxbuffer, nwords); + spiinfo("txbuffer=%p rxbuffer=%p nwords=%d\n", + txbuffer, rxbuffer, nwords); /* Set up PCS bits */ @@ -1414,7 +1419,8 @@ static void spi_exchange(struct spi_dev_s *dev, const void *txbuffer, return; } - spiinfo("txbuffer=%p rxbuffer=%p nwords=%d\n", txbuffer, rxbuffer, nwords); + spiinfo("txbuffer=%p rxbuffer=%p nwords=%d\n", + txbuffer, rxbuffer, nwords); spics = (struct sam_spics_s *)dev; spi = spi_device(spics); diff --git a/arch/arm/src/samdl/sam_serial.c b/arch/arm/src/samdl/sam_serial.c index aab2d81d23..6f00639df8 100644 --- a/arch/arm/src/samdl/sam_serial.c +++ b/arch/arm/src/samdl/sam_serial.c @@ -524,7 +524,7 @@ static void sam_disableallints(struct sam_dev_s *priv) * interrupt received on the 'irq' It should call uart_transmitchars or * uart_receivechar to perform the appropriate data transfers. The * interrupt handling logic must be able to map the 'irq' number into the - * approprite uart_dev_s structure in order to call these functions. + * appropriate uart_dev_s structure in order to call these functions. * ****************************************************************************/ @@ -1010,4 +1010,3 @@ int up_putc(int ch) #endif /* USE_SERIALDRIVER */ #endif /* SAMDL_HAVE_USART */ - diff --git a/arch/arm/src/samdl/sam_usb.c b/arch/arm/src/samdl/sam_usb.c index f1f2a7cd3d..2132fec4b7 100644 --- a/arch/arm/src/samdl/sam_usb.c +++ b/arch/arm/src/samdl/sam_usb.c @@ -317,7 +317,6 @@ struct sam_rqhead_s struct sam_req_s *tail; /* Requests are removed from the tail of the list */ }; - /* This is the internal representation of an endpoint */ struct sam_ep_s diff --git a/arch/arm/src/samdl/saml_clockconfig.c b/arch/arm/src/samdl/saml_clockconfig.c index 364933501d..f32166ee49 100644 --- a/arch/arm/src/samdl/saml_clockconfig.c +++ b/arch/arm/src/samdl/saml_clockconfig.c @@ -74,6 +74,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* BOARD_GCLK_ENABLE looks optional, but it is not */ #ifndef BOARD_GCLK_ENABLE @@ -140,6 +141,7 @@ static inline void sam_periph_clocks(void); /**************************************************************************** * Private Data ****************************************************************************/ + /* This structure describes the configuration of every enabled GCLK */ #ifdef BOARD_GCLK_ENABLE diff --git a/drivers/lcd/Kconfig b/drivers/lcd/Kconfig index 7bcf4c5e62..364cc185ce 100644 --- a/drivers/lcd/Kconfig +++ b/drivers/lcd/Kconfig @@ -494,8 +494,9 @@ config SSD1306_I2CADDR int "SSD1306 I2C Address" default 60 ---help--- - 7-bit I2C Address of SSD1306. Typical addresses are 0x3C (60) or - 0x7A (61). + 7-bit I2C Address of SSD1306. Typical addresses are 0x3c (60) or + 0x3d (61). NOTE that these correspond to the 8-bit addresses + 0x78 or 0x7a that you may see in documentation. config SSD1306_I2CFREQ int "SSD1306 I2C Frequency" -- GitLab From e0142f1d52c6d78ffc77b8b3f3a3b72374de07a7 Mon Sep 17 00:00:00 2001 From: Pelle Windestam Date: Tue, 13 Feb 2018 08:02:42 -0600 Subject: [PATCH 206/228] net/tcp: Fixed bad return value handling in psock_tcp_send(). send() expects psock_tcp_send() to return a negated errno value, not -1 with the errno set (GN: I added same change for tcp_send_buffered.c which has the same issue as tcp_send_unbuffered.c) --- net/tcp/tcp_send_buffered.c | 21 ++++++++------------- net/tcp/tcp_send_unbuffered.c | 17 +++++++---------- 2 files changed, 15 insertions(+), 23 deletions(-) diff --git a/net/tcp/tcp_send_buffered.c b/net/tcp/tcp_send_buffered.c index 9c6073aa3c..bfb9bd2baf 100644 --- a/net/tcp/tcp_send_buffered.c +++ b/net/tcp/tcp_send_buffered.c @@ -944,8 +944,6 @@ static inline void send_txnotify(FAR struct socket *psock, * In this case the process will also receive a SIGPIPE unless * MSG_NOSIGNAL is set. * - * Assumptions: - * ****************************************************************************/ ssize_t psock_tcp_send(FAR struct socket *psock, FAR const void *buf, @@ -954,20 +952,19 @@ ssize_t psock_tcp_send(FAR struct socket *psock, FAR const void *buf, FAR struct tcp_conn_s *conn; FAR struct tcp_wrbuffer_s *wrb; ssize_t result = 0; - int errcode; int ret = OK; if (psock == NULL || psock->s_crefs <= 0) { nerr("ERROR: Invalid socket\n"); - errcode = EBADF; + ret = -EBADF; goto errout; } if (psock->s_type != SOCK_STREAM || !_SS_ISCONNECTED(psock->s_flags)) { nerr("ERROR: Not connected\n"); - errcode = ENOTCONN; + ret = -ENOTCONN; goto errout; } @@ -1004,7 +1001,7 @@ ssize_t psock_tcp_send(FAR struct socket *psock, FAR const void *buf, if (ret < 0) { nerr("ERROR: Not reachable\n"); - errcode = ENETUNREACH; + ret = -ENETUNREACH; goto errout; } #endif /* CONFIG_NET_ARP_SEND || CONFIG_NET_ICMPv6_NEIGHBOR */ @@ -1030,7 +1027,7 @@ ssize_t psock_tcp_send(FAR struct socket *psock, FAR const void *buf, /* A buffer allocation error occurred */ nerr("ERROR: Failed to allocate write buffer\n"); - errcode = ENOMEM; + ret = -ENOMEM; goto errout_with_lock; } @@ -1048,7 +1045,7 @@ ssize_t psock_tcp_send(FAR struct socket *psock, FAR const void *buf, /* A buffer allocation error occurred */ nerr("ERROR: Failed to allocate callback\n"); - errcode = ENOMEM; + ret = -ENOMEM; goto errout_with_wrb; } @@ -1100,13 +1097,13 @@ ssize_t psock_tcp_send(FAR struct socket *psock, FAR const void *buf, psock->s_flags = _SS_SETSTATE(psock->s_flags, _SF_IDLE); - /* Check for errors. Errors are signalled by negative errno values + /* Check for errors. Errors are signaled by negative errno values * for the send length */ if (result < 0) { - errcode = result; + ret = result; goto errout; } @@ -1117,7 +1114,6 @@ ssize_t psock_tcp_send(FAR struct socket *psock, FAR const void *buf, if (ret < 0) { - errcode = -ret; goto errout; } @@ -1132,8 +1128,7 @@ errout_with_lock: net_unlock(); errout: - set_errno(errcode); - return ERROR; + return ret; } /**************************************************************************** diff --git a/net/tcp/tcp_send_unbuffered.c b/net/tcp/tcp_send_unbuffered.c index a431f312f3..a92a9fda40 100644 --- a/net/tcp/tcp_send_unbuffered.c +++ b/net/tcp/tcp_send_unbuffered.c @@ -680,7 +680,7 @@ static inline void send_txnotify(FAR struct socket *psock, * * Returned Value: * On success, returns the number of characters sent. On error, - * -1 is returned, and errno is set appropriately: + * a negated errno value is returned. * * EAGAIN or EWOULDBLOCK * The socket is marked non-blocking and the requested operation @@ -726,7 +726,6 @@ ssize_t psock_tcp_send(FAR struct socket *psock, { FAR struct tcp_conn_s *conn; struct send_s state; - int errcode; int ret = OK; /* Verify that the sockfd corresponds to valid, allocated socket */ @@ -734,7 +733,7 @@ ssize_t psock_tcp_send(FAR struct socket *psock, if (psock == NULL || psock->s_crefs <= 0) { nerr("ERROR: Invalid socket\n"); - errcode = EBADF; + ret = -EBADF; goto errout; } @@ -743,7 +742,7 @@ ssize_t psock_tcp_send(FAR struct socket *psock, if (psock->s_type != SOCK_STREAM || !_SS_ISCONNECTED(psock->s_flags)) { nerr("ERROR: Not connected\n"); - errcode = ENOTCONN; + ret = -ENOTCONN; goto errout; } @@ -781,7 +780,7 @@ ssize_t psock_tcp_send(FAR struct socket *psock, if (ret < 0) { nerr("ERROR: Not reachable\n"); - errcode = ENETUNREACH; + ret = -ENETUNREACH; goto errout; } #endif /* CONFIG_NET_ARP_SEND || CONFIG_NET_ICMPv6_NEIGHBOR */ @@ -869,7 +868,7 @@ ssize_t psock_tcp_send(FAR struct socket *psock, if (state.snd_sent < 0) { - errcode = state.snd_sent; + ret = state.snd_sent; goto errout; } @@ -879,17 +878,15 @@ ssize_t psock_tcp_send(FAR struct socket *psock, if (ret < 0) { - errcode = -ret; goto errout; } /* Return the number of bytes actually sent */ - return state.snd_sent; + ret = state.snd_sent; errout: - set_errno(errcode); - return ERROR; + return ret; } /**************************************************************************** -- GitLab From 643234dbcc68563a76dfc58a14f3e91003b2caba Mon Sep 17 00:00:00 2001 From: Alexander Oryshchenko Date: Tue, 13 Feb 2018 08:51:53 -0600 Subject: [PATCH 207/228] arm/arm/src/stm32: Corrections to STM32 F4 I2C to restore functionality. --- arch/arm/src/stm32/stm32f40xxx_i2c.c | 469 ++++++++++++--------------- 1 file changed, 202 insertions(+), 267 deletions(-) diff --git a/arch/arm/src/stm32/stm32f40xxx_i2c.c b/arch/arm/src/stm32/stm32f40xxx_i2c.c index 9317b3608c..1d25588eaa 100644 --- a/arch/arm/src/stm32/stm32f40xxx_i2c.c +++ b/arch/arm/src/stm32/stm32f40xxx_i2c.c @@ -270,7 +270,6 @@ struct stm32_i2c_priv_s volatile int dcnt; /* Current message length */ uint16_t flags; /* Current message flags */ bool check_addr_ACK; /* Flag to signal if on next interrupt address has ACKed */ - uint8_t total_msg_len; /* Flag to signal a short read sequence */ /* I2C trace support */ @@ -1260,27 +1259,6 @@ static int stm32_i2c_isr_process(struct stm32_i2c_priv_s *priv) priv->status = status; - /* Any new message should begin with "Start" condition - * However there were 2 situations where that was not true - * Situation 1: priv->msgc == 0 came from DMA RX handler and should - * be managed - * - * Situation 2: If an error is injected that looks like a STOP the - * interrupt will be reentered with some status that will be incorrect. This - * will ensure that the error handler will clear the interrupt enables and - * return the error to the waiting task. - */ - - if (priv->dcnt == -1 && priv->msgc != 0 && (status & I2C_SR1_SB) == 0) - { -#if defined(CONFIG_STM32_I2C_DMA) || defined(CONFIG_I2C_POLLED) - return OK; -#else - priv->status |= I2C_SR1_TIMEOUT; - goto state_error; -#endif - } - /* Check if this is a new transmission so to set up the * trace table accordingly. */ @@ -1327,13 +1305,33 @@ static int stm32_i2c_isr_process(struct stm32_i2c_priv_s *priv) if (priv->dcnt == -1 && priv->msgc > 0) { + /* Any new message should begin with "Start" condition + * However there were 2 situations where that was not true + * Situation 1: Next message continue transmission sequence of previous message + * + * Situation 2: If an error is injected that looks like a STOP the + * interrupt will be reentered with some status that will be incorrect. This + * will ensure that the error handler will clear the interrupt enables and + * return the error to the waiting task. + */ + + if (((priv->msgv[0].flags & I2C_M_NORESTART) != 0 && (status & I2C_SR1_BTF) == 0) || + ((priv->msgv[0].flags & I2C_M_NORESTART) == 0 && (status & I2C_SR1_SB) == 0)) + { +#if defined(CONFIG_STM32_I2C_DMA) || defined(CONFIG_I2C_POLLED) + return OK; +#else + priv->status |= I2C_SR1_TIMEOUT; + goto state_error; +#endif + } + i2cinfo("Switch to new message\n"); /* Get current message to process data and copy to private structure */ priv->ptr = priv->msgv->buffer; /* Copy buffer to private struct */ priv->dcnt = priv->msgv->length; /* Set counter of current msg length */ - priv->total_msg_len = priv->msgv->length; /* Set total msg length */ priv->flags = priv->msgv->flags; /* Copy flags to private struct */ i2cinfo("Current flags %i\n", priv->flags); @@ -1435,9 +1433,11 @@ static int stm32_i2c_isr_process(struct stm32_i2c_priv_s *priv) priv->dcnt = -1; +#ifndef CONFIG_I2C_POLLED /* Restart ISR by setting an interrupt buffer bit */ stm32_i2c_modifyreg(priv, STM32_I2C_CR2_OFFSET, 0, I2C_CR2_ITBUFEN); +#endif } } @@ -1504,10 +1504,6 @@ static int stm32_i2c_isr_process(struct stm32_i2c_priv_s *priv) priv->check_addr_ACK = false; - /* Enable RxNE and TxE buffers in order to receive one or multiple bytes */ - - stm32_i2c_modifyreg(priv, STM32_I2C_CR2_OFFSET, 0, I2C_CR2_ITBUFEN); - /* Note: * * When reading a single byte the stop condition has to be set @@ -1518,7 +1514,7 @@ static int stm32_i2c_isr_process(struct stm32_i2c_priv_s *priv) * after the clearing of the address. */ - if (priv->dcnt == 1 && priv->total_msg_len == 1) + if (priv->dcnt == 1) { /* this should only happen when receiving a message of length 1 */ @@ -1532,6 +1528,12 @@ static int stm32_i2c_isr_process(struct stm32_i2c_priv_s *priv) stm32_i2c_modifyreg(priv, STM32_I2C_CR1_OFFSET, I2C_CR1_ACK, 0); +#ifndef CONFIG_I2C_POLLED + /* Enable RxNE and TxE buffers in order to receive one or multiple bytes */ + + stm32_i2c_modifyreg(priv, STM32_I2C_CR2_OFFSET, 0, I2C_CR2_ITBUFEN); +#endif + /* Clear ADDR flag by reading SR2 and adding it to status */ status |= (stm32_i2c_getreg(priv, STM32_I2C_SR2_OFFSET) << 16); @@ -1554,7 +1556,7 @@ static int stm32_i2c_isr_process(struct stm32_i2c_priv_s *priv) stm32_i2c_traceevent(priv, I2CEVENT_ADDRESS_ACKED_READ_1, 0); } - else if (priv->dcnt == 2 && priv->total_msg_len == 2) + else if (priv->dcnt == 2) { /* This should only happen when receiving a message of length 2 */ @@ -1627,6 +1629,15 @@ static int stm32_i2c_isr_process(struct stm32_i2c_priv_s *priv) stm32_dmastart(priv->rxdma, stm32_i2c_dmarxcallback, priv, false); stm32_i2c_modifyreg(priv, STM32_I2C_CR2_OFFSET, 0, I2C_CR2_DMAEN); +#else +#ifndef CONFIG_I2C_POLLED + if (priv->dcnt > 3) + { + /* Don't enable I2C_CR2_ITBUFEN for messages longer than 3 bytes */ + + stm32_i2c_modifyreg(priv, STM32_I2C_CR2_OFFSET, 0, I2C_CR2_ITBUFEN); + } +#endif #endif } } @@ -1638,8 +1649,60 @@ static int stm32_i2c_isr_process(struct stm32_i2c_priv_s *priv) * begin immediately after. */ - else if ((priv->flags & (I2C_M_READ)) == 0 && - (status & (I2C_SR1_ADDR | I2C_SR1_TXE)) != 0) + else if ((priv->flags & I2C_M_READ) == 0 && + (status & I2C_SR1_BTF) != 0 && + priv->dcnt == 0) + { + /* After last byte, check what to do based on next message flags */ + + if (priv->msgc == 0) + { + /* If last message send stop bit */ + + stm32_i2c_sendstop(priv); + i2cinfo("Stop sent dcnt = %i msgc = %i\n", priv->dcnt, priv->msgc); + + /* Decrease counter to get to next message */ + + priv->dcnt--; + i2cinfo("dcnt %i\n", priv->dcnt); + stm32_i2c_traceevent(priv, I2CEVENT_WRITE_STOP, priv->dcnt); + } + + /* If there is a next message with no flags or the read flag + * a restart sequence has to be sent. + * Note msgv already points to the next message. + */ + + else if (priv->msgc > 0 && + (priv->msgv->flags == 0 || (priv->msgv[0].flags & I2C_M_READ) != 0)) + { + /* Send start */ + + stm32_i2c_sendstart(priv); + + stm32_i2c_getreg(priv, STM32_I2C_DR_OFFSET); + + i2cinfo("Restart detected!\n"); + i2cinfo("Nextflag %i\n", priv->msgv[0].flags); + + /* Decrease counter to get to next message */ + + priv->dcnt--; + i2cinfo("dcnt %i\n", priv->dcnt); + stm32_i2c_traceevent(priv, I2CEVENT_WRITE_RESTART, priv->dcnt); + } + else + { + i2cinfo("Write mode: next message has an unrecognized flag.\n"); + stm32_i2c_traceevent(priv, I2CEVENT_WRITE_FLAG_ERROR, priv->msgv->flags); + } + + status |= (stm32_i2c_getreg(priv, STM32_I2C_SR2_OFFSET) << 16); + } + else if ((priv->flags & I2C_M_READ) == 0 && + (status & (I2C_SR1_ADDR | I2C_SR1_TXE)) != 0 && + priv->dcnt != 0) { /* The has cleared(ADDR is set, ACK was received after the address) * or the transmit buffer is empty flag has been set(TxE) then we can @@ -1662,134 +1725,101 @@ static int stm32_i2c_isr_process(struct stm32_i2c_priv_s *priv) * msg flags) has to be set. */ - if (priv->dcnt >= 1) - { #ifdef CONFIG_STM32_I2C_DMA - /* if DMA is enabled, only makes sense to make use of it for longer - than 1 B transfers.. */ + /* if DMA is enabled, only makes sense to make use of it for longer + * than 1 B transfers. + */ - if (priv->dcnt > 1) - { - i2cinfo("Starting dma transfer and disabling interrupts\n"); + if (priv->dcnt > 1) + { + i2cinfo("Starting DMA transfer and disabling interrupts\n"); - /* The DMA must be initialized and enabled before the I2C data transfer. - * The DMAEN bit must be set in the I2C_CR2 register before the ADDR event. - */ + /* The DMA must be initialized and enabled before the I2C data + * transfer. The DMAEN bit must be set in the I2C_CR2 register + * before the ADDR event. + */ - stm32_dmasetup(priv->txdma, priv->config->base+STM32_I2C_DR_OFFSET, - (uint32_t) priv->ptr, priv->dcnt, - DMA_SCR_DIR_M2P | - DMA_SCR_MSIZE_8BITS | - DMA_SCR_PSIZE_8BITS | - DMA_SCR_MINC | - I2C_DMA_PRIO ); + stm32_dmasetup(priv->txdma, priv->config->base+STM32_I2C_DR_OFFSET, + (uint32_t) priv->ptr, priv->dcnt, + DMA_SCR_DIR_M2P | + DMA_SCR_MSIZE_8BITS | + DMA_SCR_PSIZE_8BITS | + DMA_SCR_MINC | + I2C_DMA_PRIO ); - /* Do not enable the ITBUFEN bit in the I2C_CR2 register if DMA is - * used. - */ + /* Do not enable the ITBUFEN bit in the I2C_CR2 register if DMA is + * used. + */ - stm32_i2c_modifyreg(priv, STM32_I2C_CR2_OFFSET, I2C_CR2_ITBUFEN, 0); + stm32_i2c_modifyreg(priv, STM32_I2C_CR2_OFFSET, I2C_CR2_ITBUFEN, 0); #ifndef CONFIG_I2C_POLLED - /* Now let DMA do all the work, disable i2c interrupts */ + /* Now let DMA do all the work, disable i2c interrupts */ - regval = stm32_i2c_getreg(priv, STM32_I2C_CR2_OFFSET); - regval &= ~I2C_CR2_ALLINTS; - stm32_i2c_putreg(priv, STM32_I2C_CR2_OFFSET, regval); + regval = stm32_i2c_getreg(priv, STM32_I2C_CR2_OFFSET); + regval &= ~I2C_CR2_ALLINTS; + stm32_i2c_putreg(priv, STM32_I2C_CR2_OFFSET, regval); #endif - /* In the interrupt routine after the EOT interrupt, disable DMA - * requests then wait for a BTF event before programming the Stop - * condition. To do this, we'll just call the ISR again in - * dma tx callback, in which point we fall into the msgc==0 case - * which ultimately sends the stop..TODO: but we don't explicitly - * wait for BTF bit being set... - * Start DMA. - */ - - stm32_i2c_modifyreg(priv, STM32_I2C_CR2_OFFSET, 0, I2C_CR2_DMAEN); - stm32_dmastart(priv->txdma, stm32_i2c_dmatxcallback, priv, false); - } - else -#endif /* CONFIG_STM32_I2C_DMA */ - { - /* Transmitting message. Send byte == write data into write register */ - - stm32_i2c_putreg(priv, STM32_I2C_DR_OFFSET, *priv->ptr++); - - /* Decrease current message length */ + /* In the interrupt routine after the EOT interrupt, disable DMA + * requests then wait for a BTF event before programming the Stop + * condition. To do this, we'll just call the ISR again in + * DMA tx callback, in which point we fall into the msgc==0 case + * which ultimately sends the stop..TODO: but we don't explicitly + * wait for BTF bit being set... + * Start DMA. + */ - stm32_i2c_traceevent(priv, I2CEVENT_WRITE_TO_DR, priv->dcnt); - priv->dcnt--; - } + stm32_i2c_modifyreg(priv, STM32_I2C_CR2_OFFSET, 0, I2C_CR2_DMAEN); + stm32_dmastart(priv->txdma, stm32_i2c_dmatxcallback, priv, false); } - else if (priv->dcnt == 0) + else +#endif /* CONFIG_STM32_I2C_DMA */ { - /* After last byte, check what to do based on next message flags */ - - if (priv->msgc == 0) +#ifndef CONFIG_I2C_POLLED + if (priv->dcnt == 1 && + (priv->msgc == 0 || (priv->msgv->flags & I2C_M_NORESTART) == 0)) { - /* If last message send stop bit */ - - stm32_i2c_sendstop(priv); - i2cinfo("Stop sent dcnt = %i msgc = %i\n", priv->dcnt, priv->msgc); - - /* Decrease counter to get to next message */ - - priv->dcnt--; - i2cinfo("dcnt %i\n", priv->dcnt); - stm32_i2c_traceevent(priv, I2CEVENT_WRITE_STOP, priv->dcnt); + stm32_i2c_modifyreg(priv, STM32_I2C_CR2_OFFSET, I2C_CR2_ITBUFEN, 0); } +#endif - /* If there is a next message with no flags or the read flag - * a restart sequence has to be sent. - * Note msgv already points to the next message. - */ + /* Transmitting message. Send byte == write data into write register */ - else if (priv->msgc > 0 && - (priv->msgv->flags == 0 || (priv->msgv[0].flags & I2C_M_READ) != 0)) - { - /* ACK ISR (for some reason this is necessary even though the - * sendstart should clear the BTF). - */ + stm32_i2c_putreg(priv, STM32_I2C_DR_OFFSET, *priv->ptr++); - stm32_i2c_getreg(priv, STM32_I2C_DR_OFFSET); + /* Decrease current message length */ - /* Send start */ + stm32_i2c_traceevent(priv, I2CEVENT_WRITE_TO_DR, priv->dcnt); + priv->dcnt--; - stm32_i2c_sendstart(priv); + if ((status & I2C_SR1_ADDR) != 0 && priv->dcnt > 0) + { + /* Transmitting message. ADDR -> BTF & TXE - Send one more byte */ - i2cinfo("Restart detected!\n"); - i2cinfo("Nextflag %i\n", priv->msgv[0].flags); + stm32_i2c_putreg(priv, STM32_I2C_DR_OFFSET, *priv->ptr++); - /* Decrease counter to get to next message */ + /* Decrease current message length */ + stm32_i2c_traceevent(priv, I2CEVENT_WRITE_TO_DR, priv->dcnt); priv->dcnt--; - i2cinfo("dcnt %i\n", priv->dcnt); - stm32_i2c_traceevent(priv, I2CEVENT_WRITE_RESTART, priv->dcnt); } - /* If there is a next message with the NO_RESTART flag - * do nothing. - */ - - else if (priv->msgc > 0 && ((priv->msgv->flags & I2C_M_NORESTART) != 0)) +#ifndef CONFIG_I2C_POLLED + if (((status & I2C_SR1_ADDR) != 0 && priv->dcnt > 0) || + (priv->msgc > 0 && (priv->msgv->flags & I2C_M_NORESTART) != 0)) + { + stm32_i2c_modifyreg(priv, STM32_I2C_CR2_OFFSET, 0, I2C_CR2_ITBUFEN); + } +#endif + if (priv->dcnt == 0 && + priv->msgc > 0 && (priv->msgv->flags & I2C_M_NORESTART) != 0) { /* Set condition to get to next message */ priv->dcnt =- 1; stm32_i2c_traceevent(priv, I2CEVENT_WRITE_NO_RESTART, priv->dcnt); } - else - { - i2cinfo("Write mode: next message has an unrecognized flag.\n"); - stm32_i2c_traceevent(priv, I2CEVENT_WRITE_FLAG_ERROR, priv->msgv->flags); - } - } - else - { - i2cerr("Write mode error.\n"); - stm32_i2c_traceevent(priv, I2CEVENT_WRITE_ERROR, 0); } } @@ -1798,6 +1828,7 @@ static int stm32_i2c_isr_process(struct stm32_i2c_priv_s *priv) * Handles all read related I2C protocol logic. * * * * * * * * WARNING STM32F1xx HARDWARE ERRATA * * * * * * * + * * source: https://github.com/hikob/openlab/blob/master/drivers/stm32/i2c.c * * RXNE-only events should not be handled since it sometimes @@ -1820,172 +1851,67 @@ static int stm32_i2c_isr_process(struct stm32_i2c_priv_s *priv) * -> the i2c transfer was B1 B2 B3 B4 B5(B6 is not sent) */ - else if ((priv->flags & (I2C_M_READ)) != 0 && (status & I2C_SR1_RXNE) != 0) + else if ((priv->flags & (I2C_M_READ)) != 0 && + (status & (I2C_SR1_RXNE | I2C_SR1_BTF)) != 0) { /* When read flag is set and the receive buffer is not empty *(RXNE is set) then the driver can read from the data register. */ - i2cinfo("Entering read mode dcnt = %i msgc = %i, status %i\n", + status |= (stm32_i2c_getreg(priv, STM32_I2C_SR2_OFFSET) << 16); + + i2cinfo("Entering read mode dcnt = %i msgc = %i, status 0x%04x\n", priv->dcnt, priv->msgc, status); - /* Implementation of method 2 for receiving data following - * the stm32f1xx reference manual. + /* Byte #N-3W, we don't want to manage RxNE interrupt anymore, bytes + * N, N-1, N-2 will be read with BTF: */ - /* Case total message length = 1 */ - - if (priv->dcnt == 1 && priv->total_msg_len == 1) +#ifndef CONFIG_I2C_POLLED + if (priv->dcnt < 5) { - i2cinfo("short read N=1: Read data from data register(DR)\n"); - - *priv->ptr++ = stm32_i2c_getreg(priv, STM32_I2C_DR_OFFSET); - priv->dcnt = -1; - stm32_i2c_traceevent(priv, I2CEVENT_READ, 0); - } - - /* Case total message length = 2 */ - - else if (priv->dcnt == 2 && priv->total_msg_len == 2 && !(status & I2C_SR1_BTF)) - { - i2cinfo("short read N=2: DR full, SR empty. Waiting for more bytes.\n"); - stm32_i2c_traceevent(priv, I2CEVENT_READ_SR_EMPTY, 0); + stm32_i2c_modifyreg(priv, STM32_I2C_CR2_OFFSET, I2C_CR2_ITBUFEN, 0); } - else if (priv->dcnt == 2 && priv->total_msg_len == 2 && (status & I2C_SR1_BTF)) +#else + if (priv->dcnt == 1 || priv->dcnt > 3 || (status & I2C_SR1_BTF) != 0) +#endif { - i2cinfo("short read N=2: DR and SR full setting stop bit and reading twice\n"); + /* BTF: N-2/N-1, set NACK, read N-2 */ - /* Send Stop/Restart */ - - if (priv->msgc > 0) + if (priv->dcnt == 3) { - stm32_i2c_sendstart(priv); + stm32_i2c_modifyreg(priv, STM32_I2C_CR1_OFFSET, I2C_CR1_ACK, 0); } - else - { - stm32_i2c_sendstop(priv); - } - - *priv->ptr++ = stm32_i2c_getreg(priv, STM32_I2C_DR_OFFSET); - priv->dcnt--; - *priv->ptr++ = stm32_i2c_getreg(priv, STM32_I2C_DR_OFFSET); - priv->dcnt--; - - /* Stop request already programmed so set dcnt for next message */ - - priv->dcnt--; - - /* Set trace */ - - stm32_i2c_traceevent(priv, I2CEVENT_READ_2, 0); - } - -#ifndef CONFIG_STM32_I2C_DMA - /* Case total message length >= 3 */ - - else if (priv->dcnt >= 4 && priv->total_msg_len >= 3) - { - /* Read data from data register(DR). Note this clears the - * RXNE(receive buffer not empty) flag. - */ - - i2cinfo("Read data from data register(DR)\n"); - *priv->ptr++ = stm32_i2c_getreg(priv, STM32_I2C_DR_OFFSET); - - /* Decrease current message length */ - - priv->dcnt--; - stm32_i2c_traceevent(priv, I2CEVENT_READ, 0); - } - else if (priv->dcnt == 3 && priv->total_msg_len >= 3 && !(status & I2C_SR1_BTF)) - { - i2cinfo("short read N=3: DR full, SR empty. Waiting for more bytes.\n"); - stm32_i2c_traceevent(priv, I2CEVENT_READ_SR_EMPTY, 0); - } - else if (priv->dcnt == 3 && (status & I2C_SR1_BTF) && priv->total_msg_len >= 3) - { - /* This means that we are reading dcnt 3 and there is already dcnt 2 in - * the shift register. - * This coincides with EV7_1 in the reference manual. - */ - i2cinfo("Program NACK\n"); - i2cinfo("Read data from data register(DR) dcnt=3\n"); + /* BTF: N-1/N, STOP/START, read N-1, N */ - stm32_i2c_traceevent(priv, I2CEVENT_READ_3, priv->dcnt); - - /* Program NACK */ - - stm32_i2c_modifyreg(priv, STM32_I2C_CR1_OFFSET, I2C_CR1_ACK, 0); + else if (priv->dcnt == 2) + { + if (priv->msgc > 0) + { + stm32_i2c_sendstart(priv); + } + else + { + stm32_i2c_sendstop(priv); + } + + /* Read byte #N-1 */ + + *priv->ptr++ = stm32_i2c_getreg(priv, STM32_I2C_DR_OFFSET); + priv->dcnt--; + } - /* Read dcnt = 3, to ensure a BTF event after having recieved - * in the shift register. - */ + /* Read last or current byte */ *priv->ptr++ = stm32_i2c_getreg(priv, STM32_I2C_DR_OFFSET); - - /* Decrease current message length */ - priv->dcnt--; - } - else if (priv->dcnt == 2 && priv->total_msg_len >= 3 && !(status & I2C_SR1_BTF)) - { - i2cinfo("short read N=3: DR full, SR empty. Waiting for more bytes.\n"); - stm32_i2c_traceevent(priv, I2CEVENT_READ_SR_EMPTY, 0); - } - else if (priv->dcnt == 2 && (status & I2C_SR1_BTF) && priv->total_msg_len >= 3) - { - i2cinfo("Program stop\n"); - i2cinfo("Read data from data register(DR) dcnt=2\n"); - i2cinfo("Read data from data register(SR) dcnt=1\n"); - i2cinfo("Setting condition to stop ISR dcnt = -1\n"); - stm32_i2c_traceevent(priv, I2CEVENT_READ_3, priv->dcnt); - - /* Program Stop/Restart */ - - if (priv->msgc > 0) + if (priv->dcnt == 0) { - stm32_i2c_sendstart(priv); - } - else - { - stm32_i2c_sendstop(priv); + priv->dcnt = -1; } - - /* read dcnt = 2 */ - - *priv->ptr++ = stm32_i2c_getreg(priv, STM32_I2C_DR_OFFSET); - - /* read last byte dcnt=1 */ - - *priv->ptr++ = stm32_i2c_getreg(priv, STM32_I2C_DR_OFFSET); - - /* Stop already sent will not get another interrupt set - * condition to stop ISR - */ - - priv->dcnt = -1; } -#endif /* CONFIG_STM32_I2C_DMA */ - - /* Error handling for read mode */ - - else - { - i2cinfo("I2C read mode no correct state detected\n"); - i2cinfo(" state %i, dcnt=%i\n", status, priv->dcnt); - - /* Set condition to terminate ISR and wake waiting thread */ - - priv->dcnt = -1; - priv->msgc = 0; - stm32_i2c_traceevent(priv, I2CEVENT_READ_ERROR, 0); - } - - /* Read rest of the state */ - - status |= (stm32_i2c_getreg(priv, STM32_I2C_SR2_OFFSET) << 16); } /* Empty call handler @@ -2023,6 +1949,15 @@ static int stm32_i2c_isr_process(struct stm32_i2c_priv_s *priv) status |= (stm32_i2c_getreg(priv, STM32_I2C_SR2_OFFSET) << 16); + /* No any error bit is set, but driver is in incorrect state, signal + * it with "Bus error" bit. + */ + + if ((status & I2C_SR1_ERRORMASK) != 0) + { + priv->status |= I2C_SR1_BERR; + } + i2cinfo(" No correct state detected(start bit, read or write) \n"); i2cinfo(" state %i\n", status); -- GitLab From 9b812e3fa306616d7934d97033863f63e97e5ce0 Mon Sep 17 00:00:00 2001 From: Alexander Oryshchenko Date: Tue, 13 Feb 2018 11:41:57 -0600 Subject: [PATCH 208/228] arm/arm/src/stm32: Corrections to STM32 F4 I2C to fix the NORESTART flag. --- arch/arm/src/stm32/stm32f40xxx_i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/src/stm32/stm32f40xxx_i2c.c b/arch/arm/src/stm32/stm32f40xxx_i2c.c index 1d25588eaa..ac3c85adc0 100644 --- a/arch/arm/src/stm32/stm32f40xxx_i2c.c +++ b/arch/arm/src/stm32/stm32f40xxx_i2c.c @@ -1315,7 +1315,7 @@ static int stm32_i2c_isr_process(struct stm32_i2c_priv_s *priv) * return the error to the waiting task. */ - if (((priv->msgv[0].flags & I2C_M_NORESTART) != 0 && (status & I2C_SR1_BTF) == 0) || + if (((priv->msgv[0].flags & I2C_M_NORESTART) != 0 && (status & I2C_SR1_TXE) == 0) || ((priv->msgv[0].flags & I2C_M_NORESTART) == 0 && (status & I2C_SR1_SB) == 0)) { #if defined(CONFIG_STM32_I2C_DMA) || defined(CONFIG_I2C_POLLED) -- GitLab From e79e2e2d9749c0e755f5b24c7952e181ddfde549 Mon Sep 17 00:00:00 2001 From: Matt Thompson Date: Tue, 13 Feb 2018 19:00:29 +0000 Subject: [PATCH 209/228] Merged in extent3d/nuttx/lis3dh (pull request #598) Added support for LIS3DH accelerometer sensor. * Added support for LIS3DH accelerometer sensor. * Fix line length * Fix more line lengthts Approved-by: Gregory Nutt --- drivers/sensors/Kconfig | 7 + drivers/sensors/Make.defs | 4 + drivers/sensors/lis3dh.c | 1032 ++++++++++++++++++++++++++++++++ include/nuttx/sensors/ioctl.h | 6 + include/nuttx/sensors/lis3dh.h | 303 ++++++++++ 5 files changed, 1352 insertions(+) create mode 100644 drivers/sensors/lis3dh.c create mode 100644 include/nuttx/sensors/lis3dh.h diff --git a/drivers/sensors/Kconfig b/drivers/sensors/Kconfig index 3eb524dc52..b04e422495 100644 --- a/drivers/sensors/Kconfig +++ b/drivers/sensors/Kconfig @@ -160,6 +160,13 @@ config LIS3DSH ---help--- Enable driver support for the STMicro LIS3DSH 3-Axis accelerometer. +config LIS3DH + bool "STMicro LIS3DH 3-Axis accelerometer support" + default n + select SPI + ---help--- + Enable driver support for the STMicro LIS3DH 3-Axis accelerometer. + config LIS331DL bool "STMicro LIS331DL device support" default n diff --git a/drivers/sensors/Make.defs b/drivers/sensors/Make.defs index c4cfe3af0d..5b27819f8d 100644 --- a/drivers/sensors/Make.defs +++ b/drivers/sensors/Make.defs @@ -146,6 +146,10 @@ ifeq ($(CONFIG_LIS3DSH),y) CSRCS += lis3dsh.c endif +ifeq ($(CONFIG_LIS3DH),y) + CSRCS += lis3dh.c +endif + ifeq ($(CONFIG_SENSORS_MAX31855),y) CSRCS += max31855.c endif diff --git a/drivers/sensors/lis3dh.c b/drivers/sensors/lis3dh.c new file mode 100644 index 0000000000..2055a7c682 --- /dev/null +++ b/drivers/sensors/lis3dh.c @@ -0,0 +1,1032 @@ +/**************************************************************************** + * drivers/sensors/lis3dh.c + * + * Copyright (C) 2018 Extent3D. All rights reserved. + * Author: Matt Thompson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +#if defined(CONFIG_SPI) && defined(CONFIG_LIS3DH) + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#define LIS3DH_QUEUE_MAX 32 +#define LIS3DH_FIFOBUF_SIZE ((32 * 6) + 1) + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +struct lis3dh_dev_s +{ + FAR struct lis3dh_config_s *config; /* Driver configuration */ + FAR struct spi_dev_s *spi; /* Pointer to the SPI instance */ + struct work_s work; /* Work Queue */ + uint8_t power_mode; /* The power mode used to determine mg/digit */ + uint8_t odr; /* The current output data rate */ + sem_t readsem; /* Read notification semaphore */ + uint8_t fifobuf[LIS3DH_FIFOBUF_SIZE]; /* Raw FIFO buffer */ + struct lis3dh_sensor_data_s queue[LIS3DH_QUEUE_MAX]; + sem_t queuesem; /* Queue exclusive lock */ + uint8_t queue_rpos; /* Queue read position */ + uint8_t queue_wpos; /* Queue write position */ + uint8_t queue_count; /* Number of elements in the queue */ +}; + +struct lis3dh_sample_s +{ + int16_t x; + int16_t y; + int16_t z; +}; + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +static void lis3dh_read_register(FAR struct lis3dh_dev_s *dev, + uint8_t const reg_addr, uint8_t *reg_data); +static void lis3dh_write_register(FAR struct lis3dh_dev_s *dev, + uint8_t const reg_addr, + uint8_t const reg_data); +static void lis3dh_reset(FAR struct lis3dh_dev_s *dev); +static int lis3dh_ident(FAR struct lis3dh_dev_s *dev); +static int lis3dh_read_fifo(FAR struct lis3dh_dev_s *dev); +static int lis3dh_interrupt_handler(int irq, FAR void *context, FAR void *arg); +static void lis3dh_worker(FAR void *arg); +static int lis3dh_irq_enable(FAR struct lis3dh_dev_s *dev, bool enable); +static int lis3dh_fifo_enable(FAR struct lis3dh_dev_s *dev); + +static int lis3dh_open(FAR struct file *filep); +static int lis3dh_close(FAR struct file *filep); +static ssize_t lis3dh_read(FAR struct file *, FAR char *buffer, + size_t buflen); +static ssize_t lis3dh_write(FAR struct file *filep, FAR const char *buffer, + size_t buflen); +static int lis3dh_ioctl(FAR struct file *filep, int cmd, unsigned long arg); + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static const struct file_operations g_lis3dh_fops = +{ + lis3dh_open, + lis3dh_close, + lis3dh_read, + lis3dh_write, + NULL, + lis3dh_ioctl +#ifndef CONFIG_DISABLE_POLL + , NULL +#endif +#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS + , NULL +#endif +}; + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: lis3dh_read_register + * + * Description: + * Read a single register from the LIS3DH sensor. + * + * Input Parameters: + * dev - Pointer to device driver instance + * reg_addr - LIS3DH register address + * reg_data - Pointer to uint8_t where read value will be stored + * + ****************************************************************************/ + +static void lis3dh_read_register(FAR struct lis3dh_dev_s *dev, + uint8_t const reg_addr, uint8_t * reg_data) +{ + uint8_t buffer[2]; + + /* Lock the SPI bus so that only one device can access it at the same time */ + + SPI_LOCK(dev->spi, true); + + /* Set CS to low which selects the LIS3DH */ + + SPI_SELECT(dev->spi, dev->config->spi_devid, true); + + buffer[0] = reg_addr | 0x80; + buffer[1] = 0; + SPI_EXCHANGE(dev->spi, buffer, buffer, 2); + *reg_data = buffer[1]; + + /* Set CS to high which deselects the LIS3DH */ + + SPI_SELECT(dev->spi, dev->config->spi_devid, false); + + /* Unlock the SPI bus */ + + SPI_LOCK(dev->spi, false); +} + +/**************************************************************************** + * Name: lis3dh_write_register + * + * Description: + * Write a single register to the LIS3DH sensor. + * + * Input Parameters: + * dev - Pointer to device driver instance + * reg_addr - LIS3DH register address + * reg_data - Value to write into the specified register address + * + ****************************************************************************/ + +static void lis3dh_write_register(FAR struct lis3dh_dev_s *dev, + uint8_t const reg_addr, + uint8_t const reg_data) +{ + uint8_t buffer[2]; + + /* Lock the SPI bus so that only one device can access it at the same time */ + + SPI_LOCK(dev->spi, true); + + /* Set CS to low which selects the LIS3DH */ + + SPI_SELECT(dev->spi, dev->config->spi_devid, true); + + buffer[0] = reg_addr; + buffer[1] = reg_data; + SPI_EXCHANGE(dev->spi, buffer, buffer, 2); + + /* Set CS to high which deselects the LIS3DH */ + + SPI_SELECT(dev->spi, dev->config->spi_devid, false); + + /* Unlock the SPI bus */ + + SPI_LOCK(dev->spi, false); +} + +/**************************************************************************** + * Name: lis3dh_reset + * + * Description: + * Perform a software reset of the LIS3DH sensor. + * + * Input Parameters: + * dev - Pointer to device driver instance + * + ****************************************************************************/ + +static void lis3dh_reset(FAR struct lis3dh_dev_s *dev) +{ + lis3dh_write_register(dev, LIS3DH_CTRL_REG5, LIS3DH_CTRL_REG5_BOOT); + up_mdelay(100); +} + +/**************************************************************************** + * Name: lis3dh_ident + * + * Description: + * Identify an LIS3DH sensor on the SPI bus using the WHO_AM_I register. + * + * Input Parameters: + * dev - Pointer to device driver instance + * + * Returned Value: + * OK if the device responded with the correct ID + * -ENODEV if the device did not respond with the correct ID + * + ****************************************************************************/ + +static int lis3dh_ident(FAR struct lis3dh_dev_s *dev) +{ + uint8_t reg; + lis3dh_read_register(dev, LIS3DH_WHO_AM_I, ®); + + if(reg == LIS3DH_DEVICE_ID) + { + return OK; + } + return -ENODEV; +} + + +/**************************************************************************** + * Name: lis3dh_queue_lock + * + * Description: + * Locks exclusive access to the ring buffer queue + * + * Input Parameters: + * dev - Pointer to device driver instance + * + ****************************************************************************/ + +static void lis3dh_queue_lock(FAR struct lis3dh_dev_s *dev) +{ + int ret; + + ret = nxsem_wait(&dev->queuesem); + if (ret < 0) + { + snerr("ERROR: queuesem wait error: %d\n", ret); + return; + } +} + +/**************************************************************************** + * Name: lis3dh_queue_unlock + * + * Description: + * Unlocks exclusive acccess to the ring buffer queue + * + * Input Parameters: + * dev - Pointer to device driver instance + * + ****************************************************************************/ + +static void lis3dh_queue_unlock(FAR struct lis3dh_dev_s *dev) +{ + nxsem_post(&dev->queuesem); +} + +/**************************************************************************** + * Name: lis3dh_queue_push + * + * Description: + * Push a sensor measurement into the queue + * + * Input Parameters: + * dev - Pointer to device driver instance + * + ****************************************************************************/ + +static int lis3dh_queue_push(FAR struct lis3dh_dev_s *dev, + struct lis3dh_sensor_data_s *data) +{ + lis3dh_queue_lock(dev); + if(dev->queue_count >= LIS3DH_QUEUE_MAX) + { + lis3dh_queue_unlock(dev); + return -ENOMEM; + } + + dev->queue_wpos++; + dev->queue[dev->queue_wpos % LIS3DH_QUEUE_MAX] = *data; + + dev->queue_count++; + lis3dh_queue_unlock(dev); + + return OK; +} + +/**************************************************************************** + * Name: lis3dh_queue_pop + * + * Description: + * Pops a sensor measurement from the queue + * + * Input Parameters: + * dev - Pointer to device driver instance + * + * Returned Value: + * OK if a measurement was successfully dequeued + * -EAGAIN if the queue is empty + * + ****************************************************************************/ + +static int lis3dh_queue_pop(FAR struct lis3dh_dev_s *dev, + struct lis3dh_sensor_data_s *data) +{ + lis3dh_queue_lock(dev); + if(dev->queue_count == 0) + { + lis3dh_queue_unlock(dev); + return -EAGAIN; + } + + dev->queue_rpos++; + *data = dev->queue[dev->queue_rpos % LIS3DH_QUEUE_MAX]; + + dev->queue_count--; + + lis3dh_queue_unlock(dev); + + return OK; +} + +/**************************************************************************** + * Name: lis3dh_read_fifo + * + * Description: + * Reads the FIFO from the LIS3DH sensor, and pushes to the internal queue. + * + * Input Parameters: + * dev - Pointer to device driver instance + * + * Returned Value: + * + ****************************************************************************/ + +static int lis3dh_read_fifo(FAR struct lis3dh_dev_s *dev) +{ + uint8_t fifosrc; + uint8_t count; + int i; + + /* Lock the SPI bus */ + + SPI_LOCK(dev->spi, true); + + /* Read the FIFO source register */ + + dev->fifobuf[0] = LIS3DH_FIFO_SRC_REG | 0x80; + dev->fifobuf[1] = 0; + + SPI_SELECT(dev->spi, dev->config->spi_devid, true); + SPI_EXCHANGE(dev->spi, dev->fifobuf, dev->fifobuf, 2); + SPI_SELECT(dev->spi, dev->config->spi_devid, false); + + fifosrc = dev->fifobuf[1]; + + count = fifosrc & 0x1f; + + if(fifosrc & LIS3DH_FIFO_SRC_REG_OVRN_FIFO) + { + snerr("FIFO overrun\n"); + } + + memset(dev->fifobuf, 0, LIS3DH_FIFOBUF_SIZE); + dev->fifobuf[0] = LIS3DH_OUT_X_L | 0xC0; + + SPI_SELECT(dev->spi, dev->config->spi_devid, true); + SPI_EXCHANGE(dev->spi, dev->fifobuf, dev->fifobuf, 1 + count*6); + SPI_SELECT(dev->spi, dev->config->spi_devid, false); + + /* Unlock the SPI bus */ + + SPI_LOCK(dev->spi, false); + + for(i=0;ififobuf[(i*6)+1] | + (uint16_t)dev->fifobuf[(i*6)+2] << 8; + + y_raw = (uint16_t)dev->fifobuf[(i*6)+3] | + (uint16_t)dev->fifobuf[(i*6)+4] << 8; + + z_raw = (uint16_t)dev->fifobuf[(i*6)+5] | + (uint16_t)dev->fifobuf[(i*6)+6] << 8; + + /* The sensor left justifies the data in the register, so we must + * shift it to the right depending on the selected power mode + */ + + switch(dev->power_mode) + { + case LIS3DH_POWER_LOW: /* 8 bit measurements */ + x_acc = (int16_t)x_raw >> 8; + y_acc = (int16_t)y_raw >> 8; + z_acc = (int16_t)z_raw >> 8; + + data.x_acc = (float)x_acc * 0.016; + data.y_acc = (float)y_acc * 0.016; + data.z_acc = (float)z_acc * 0.016; + + break; + case LIS3DH_POWER_NORMAL: /* 10 bit measurements */ + x_acc = (int16_t)x_raw >> 6; + y_acc = (int16_t)y_raw >> 6; + z_acc = (int16_t)z_raw >> 6; + + data.x_acc = (float)x_acc * 0.004; + data.y_acc = (float)y_acc * 0.004; + data.z_acc = (float)z_acc * 0.004; + + break; + case LIS3DH_POWER_HIGH: /* 12 bit measurements */ + x_acc = (int16_t)x_raw >> 4; + y_acc = (int16_t)y_raw >> 4; + z_acc = (int16_t)z_raw >> 4; + + data.x_acc = (float)x_acc * 0.001; + data.y_acc = (float)y_acc * 0.001; + data.z_acc = (float)z_acc * 0.001; + + break; + default: + snerr("Unknown power mode\n"); + return -EINVAL; + } + + if (lis3dh_queue_push(dev, &data) == OK) + { + nxsem_post(&dev->readsem); + } + } + + return OK; +} + +/**************************************************************************** + * Name: lis3dh_interrupt_handler + * + * Description: + * Interrupt service routine, queues work on high priority work queue. + * + * Input Parameters: + * irq - Interrupt request number + * context - Context pointer + * arg - Pointer to device driver instance + * + * Returned Value: + * Returns OK to indicate the interrupt has been serviced. + * + ****************************************************************************/ + +static int lis3dh_interrupt_handler(int irq, FAR void *context, FAR void *arg) +{ + /* The interrupt handler is called when the FIFO watermark is reached */ + + FAR struct lis3dh_dev_s *priv = (FAR struct lis3dh_dev_s *)arg; + int ret; + + DEBUGASSERT(priv != NULL); + + if (work_available(&priv->work)) + { + ret = work_queue(HPWORK, &priv->work, lis3dh_worker, priv, 0); + if (ret < 0) + { + snerr("ERROR: Failed to queue work: %d\n", ret); + return ret; + } + } + + return OK; +} + +/**************************************************************************** + * Name: lis3dh_worker + * + * Description: + * Worker callback executed from high priority work queue. + * Performs reading the FIFO from the sensor and pushing samples to + * the internal device driver queue. + * + * Input Parameters: + * arg - Pointer to device driver instance + * + ****************************************************************************/ + +static void lis3dh_worker(FAR void *arg) +{ + FAR struct lis3dh_dev_s *priv = (FAR struct lis3dh_dev_s *)(arg); + + DEBUGASSERT(priv != NULL); + + /* Read the FIFO and fill the queue */ + + lis3dh_read_fifo(priv); +} + +/**************************************************************************** + * Name: lis3dh_set_power_mode + * + * Description: + * Sets the power mode of the sensor. + * + * Input Parameters: + * dev - Pointer to device driver instance + * power_mode - LIS3DH_POWER_* + * + * Returned Value: + * OK - Power mode was set successfully + * -EINVAL - Invalid power mode argument + * + ****************************************************************************/ + +static int lis3dh_set_power_mode(FAR struct lis3dh_dev_s *dev, + uint8_t power_mode) +{ + uint8_t ctrl1; + uint8_t ctrl4; + + switch(power_mode) + { + case LIS3DH_POWER_LOW: + lis3dh_read_register(dev, LIS3DH_CTRL_REG1, &ctrl1); + lis3dh_read_register(dev, LIS3DH_CTRL_REG4, &ctrl4); + + ctrl1 |= LIS3DH_CTRL_REG1_LPEN; + ctrl4 &= ~LIS3DH_CTRL_REG4_HR; + + lis3dh_write_register(dev, LIS3DH_CTRL_REG1, ctrl1); + lis3dh_write_register(dev, LIS3DH_CTRL_REG4, ctrl4); + break; + case LIS3DH_POWER_NORMAL: + lis3dh_read_register(dev, LIS3DH_CTRL_REG1, &ctrl1); + lis3dh_read_register(dev, LIS3DH_CTRL_REG4, &ctrl4); + + ctrl1 &= ~LIS3DH_CTRL_REG1_LPEN; + ctrl4 &= ~LIS3DH_CTRL_REG4_HR; + + lis3dh_write_register(dev, LIS3DH_CTRL_REG1, ctrl1); + lis3dh_write_register(dev, LIS3DH_CTRL_REG4, ctrl4); + break; + case LIS3DH_POWER_HIGH: + lis3dh_read_register(dev, LIS3DH_CTRL_REG1, &ctrl1); + lis3dh_read_register(dev, LIS3DH_CTRL_REG4, &ctrl4); + + ctrl1 &= ~LIS3DH_CTRL_REG1_LPEN; + ctrl4 |= LIS3DH_CTRL_REG4_HR; + + lis3dh_write_register(dev, LIS3DH_CTRL_REG1, ctrl1); + lis3dh_write_register(dev, LIS3DH_CTRL_REG4, ctrl4); + break; + default: + return -EINVAL; + break; + } + + dev->power_mode = power_mode; + sninfo("Power mode set to %d\n", power_mode); + + return OK; +} + +/**************************************************************************** + * Name: lis3dh_set_odr + * + * Description: + * Sets the output data rate of the sensor. + * + * Input Parameters: + * dev - Pointer to device driver instance + * odr - LIS3DH_ODR_* + * + * Returned Value: + * OK - Power mode was set successfully + * -EINVAL - Invalid odr argument + * + ****************************************************************************/ + +static int lis3dh_set_odr(FAR struct lis3dh_dev_s *dev, uint8_t odr) +{ + uint8_t ctrl1; + + if (odr > LIS3DH_CTRL_REG1_ODR_LP_5376HZ) + { + return -EINVAL; + } + + lis3dh_read_register(dev, LIS3DH_CTRL_REG1, &ctrl1); + ctrl1 |= odr & LIS3DH_CTRL_REG1_ODR_MASK; + lis3dh_write_register(dev, LIS3DH_CTRL_REG1, ctrl1); + + /* Cache the current ODR in the device structure */ + + dev->odr = odr; + sninfo("Output data rate set to %d\n", odr); + + return OK; +} + +/**************************************************************************** + * Name: lis3dh_irq_enable + * + * Description: + * Enable or disable sensor interrupt generation on FIFO watermark. + * + * Input Parameters: + * dev - Pointer to device driver instance + * enable - Boolean to enable or disable the interrupt generation + * + * Returned Value: + * OK - Interrupt generation register written. + * + ****************************************************************************/ + +static int lis3dh_irq_enable(FAR struct lis3dh_dev_s *dev, bool enable) +{ + uint8_t reg; + + reg = 0; + + if(enable == true) + { + reg = LIS3DH_CTRL_REG3_I1_WTM; + } + + lis3dh_write_register(dev, LIS3DH_CTRL_REG3, reg); + return OK; +} + +/**************************************************************************** + * Name: lis3dh_irq_enable + * + * Description: + * Enable or disable sensor interrupt generation on FIFO watermark. + * + * Input Parameters: + * dev - Pointer to device driver instance + * enable - Boolean to enable or disable the interrupt generation + * + * Returned Value: + * OK - Interrupt generation register written. + * + ****************************************************************************/ + +static int lis3dh_fifo_enable(FAR struct lis3dh_dev_s *dev) +{ + uint8_t reg; + lis3dh_write_register(dev, LIS3DH_FIFO_CTRL_REG, + LIS3DH_FIFO_CTRL_REG_MODE_STREAM | 28); + + lis3dh_read_register(dev, LIS3DH_CTRL_REG5, ®); + reg |= LIS3DH_CTRL_REG5_FIFO_EN; + lis3dh_write_register(dev, LIS3DH_CTRL_REG5, reg); + + return OK; +} + +/**************************************************************************** + * Name: lis3dh_enable + * + * Description: + * Enable sensor measurements into the on-chip FIFO. + * + * Input Parameters: + * priv - Pointer to device driver instance + * + * Returned Value: + * OK - Sensor measurements enabled. + * + ****************************************************************************/ + +static int lis3dh_enable(FAR struct lis3dh_dev_s *priv) +{ + uint8_t reg; + + /* Select the default power mode */ + + lis3dh_set_power_mode(priv, LIS3DH_POWER_NORMAL); + + /* Select the default output data rate */ + + lis3dh_set_odr(priv, LIS3DH_ODR_1344HZ); + + reg = LIS3DH_CTRL_REG4_BDU | LIS3DH_CTRL_REG4_FS_2G; + lis3dh_write_register(priv, LIS3DH_CTRL_REG4, reg); + + lis3dh_fifo_enable(priv); + + /* Enable X, Y, and Z axes */ + + lis3dh_read_register(priv, LIS3DH_CTRL_REG1, ®); + reg |= LIS3DH_CTRL_REG1_ZEN | LIS3DH_CTRL_REG1_YEN | LIS3DH_CTRL_REG1_XEN; + lis3dh_write_register(priv, LIS3DH_CTRL_REG1, reg); + + return OK; +} + +/**************************************************************************** + * Name: lis3dh_open + * + * Description: + * Character device open call. + * + * Input Parameters: + * filep - Pointer to struct file + * + * Returned Value: + * -ENODEV - Device was not identified on the SPI bus. + * OK - Sensor device was opened successfully. + * + ****************************************************************************/ + +static int lis3dh_open(FAR struct file *filep) +{ + FAR struct inode *inode = filep->f_inode; + FAR struct lis3dh_dev_s *priv = inode->i_private; + + DEBUGASSERT(priv != NULL); + + /* Perform a reset */ + + lis3dh_reset(priv); + if(lis3dh_ident(priv) < 0) + { + snerr("ERROR: Failed to identify LIS3DH on SPI bus\n"); + return -ENODEV; + } + + /* Attach the interrupt line */ + + (priv->config->irq_attach)(priv->config, lis3dh_interrupt_handler, priv); + + /* Enable interrupt generation on the sensor */ + + lis3dh_irq_enable(priv, true); + + /* Enable measurements on the sensor */ + + if(lis3dh_enable(priv) < 0) + { + snerr("ERROR: Failed to enable LIS3DH\n"); + return -ENODEV; + } + + return OK; +} + +/**************************************************************************** + * Name: lis3dh_close + * + * Description: + * Character device close call. + * + * Input Parameters: + * filep - Pointer to struct file + * + * Returned Value: + * OK - Sensor device was closed successfully. + * + ****************************************************************************/ + +static int lis3dh_close(FAR struct file *filep) +{ + FAR struct inode *inode = filep->f_inode; + FAR struct lis3dh_dev_s *priv = inode->i_private; + + DEBUGASSERT(priv != NULL); + + /* Perform a reset */ + + lis3dh_reset(priv); + + /* Detach the interrupt line */ + + (priv->config->irq_detach)(priv->config); + + return OK; +} + +/**************************************************************************** + * Name: lis3dh_read + * + * Description: + * Character device read call. Blocks until requested buffer size is full. + * + * Input Parameters: + * filep - Pointer to struct file + * buffer - Pointer to user buffer + * buflen - Size of user buffer in bytes + * + * Returned Value: + * Returns the number of bytes written to the buffer. + * -EINVAL - Supplied buffer length invalid + * + ****************************************************************************/ + +static ssize_t lis3dh_read(FAR struct file *filep, FAR char *buffer, + size_t buflen) +{ + FAR struct inode *inode = filep->f_inode; + FAR struct lis3dh_dev_s *priv = inode->i_private; + FAR struct lis3dh_sensor_data_s *data; + int count; + int remain; + + DEBUGASSERT(priv != NULL); + + if ((buflen % sizeof(FAR struct lis3dh_sensor_data_s)) != 0) + { + snerr("ERROR: Provided buffer must be multiple of sensor data size\n"); + return -EINVAL; + } + + /* Get the number of samples the user has requested */ + + count = buflen / sizeof(struct lis3dh_sensor_data_s); + + /* Cast a pointer into the user buffer */ + + data = (FAR struct lis3dh_sensor_data_s *)buffer; + + for (remain=count;remain > 0;remain--) + { + + /* Wait for data to be available in the queue */ + + nxsem_wait(&priv->readsem); + + /* Pop a sample off of the queue */ + + lis3dh_queue_pop(priv, data); + + data++; + } + return count * sizeof(struct lis3dh_sensor_data_s); +} + +/**************************************************************************** + * Name: lis3dh_write + * + * Description: + * Character device write call. Not supported. + * + * Input Parameters: + * filep - Pointer to struct file + * buffer - Pointer to user buffer + * buflen - Size of user buffer in bytes + * + * Returned Value: + * -ENOSYS + * + ****************************************************************************/ + +static ssize_t lis3dh_write(FAR struct file *filep, FAR const char *buffer, + size_t buflen) +{ + return -ENOSYS; +} + +/**************************************************************************** + * Name: lis3dh_ioctl + * + * Description: + * Character device ioctl call. Sets device parameters. + * + * Input Parameters: + * filep - Pointer to struct file + * cmd - SNIOC_* + * arg - ioctl specific argument + * + * Returned Value: + * OK - The command was executed successfully. + * -ENOTTY - The request command is not applicible to the driver. + * + ****************************************************************************/ + +static int lis3dh_ioctl(FAR struct file *filep, int cmd, unsigned long arg) +{ + FAR struct inode *inode = filep->f_inode; + FAR struct lis3dh_dev_s *priv = inode->i_private; + int ret = OK; + + switch (cmd) + { + case SNIOC_SET_POWER_MODE: + ret = lis3dh_set_power_mode(priv, arg); + break; + + case SNIOC_SET_DATA_RATE: + ret = lis3dh_set_odr(priv, arg); + break; + + default: + snerr("ERROR: Unrecognized cmd: %d\n", cmd); + ret = -ENOTTY; + break; + } + + return ret; +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: lis3dh_register + * + * Description: + * Register the LIS3DH character device at the specified device path + * + * Input Parameters: + * devpath - Full path of device node to register ie "/dev/accel0" + * spi - SPI bus device instance + * config - Driver instance configuration structure + * + * Returned Value: + * OK on success or a negative errno value on failure. + * + ****************************************************************************/ + +int lis3dh_register(FAR const char *devpath, FAR struct spi_dev_s *spi, + FAR struct lis3dh_config_s *config) +{ + FAR struct lis3dh_dev_s *priv; + int ret; + + DEBUGASSERT(spi != NULL); + + /* Initialize the LIS3DH device structure */ + + priv = (FAR struct lis3dh_dev_s *)kmm_malloc(sizeof(struct lis3dh_dev_s)); + if (priv == NULL) + { + snerr("ERROR: Failed to allocate instance\n"); + return -ENOMEM; + } + + priv->config = config; + priv->spi = spi; + priv->work.worker = NULL; + priv->queue_count = 0; + + /* Initialize queue semaphore */ + + nxsem_init(&priv->queuesem, 0, 1); + + /* Initialize read notification semaphore */ + + nxsem_init(&priv->readsem, 0, 0); + nxsem_setprotocol(&priv->readsem, SEM_PRIO_NONE); + + /* Setup SPI frequency and mode */ + + SPI_SETFREQUENCY(spi, LIS3DH_SPI_FREQUENCY); + SPI_SETMODE(spi, LIS3DH_SPI_MODE); + + /* Register the character driver */ + + ret = register_driver(devpath, &g_lis3dh_fops, 0666, priv); + if (ret < 0) + { + snerr("ERROR: Failed to register driver: %d\n", ret); + kmm_free(priv); + nxsem_destroy(&priv->queuesem); + nxsem_destroy(&priv->readsem); + return ret; + } + + return OK; +} + +#endif /* CONFIG_SPI && CONFIG_LIS3DH */ diff --git a/include/nuttx/sensors/ioctl.h b/include/nuttx/sensors/ioctl.h index 3f6add61d0..96ac4d5ace 100644 --- a/include/nuttx/sensors/ioctl.h +++ b/include/nuttx/sensors/ioctl.h @@ -149,4 +149,10 @@ #define SNIOC_INIT _SNIOC(0x003b) #define SNIOC_THRESHOLD _SNIOC(0x003c) +/* IOCTL commands unique to LIS3DH */ + +#define SNIOC_SET_POWER_MODE _SNIOC(0x003d) /* Arg: LIS3DH_POWER_xxx */ +#define SNIOC_SET_DATA_RATE _SNIOC(0x003e) /* Arg: LIS3DH_ODR_xxx */ +#define SNIOC_SET_DATA_FORMAT _SNIOC(0x003f) /* Arg: LIS3DH_FORMAT_xxx */ + #endif /* __INCLUDE_NUTTX_SENSORS_IOCTL_H */ diff --git a/include/nuttx/sensors/lis3dh.h b/include/nuttx/sensors/lis3dh.h new file mode 100644 index 0000000000..646274ee23 --- /dev/null +++ b/include/nuttx/sensors/lis3dh.h @@ -0,0 +1,303 @@ +/**************************************************************************** + * include/nuttx/sensors/lis3dh.h + * + * Copyright (C) 2018 Extent3D. All rights reserved. + * Author: Matt Thompson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __INCLUDE_NUTTX_SENSORS_LIS3DH_H +#define __INCLUDE_NUTTX_SENSORS_LIS3DH_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include +#include +#include + +#if defined(CONFIG_SPI) && defined(CONFIG_LIS3DH) + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* LIS3DH Device Identification *********************************************/ + +#define LIS3DH_DEVICE_ID (0x33) + +/* LIS3DH Register Definitions **********************************************/ + +#define LIS3DH_STATUS_REG_AUX (0x07) +#define LIS3DH_OUT_ADC1_L (0x08) +#define LIS3DH_OUT_ADC1_H (0x09) +#define LIS3DH_OUT_ADC2_L (0x0A) +#define LIS3DH_OUT_ADC2_H (0x0B) +#define LIS3DH_OUT_ADC3_L (0x0C) +#define LIS3DH_OUT_ADC3_H (0x0D) +#define LIS3DH_WHO_AM_I (0x0F) +#define LIS3DH_CTRL_REG0 (0x1E) +#define LIS3DH_TEMP_CFG_REG (0x1F) +#define LIS3DH_CTRL_REG1 (0x20) +#define LIS3DH_CTRL_REG2 (0x21) +#define LIS3DH_CTRL_REG3 (0x22) +#define LIS3DH_CTRL_REG4 (0x23) +#define LIS3DH_CTRL_REG5 (0x24) +#define LIS3DH_CTRL_REG6 (0x25) +#define LIS3DH_REFERENCE (0x26) +#define LIS3DH_STATUS_REG (0x27) +#define LIS3DH_OUT_X_L (0x28) +#define LIS3DH_OUT_X_H (0x29) +#define LIS3DH_OUT_Y_L (0x2A) +#define LIS3DH_OUT_Y_H (0x2B) +#define LIS3DH_OUT_Z_L (0x2C) +#define LIS3DH_OUT_Z_H (0x2D) +#define LIS3DH_FIFO_CTRL_REG (0x2E) +#define LIS3DH_FIFO_SRC_REG (0x2F) +#define LIS3DH_INT1_CFG (0x30) +#define LIS3DH_INT1_SRC (0x31) +#define LIS3DH_INT1_THS (0x32) +#define LIS3DH_INT1_DURATION (0x33) +#define LIS3DH_INT2_CFG (0x34) +#define LIS3DH_INT2_SRC (0x35) +#define LIS3DH_INT2_THS (0x36) +#define LIS3DH_INT2_DURATION (0x37) +#define LIS3DH_CLICK_CFG (0x38) +#define LIS3DH_CLICK_SRC (0x39) +#define LIS3DH_CLICK_THS (0x3A) +#define LIS3DH_TIME_LIMIT (0x3B) +#define LIS3DH_TIME_LATENCY (0x3C) +#define LIS3DH_TIME_WINDOW (0x3D) +#define LIS3DH_ACT_THS (0x3E) +#define LIS3DH_ACT_DUR (0x3F) + +/* LIS3DH STATUS_REG_AUX Definitions **********************************************/ + +#define LIS3DH_STATUS_REG_AUX_321OR (1 << 7) +#define LIS3DH_STATUS_REG_AUX_3OR (1 << 6) +#define LIS3DH_STATUS_REG_AUX_2OR (1 << 5) +#define LIS3DH_STATUS_REG_AUX_1OR (1 << 4) +#define LIS3DH_STATUS_REG_AUX_321DA (1 << 3) +#define LIS3DH_STATUS_REG_AUX_3DA (1 << 2) +#define LIS3DH_STATUS_REG_AUX_2DA (1 << 1) +#define LIS3DH_STATUS_REG_AUX_1DA (1 << 0) + +/* LIS3DH CTRL_REG0 Definitions **********************************************/ + +#define LIS3DH_CTRL_REG0_SDO_PU_DISC (1 << 7) /* Disconnect SDO/SA0 pull-up */ + +/* LIS3DH TEMP_CFG_REG Definitions **********************************************/ + +#define LIS3DH_TEMP_CFG_REG_ADC_EN (1 << 7) /* ADC enable */ +#define LIS3DH_TEMP_CFG_REG_TEMP_EN (1 << 6) /* Temperator sensor enable */ + +/* LIS3DH CTRL_REG1 Definitions **********************************************/ + +#define LIS3DH_CTRL_REG1_ODR_SHIFT (4) +#define LIS3DH_CTRL_REG1_ODR_MASK (0xf << LIS3DH_CTRL_REG1_ODR_SHIFT) +#define LIS3DH_CTRL_REG1_ODR_POWER_DOWN (0) +#define LIS3DH_CTRL_REG1_ODR_1HZ (0x1 << LIS3DH_CTRL_REG1_ODR_SHIFT) +#define LIS3DH_CTRL_REG1_ODR_10HZ (0x2 << LIS3DH_CTRL_REG1_ODR_SHIFT) +#define LIS3DH_CTRL_REG1_ODR_25HZ (0x3 << LIS3DH_CTRL_REG1_ODR_SHIFT) +#define LIS3DH_CTRL_REG1_ODR_50HZ (0x4 << LIS3DH_CTRL_REG1_ODR_SHIFT) +#define LIS3DH_CTRL_REG1_ODR_100HZ (0x5 << LIS3DH_CTRL_REG1_ODR_SHIFT) +#define LIS3DH_CTRL_REG1_ODR_200HZ (0x6 << LIS3DH_CTRL_REG1_ODR_SHIFT) +#define LIS3DH_CTRL_REG1_ODR_400HZ (0x7 << LIS3DH_CTRL_REG1_ODR_SHIFT) +#define LIS3DH_CTRL_REG1_ODR_LP_1600HZ (0x8 << LIS3DH_CTRL_REG1_ODR_SHIFT) +#define LIS3DH_CTRL_REG1_ODR_1344HZ (0x9 << LIS3DH_CTRL_REG1_ODR_SHIFT) +#define LIS3DH_CTRL_REG1_ODR_LP_5376HZ (0x9 << LIS3DH_CTRL_REG1_ODR_SHIFT) + +#define LIS3DH_CTRL_REG1_LPEN (1 << 3) /* Low-power mode enable */ +#define LIS3DH_CTRL_REG1_ZEN (1 << 2) /* Z axis enable */ +#define LIS3DH_CTRL_REG1_YEN (1 << 1) /* Y axis enable */ +#define LIS3DH_CTRL_REG1_XEN (1 << 0) /* X axis enable */ + +/* LIS3DH CTRL_REG2 Definitions **********************************************/ + +/* LIS3DH CTRL_REG3 Definitions **********************************************/ + +#define LIS3DH_CTRL_REG3_I1_CLICK (1 << 6) /* Click interrupt on INT1 */ +#define LIS3DH_CTRL_REG3_I1_IA1 (1 << 6) /* IA1 interrupt on INT1 */ +#define LIS3DH_CTRL_REG3_I1_IA2 (1 << 5) /* IA2 interrupt on INT1 */ +#define LIS3DH_CTRL_REG3_I1_ZYXDA (1 << 4) /* ZYX data available interrupt on INT1 */ +#define LIS3DH_CTRL_REG3_I1_321DA (1 << 3) /* 321 data available interrupt on INT1 */ +#define LIS3DH_CTRL_REG3_I1_WTM (1 << 2) /* FIFO watermark interrupt on INT1 */ +#define LIS3DH_CTRL_REG3_I1_OVERRUN (1 << 1) /* FIFO overrun interrupt on INT1 */ + +/* LIS3DH CTRL_REG4 Definitions **********************************************/ + +#define LIS3DH_CTRL_REG4_BDU (1 << 7) /* Block data update */ +#define LIS3DH_CTRL_REG4_BLE (1 << 6) /* Endian selection. 0: LSB first, 1: MSB first */ +#define LIS3DH_CTRL_REG4_FS_16G (3 << 4) /* 16g full scale range */ +#define LIS3DH_CTRL_REG4_FS_8G (2 << 4) /* 8g full scale range */ +#define LIS3DH_CTRL_REG4_FS_4G (1 << 4) /* 4g full scale range */ +#define LIS3DH_CTRL_REG4_FS_2G (0 << 4) /* 2g full scale range */ +#define LIS3DH_CTRL_REG4_HR (1 << 3) /* High resolution output enable */ +#define LIS3DH_CTRL_REG4_ST1 (2 << 1) /* Self test 1 */ +#define LIS3DH_CTRL_REG4_ST0 (1 << 1) /* Self test 0 */ +#define LIS3DH_CTRL_REG4_SIM (1 << 0) /* SPI serial interface mode selection (0: 4-wire, 1: 3-wire) */ + +/* LIS3DH CTRL_REG5 Definitions **********************************************/ + +#define LIS3DH_CTRL_REG5_BOOT (1 << 7) /* Reboot memory content */ +#define LIS3DH_CTRL_REG5_FIFO_EN (1 << 6) /* FIFO enable */ +#define LIS3DH_CTRL_REG5_LIR_INT1 (1 << 3) /* Latch interrupt request on INT1_SRC register */ +#define LIS3DH_CTRL_REG5_D4D_INT1 (1 << 2) /* 4D detection enable on INT1 */ +#define LIS3DH_CTRL_REG5_LIR_INT2 (1 << 1) /* Latch interrupt request on INT2_SRC register */ +#define LIS3DH_CTRL_REG5_D4D_INT2 (1 << 0) /* 4D detection enable on INT2 */ + +/* LIS3DH CTRL_REG6 Definitions **********************************************/ + +#define LIS3DH_CTRL_REG6_I2_CLICK (1 << 6) /* Click interrupt on INT2 */ +#define LIS3DH_CTRL_REG6_I2_IA1 (1 << 6) /* IA1 interrupt on INT2 */ +#define LIS3DH_CTRL_REG6_I2_IA2 (1 << 5) /* IA2 interrupt on INT2 */ +#define LIS3DH_CTRL_REG6_I2_BOOT (1 << 4) /* Enable boot on INT2 */ +#define LIS3DH_CTRL_REG6_I2_ACT (1 << 3) /* Enable activity interrupt on INT2 */ +#define LIS3DH_CTRL_REG6_INT_POLARITY (1 << 1) /* INT1 and INT2 pin polarity */ + +/* LIS3DH STATUS_REG Definitions **********************************************/ + +#define LIS3DH_STATUS_ZYXOR (1 << 7) /* X,Y,Z axis data overrun */ +#define LIS3DH_STATUS_ZOR (1 << 6) /* Z axis data overrun */ +#define LIS3DH_STATUS_YOR (1 << 5) /* Y axis data overrun */ +#define LIS3DH_STATUS_XOR (1 << 4) /* X axis data overrun */ +#define LIS3DH_STATUS_REG_ZYXDA (1 << 3) /* X,Y,Z axis data available */ +#define LIS3DH_STATUS_REG_ZDA (1 << 2) /* Z axis data available */ +#define LIS3DH_STATUS_REG_YDA (1 << 1) /* Y axis data available */ +#define LIS3DH_STATUS_REG_XDA (1 << 0) /* X axis data available */ + +/* LIS3DH FIFO_CTRL_REG Definitions **********************************************/ + +#define LIS3DH_FIFO_CTRL_REG_MODE_STREAM2 (3 << 6) +#define LIS3DH_FIFO_CTRL_REG_MODE_STREAM (2 << 6) +#define LIS3DH_FIFO_CTRL_REG_MODE_FIFO (1 << 6) +#define LIS3DH_FIFO_CTRL_REG_MODE_BYPASS (0 << 6) +#define LIS3DH_FIFO_CTRL_REG_TR (1 << 5) + +/* LIS3DH FIFO_SRC_REG Definitions **********************************************/ + +#define LIS3DH_FIFO_SRC_REG_WTM (1 << 7) +#define LIS3DH_FIFO_SRC_REG_OVRN_FIFO (1 << 6) +#define LIS3DH_FIFO_SRC_REG_EMPTY (1 << 5) + +/* SPI parameters ***************************************************************/ + +#define LIS3DH_SPI_FREQUENCY (9600000) /* SPI Clock Frequency */ +#define LIS3DH_SPI_MODE (SPIDEV_MODE3) /* Device uses SPI Mode 3: CPOL=1, CPHA=1 */ + +/* Power Modes ******************************************************************/ + +#define LIS3DH_POWER_LOW (0x0) /* Lower power 8bit output */ +#define LIS3DH_POWER_NORMAL (0x1) /* Normal 10bit */ +#define LIS3DH_POWER_HIGH (0x2) /* HR 12bit mode */ + +/* Output Data Rates ***********************************************************/ + +#define LIS3DH_ODR_POWER_DOWN (0) /* Disable output */ +#define LIS3DH_ODR_1HZ (0x1) /* 1Hz in all power modes */ +#define LIS3DH_ODR_10HZ (0x2) /* 10Hz in all power modes */ +#define LIS3DH_ODR_25HZ (0x3) /* 25Hz in all power modes */ +#define LIS3DH_ODR_50HZ (0x4) /* 50Hz in all power modes */ +#define LIS3DH_ODR_100HZ (0x5) /* 100Hz in all power modes */ +#define LIS3DH_ODR_200HZ (0x6) /* 200Hz in all power modes */ +#define LIS3DH_ODR_400HZ (0x7) /* 400Hz in all power modes */ +#define LIS3DH_ODR_LP_1600HZ (0x8) /* 1.6kHz in low power mode only */ +#define LIS3DH_ODR_1344HZ (0x9) /* 1.344kHz in normal and high power modes only */ +#define LIS3DH_ODR_LP_5376HZ (0x9) /* 5.376kHz in low power mode only */ + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +struct lis3dh_sensor_data_s +{ + float x_acc; /* X axis acceleration */ + float y_acc; /* Y axis acceleration */ + float z_acc; /* Z axis acceleration */ +}; + +/* Configuration structure used to register the driver */ + +struct lis3dh_config_s +{ + /* SPI device ID used to select the CS line of the sensor */ + + int spi_devid; + + /* IRQ number associated with this driver instance */ + + int irq; + + /* Attach callback used to configure the interrupt line */ + + int (*irq_attach)(FAR struct lis3dh_config_s *, xcpt_t, void *arg); + int (*irq_detach)(FAR struct lis3dh_config_s *); +}; + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#ifdef __cplusplus +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Name: lis3dh_register + * + * Description: + * Register the LIS3DH character device at the specified device path + * + * Input Parameters: + * devpath - Full path of device node to register ie "/dev/accel0" + * spi - SPI bus device instance + * config - Driver instance configuration structure + * + * Returned Value: + * OK on success or a negative errno value on failure. + * + ****************************************************************************/ + +int lis3dh_register(FAR const char *devpath, FAR struct spi_dev_s *spi, + FAR struct lis3dh_config_s *); + +#undef EXTERN +#ifdef __cplusplus +} +#endif + +#endif /* CONFIG_SPI && CONFIG_LIS3DH */ +#endif /* __INCLUDE_NUTTX_SENSORS_LIS3DH_H */ -- GitLab From e07f12954c2a90370551b42962b0ebcc3dea8a88 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 13 Feb 2018 13:08:38 -0600 Subject: [PATCH 210/228] Trivial changes from review of last PR. --- drivers/sensors/lis3dh.c | 112 ++++++++++++++++----------------- include/nuttx/sensors/lis3dh.h | 4 +- 2 files changed, 58 insertions(+), 58 deletions(-) diff --git a/drivers/sensors/lis3dh.c b/drivers/sensors/lis3dh.c index 2055a7c682..40de1125d3 100644 --- a/drivers/sensors/lis3dh.c +++ b/drivers/sensors/lis3dh.c @@ -67,7 +67,7 @@ struct lis3dh_dev_s { - FAR struct lis3dh_config_s *config; /* Driver configuration */ + FAR struct lis3dh_config_s *config; /* Driver configuration */ FAR struct spi_dev_s *spi; /* Pointer to the SPI instance */ struct work_s work; /* Work Queue */ uint8_t power_mode; /* The power mode used to determine mg/digit */ @@ -75,7 +75,7 @@ struct lis3dh_dev_s sem_t readsem; /* Read notification semaphore */ uint8_t fifobuf[LIS3DH_FIFOBUF_SIZE]; /* Raw FIFO buffer */ struct lis3dh_sensor_data_s queue[LIS3DH_QUEUE_MAX]; - sem_t queuesem; /* Queue exclusive lock */ + sem_t queuesem; /* Queue exclusive lock */ uint8_t queue_rpos; /* Queue read position */ uint8_t queue_wpos; /* Queue write position */ uint8_t queue_count; /* Number of elements in the queue */ @@ -93,10 +93,10 @@ struct lis3dh_sample_s ****************************************************************************/ static void lis3dh_read_register(FAR struct lis3dh_dev_s *dev, - uint8_t const reg_addr, uint8_t *reg_data); + uint8_t const reg_addr, uint8_t *reg_data); static void lis3dh_write_register(FAR struct lis3dh_dev_s *dev, - uint8_t const reg_addr, - uint8_t const reg_data); + uint8_t const reg_addr, + uint8_t const reg_data); static void lis3dh_reset(FAR struct lis3dh_dev_s *dev); static int lis3dh_ident(FAR struct lis3dh_dev_s *dev); static int lis3dh_read_fifo(FAR struct lis3dh_dev_s *dev); @@ -108,9 +108,9 @@ static int lis3dh_fifo_enable(FAR struct lis3dh_dev_s *dev); static int lis3dh_open(FAR struct file *filep); static int lis3dh_close(FAR struct file *filep); static ssize_t lis3dh_read(FAR struct file *, FAR char *buffer, - size_t buflen); + size_t buflen); static ssize_t lis3dh_write(FAR struct file *filep, FAR const char *buffer, - size_t buflen); + size_t buflen); static int lis3dh_ioctl(FAR struct file *filep, int cmd, unsigned long arg); /**************************************************************************** @@ -133,10 +133,6 @@ static const struct file_operations g_lis3dh_fops = #endif }; -/**************************************************************************** - * Public Data - ****************************************************************************/ - /**************************************************************************** * Private Functions ****************************************************************************/ @@ -188,15 +184,15 @@ static void lis3dh_read_register(FAR struct lis3dh_dev_s *dev, * Write a single register to the LIS3DH sensor. * * Input Parameters: - * dev - Pointer to device driver instance + * dev - Pointer to device driver instance * reg_addr - LIS3DH register address * reg_data - Value to write into the specified register address * ****************************************************************************/ static void lis3dh_write_register(FAR struct lis3dh_dev_s *dev, - uint8_t const reg_addr, - uint8_t const reg_data) + uint8_t const reg_addr, + uint8_t const reg_data) { uint8_t buffer[2]; @@ -249,7 +245,7 @@ static void lis3dh_reset(FAR struct lis3dh_dev_s *dev) * * Returned Value: * OK if the device responded with the correct ID - * -ENODEV if the device did not respond with the correct ID + * -ENODEV if the device did not respond with the correct ID * ****************************************************************************/ @@ -258,22 +254,22 @@ static int lis3dh_ident(FAR struct lis3dh_dev_s *dev) uint8_t reg; lis3dh_read_register(dev, LIS3DH_WHO_AM_I, ®); - if(reg == LIS3DH_DEVICE_ID) + if (reg == LIS3DH_DEVICE_ID) { return OK; } + return -ENODEV; } - /**************************************************************************** * Name: lis3dh_queue_lock * * Description: - * Locks exclusive access to the ring buffer queue + * Locks exclusive access to the ring buffer queue * * Input Parameters: - * dev - Pointer to device driver instance + * dev - Pointer to device driver instance * ****************************************************************************/ @@ -293,10 +289,10 @@ static void lis3dh_queue_lock(FAR struct lis3dh_dev_s *dev) * Name: lis3dh_queue_unlock * * Description: - * Unlocks exclusive acccess to the ring buffer queue + * Unlocks exclusive acccess to the ring buffer queue * * Input Parameters: - * dev - Pointer to device driver instance + * dev - Pointer to device driver instance * ****************************************************************************/ @@ -309,10 +305,10 @@ static void lis3dh_queue_unlock(FAR struct lis3dh_dev_s *dev) * Name: lis3dh_queue_push * * Description: - * Push a sensor measurement into the queue + * Push a sensor measurement into the queue * * Input Parameters: - * dev - Pointer to device driver instance + * dev - Pointer to device driver instance * ****************************************************************************/ @@ -320,7 +316,7 @@ static int lis3dh_queue_push(FAR struct lis3dh_dev_s *dev, struct lis3dh_sensor_data_s *data) { lis3dh_queue_lock(dev); - if(dev->queue_count >= LIS3DH_QUEUE_MAX) + if (dev->queue_count >= LIS3DH_QUEUE_MAX) { lis3dh_queue_unlock(dev); return -ENOMEM; @@ -339,13 +335,13 @@ static int lis3dh_queue_push(FAR struct lis3dh_dev_s *dev, * Name: lis3dh_queue_pop * * Description: - * Pops a sensor measurement from the queue + * Pops a sensor measurement from the queue * * Input Parameters: - * dev - Pointer to device driver instance + * dev - Pointer to device driver instance * * Returned Value: - * OK if a measurement was successfully dequeued + * OK if a measurement was successfully dequeued * -EAGAIN if the queue is empty * ****************************************************************************/ @@ -354,7 +350,7 @@ static int lis3dh_queue_pop(FAR struct lis3dh_dev_s *dev, struct lis3dh_sensor_data_s *data) { lis3dh_queue_lock(dev); - if(dev->queue_count == 0) + if (dev->queue_count == 0) { lis3dh_queue_unlock(dev); return -EAGAIN; @@ -406,7 +402,7 @@ static int lis3dh_read_fifo(FAR struct lis3dh_dev_s *dev) count = fifosrc & 0x1f; - if(fifosrc & LIS3DH_FIFO_SRC_REG_OVRN_FIFO) + if (fifosrc & LIS3DH_FIFO_SRC_REG_OVRN_FIFO) { snerr("FIFO overrun\n"); } @@ -422,7 +418,7 @@ static int lis3dh_read_fifo(FAR struct lis3dh_dev_s *dev) SPI_LOCK(dev->spi, false); - for(i=0;ipower_mode) + switch (dev->power_mode) { case LIS3DH_POWER_LOW: /* 8 bit measurements */ x_acc = (int16_t)x_raw >> 8; @@ -456,8 +452,8 @@ static int lis3dh_read_fifo(FAR struct lis3dh_dev_s *dev) data.x_acc = (float)x_acc * 0.016; data.y_acc = (float)y_acc * 0.016; data.z_acc = (float)z_acc * 0.016; - break; + case LIS3DH_POWER_NORMAL: /* 10 bit measurements */ x_acc = (int16_t)x_raw >> 6; y_acc = (int16_t)y_raw >> 6; @@ -466,8 +462,8 @@ static int lis3dh_read_fifo(FAR struct lis3dh_dev_s *dev) data.x_acc = (float)x_acc * 0.004; data.y_acc = (float)y_acc * 0.004; data.z_acc = (float)z_acc * 0.004; - break; + case LIS3DH_POWER_HIGH: /* 12 bit measurements */ x_acc = (int16_t)x_raw >> 4; y_acc = (int16_t)y_raw >> 4; @@ -476,13 +472,13 @@ static int lis3dh_read_fifo(FAR struct lis3dh_dev_s *dev) data.x_acc = (float)x_acc * 0.001; data.y_acc = (float)y_acc * 0.001; data.z_acc = (float)z_acc * 0.001; - break; + default: snerr("Unknown power mode\n"); return -EINVAL; } - + if (lis3dh_queue_push(dev, &data) == OK) { nxsem_post(&dev->readsem); @@ -496,7 +492,7 @@ static int lis3dh_read_fifo(FAR struct lis3dh_dev_s *dev) * Name: lis3dh_interrupt_handler * * Description: - * Interrupt service routine, queues work on high priority work queue. + * Interrupt service routine, queues work on high priority work queue. * * Input Parameters: * irq - Interrupt request number @@ -558,7 +554,7 @@ static void lis3dh_worker(FAR void *arg) * Name: lis3dh_set_power_mode * * Description: - * Sets the power mode of the sensor. + * Sets the power mode of the sensor. * * Input Parameters: * dev - Pointer to device driver instance @@ -576,38 +572,41 @@ static int lis3dh_set_power_mode(FAR struct lis3dh_dev_s *dev, uint8_t ctrl1; uint8_t ctrl4; - switch(power_mode) + switch (power_mode) { case LIS3DH_POWER_LOW: lis3dh_read_register(dev, LIS3DH_CTRL_REG1, &ctrl1); lis3dh_read_register(dev, LIS3DH_CTRL_REG4, &ctrl4); - ctrl1 |= LIS3DH_CTRL_REG1_LPEN; + ctrl1 |= LIS3DH_CTRL_REG1_LPEN; ctrl4 &= ~LIS3DH_CTRL_REG4_HR; lis3dh_write_register(dev, LIS3DH_CTRL_REG1, ctrl1); lis3dh_write_register(dev, LIS3DH_CTRL_REG4, ctrl4); break; + case LIS3DH_POWER_NORMAL: lis3dh_read_register(dev, LIS3DH_CTRL_REG1, &ctrl1); lis3dh_read_register(dev, LIS3DH_CTRL_REG4, &ctrl4); - ctrl1 &= ~LIS3DH_CTRL_REG1_LPEN; + ctrl1 &= ~LIS3DH_CTRL_REG1_LPEN; ctrl4 &= ~LIS3DH_CTRL_REG4_HR; lis3dh_write_register(dev, LIS3DH_CTRL_REG1, ctrl1); lis3dh_write_register(dev, LIS3DH_CTRL_REG4, ctrl4); break; + case LIS3DH_POWER_HIGH: lis3dh_read_register(dev, LIS3DH_CTRL_REG1, &ctrl1); lis3dh_read_register(dev, LIS3DH_CTRL_REG4, &ctrl4); - ctrl1 &= ~LIS3DH_CTRL_REG1_LPEN; + ctrl1 &= ~LIS3DH_CTRL_REG1_LPEN; ctrl4 |= LIS3DH_CTRL_REG4_HR; lis3dh_write_register(dev, LIS3DH_CTRL_REG1, ctrl1); lis3dh_write_register(dev, LIS3DH_CTRL_REG4, ctrl4); break; + default: return -EINVAL; break; @@ -616,14 +615,14 @@ static int lis3dh_set_power_mode(FAR struct lis3dh_dev_s *dev, dev->power_mode = power_mode; sninfo("Power mode set to %d\n", power_mode); - return OK; + return OK; } /**************************************************************************** * Name: lis3dh_set_odr * * Description: - * Sets the output data rate of the sensor. + * Sets the output data rate of the sensor. * * Input Parameters: * dev - Pointer to device driver instance @@ -674,10 +673,10 @@ static int lis3dh_set_odr(FAR struct lis3dh_dev_s *dev, uint8_t odr) static int lis3dh_irq_enable(FAR struct lis3dh_dev_s *dev, bool enable) { uint8_t reg; - + reg = 0; - if(enable == true) + if (enable == true) { reg = LIS3DH_CTRL_REG3_I1_WTM; } @@ -705,8 +704,8 @@ static int lis3dh_fifo_enable(FAR struct lis3dh_dev_s *dev) { uint8_t reg; lis3dh_write_register(dev, LIS3DH_FIFO_CTRL_REG, - LIS3DH_FIFO_CTRL_REG_MODE_STREAM | 28); - + LIS3DH_FIFO_CTRL_REG_MODE_STREAM | 28); + lis3dh_read_register(dev, LIS3DH_CTRL_REG5, ®); reg |= LIS3DH_CTRL_REG5_FIFO_EN; lis3dh_write_register(dev, LIS3DH_CTRL_REG5, reg); @@ -750,7 +749,7 @@ static int lis3dh_enable(FAR struct lis3dh_dev_s *priv) lis3dh_read_register(priv, LIS3DH_CTRL_REG1, ®); reg |= LIS3DH_CTRL_REG1_ZEN | LIS3DH_CTRL_REG1_YEN | LIS3DH_CTRL_REG1_XEN; lis3dh_write_register(priv, LIS3DH_CTRL_REG1, reg); - + return OK; } @@ -765,7 +764,7 @@ static int lis3dh_enable(FAR struct lis3dh_dev_s *priv) * * Returned Value: * -ENODEV - Device was not identified on the SPI bus. - * OK - Sensor device was opened successfully. + * OK - Sensor device was opened successfully. * ****************************************************************************/ @@ -779,7 +778,7 @@ static int lis3dh_open(FAR struct file *filep) /* Perform a reset */ lis3dh_reset(priv); - if(lis3dh_ident(priv) < 0) + if (lis3dh_ident(priv) < 0) { snerr("ERROR: Failed to identify LIS3DH on SPI bus\n"); return -ENODEV; @@ -795,7 +794,7 @@ static int lis3dh_open(FAR struct file *filep) /* Enable measurements on the sensor */ - if(lis3dh_enable(priv) < 0) + if (lis3dh_enable(priv) < 0) { snerr("ERROR: Failed to enable LIS3DH\n"); return -ENODEV; @@ -891,6 +890,7 @@ static ssize_t lis3dh_read(FAR struct file *filep, FAR char *buffer, data++; } + return count * sizeof(struct lis3dh_sensor_data_s); } @@ -901,7 +901,7 @@ static ssize_t lis3dh_read(FAR struct file *filep, FAR char *buffer, * Character device write call. Not supported. * * Input Parameters: - * filep - Pointer to struct file + * filep - Pointer to struct file * buffer - Pointer to user buffer * buflen - Size of user buffer in bytes * @@ -920,16 +920,16 @@ static ssize_t lis3dh_write(FAR struct file *filep, FAR const char *buffer, * Name: lis3dh_ioctl * * Description: - * Character device ioctl call. Sets device parameters. + * Character device ioctl call. Sets device parameters. * * Input Parameters: * filep - Pointer to struct file - * cmd - SNIOC_* - * arg - ioctl specific argument + * cmd - SNIOC_* + * arg - ioctl specific argument * * Returned Value: * OK - The command was executed successfully. - * -ENOTTY - The request command is not applicible to the driver. + * -ENOTTY - The request command is not applicable to the driver. * ****************************************************************************/ diff --git a/include/nuttx/sensors/lis3dh.h b/include/nuttx/sensors/lis3dh.h index 646274ee23..2fea0dc10f 100644 --- a/include/nuttx/sensors/lis3dh.h +++ b/include/nuttx/sensors/lis3dh.h @@ -1,5 +1,5 @@ /**************************************************************************** - * include/nuttx/sensors/lis3dh.h + * include/nuttx/sensors/lis3dh.h * * Copyright (C) 2018 Extent3D. All rights reserved. * Author: Matt Thompson @@ -292,7 +292,7 @@ extern "C" ****************************************************************************/ int lis3dh_register(FAR const char *devpath, FAR struct spi_dev_s *spi, - FAR struct lis3dh_config_s *); + FAR struct lis3dh_config_s *); #undef EXTERN #ifdef __cplusplus -- GitLab From 2284d045ff5263479245492652ebd5a2f1313893 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 13 Feb 2018 19:16:57 -0600 Subject: [PATCH 211/228] configs/flipnclick-pic32mz and -sam3x: Generalize naming. HiletGo is one SSD1306 LCD, but the logic should work with any SSD1306. Naming need to be generalized to SSD1306 to make this reusability clear. --- configs/flipnclick-pic32mz/Kconfig | 22 +++--- configs/flipnclick-pic32mz/README.txt | 4 +- configs/flipnclick-pic32mz/nxlines/defconfig | 2 +- configs/flipnclick-pic32mz/src/Makefile | 4 +- .../src/flipnclick-pic32mz.h | 65 ++++++++--------- .../flipnclick-pic32mz/src/pic32mz_bringup.c | 6 +- configs/flipnclick-pic32mz/src/pic32mz_spi.c | 32 ++++---- .../{pic32mz_hiletgo.c => pic32mz_ssd1306.c} | 16 ++-- configs/flipnclick-sam3x/Kconfig | 22 +++--- configs/flipnclick-sam3x/README.txt | 4 +- configs/flipnclick-sam3x/nxlines/defconfig | 4 +- configs/flipnclick-sam3x/src/Makefile | 4 +- .../flipnclick-sam3x/src/flipnclick-sam3x.h | 73 +++++++++---------- configs/flipnclick-sam3x/src/sam_bringup.c | 6 +- configs/flipnclick-sam3x/src/sam_spi0.c | 16 ++-- .../src/{sam_hiletgo.c => sam_ssd1306.c} | 16 ++-- 16 files changed, 147 insertions(+), 149 deletions(-) rename configs/flipnclick-pic32mz/src/{pic32mz_hiletgo.c => pic32mz_ssd1306.c} (95%) rename configs/flipnclick-sam3x/src/{sam_hiletgo.c => sam_ssd1306.c} (95%) diff --git a/configs/flipnclick-pic32mz/Kconfig b/configs/flipnclick-pic32mz/Kconfig index 1e8fe4a895..befce845ba 100644 --- a/configs/flipnclick-pic32mz/Kconfig +++ b/configs/flipnclick-pic32mz/Kconfig @@ -5,29 +5,29 @@ if ARCH_BOARD_FLIPNCLICK_PIC32MZ -config FLIPNCLICK_PIC32MZ_HILETGO - bool "HiletGo Click Present" +config FLIPNCLICK_PIC32MZ_SSD1306 + bool "SSD1306 Click Present" default n - depends on LCD_HILETGO + depends on LCD_SSD1306 select NXSTART_EXTERNINIT if NX choice - prompt "HiletGo mikroBUS" - default FLIPNCLICK_PIC32MZ_HILETGO_MBA - depends on FLIPNCLICK_PIC32MZ_HILETGO + prompt "SSD1306 mikroBUS" + default FLIPNCLICK_PIC32MZ_SSD1306_MBA + depends on FLIPNCLICK_PIC32MZ_SSD1306 -config FLIPNCLICK_PIC32MZ_HILETGO_MBA +config FLIPNCLICK_PIC32MZ_SSD1306_MBA bool "mikroBUS A" -config FLIPNCLICK_PIC32MZ_HILETGO_MBB +config FLIPNCLICK_PIC32MZ_SSD1306_MBB bool "mikroBUS B" -config FLIPNCLICK_PIC32MZ_HILETGO_MBC +config FLIPNCLICK_PIC32MZ_SSD1306_MBC bool "mikroBUS C" -config FLIPNCLICK_PIC32MZ_HILETGO_MBD +config FLIPNCLICK_PIC32MZ_SSD1306_MBD bool "mikroBUS D" -endchoice # HiletGo mikroBUS +endchoice # SSD1306 mikroBUS endif # ARCH_BOARD_FLIPNCLICK_PIC32MZ diff --git a/configs/flipnclick-pic32mz/README.txt b/configs/flipnclick-pic32mz/README.txt index 7321abd27c..5707bd1569 100644 --- a/configs/flipnclick-pic32mz/README.txt +++ b/configs/flipnclick-pic32mz/README.txt @@ -17,7 +17,7 @@ Contents Serial Console SPI LEDs - HiletGo OLED + SSD1306 OLED Configurations Port Status @@ -326,7 +326,7 @@ LEDs and Buttons The switches have external pull-up resistors. The switches are pulled high (+3.3V) and grounded when pressed. -HiletGo OLED +SSD1306 OLED ============ Hardware diff --git a/configs/flipnclick-pic32mz/nxlines/defconfig b/configs/flipnclick-pic32mz/nxlines/defconfig index 647db81d0b..bf09c0b9ac 100644 --- a/configs/flipnclick-pic32mz/nxlines/defconfig +++ b/configs/flipnclick-pic32mz/nxlines/defconfig @@ -17,7 +17,7 @@ CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=4 CONFIG_EXAMPLES_NXLINES_BPP=1 CONFIG_EXAMPLES_NXLINES_LINEWIDTH=4 CONFIG_EXAMPLES_NXLINES=y -CONFIG_FLIPNCLICK_PIC32MZ_HILETGO=y +CONFIG_FLIPNCLICK_PIC32MZ_SSD1306=y CONFIG_FS_PROCFS=y CONFIG_HOST_WINDOWS=y CONFIG_IDLETHREAD_STACKSIZE=2048 diff --git a/configs/flipnclick-pic32mz/src/Makefile b/configs/flipnclick-pic32mz/src/Makefile index 262dcf3051..529b5c926c 100644 --- a/configs/flipnclick-pic32mz/src/Makefile +++ b/configs/flipnclick-pic32mz/src/Makefile @@ -50,8 +50,8 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += pic32mz_buttons.c endif -ifeq ($(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO),y) -CSRCS += pic32mz_hiletgo.c +ifeq ($(CONFIG_FLIPNCLICK_PIC32MZ_SSD1306),y) +CSRCS += pic32mz_ssd1306.c endif include $(TOPDIR)/configs/Board.mk diff --git a/configs/flipnclick-pic32mz/src/flipnclick-pic32mz.h b/configs/flipnclick-pic32mz/src/flipnclick-pic32mz.h index b1c68aacab..f349e69f63 100644 --- a/configs/flipnclick-pic32mz/src/flipnclick-pic32mz.h +++ b/configs/flipnclick-pic32mz/src/flipnclick-pic32mz.h @@ -48,21 +48,20 @@ ****************************************************************************/ /* Configuration ************************************************************/ -#define HAVE_HILETGO 1 +#define HAVE_SSD1306 1 -/* The HiletGo LCD must be selected, installed on the Flip&Click, and must +/* The SSD1306 LCD must be selected, installed on the Flip&Click, and must * be configured to use the SPI interface. */ -#if !defined(CONFIG_LCD_HILETGO) || \ - !defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO) || \ +#if !defined(CONFIG_FLIPNCLICK_PIC32MZ_SSD1306) || \ !defined(CONFIG_LCD_SSD1306_SPI) -# undef HAVE_HILETGO -# undef CONFIG_FLIPNCLICK_PIC32MZ_HILETGO -# undef CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBA -# undef CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBB -# undef CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBC -# undef CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBD +# undef HAVE_SSD1306 +# undef CONFIG_FLIPNCLICK_PIC32MZ_SSD1306 +# undef CONFIG_FLIPNCLICK_PIC32MZ_SSD1306_MBA +# undef CONFIG_FLIPNCLICK_PIC32MZ_SSD1306_MBB +# undef CONFIG_FLIPNCLICK_PIC32MZ_SSD1306_MBC +# undef CONFIG_FLIPNCLICK_PIC32MZ_SSD1306_MBD #endif /* LEDs *********************************************************************/ @@ -143,7 +142,7 @@ #define GPIO_MBC_CS (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORTD | GPIO_PIN12) #define GPIO_MBD_CS (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORTD | GPIO_PIN13) -/* HiletGo OLED +/* SSD1306 OLED * * The HiletGo is a 128x64 OLED that can be driven either via SPI or I2C (SPI * is the default and is what is used here). I have mounted the OLED on a @@ -174,45 +173,45 @@ * DC INT1 RD5 DC INT2 RD4 */ -#if defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBA) +#if defined(CONFIG_FLIPNCLICK_PIC32MZ_SSD1306_MBA) # ifndef CONFIG_PIC32MZ_SPI2 # error "The OLED driver requires CONFIG_PIC32MZ_SPI2 in the configuration" # endif -# define HILETGO_SPI_BUS 2 -# define GPIO_HILETGO_CS GPIO_MBA_CS -# define GPIO_HILETGO_RST (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTE | GPIO_PIN2) -# define GPIO_HILETGO_DC (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTD | GPIO_PIN9) +# define SSD1306_SPI_BUS 2 +# define GPIO_SSD1306_CS GPIO_MBA_CS +# define GPIO_SSD1306_RST (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTE | GPIO_PIN2) +# define GPIO_SSD1306_DC (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTD | GPIO_PIN9) -#elif defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBB) +#elif defined(CONFIG_FLIPNCLICK_PIC32MZ_SSD1306_MBB) # ifndef CONFIG_PIC32MZ_SPI2 # error "The OLED driver requires CONFIG_PIC32MZ_SPI2 in the configuration" # endif -# define HILETGO_SPI_BUS 2 -# define GPIO_HILETGO_CS GPIO_MBB_CS -# define GPIO_HILETGO_RST (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTG | GPIO_PIN13) -# define GPIO_HILETGO_DC (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTG | GPIO_PIN1) +# define SSD1306_SPI_BUS 2 +# define GPIO_SSD1306_CS GPIO_MBB_CS +# define GPIO_SSD1306_RST (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTG | GPIO_PIN13) +# define GPIO_SSD1306_DC (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTG | GPIO_PIN1) -#elif defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBC) +#elif defined(CONFIG_FLIPNCLICK_PIC32MZ_SSD1306_MBC) # ifndef CONFIG_PIC32MZ_SPI1 # error "The OLED driver requires CONFIG_PIC32MZ_SPI1 in the configuration" # endif -# define HILETGO_SPI_BUS 1 -# define GPIO_HILETGO_CS GPIO_MBC_CS -# define GPIO_HILETGO_RST (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTG | GPIO_PIN14) -# define GPIO_HILETGO_DC (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTD | GPIO_PIN5) +# define SSD1306_SPI_BUS 1 +# define GPIO_SSD1306_CS GPIO_MBC_CS +# define GPIO_SSD1306_RST (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTG | GPIO_PIN14) +# define GPIO_SSD1306_DC (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTD | GPIO_PIN5) -#elif defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBD) +#elif defined(CONFIG_FLIPNCLICK_PIC32MZ_SSD1306_MBD) # ifndef CONFIG_PIC32MZ_SPI1 # error "The OLED driver requires CONFIG_PIC32MZ_SPI1 in the configuration" # endif -# define HILETGO_SPI_BUS 1 -# define GPIO_HILETGO_CS GPIO_MBD_CS -# define GPIO_HILETGO_RST (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTG | GPIO_PIN12) -# define GPIO_HILETGO_DC (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTD | GPIO_PIN4) +# define SSD1306_SPI_BUS 1 +# define GPIO_SSD1306_CS GPIO_MBD_CS +# define GPIO_SSD1306_RST (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTG | GPIO_PIN12) +# define GPIO_SSD1306_DC (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTD | GPIO_PIN4) #endif /**************************************************************************** @@ -277,11 +276,11 @@ int pic32mz_bringup(void); * Description: * Called by either NX initialization logic (via board_graphics_setup) or * directly from the board bring-up logic in order to configure the - * HiletGo OLED. + * SSD1306 OLED. * ****************************************************************************/ -#ifdef HAVE_HILETGO +#ifdef HAVE_SSD1306 struct lcd_dev_s; /* Forward reference */ FAR struct lcd_dev_s *pic32mz_graphics_setup(unsigned int devno); #endif diff --git a/configs/flipnclick-pic32mz/src/pic32mz_bringup.c b/configs/flipnclick-pic32mz/src/pic32mz_bringup.c index fae43551d9..c24c4cc9ea 100644 --- a/configs/flipnclick-pic32mz/src/pic32mz_bringup.c +++ b/configs/flipnclick-pic32mz/src/pic32mz_bringup.c @@ -72,12 +72,12 @@ int pic32mz_bringup(void) } #endif -#if defined(HAVE_HILETGO) && !defined(CONFIG_NXSTART_EXTERNINIT) - /* Configure the HiletGo OLED */ +#if defined(HAVE_SSD1306) && !defined(CONFIG_NXSTART_EXTERNINIT) + /* Configure the SSD1306 OLED */ if (pic32mz_graphics_setup(0) == NULL) { - syslog(LOG_ERR,"ERROR: Failed to configure the HiletGo OLED\n"); + syslog(LOG_ERR,"ERROR: Failed to configure the SSD1306 OLED\n"); } #endif diff --git a/configs/flipnclick-pic32mz/src/pic32mz_spi.c b/configs/flipnclick-pic32mz/src/pic32mz_spi.c index 6daee5f589..5817945842 100644 --- a/configs/flipnclick-pic32mz/src/pic32mz_spi.c +++ b/configs/flipnclick-pic32mz/src/pic32mz_spi.c @@ -68,11 +68,11 @@ void weak_function pic32mz_spidev_initialize(void) { -#ifdef HAVE_HILETGO - /* Configure the HiletGo chip select and command/data GPIOs */ +#ifdef HAVE_SSD1306 + /* Configure the SSD1306 chip select and command/data GPIOs */ - (void)pic32mz_configgpio(GPIO_HILETGO_CS); - (void)pic32mz_configgpio(GPIO_HILETGO_DC); + (void)pic32mz_configgpio(GPIO_SSD1306_CS); + (void)pic32mz_configgpio(GPIO_SSD1306_DC); #endif } @@ -111,15 +111,15 @@ void pic32mz_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selecte { spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); -#if defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBC) || \ - defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBD) +#if defined(CONFIG_FLIPNCLICK_PIC32MZ_SSD1306_MBC) || \ + defined(CONFIG_FLIPNCLICK_PIC32MZ_SSD1306_MBD) if (devid == SPIDEV_DISPLAY(0)) { /* Low: the display is selected * High: the display is deselected */ - pic32mz_gpiowrite(GPIO_HILETGO_CS, !selected); + pic32mz_gpiowrite(GPIO_SSD1306_CS, !selected); } #endif } @@ -132,15 +132,15 @@ uint8_t pic32mz_spi1status(FAR struct spi_dev_s *dev, uint32_t devid) #ifdef CONFIG_SPI_CMDDATA int pic32mz_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) { -#if defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBC) || \ - defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBD) +#if defined(CONFIG_FLIPNCLICK_PIC32MZ_SSD1306_MBC) || \ + defined(CONFIG_FLIPNCLICK_PIC32MZ_SSD1306_MBD) if (devid == SPIDEV_DISPLAY(0)) { /* High: the inputs are treated as display data. * Low: the inputs are transferred to the command registers. */ - pic32mz_gpiowrite(GPIO_HILETGO_DC, !cmd); + pic32mz_gpiowrite(GPIO_SSD1306_DC, !cmd); } #endif @@ -154,15 +154,15 @@ void pic32mz_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selecte { spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); -#if defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBA) || \ - defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBB) +#if defined(CONFIG_FLIPNCLICK_PIC32MZ_SSD1306_MBA) || \ + defined(CONFIG_FLIPNCLICK_PIC32MZ_SSD1306_MBB) if (devid == SPIDEV_DISPLAY(0)) { /* Low: the display is selected * High: the display is deselected */ - pic32mz_gpiowrite(GPIO_HILETGO_CS, !selected); + pic32mz_gpiowrite(GPIO_SSD1306_CS, !selected); } #endif } @@ -175,15 +175,15 @@ uint8_t pic32mz_spi2status(FAR struct spi_dev_s *dev, uint32_t devid) #ifdef CONFIG_SPI_CMDDATA int pic32mz_spi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) { -#if defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBA) || \ - defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBB) +#if defined(CONFIG_FLIPNCLICK_PIC32MZ_SSD1306_MBA) || \ + defined(CONFIG_FLIPNCLICK_PIC32MZ_SSD1306_MBB) if (devid == SPIDEV_DISPLAY(0)) { /* High: the inputs are treated as display data. * Low: the inputs are transferred to the command registers. */ - pic32mz_gpiowrite(GPIO_HILETGO_DC, !cmd); + pic32mz_gpiowrite(GPIO_SSD1306_DC, !cmd); } #endif diff --git a/configs/flipnclick-pic32mz/src/pic32mz_hiletgo.c b/configs/flipnclick-pic32mz/src/pic32mz_ssd1306.c similarity index 95% rename from configs/flipnclick-pic32mz/src/pic32mz_hiletgo.c rename to configs/flipnclick-pic32mz/src/pic32mz_ssd1306.c index 24e10f889c..47e4b29b6f 100644 --- a/configs/flipnclick-pic32mz/src/pic32mz_hiletgo.c +++ b/configs/flipnclick-pic32mz/src/pic32mz_ssd1306.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/flipnclick-pic32mz/src/pic32mz_hiletgo.c + * config/flipnclick-pic32mz/src/pic32mz_ssd1306.c * * Copyright (C) 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,7 +33,7 @@ * ****************************************************************************/ -/* HiletGo OLED +/* SSD1306 OLED * * The HiletGo is a 128x64 OLED that can be driven either via SPI or I2C (SPI * is the default and is what is used here). I have mounted the OLED on a @@ -72,7 +72,7 @@ #include "flipnclick-pic32mz.h" -#ifdef HAVE_HILETGO +#ifdef HAVE_SSD1306 /**************************************************************************** * Pre-processor Definitions @@ -93,7 +93,7 @@ * Description: * Called by either NX initialization logic (via board_graphics_setup) or * directly from the board bring-up logic in order to configure the - * HiletGo OLED. + * SSD1306 OLED. * ****************************************************************************/ @@ -106,16 +106,16 @@ FAR struct lcd_dev_s *pic32mz_graphics_setup(unsigned int devno) * putting the OLED into reset state. */ - (void)pic32mz_configgpio(GPIO_HILETGO_RST); + (void)pic32mz_configgpio(GPIO_SSD1306_RST); /* Wait a bit then release the OLED from the reset state */ up_mdelay(20); - pic32mz_gpiowrite(GPIO_HILETGO_RST, true); + pic32mz_gpiowrite(GPIO_SSD1306_RST, true); /* Get the SPI1 port interface */ - spi = pic32mz_spibus_initialize(HILETGO_SPI_BUS); + spi = pic32mz_spibus_initialize(SSD1306_SPI_BUS); if (!spi) { lcderr("ERROR: Failed to initialize SPI port 1\n"); @@ -169,4 +169,4 @@ FAR struct lcd_dev_s *board_graphics_setup(unsigned int devno) } #endif -#endif /* HAVE_HILETGO */ +#endif /* HAVE_SSD1306 */ diff --git a/configs/flipnclick-sam3x/Kconfig b/configs/flipnclick-sam3x/Kconfig index bbabfcbbbf..07f939ec79 100644 --- a/configs/flipnclick-sam3x/Kconfig +++ b/configs/flipnclick-sam3x/Kconfig @@ -5,29 +5,29 @@ if ARCH_BOARD_FLIPNCLICK_SAM3X -config FLIPNCLICK_SAM3X_HILETGO - bool "HiletGo Click Present" +config FLIPNCLICK_SAM3X_SSD1306 + bool "SSD1306 Click Present" default n - depends on LCD_HILETGO + depends on LCD_SSD1306 select NXSTART_EXTERNINIT if NX choice - prompt "HiletGo mikroBUS" - default FLIPNCLICK_SAM3X_HILETGO_MBA - depends on FLIPNCLICK_SAM3X_HILETGO + prompt "SSD1306 mikroBUS" + default FLIPNCLICK_SAM3X_SSD1306_MBA + depends on FLIPNCLICK_SAM3X_SSD1306 -config FLIPNCLICK_SAM3X_HILETGO_MBA +config FLIPNCLICK_SAM3X_SSD1306_MBA bool "mikroBUS A" -config FLIPNCLICK_SAM3X_HILETGO_MBB +config FLIPNCLICK_SAM3X_SSD1306_MBB bool "mikroBUS B" -config FLIPNCLICK_SAM3X_HILETGO_MBC +config FLIPNCLICK_SAM3X_SSD1306_MBC bool "mikroBUS C" -config FLIPNCLICK_SAM3X_HILETGO_MBD +config FLIPNCLICK_SAM3X_SSD1306_MBD bool "mikroBUS D" -endchoice # HiletGo mikroBUS +endchoice # SSD1306 mikroBUS endif diff --git a/configs/flipnclick-sam3x/README.txt b/configs/flipnclick-sam3x/README.txt index 393b83d00a..c4d154ae45 100644 --- a/configs/flipnclick-sam3x/README.txt +++ b/configs/flipnclick-sam3x/README.txt @@ -16,7 +16,7 @@ Contents - Serial Consoles - SPI - I2C - - HiletGo OLED + - SSD1306 OLED - Loading Code - Flip&Click SAM3X-specific Configuration Options - Configurations @@ -188,7 +188,7 @@ I2C SCL I2C1_SCL PB13 SCL I2C1_SCL PB13 SDA I2C1_SDA PB12 SDA I2C1_SDA PB12 -HiletGo OLED +SSD1306 OLED ============ Hardware diff --git a/configs/flipnclick-sam3x/nxlines/defconfig b/configs/flipnclick-sam3x/nxlines/defconfig index 8fec5ed9ea..84685e922c 100644 --- a/configs/flipnclick-sam3x/nxlines/defconfig +++ b/configs/flipnclick-sam3x/nxlines/defconfig @@ -16,8 +16,8 @@ CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=4 CONFIG_EXAMPLES_NXLINES_BPP=1 CONFIG_EXAMPLES_NXLINES_LINEWIDTH=4 CONFIG_EXAMPLES_NXLINES=y -CONFIG_FLIPNCLICK_SAM3X_HILETGO_MBB=y -CONFIG_FLIPNCLICK_SAM3X_HILETGO=y +CONFIG_FLIPNCLICK_SAM3X_SSD1306_MBB=y +CONFIG_FLIPNCLICK_SAM3X_SSD1306=y CONFIG_FS_PROCFS=y CONFIG_HAVE_CXX=y CONFIG_HAVE_CXXINITIALIZE=y diff --git a/configs/flipnclick-sam3x/src/Makefile b/configs/flipnclick-sam3x/src/Makefile index 99781462b0..542654f163 100644 --- a/configs/flipnclick-sam3x/src/Makefile +++ b/configs/flipnclick-sam3x/src/Makefile @@ -52,8 +52,8 @@ ifeq ($(CONFIG_SAM34_SPI0),y) CSRCS += sam_spi0.c endif -ifeq ($(CONFIG_FLIPNCLICK_SAM3X_HILETGO),y) -CSRCS += sam_hiletgo.c +ifeq ($(CONFIG_FLIPNCLICK_SAM3X_SSD1306),y) +CSRCS += sam_ssd1306.c endif include $(TOPDIR)/configs/Board.mk diff --git a/configs/flipnclick-sam3x/src/flipnclick-sam3x.h b/configs/flipnclick-sam3x/src/flipnclick-sam3x.h index f26d0c5f81..0bde2f81e5 100644 --- a/configs/flipnclick-sam3x/src/flipnclick-sam3x.h +++ b/configs/flipnclick-sam3x/src/flipnclick-sam3x.h @@ -55,21 +55,20 @@ ************************************************************************************/ /* Configuration ************************************************************/ -#define HAVE_HILETGO 1 +#define HAVE_SSD1306 1 -/* The HiletGo LCD must be selected, installed on the Flip&Click, and must +/* The SSD1306 LCD must be selected, installed on the Flip&Click, and must * be configured to use the SPI interface. */ -#if !defined(CONFIG_LCD_HILETGO) || \ - !defined(CONFIG_FLIPNCLICK_SAM3X_HILETGO) || \ +#if !defined(CONFIG_FLIPNCLICK_SAM3X_SSD1306) || \ !defined(CONFIG_LCD_SSD1306_SPI) -# undef HAVE_HILETGO -# undef CONFIG_FLIPNCLICK_SAM3X_HILETGO -# undef CONFIG_FLIPNCLICK_SAM3X_HILETGO_MBA -# undef CONFIG_FLIPNCLICK_SAM3X_HILETGO_MBB -# undef CONFIG_FLIPNCLICK_SAM3X_HILETGO_MBC -# undef CONFIG_FLIPNCLICK_SAM3X_HILETGO_MBD +# undef HAVE_SSD1306 +# undef CONFIG_FLIPNCLICK_SAM3X_SSD1306 +# undef CONFIG_FLIPNCLICK_SAM3X_SSD1306_MBA +# undef CONFIG_FLIPNCLICK_SAM3X_SSD1306_MBB +# undef CONFIG_FLIPNCLICK_SAM3X_SSD1306_MBC +# undef CONFIG_FLIPNCLICK_SAM3X_SSD1306_MBD #endif /* There are four LEDs on the top, blue side of the board. Only one can be @@ -147,7 +146,7 @@ GPIO_PORT_PIOB | GPIO_PIN23) #define MBD_CSNUM 3 -/* HiletGo OLED +/* SSD1306 OLED * * The HiletGo is a 128x64 OLED that can be driven either via SPI or I2C (SPI * is the default and is what is used here). I have mounted the OLED on a @@ -178,56 +177,56 @@ * DC INTC PD3 DC INTD PD6 */ -#if defined(CONFIG_FLIPNCLICK_SAM3X_HILETGO_MBA) +#if defined(CONFIG_FLIPNCLICK_SAM3X_SSD1306_MBA) # ifndef CONFIG_SAM34_SPI0 # error "The OLED driver requires CONFIG_SAM34_SPI0 in the configuration" # endif -# define HILETGO_SPI_BUS 0 -# define HILETGO_CSNUM MBA_CSNUM -# define GPIO_HILETGO_CS GPIO_MBA_CS -# define GPIO_HILETGO_RST (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ +# define SSD1306_SPI_BUS 0 +# define SSD1306_CSNUM MBA_CSNUM +# define GPIO_SSD1306_CS GPIO_MBA_CS +# define GPIO_SSD1306_RST (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ GPIO_PORT_PIOC | GPIO_PIN1) -# define GPIO_HILETGO_DC (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ +# define GPIO_SSD1306_DC (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ GPIO_PORT_PIOD | GPIO_PIN1) -#elif defined(CONFIG_FLIPNCLICK_SAM3X_HILETGO_MBB) +#elif defined(CONFIG_FLIPNCLICK_SAM3X_SSD1306_MBB) # ifndef CONFIG_SAM34_SPI0 # error "The OLED driver requires CONFIG_SAM34_SPI0 in the configuration" # endif -# define HILETGO_SPI_BUS 0 -# define HILETGO_CSNUM MBB_CSNUM -# define GPIO_HILETGO_CS GPIO_MBB_CS -# define GPIO_HILETGO_RST (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ +# define SSD1306_SPI_BUS 0 +# define SSD1306_CSNUM MBB_CSNUM +# define GPIO_SSD1306_CS GPIO_MBB_CS +# define GPIO_SSD1306_RST (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ GPIO_PORT_PIOC | GPIO_PIN2) -# define GPIO_HILETGO_DC (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ +# define GPIO_SSD1306_DC (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ GPIO_PORT_PIOD | GPIO_PIN2) -#elif defined(CONFIG_FLIPNCLICK_SAM3X_HILETGO_MBC) +#elif defined(CONFIG_FLIPNCLICK_SAM3X_SSD1306_MBC) # ifndef CONFIG_SAM34_SPI0 # error "The OLED driver requires CONFIG_SAM34_SPI0 in the configuration" # endif -# define HILETGO_SPI_BUS 0 -# define HILETGO_CSNUM MBC_CSNUM -# define GPIO_HILETGO_CS GPIO_MBC_CS -# define GPIO_HILETGO_RST (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ +# define SSD1306_SPI_BUS 0 +# define SSD1306_CSNUM MBC_CSNUM +# define GPIO_SSD1306_CS GPIO_MBC_CS +# define GPIO_SSD1306_RST (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ GPIO_PORT_PIOC | GPIO_PIN3) -# define GPIO_HILETGO_DC (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ +# define GPIO_SSD1306_DC (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ GPIO_PORT_PIOD | GPIO_PIN3) -#elif defined(CONFIG_FLIPNCLICK_SAM3X_HILETGO_MBD) +#elif defined(CONFIG_FLIPNCLICK_SAM3X_SSD1306_MBD) # ifndef CONFIG_SAM34_SPI0 # error "The OLED driver requires CONFIG_SAM34_SPI0 in the configuration" # endif -# define HILETGO_SPI_BUS 0 -# define HILETGO_CSNUM MBD_CSNUM -# define GPIO_HILETGO_CS GPIO_MBD_CS -# define GPIO_HILETGO_RST (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ +# define SSD1306_SPI_BUS 0 +# define SSD1306_CSNUM MBD_CSNUM +# define GPIO_SSD1306_CS GPIO_MBD_CS +# define GPIO_SSD1306_RST (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ GPIO_PORT_PIOC | GPIO_PIN4) -# define GPIO_HILETGO_DC (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ +# define GPIO_SSD1306_DC (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ GPIO_PORT_PIOD | GPIO_PIN6) #endif @@ -267,11 +266,11 @@ int sam_bringup(void); * Description: * Called by either NX initialization logic (via board_graphics_setup) or * directly from the board bring-up logic in order to configure the - * HiletGo OLED. + * SSD1306 OLED. * ****************************************************************************/ -#ifdef HAVE_HILETGO +#ifdef HAVE_SSD1306 struct lcd_dev_s; /* Forward reference */ FAR struct lcd_dev_s *sam_graphics_setup(unsigned int devno); #endif diff --git a/configs/flipnclick-sam3x/src/sam_bringup.c b/configs/flipnclick-sam3x/src/sam_bringup.c index 155139bf7a..3d1d229bb1 100644 --- a/configs/flipnclick-sam3x/src/sam_bringup.c +++ b/configs/flipnclick-sam3x/src/sam_bringup.c @@ -84,12 +84,12 @@ int sam_bringup(void) } #endif -#if defined(HAVE_HILETGO) && !defined(CONFIG_NXSTART_EXTERNINIT) - /* Configure the HiletGo OLED */ +#if defined(HAVE_SSD1306) && !defined(CONFIG_NXSTART_EXTERNINIT) + /* Configure the SSD1306 OLED */ if (sam_graphics_setup(0) == NULL) { - syslog(LOG_ERR,"ERROR: Failed to configure the HiletGo OLED\n"); + syslog(LOG_ERR,"ERROR: Failed to configure the SSD1306 OLED\n"); } #endif diff --git a/configs/flipnclick-sam3x/src/sam_spi0.c b/configs/flipnclick-sam3x/src/sam_spi0.c index e910621003..40c6bc2fd0 100644 --- a/configs/flipnclick-sam3x/src/sam_spi0.c +++ b/configs/flipnclick-sam3x/src/sam_spi0.c @@ -70,11 +70,11 @@ void weak_function sam_spidev_initialize(void) { -#ifdef HAVE_HILETGO - /* Configure the HiletGo chip select and command/data GPIOs */ +#ifdef HAVE_SSD1306 + /* Configure the SSD1306 chip select and command/data GPIOs */ - sam_configgpio(GPIO_HILETGO_CS); - sam_configgpio(GPIO_HILETGO_DC); + sam_configgpio(GPIO_SSD1306_CS); + sam_configgpio(GPIO_SSD1306_DC); #endif } @@ -141,14 +141,14 @@ void sam_spi0select(uint32_t devid, bool selected) spiinfo("devid: %08x CS: %s\n", (unsigned int)devid, selected ? "assert" : "de-assert"); -#ifdef HAVE_HILETGO +#ifdef HAVE_SSD1306 if (devid == SPIDEV_DISPLAY(0)) { /* Low: the display is selected * High: the display is deselected */ - sam_gpiowrite(GPIO_HILETGO_CS, !selected); + sam_gpiowrite(GPIO_SSD1306_CS, !selected); } #endif } @@ -201,14 +201,14 @@ int sam_spi0cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) { spiinfo("devid: %08x %s\n", (unsigned int)devid, cmd ? "cmd" : "data"); -#ifdef HAVE_HILETGO +#ifdef HAVE_SSD1306 if (devid == SPIDEV_DISPLAY(0)) { /* High: the inputs are treated as display data. * Low: the inputs are transferred to the command registers. */ - sam_gpiowrite(GPIO_HILETGO_DC, !cmd); + sam_gpiowrite(GPIO_SSD1306_DC, !cmd); } #endif diff --git a/configs/flipnclick-sam3x/src/sam_hiletgo.c b/configs/flipnclick-sam3x/src/sam_ssd1306.c similarity index 95% rename from configs/flipnclick-sam3x/src/sam_hiletgo.c rename to configs/flipnclick-sam3x/src/sam_ssd1306.c index 31013e5022..f6cfa857e2 100644 --- a/configs/flipnclick-sam3x/src/sam_hiletgo.c +++ b/configs/flipnclick-sam3x/src/sam_ssd1306.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/flipnclick-sam3x/src/sam_hiletgo.c + * config/flipnclick-sam3x/src/sam_ssd1306.c * * Copyright (C) 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,7 +33,7 @@ * ****************************************************************************/ -/* HiletGo OLED +/* SSD1306 OLED * * The HiletGo is a 128x64 OLED that can be driven either via SPI or I2C (SPI * is the default and is what is used here). I have mounted the OLED on a @@ -72,7 +72,7 @@ #include "flipnclick-sam3x.h" -#ifdef HAVE_HILETGO +#ifdef HAVE_SSD1306 /**************************************************************************** * Pre-processor Definitions @@ -93,7 +93,7 @@ * Description: * Called by either NX initialization logic (via board_graphics_setup) or * directly from the board bring-up logic in order to configure the - * HiletGo OLED. + * SSD1306 OLED. * ****************************************************************************/ @@ -106,16 +106,16 @@ FAR struct lcd_dev_s *sam_graphics_setup(unsigned int devno) * putting the OLED into reset state. */ - sam_configgpio(GPIO_HILETGO_RST); + sam_configgpio(GPIO_SSD1306_RST); /* Wait a bit then release the OLED from the reset state */ up_mdelay(20); - sam_gpiowrite(GPIO_HILETGO_RST, true); + sam_gpiowrite(GPIO_SSD1306_RST, true); /* Get the SPI1 port interface */ - spi = sam_spibus_initialize(GPIO_HILETGO_CS); + spi = sam_spibus_initialize(GPIO_SSD1306_CS); if (!spi) { lcderr("ERROR: Failed to initialize SPI port 1\n"); @@ -169,4 +169,4 @@ FAR struct lcd_dev_s *board_graphics_setup(unsigned int devno) } #endif -#endif /* HAVE_HILETGO */ +#endif /* HAVE_SSD1306 */ -- GitLab From abd3c4a7ea6061a3e6c4c0cc634124d60e560ef8 Mon Sep 17 00:00:00 2001 From: Sebastien Lorquet Date: Wed, 14 Feb 2018 07:53:01 -0600 Subject: [PATCH 212/228] drivers/eeprobom: EEPROM driver for AT24xx compatible EEPROMs. --- drivers/eeprom/Kconfig | 22 +- drivers/eeprom/Make.defs | 8 +- drivers/eeprom/i2c_xx24xx.c | 772 ++++++++++++++++++++++++++++++ include/nuttx/eeprom/i2c_xx24xx.h | 113 +++++ 4 files changed, 912 insertions(+), 3 deletions(-) create mode 100644 drivers/eeprom/i2c_xx24xx.c create mode 100644 include/nuttx/eeprom/i2c_xx24xx.h diff --git a/drivers/eeprom/Kconfig b/drivers/eeprom/Kconfig index f2ea39ce1b..cbb6747c9e 100644 --- a/drivers/eeprom/Kconfig +++ b/drivers/eeprom/Kconfig @@ -5,11 +5,11 @@ if EEPROM config SPI_EE_25XX - bool "Microchip 25xxNNN / Atmel AT25NNN EEPROM devices" + bool "Microchip 25xxNNN / Atmel AT25NNN / ST M95NNN SPI EEPROM devices" default n depends on SPI ---help--- - This selection enables support for the Microchip/Atmel SPI EEPROM + This selection enables support for the Microchip/Atmel/ST SPI EEPROM devices if SPI_EE_25XX @@ -20,4 +20,22 @@ config EE25XX_SPIMODE depends on SPI_EE_25XX endif # SPI_EE_25XX + +config I2C_EE_24XX + bool "Microchip 24xxNNN / Atmel AT24NNN / ST M24NNN I2C EEPROM devices" + default n + depends on I2C + ---help--- + This selection enables support for the Microchip/Atmel/ST I2C EEPROM + devices + +if I2C_EE_24XX + +config EE24XX_FREQUENCY + int "I2C EEPROM frequency (100000 or 400000)" + default 100000 + depends on I2C_EE_24XX + +endif # I2C_EE_24XX + endif # EEPROM diff --git a/drivers/eeprom/Make.defs b/drivers/eeprom/Make.defs index afbebea625..475399886e 100644 --- a/drivers/eeprom/Make.defs +++ b/drivers/eeprom/Make.defs @@ -37,12 +37,18 @@ ifeq ($(CONFIG_EEPROM),y) -# Include the Microchip/Atmel xx25xx driver +# Include the Microchip/Atmel/ST xx25xx driver for SPI ifeq ($(CONFIG_SPI_EE_25XX),y) CSRCS += spi_xx25xx.c endif +# Include the Microchip/Atmel/ST xx24xx driver for I2C + +ifeq ($(CONFIG_I2C_EE_24XX),y) +CSRCS += i2c_xx24xx.c +endif + # Include build support DEPPATH += --dep-path eeprom diff --git a/drivers/eeprom/i2c_xx24xx.c b/drivers/eeprom/i2c_xx24xx.c new file mode 100644 index 0000000000..944e14e856 --- /dev/null +++ b/drivers/eeprom/i2c_xx24xx.c @@ -0,0 +1,772 @@ +/**************************************************************************** + * drivers/eeprom/i2c_xx24xx.c + * + * Copyright (C) 2018 Sebastien Lorquet. All rights reserved. + * Author: Sebastien Lorquet + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/* This is a driver for I2C EEPROMs that use the same commands as the + * xx24xx. + * + * The following devices should be supported: + * + * Manufacturer Device Bytes PgSize AddrLen DevAddr + * Microchip + * 24xx00 16 1 1 1010000 Special case + * 24xx01 128 8 1 1010000 + * 24xx02 256 8 1 1010000 + * 24xx04 512 16 1 101000P + * 24xx08 1024 16 1 10100PP + * 24xx16 2048 16 1 1010PPP + * 24xx32 4096 32 2 1010AAA + * 24xx64 8192 32 2 1010AAA + * 24xx128 16384 64 2 1010AAA + * 24xx256 32768 64 2 1010AAA + * 24xx512 65536 128 2 1010AAA + * 24xx1025 131072 128 2 1010PAA Special case: address bit is shifted. + * 24xx1026 131072 128 2 1010AAP + * + * Atmel + * AT24C01 128 8 1 1010AAA + * AT24C02 256 8 1 1010AAA + * AT24C04 512 16 1 1010AAP P bits = word address + * AT24C08 1024 16 1 1010APP + * AT24C16 2048 16 1 1010PPP + * AT24C32 4096 32 2 1010AAA + * AT24C64 8192 32 2 1010AAA + * AT24C128 16384 64 2 10100AA + * AT24C256 32768 64 2 10100AA + * AT24C512 65536 128 2 10100AA + * AT24C1024 131072 256 2 10100AP + * + * ST Microelectronics + * M24C01 128 16 1 1010AAA + * M24C02 256 16 1 1010AAA + * M24C04 512 16 1 1010AAP + * M24C08 1024 16 1 1010APP + * M24C16 2048 16 1 1010PPP + * M24C32 4096 32 2 1010AAA ID pages supported as a separate device + * M24C64 8192 32 2 1010AAA + * M24128 16384 64 2 1010AAA + * M24256 32768 64 2 1010AAA + * M24512 65536 128 2 1010AAA + * M24M01 131072 256 2 1010AAP + * M24M02 262144 256 2 1010APP + */ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#ifndef CONFIG_EE24XX_FREQUENCY +#define CONFIG_EE24XX_FREQUENCY 100000 +#endif + +/**************************************************************************** + * Types + ****************************************************************************/ + +/* Device geometry description, compact form (2 bytes per entry) */ + +struct ee24xx_geom_s +{ + uint8_t bytes : 4; /* Power of two of 128 bytes (0:128 ... 11:262144) */ + uint8_t pagesize : 4; /* Power of two of 8 bytes (0:8 1:16 2:32 3:64 etc) */ + uint8_t addrlen : 4; /* Nr of bytes in command address field */ + uint8_t abits : 3; /* Nr of Address MSBits in the i2c device address LSBs*/ + uint8_t special : 1; /* Special device: uchip 24xx00 (total 16 bytes) + * or 24xx1025 (shifted P bits) */ +}; + +/* Private data attached to the inode */ + +struct ee24xx_dev_s +{ + /* Bus management */ + + struct i2c_master_s *i2c; /* I2C device where the EEPROM is attached */ + uint32_t freq; /* I2C bus speed */ + uint8_t addr; /* 7-bit unshifted I2C device address */ + + /* Driver management */ + + sem_t sem; /* file write access serialization */ + uint8_t refs; /* Nr of times the device has been opened */ + bool readonly; /* Flags */ + + /* Expanded from geometry */ + + uint32_t size; /* total bytes in device */ + uint16_t pgsize; /* write block size, in bytes */ + uint16_t addrlen; /* number of bytes in data addresses */ + uint16_t haddrbits; /* Number of bits in high address part */ + uint16_t haddrshift; /* bit-shift of high address part */ +}; + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +static int ee24xx_open(FAR struct file *filep); +static int ee24xx_close(FAR struct file *filep); +static off_t ee24xx_seek(FAR struct file *filep, off_t offset, int whence); +static ssize_t ee24xx_read(FAR struct file *filep, FAR char *buffer, + size_t buflen); +static ssize_t ee24xx_write(FAR struct file *filep, FAR const char *buffer, + size_t buflen); +static int ee24xx_ioctl(FAR struct file *filep, int cmd, + unsigned long arg); + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/* Supported device geometries. + * One geometry can fit more than one device. + * The user will use an enum'ed index from include/eeprom/i2c_xx24xx.h + */ + +static const struct ee24xx_geom_s g_ee24xx_devices[] = +{ + /* Microchip devices */ + +/* by pg al ab sp device bytes page alen */ + { 0, 1, 1, 0, 1}, /* 24xx00 16 1 1 Ridiculously small device */ + { 0, 0, 1, 0, 0}, /* 24xx01 128 8 1 */ + { 1, 0, 1, 0, 0}, /* 24xx02 256 8 1 */ + { 2, 1, 1, 1, 0}, /* 24xx04 512 16 1 */ + { 3, 1, 1, 2, 0}, /* 24xx08 1024 16 1 */ + { 4, 1, 1, 3, 0}, /* 24xx16 2048 16 1 */ + { 5, 2, 2, 0, 0}, /* 24xx32 4096 32 2 */ + { 6, 2, 2, 0, 0}, /* 24xx64 8192 32 2 */ + { 7, 3, 2, 0, 0}, /* 24xx128 16384 64 2 */ + { 8, 3, 2, 0, 0}, /* 24xx256 32768 64 2 */ + { 9, 4, 2, 0, 0}, /* 24xx512 65536 128 2 */ + {10, 4, 2, 1, 1}, /* 24xx1025 131072 128 2 Shifted address, todo */ + {10, 4, 2, 1, 0}, /* 24xx1026 131072 128 2 */ + + /* STM devices */ + + { 0, 1, 1, 0, 0}, /* M24C01 128 16 1 */ + { 1, 1, 1, 0, 0}, /* M24C02 256 16 1 */ + {11, 5, 2, 2, 0}, /* M24M02 262144 256 2 */ +}; + +/* Driver operations */ + +static const struct file_operations ee24xx_fops = +{ + ee24xx_open, /* open */ + ee24xx_close, /* close */ + ee24xx_read, /* read */ + ee24xx_write, /* write */ + ee24xx_seek, /* seek */ + ee24xx_ioctl /* ioctl */ +#ifndef CONFIG_DISABLE_POLL + , 0 /* poll */ +#endif +}; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: ee24xx_waitwritecomplete + * + * Use ACK polling to detect the completion of the write operation. + * Returns TRUE if write is complete (device replies to ACK). + * Note: The device always replies an ACK for the control byte, the polling + * shall be done using the ACK for the memory address byte. Read or write does + * not matter. + * Note: We should sleep a bit between retries, the write time is around 5 ms, + * but the bus is slow, so, a few retries at most will happen. + * + ****************************************************************************/ + +static int ee24xx_waitwritecomplete(FAR struct ee24xx_dev_s *eedev, + uint32_t memaddr) +{ + struct i2c_msg_s msgs[1]; + int ret; + int retries = 100; + uint8_t adr; + uint32_t addr_hi = (memaddr >> (eedev->addrlen << 3)); + + msgs[0].frequency = eedev->freq; + msgs[0].addr = eedev->addr | (addr_hi & ((1 << eedev->haddrbits) - 1)); + msgs[0].flags = I2C_M_READ; + msgs[0].buffer = &adr; + msgs[0].length = 1; + + do + { + ret = I2C_TRANSFER(eedev->i2c, msgs, 1); + retries--; + } + while(ret != 0 && retries > 0); + + return ret; +} + +/**************************************************************************** + * Name: ee24xx_writepage + * + * Description: Write data to the EEPROM, NOT crossing page boundaries. + * To avoid allocating a buffer to prepend the address, we are using 2 I2C + * messages while avoiding beginning the second one with a restart condition. + * + ****************************************************************************/ + +static int ee24xx_writepage(FAR struct ee24xx_dev_s *eedev, uint32_t memaddr, + FAR const char *buffer, size_t len) +{ + + struct i2c_msg_s msgs[2]; + uint8_t maddr[2]; + uint32_t addr_hi = (memaddr >> (eedev->addrlen << 3)); + + /* Write data address */ + + maddr[0] = memaddr >> 8; + maddr[1] = memaddr & 0xFF; + + msgs[0].frequency = eedev->freq; + msgs[0].addr = eedev->addr | (addr_hi & ((1 << eedev->haddrbits) - 1)); + msgs[0].flags = 0; + msgs[0].buffer = eedev->addrlen==2 ? &maddr[0] : &maddr[1]; + msgs[0].length = eedev->addrlen; + + /* Write data without a restart nor a control byte */ + + msgs[1].frequency = msgs[0].frequency; + msgs[1].addr = msgs[0].addr; + msgs[1].flags = I2C_M_NORESTART; + msgs[1].buffer = (uint8_t*)buffer; + msgs[1].length = len; + + return I2C_TRANSFER(eedev->i2c, msgs, 2); +} + +/**************************************************************************** + * Name: ee24xx_semtake + * + * Acquire a resource to access the device. + * The purpose of the semaphore is to block tasks that try to access the + * EEPROM while another task is actively using it. + * + ****************************************************************************/ + +static void ee24xx_semtake(FAR struct ee24xx_dev_s *eedev) +{ + /* Take the semaphore (perhaps waiting) */ + + while (sem_wait(&eedev->sem) != 0) + { + /* The only case that an error should occur here is if + * the wait was awakened by a signal. + */ + + DEBUGASSERT(errno == EINTR); + } +} + +/**************************************************************************** + * Name: ee24xx_semgive + * + * Release a resource to access the device. + * + ****************************************************************************/ + +static inline void ee24xx_semgive(FAR struct ee24xx_dev_s *eedev) +{ + sem_post(&eedev->sem); +} + +/**************************************************************************** + * Driver Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: ee24xx_open + * + * Description: Open the block device + * + ****************************************************************************/ + +static int ee24xx_open(FAR struct file *filep) +{ + FAR struct inode *inode = filep->f_inode; + FAR struct ee24xx_dev_s *eedev; + int ret = OK; + + DEBUGASSERT(inode && inode->i_private); + eedev = (FAR struct ee24xx_dev_s *)inode->i_private; + ee24xx_semtake(eedev); + + /* Increment the reference count */ + + if ((eedev->refs + 1) == 0) + { + ret = -EMFILE; + } + else + { + eedev->refs += 1; + } + + ee24xx_semgive(eedev); + return ret; +} + +/**************************************************************************** + * Name: ee24xx_close + * + * Description: Close the block device + * + ****************************************************************************/ + +static int ee24xx_close(FAR struct file *filep) +{ + FAR struct inode *inode = filep->f_inode; + FAR struct ee24xx_dev_s *eedev; + int ret = OK; + + DEBUGASSERT(inode && inode->i_private); + eedev = (FAR struct ee24xx_dev_s *)inode->i_private; + ee24xx_semtake(eedev); + + /* Decrement the reference count. I want the entire close operation + * to be atomic wrt other driver operations. + */ + + if (eedev->refs == 0) + { + ret = -EIO; + } + else + { + eedev->refs -= 1; + } + + ee24xx_semgive(eedev); + return ret; +} + +/**************************************************************************** + * Name: ee24xx_seek + * + * Remark: Copied from bchlib + * + ****************************************************************************/ + +static off_t ee24xx_seek(FAR struct file *filep, off_t offset, int whence) +{ + FAR struct ee24xx_dev_s *eedev; + off_t newpos; + int ret; + FAR struct inode *inode = filep->f_inode; + + DEBUGASSERT(inode && inode->i_private); + eedev = (FAR struct ee24xx_dev_s *)inode->i_private; + ee24xx_semtake(eedev); + + /* Determine the new, requested file position */ + + switch (whence) + { + case SEEK_CUR: + newpos = filep->f_pos + offset; + break; + + case SEEK_SET: + newpos = offset; + break; + + case SEEK_END: + newpos = eedev->size + offset; + break; + + default: + /* Return EINVAL if the whence argument is invalid */ + + ee24xx_semgive(eedev); + return -EINVAL; + } + + /* Opengroup.org: + * + * "The lseek() function shall allow the file offset to be set beyond the end + * of the existing data in the file. If data is later written at this point, + * subsequent reads of data in the gap shall return bytes with the value 0 + * until data is actually written into the gap." + * + * We can conform to the first part, but not the second. But return EINVAL if + * + * "...the resulting file offset would be negative for a regular file, block + * special file, or directory." + */ + + if (newpos >= 0) + { + filep->f_pos = newpos; + ret = newpos; + finfo("SEEK newpos %d\n",newpos); + } + else + { + ret = -EINVAL; + } + + ee24xx_semgive(eedev); + return ret; +} + +/**************************************************************************** + * Name: ee24xx_read + ****************************************************************************/ + +static ssize_t ee24xx_read(FAR struct file *filep, FAR char *buffer, + size_t len) +{ + FAR struct ee24xx_dev_s *eedev; + FAR struct inode *inode = filep->f_inode; + struct i2c_msg_s msgs[2]; + uint8_t addr[2]; + uint32_t addr_hi; + int ret; + + DEBUGASSERT(inode && inode->i_private); + eedev = (FAR struct ee24xx_dev_s *)inode->i_private; + + ee24xx_semtake(eedev); + + /* trim len if read would go beyond end of device */ + + if ((filep->f_pos + len) > eedev->size) + { + len = eedev->size - filep->f_pos; + } + + if (len == 0) + { + /* We are at end of file */ + + ret = 0; + goto done; + } + + /* Write data address */ + + finfo("READ %d bytes at pos %d\n", len, filep->f_pos); + + addr_hi = (filep->f_pos >> (eedev->addrlen << 3)); + + addr[0] = (filep->f_pos) >> 8; + addr[1] = (filep->f_pos) & 0xFF; + + msgs[0].frequency = eedev->freq; + msgs[0].addr = eedev->addr | (addr_hi & ((1 << eedev->haddrbits) - 1)); + msgs[0].flags = 0; + msgs[0].buffer = eedev->addrlen==2 ? &addr[0] : &addr[1]; + msgs[0].length = eedev->addrlen; + + /* Read data */ + + msgs[1].frequency = msgs[0].frequency; + msgs[1].addr = msgs[0].addr; + msgs[1].flags = I2C_M_READ; + msgs[1].buffer = (uint8_t*)buffer; + msgs[1].length = len; + + ret = I2C_TRANSFER(eedev->i2c, msgs, 2); + if (ret < 0) + { + goto done; + } + + ret = len; + + /* Update the file position */ + + filep->f_pos += len; + +done: + ee24xx_semgive(eedev); + return ret; +} + +/**************************************************************************** + * Name: ee24xx_write + ****************************************************************************/ + +static ssize_t ee24xx_write(FAR struct file *filep, FAR const char *buffer, + size_t len) +{ + FAR struct ee24xx_dev_s *eedev; + size_t cnt; + int pageoff; + FAR struct inode *inode = filep->f_inode; + int ret = -EACCES; + int savelen; + + DEBUGASSERT(inode && inode->i_private); + eedev = (FAR struct ee24xx_dev_s *)inode->i_private; + + if (eedev->readonly) + { + return ret; + } + + /* Forbid writes past the end of the device */ + + if (filep->f_pos >= eedev->size) + { + return -EFBIG; + } + + finfo("Entering with len=%d\n", len); + + /* Clamp len to avoid crossing the end of the memory */ + + if ((len + filep->f_pos) > eedev->size) + { + len = eedev->size - filep->f_pos; + finfo("Len clamped to %d\n", len); + } + + savelen = len; /* save number of bytes written */ + + ee24xx_semtake(eedev); + + /* Writes can't happen in a row like the read does. + * The EEPROM is made of pages, and write sequences + * cannot cross page boundaries. So every time the last + * byte of a page is programmed, a separate I2C transaction + * required to continue writing. + */ + + /* First, write some page-unaligned data */ + + pageoff = filep->f_pos & (eedev->pgsize - 1); + cnt = eedev->pgsize - pageoff; + if (cnt > len) + { + cnt = len; + } + + if (pageoff > 0) + { + finfo("First %d unaligned bytes at %d (pageoff %d)\n", cnt, filep->f_pos, + pageoff); + + ret = ee24xx_writepage(eedev, filep->f_pos, buffer, cnt); + if (ret < 0) + { + ferr("write failed, ret = %d\n", ret); + goto done; + } + + ret = ee24xx_waitwritecomplete(eedev, filep->f_pos); + if (ret < 0) + { + ferr("writecomplete failed, ret = %d\n", ret); + goto done; + } + + len -= cnt; + buffer += cnt; + filep->f_pos += cnt; + } + + /* Then, write remaining bytes at page-aligned addresses */ + + while (len > 0) + { + cnt = len; + if (cnt > eedev->pgsize) + { + cnt = eedev->pgsize; + } + + finfo("Aligned page write for %d bytes at %d\n", cnt, filep->f_pos); + + ret = ee24xx_writepage(eedev, filep->f_pos, buffer, cnt); + if (ret < 0) + { + ferr("write failed, ret = %d\n", ret); + goto done; + } + + ret = ee24xx_waitwritecomplete(eedev, filep->f_pos); + if (ret < 0) + { + ferr("writecomplete failed, ret = %d\n", ret); + goto done; + } + + len -= cnt; + buffer += cnt; + filep->f_pos += cnt; + } + + ret = savelen; + +done: + ee24xx_semgive(eedev); + return ret; +} + +/**************************************************************************** + * Name: ee24xx_ioctl + * + * Description: TODO: Erase a sector/page/device or read device ID / MAC. + * This is completely optional. + * + ****************************************************************************/ + +static int ee24xx_ioctl(FAR struct file *filep, int cmd, unsigned long arg) +{ + FAR struct ee24xx_dev_s *eedev; + FAR struct inode *inode = filep->f_inode; + int ret = 0; + + DEBUGASSERT(inode && inode->i_private); + eedev = (FAR struct ee24xx_dev_s *)inode->i_private; + + switch (cmd) + { + default: + (void)eedev; + ret = -EINVAL; + } + + return ret; +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: ee24xx_initialize + * + * Description: Bind a EEPROM driver to an I2C bus. The user MUST provide + * a description of the device geometry, since it is not possible to read + * this information from the device (contrary to the SPI flash devices). + * + ****************************************************************************/ + +int ee24xx_initialize(FAR struct i2c_master_s *bus, uint8_t devaddr, + FAR char *devname, int devtype, int readonly) +{ + FAR struct ee24xx_dev_s *eedev; + + /* Check device type early */ + + if ((devtype < 0) || + (devtype >= sizeof(g_ee24xx_devices) / sizeof(g_ee24xx_devices[0]))) + { + return -EINVAL; + } + + eedev = kmm_zalloc(sizeof(struct ee24xx_dev_s)); + + if (!eedev) + { + return -ENOMEM; + } + + sem_init(&eedev->sem, 0, 1); + + eedev->freq = CONFIG_EE24XX_FREQUENCY; + eedev->i2c = bus; + eedev->addr = devaddr; + eedev->readonly = !!readonly; + + /* Expand device geometry from compacted info */ + + eedev->size = 128 << g_ee24xx_devices[devtype].bytes; + eedev->pgsize = 8 << g_ee24xx_devices[devtype].pagesize; + eedev->addrlen = g_ee24xx_devices[devtype].addrlen; + eedev->haddrbits = g_ee24xx_devices[devtype].abits; + eedev->haddrshift = 0; + + /* Apply special properties */ + + if (g_ee24xx_devices[devtype].special) + { + if (devtype == EEPROM_24xx00) + { + /* Ultra small 16-byte EEPROM */ + + eedev->size = 16; + + /* The device only has BYTE write, + * which is emulated with 1-byte pages + */ + + eedev->pgsize = 1; + } + else if (devtype == EEPROM_24xx1025) + { + /* Microchip alien part where the address MSB is << 2 bits */ + + ferr("Device 24xx1025 is not supported for the moment, TODO.\n"); + + eedev->haddrshift = 2; + free(eedev); + return -ENODEV; + } + } + + finfo("EEPROM device %s, %d bytes, %d per page, addrlen %d, %s\n", + devname, eedev->size, eedev->pgsize, eedev->addrlen, + eedev->readonly ? "readonly" : ""); + + return register_driver(devname, &ee24xx_fops, 0666, eedev); +} diff --git a/include/nuttx/eeprom/i2c_xx24xx.h b/include/nuttx/eeprom/i2c_xx24xx.h new file mode 100644 index 0000000000..6dfd16ba29 --- /dev/null +++ b/include/nuttx/eeprom/i2c_xx24xx.h @@ -0,0 +1,113 @@ + /**************************************************************************** + * include/nuttx/eeprom/i2c_xx24xx.h + * + * Copyright (C) 2018 Sebastien Lorquet. All rights reserved. + * Author: Sebastien Lorquet + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __INCLUDE_NUTTX_EEPROM_I2C_XX24XX_H +#define __INCLUDE_NUTTX_EEPROM_I2C_XX24XX_H 1 + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/* DO NOT CHANGE ORDER, IT MACHES CODE IN drivers/eeprom/i2c_xx24xx.c */ + +enum eeprom_24xx_e +{ + /* Microchip geometries */ + + EEPROM_24xx00, + EEPROM_24xx01, + EEPROM_24xx02, + EEPROM_24xx04, + EEPROM_24xx08, + EEPROM_24xx16, + EEPROM_24xx32, + EEPROM_24xx64, + EEPROM_24xx128, + EEPROM_24xx256, + EEPROM_24xx512, + EEPROM_24xx1025, + EEPROM_24xx1026, + + /* Atmel geometries - none... */ + + /* STM geometries */ + + EEPROM_M24C01, + EEPROM_M24C02, + EEPROM_M24M02, + + /* Aliases (devices similar to previously defined ones) */ + + EEPROM_AT24C01 = EEPROM_24xx01, + EEPROM_AT24C02 = EEPROM_24xx02, + EEPROM_AT24C04 = EEPROM_24xx04, + EEPROM_AT24C08 = EEPROM_24xx08, + EEPROM_AT24C16 = EEPROM_24xx16, + EEPROM_AT24C32 = EEPROM_24xx32, + EEPROM_AT24C64 = EEPROM_24xx64, + EEPROM_AT24C128 = EEPROM_24xx128, + EEPROM_AT24C256 = EEPROM_24xx256, + EEPROM_AT24C512 = EEPROM_24xx512, + EEPROM_AT24C1024 = EEPROM_24xx1026, + + EEPROM_M24C04 = EEPROM_24xx04, + EEPROM_M24C08 = EEPROM_24xx08, + EEPROM_M24C16 = EEPROM_24xx16, + EEPROM_M24C32 = EEPROM_24xx32, + EEPROM_M24C64 = EEPROM_24xx64, + EEPROM_M24128 = EEPROM_24xx128, + EEPROM_M24256 = EEPROM_24xx256, + EEPROM_M24512 = EEPROM_24xx512, + EEPROM_M24M01 = EEPROM_24xx1026, +}; + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Name: ee24xx_initialize + * + * Description: Bind a EEPROM driver to an I2C bus. The user MUST provide + * a description of the device geometry, since it is not possible to read + * this information from the device (contrary to the SPI flash devices). + * + ****************************************************************************/ + +struct i2c_master_s; +int ee24xx_initialize(FAR struct i2c_master_s *bus, uint8_t devaddr, + FAR char *devname, int devtype, int readonly); + +#endif /* __INCLUDE__NUTTX_EEPROM_I2C_XX24XX_H */ -- GitLab From a583b168a7ad8c7b820e572131f92b9c800ebe0d Mon Sep 17 00:00:00 2001 From: Alan Carvalho de Assis Date: Wed, 14 Feb 2018 07:58:26 -0600 Subject: [PATCH 213/228] configs/stm32f103-minimum: Add board support to MAX6675 Thermocouple sensor --- configs/stm32f103-minimum/src/Makefile | 4 + configs/stm32f103-minimum/src/stm32_bringup.c | 8 ++ configs/stm32f103-minimum/src/stm32_max6675.c | 102 ++++++++++++++++++ configs/stm32f103-minimum/src/stm32_spi.c | 11 ++ .../stm32f103-minimum/src/stm32f103_minimum.h | 15 +++ 5 files changed, 140 insertions(+) create mode 100644 configs/stm32f103-minimum/src/stm32_max6675.c diff --git a/configs/stm32f103-minimum/src/Makefile b/configs/stm32f103-minimum/src/Makefile index e10ac85e96..755c4e6bb1 100644 --- a/configs/stm32f103-minimum/src/Makefile +++ b/configs/stm32f103-minimum/src/Makefile @@ -115,6 +115,10 @@ ifeq ($(CONFIG_SENSORS_HCSR04),y) CSRCS += stm32_hcsr04.c endif +ifeq ($(CONFIG_SENSORS_MAX6675),y) + CSRCS += stm32_max6675.c +endif + ifeq ($(CONFIG_LCD_MAX7219),y) CSRCS += stm32_max7219.c endif diff --git a/configs/stm32f103-minimum/src/stm32_bringup.c b/configs/stm32f103-minimum/src/stm32_bringup.c index 2c47270fc7..e751211aee 100644 --- a/configs/stm32f103-minimum/src/stm32_bringup.c +++ b/configs/stm32f103-minimum/src/stm32_bringup.c @@ -279,6 +279,14 @@ int stm32_bringup(void) } #endif +#ifdef CONFIG_SENSORS_MAX6675 + ret = stm32_max6675initialize("/dev/temp0"); + if (ret < 0) + { + serr("ERROR: stm32_max6675initialize failed: %d\n", ret); + } +#endif + #ifdef CONFIG_CAN_MCP2515 /* Configure and initialize the MCP2515 CAN device */ diff --git a/configs/stm32f103-minimum/src/stm32_max6675.c b/configs/stm32f103-minimum/src/stm32_max6675.c new file mode 100644 index 0000000000..2f3b1c9018 --- /dev/null +++ b/configs/stm32f103-minimum/src/stm32_max6675.c @@ -0,0 +1,102 @@ +/************************************************************************************ + * configs/stm32f4discovery/src/stm32_max6675.c + * + * Copyright (C) 2018 Alan Carvalho de Assis. All rights reserved. + * Author: Alan Carvalho de Assis + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ************************************************************************************/ + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +#include +#include + +#include +#include + +#include "stm32.h" +#include "stm32_spi.h" +#include "stm32f103_minimum.h" + +#if defined(CONFIG_SPI) && defined(CONFIG_SENSORS_MAX6675) && defined(CONFIG_STM32_SPI1) + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +#define MAX6675_SPI_PORTNO 1 /* On SPI1 */ + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +/************************************************************************************ + * Name: stm32_max6675initialize + * + * Description: + * Initialize and register the MAX6675 Temperature Sensor driver. + * + * Input Parameters: + * devpath - The full path to the driver to register. E.g., "/dev/temp0" + * + * Returned Value: + * Zero (OK) on success; a negated errno value on failure. + * + ************************************************************************************/ + +int stm32_max6675initialize(FAR const char *devpath) +{ + FAR struct spi_dev_s *spi; + int ret; + + spi = stm32_spibus_initialize(MAX6675_SPI_PORTNO); + + if (!spi) + { + return -ENODEV; + } + + /* Then register the barometer sensor */ + + ret = max6675_register(devpath, spi); + if (ret < 0) + { + snerr("ERROR: Error registering MAX6675\n"); + } + + return ret; +} + +#endif /* CONFIG_SPI && CONFIG_SENSORS_MAX6675 */ + diff --git a/configs/stm32f103-minimum/src/stm32_spi.c b/configs/stm32f103-minimum/src/stm32_spi.c index 2ae29c9e95..a0ff5d7ee6 100644 --- a/configs/stm32f103-minimum/src/stm32_spi.c +++ b/configs/stm32f103-minimum/src/stm32_spi.c @@ -86,6 +86,10 @@ void stm32_spidev_initialize(void) (void)stm32_configgpio(GPIO_CS_MFRC522); /* MFRC522 chip select */ #endif +#if defined(CONFIG_SENSORS_MAX6675) + (void)stm32_configgpio(GPIO_MAX6675_CS); /* MAX6675 chip select */ +#endif + #ifdef CONFIG_LCD_MAX7219 (void)stm32_configgpio(STM32_LCD_CS); /* MAX7219 chip select */ #endif @@ -150,6 +154,13 @@ void stm32_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, } #endif +#if defined(CONFIG_SENSORS_MAX6675) + if (devid == SPIDEV_TEMPERATURE(0)) + { + stm32_gpiowrite(GPIO_MAX6675_CS, !selected); + } +#endif + #ifdef CONFIG_LCD_MAX7219 if (devid == SPIDEV_DISPLAY(0)) { diff --git a/configs/stm32f103-minimum/src/stm32f103_minimum.h b/configs/stm32f103-minimum/src/stm32f103_minimum.h index 9841a5a4c7..af3228c30e 100644 --- a/configs/stm32f103-minimum/src/stm32f103_minimum.h +++ b/configs/stm32f103-minimum/src/stm32f103_minimum.h @@ -135,6 +135,9 @@ #define STM32_LCD_CS (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\ GPIO_OUTPUT_SET|GPIO_PORTA|GPIO_PIN4) +#define GPIO_MAX6675_CS (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\ + GPIO_OUTPUT_SET|GPIO_PORTA|GPIO_PIN4) + #define GPIO_MCP2515_CS (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\ GPIO_OUTPUT_SET|GPIO_PORTA|GPIO_PIN4) @@ -337,6 +340,18 @@ int stm32_hcsr04_initialize(FAR const char *devname); int stm32_lm75initialize(FAR const char *devpath); #endif +/************************************************************************************ + * Name: stm32_max6675initialize + * + * Description: + * Called to initialize MAX6675 temperature sensor + * + ************************************************************************************/ + +#ifdef CONFIG_SENSORS_MAX6675 +int stm32_max6675initialize(FAR const char *devpath); +#endif + /************************************************************************************ * Name: stm32_w25initialize * -- GitLab From b9707776d6b0009cb7f1fafcf731a420f0cf57b4 Mon Sep 17 00:00:00 2001 From: Masayuki Ishikawa Date: Wed, 14 Feb 2018 14:10:32 +0000 Subject: [PATCH 214/228] Merged in masayuki2009/nuttx.nuttx/fix_signal_handing_for_smp (pull request #599) Fix signal handing for smp * sched/signal: Remove SMP related logic in sig_dispatch.c This change prevents from a deadlock in up_schedulesigaction.c where inter-CPU signal handling is actually implemented. Signed-off-by: Masayuki Ishikawa * arch/arm/src/armv7-m: Fix signal handling for SMP In previous implementation, signal handling for SMP was incorrect. Thus, for example, if an inter-CPU signal happened an incorret tcb was signaled and caused ASSERT(). This change fixes the issues and works for both inter-CPU signal handling and signal handling on the same CPU. Signed-off-by: Masayuki Ishikawa Approved-by: Gregory Nutt --- arch/arm/src/armv7-m/up_schedulesigaction.c | 105 +++++++++++--------- sched/signal/sig_dispatch.c | 26 +---- 2 files changed, 61 insertions(+), 70 deletions(-) diff --git a/arch/arm/src/armv7-m/up_schedulesigaction.c b/arch/arm/src/armv7-m/up_schedulesigaction.c index 42aa2932ba..83d51e8c12 100644 --- a/arch/arm/src/armv7-m/up_schedulesigaction.c +++ b/arch/arm/src/armv7-m/up_schedulesigaction.c @@ -266,12 +266,6 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) * CPU. In the former case, we will have to PAUSE the other CPU * first. But in either case, we will have to modify the return * state as well as the state in the TCB. - * - * Hmmm... there looks like a latent bug here: The following logic - * would fail in the strange case where we are in an interrupt - * handler, the thread is signalling itself, but a context switch - * to another task has occurred so that CURRENT_REGS does not - * refer to the thread of this_task()! */ else @@ -282,44 +276,33 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) if (cpu != me) { + /* Pause the CPU */ + up_cpu_pause(cpu); - } - /* Save the return PC, CPSR and either the BASEPRI or PRIMASK - * registers (and perhaps also the LR). These will be - * restored by the signal trampoline after the signal has been - * delivered. - */ + /* Wait while the pause request is pending */ - tcb->xcp.sigdeliver = (FAR void *)sigdeliver; - tcb->xcp.saved_pc = CURRENT_REGS[REG_PC]; + while (up_cpu_pausereq(cpu)); + + /* Now tcb on the other CPU can be accessed safely */ + + /* Copy tcb->xcp.regs to tcp.xcp.saved. These will be restored + * by the signal trampoline after the signal has been delivered. + */ + + tcb->xcp.sigdeliver = (FAR void *)sigdeliver; + tcb->xcp.saved_pc = tcb->xcp.regs[REG_PC]; #ifdef CONFIG_ARMV7M_USEBASEPRI - tcb->xcp.saved_basepri = CURRENT_REGS[REG_BASEPRI]; + tcb->xcp.saved_basepri = tcb->xcp.regs[REG_BASEPRI]; #else - tcb->xcp.saved_primask = CURRENT_REGS[REG_PRIMASK]; + tcb->xcp.saved_primask = tcb->xcp.regs[REG_PRIMASK]; #endif - tcb->xcp.saved_xpsr = CURRENT_REGS[REG_XPSR]; + tcb->xcp.saved_xpsr = tcb->xcp.regs[REG_XPSR]; #ifdef CONFIG_BUILD_PROTECTED - tcb->xcp.saved_lr = CURRENT_REGS[REG_LR]; + tcb->xcp.saved_lr = tcb->xcp.regs[REG_LR]; #endif - /* Increment the IRQ lock count so that when the task is restarted, - * it will hold the IRQ spinlock. - */ - - DEBUGASSERT(tcb->irqcount < INT16_MAX); - tcb->irqcount++; - - /* Handle a possible race condition where the TCB was suspended - * just before we paused the other CPU. The critical section - * established above will prevent new threads from running on - * that CPU, but it will not guarantee that the running thread - * did not suspend itself (allowing any threads "assigned" to - * the CPU to run). - */ - if (tcb->task_state != TSTATE_TASK_RUNNING) - { - /* Then set up to vector to the trampoline with interrupts + /* Then set up vector to the trampoline with interrupts * disabled. We must already be in privileged thread mode * to be here. */ @@ -337,8 +320,29 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) } else { - /* Then set up to vector to the trampoline with interrupts - * disabled + /* tcb is running on the same CPU */ + + /* Save the return PC, CPSR and either the BASEPRI or PRIMASK + * registers (and perhaps also the LR). These will be + * restored by the signal trampoline after the signal has been + * delivered. + */ + + tcb->xcp.sigdeliver = (FAR void *)sigdeliver; + tcb->xcp.saved_pc = CURRENT_REGS[REG_PC]; +#ifdef CONFIG_ARMV7M_USEBASEPRI + tcb->xcp.saved_basepri = CURRENT_REGS[REG_BASEPRI]; +#else + tcb->xcp.saved_primask = CURRENT_REGS[REG_PRIMASK]; +#endif + tcb->xcp.saved_xpsr = CURRENT_REGS[REG_XPSR]; +#ifdef CONFIG_BUILD_PROTECTED + tcb->xcp.saved_lr = CURRENT_REGS[REG_LR]; +#endif + + /* Then set up vector to the trampoline with interrupts + * disabled. The kernel-space trampoline must run in + * privileged thread mode. */ CURRENT_REGS[REG_PC] = (uint32_t)up_sigdeliver; @@ -351,15 +355,6 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) #ifdef CONFIG_BUILD_PROTECTED CURRENT_REGS[REG_LR] = EXC_RETURN_PRIVTHR; #endif - /* In an SMP configuration, the interrupt disable logic also - * involves spinlocks that are configured per the TCB irqcount - * field. This is logically equivalent to enter_critical_section(). - * The matching call to leave_critical_section() will be - * performed in up_sigdeliver(). - */ - - spin_setbit(&g_cpu_irqset, cpu, &g_cpu_irqsetlock, - &g_cpu_irqlock); /* And make sure that the saved context in the TCB is the same * as the interrupt return context. @@ -368,6 +363,24 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) up_savestate(tcb->xcp.regs); } + /* Increment the IRQ lock count so that when the task is restarted, + * it will hold the IRQ spinlock. + */ + + DEBUGASSERT(tcb->irqcount < INT16_MAX); + tcb->irqcount++; + + /* In an SMP configuration, the interrupt disable logic also + * involves spinlocks that are configured per the TCB irqcount + * field. This is logically equivalent to enter_critical_section(). + * The matching call to leave_critical_section() will be + * performed in up_sigdeliver(). + */ + + spin_setbit(&g_cpu_irqset, cpu, &g_cpu_irqsetlock, + &g_cpu_irqlock); + + /* RESUME the other CPU if it was PAUSED */ if (cpu != me) diff --git a/sched/signal/sig_dispatch.c b/sched/signal/sig_dispatch.c index ebe31093ae..e11d25e223 100644 --- a/sched/signal/sig_dispatch.c +++ b/sched/signal/sig_dispatch.c @@ -345,9 +345,6 @@ int nxsig_tcbdispatch(FAR struct tcb_s *stcb, siginfo_t *info) else { -#ifdef CONFIG_SMP - int cpu; -#endif /* Queue any sigaction's requested by this task. */ ret = nxsig_queue_action(stcb, info); @@ -356,32 +353,13 @@ int nxsig_tcbdispatch(FAR struct tcb_s *stcb, siginfo_t *info) flags = enter_critical_section(); -#ifdef CONFIG_SMP - /* If the thread is running on another CPU, then pause that CPU. We can - * then setup the for signal delivery on the running thread. When the - * CPU is resumed, the signal handler will then execute. - */ - - cpu = sched_cpu_pause(stcb); -#endif /* CONFIG_SMP */ - /* Then schedule execution of the signal handling action on the - * recipient's thread. + * recipient's thread. SMP related handling will be done in + * up_schedule_sigaction() */ up_schedule_sigaction(stcb, nxsig_deliver); -#ifdef CONFIG_SMP - /* Resume the paused CPU (if any) */ - - if (cpu >= 0) - { - /* I am not yet sure how to handle a failure here. */ - - DEBUGVERIFY(up_cpu_resume(cpu)); - } -#endif /* CONFIG_SMP */ - /* Check if the task is waiting for an unmasked signal. If so, then * unblock it. This must be performed in a critical section because * signals can be queued from the interrupt level. -- GitLab From d7fae340c1bdbb5f1df01911cd9b964506b1aa39 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 14 Feb 2018 08:20:40 -0600 Subject: [PATCH 215/228] Trivial changes from review of last PR. --- arch/arm/src/armv7-m/up_schedulesigaction.c | 18 ++++++++++-------- arch/arm/src/armv7-m/up_signal_dispatch.c | 2 +- sched/signal/sig_dispatch.c | 7 ++++--- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/arch/arm/src/armv7-m/up_schedulesigaction.c b/arch/arm/src/armv7-m/up_schedulesigaction.c index 83d51e8c12..698b8a3c2c 100644 --- a/arch/arm/src/armv7-m/up_schedulesigaction.c +++ b/arch/arm/src/armv7-m/up_schedulesigaction.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/armv7-m/up_schedulesigaction.c * - * Copyright (C) 2009-2014, 2016-2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2009-2014, 2016-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -118,7 +118,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) if (tcb == this_task()) { /* CASE 1: We are not in an interrupt handler and a task is - * signalling itself for some reason. + * signaling itself for some reason. */ if (!CURRENT_REGS) @@ -176,9 +176,9 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) } } - /* Otherwise, we are (1) signalling a task is not running from an + /* Otherwise, we are (1) signaling a task is not running from an * interrupt handler or (2) we are not in an interrupt handler and the - * running task is signalling* some non-running task. + * running task is signaling* some non-running task. */ else @@ -250,7 +250,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) cpu = tcb->cpu; /* CASE 1: We are not in an interrupt handler and a task is - * signalling itself for some reason. + * signaling itself for some reason. */ if (cpu == me && !CURRENT_REGS) @@ -270,7 +270,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) else { - /* If we signalling a task running on the other CPU, we have + /* If we signaling a task running on the other CPU, we have * to PAUSE the other CPU. */ @@ -282,7 +282,9 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) /* Wait while the pause request is pending */ - while (up_cpu_pausereq(cpu)); + while (up_cpu_pausereq(cpu)) + { + } /* Now tcb on the other CPU can be accessed safely */ @@ -392,7 +394,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) /* Otherwise, we are (1) signaling a task is not running from an * interrupt handler or (2) we are not in an interrupt handler and the - * running task is signalling some other non-running task. + * running task is signaling some other non-running task. */ else diff --git a/arch/arm/src/armv7-m/up_signal_dispatch.c b/arch/arm/src/armv7-m/up_signal_dispatch.c index c29d9c769a..63f2c56fc8 100644 --- a/arch/arm/src/armv7-m/up_signal_dispatch.c +++ b/arch/arm/src/armv7-m/up_signal_dispatch.c @@ -60,7 +60,7 @@ * This kernel-mode stub will then be called transfer control to the user * mode signal handler by calling this function. * - * Normally the a user-mode signalling handling stub will also execute + * Normally the a user-mode signaling handling stub will also execute * before the ultimate signal handler is called. See * arch/arm/src/armv[6\7]/up_signal_handler. This function is the * user-space, signal handler trampoline function. It is called from diff --git a/sched/signal/sig_dispatch.c b/sched/signal/sig_dispatch.c index e11d25e223..600ea4b93b 100644 --- a/sched/signal/sig_dispatch.c +++ b/sched/signal/sig_dispatch.c @@ -1,7 +1,8 @@ /**************************************************************************** * sched/signal/sig_dispatch.c * - * Copyright (C) 2007, 2009, 2011, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2009, 2011, 2016, 2018 Gregory Nutt. All rights + * reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -201,11 +202,11 @@ static FAR sigpendq_t * DEBUGASSERT(group != NULL); - /* Pending sigals can be added from interrupt level. */ + /* Pending signals can be added from interrupt level. */ flags = enter_critical_section(); - /* Seach the list for a sigpendion on this signal */ + /* Search the list for a action pending on this signal */ for (sigpend = (FAR sigpendq_t *)group->tg_sigpendingq.head; (sigpend && sigpend->info.si_signo != signo); -- GitLab From 3ddea73dc12fdda7663d4d363ff63bd607900372 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 14 Feb 2018 08:36:34 -0600 Subject: [PATCH 216/228] arch/arm/src/armv7-a: Port the SMP change by Masayuki Ishikawa to the ARMv7-A family. --- arch/arm/src/armv7-a/arm_schedulesigaction.c | 97 ++++++++++---------- sched/signal/sig_dispatch.c | 2 +- 2 files changed, 52 insertions(+), 47 deletions(-) diff --git a/arch/arm/src/armv7-a/arm_schedulesigaction.c b/arch/arm/src/armv7-a/arm_schedulesigaction.c index 9f1a46f675..2bb30374a3 100644 --- a/arch/arm/src/armv7-a/arm_schedulesigaction.c +++ b/arch/arm/src/armv7-a/arm_schedulesigaction.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/armv7-a/arm_schedulesigaction.c * - * Copyright (C) 2013, 2015-2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2013, 2015-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -116,7 +116,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) if (tcb == this_task()) { /* CASE 1: We are not in an interrupt handler and a task is - * signalling itself for some reason. + * signaling itself for some reason. */ if (!CURRENT_REGS) @@ -133,7 +133,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) * * Hmmm... there looks like a latent bug here: The following logic * would fail in the strange case where we are in an interrupt - * handler, the thread is signalling itself, but a context switch + * handler, the thread is signaling itself, but a context switch * to another task has occurred so that CURRENT_REGS does not * refer to the thread of this_task()! */ @@ -166,7 +166,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) /* Otherwise, we are (1) signaling a task is not running from an * interrupt handler or (2) we are not in an interrupt handler and the - * running task is signalling some other non-running task. + * running task is signaling some other non-running task. */ else @@ -222,7 +222,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) cpu = tcb->cpu; /* CASE 1: We are not in an interrupt handler and a task is - * signalling itself for some reason. + * signaling itself for some reason. */ if (cpu == me && !CURRENT_REGS) @@ -238,51 +238,36 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) * CPU. In the former case, we will have to PAUSE the other CPU * first. But in either case, we will have to modify the return * state as well as the state in the TCB. - * - * Hmmm... there looks like a latent bug here: The following logic - * would fail in the strange case where we are in an interrupt - * handler, the thread is signalling itself, but a context switch - * to another task has occurred so that CURRENT_REGS does not - * refer to the thread of this_task()! */ else { - /* If we signalling a task running on the other CPU, we have + /* If we signaling a task running on the other CPU, we have * to PAUSE the other CPU. */ if (cpu != me) { + /* Pause the CPU */ + up_cpu_pause(cpu); - } - /* Save the return lr and cpsr and one scratch register - * These will be restored by the signal trampoline after - * the signals have been delivered. - */ + /* Wait while the pause request is pending */ - tcb->xcp.sigdeliver = sigdeliver; - tcb->xcp.saved_pc = CURRENT_REGS[REG_PC]; - tcb->xcp.saved_cpsr = CURRENT_REGS[REG_CPSR]; + while (up_cpu_pausereq(cpu)) + { + } - /* Increment the IRQ lock count so that when the task is restarted, - * it will hold the IRQ spinlock. - */ + /* Now tcb on the other CPU can be accessed safely */ - DEBUGASSERT(tcb->irqcount < INT16_MAX); - tcb->irqcount++; + /* Copy tcb->xcp.regs to tcp.xcp.saved. These will be restored + * by the signal trampoline after the signal has been delivered. + */ - /* Handle a possible race condition where the TCB was suspended - * just before we paused the other CPU. The critical section - * established above will prevent new threads from running on - * that CPU, but it will not guarantee that the running thread - * did not suspend itself (allowing any threads "assigned" to - * the CPU to run). - */ + tcb->xcp.sigdeliver = sigdeliver; + tcb->xcp.saved_pc = tcb->xcp.regs[REG_PC]; + tcb->xcp.saved_cpsr = tcb->xcp.regs[REG_CPSR]; - if (tcb->task_state != TSTATE_TASK_RUNNING) - { /* Then set up to vector to the trampoline with interrupts * disabled */ @@ -292,22 +277,25 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) } else { - /* Then set up to vector to the trampoline with interrupts - * disabled + /* tcb is running on the same CPU */ + + /* Save the return PC, CPSR and either the BASEPRI or PRIMASK + * registers (and perhaps also the LR). These will be + * restored by the signal trampoline after the signal has been + * delivered. */ - CURRENT_REGS[REG_PC] = (uint32_t)up_sigdeliver; - CURRENT_REGS[REG_CPSR] = (PSR_MODE_SVC | PSR_I_BIT | PSR_F_BIT); + tcb->xcp.sigdeliver = (FAR void *)sigdeliver; + tcb->xcp.saved_pc = CURRENT_REGS[REG_PC]; + tcb->xcp.saved_cpsr = CURRENT_REGS[REG_CPSR]; - /* In an SMP configuration, the interrupt disable logic also - * involves spinlocks that are configured per the TCB irqcount - * field. This is logically equivalent to enter_critical_section(). - * The matching call to leave_critical_section() will be - * performed in up_sigdeliver(). + /* Then set up vector to the trampoline with interrupts + * disabled. The kernel-space trampoline must run in + * privileged thread mode. */ - spin_setbit(&g_cpu_irqset, cpu, &g_cpu_irqsetlock, - &g_cpu_irqlock); + CURRENT_REGS[REG_PC] = (uint32_t)up_sigdeliver; + CURRENT_REGS[REG_CPSR] = (PSR_MODE_SVC | PSR_I_BIT | PSR_F_BIT); /* And make sure that the saved context in the TCB is the same * as the interrupt return context. @@ -316,6 +304,23 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) up_savestate(tcb->xcp.regs); } + /* Increment the IRQ lock count so that when the task is restarted, + * it will hold the IRQ spinlock. + */ + + DEBUGASSERT(tcb->irqcount < INT16_MAX); + tcb->irqcount++; + + /* In an SMP configuration, the interrupt disable logic also + * involves spinlocks that are configured per the TCB irqcount + * field. This is logically equivalent to enter_critical_section(). + * The matching call to leave_critical_section() will be + * performed in up_sigdeliver(). + */ + + spin_setbit(&g_cpu_irqset, cpu, &g_cpu_irqsetlock, + &g_cpu_irqlock); + /* RESUME the other CPU if it was PAUSED */ if (cpu != me) @@ -327,7 +332,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) /* Otherwise, we are (1) signaling a task is not running from an * interrupt handler or (2) we are not in an interrupt handler and the - * running task is signalling some other non-running task. + * running task is signaling some other non-running task. */ else diff --git a/sched/signal/sig_dispatch.c b/sched/signal/sig_dispatch.c index 600ea4b93b..67f834a75f 100644 --- a/sched/signal/sig_dispatch.c +++ b/sched/signal/sig_dispatch.c @@ -413,7 +413,7 @@ int nxsig_tcbdispatch(FAR struct tcb_s *stcb, siginfo_t *info) * Description: * This is the front-end for nxsig_tcbdispatch that should be typically * be used to dispatch a signal. If HAVE_GROUP_MEMBERS is defined, - * then function will follow the group signal delivery algorthrims: + * then function will follow the group signal delivery algorithms: * * This front-end does the following things before calling * nxsig_tcbdispatch. -- GitLab From c260ef5d59ca343a8feb47bc3e78e83238fa4f01 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 14 Feb 2018 08:58:22 -0600 Subject: [PATCH 217/228] arch/xtensa/common: Port the SMP change by Masayuki Ishikawa to the Xtensa family. --- .../xtensa/src/common/xtensa_schedsigaction.c | 107 ++++++++++-------- 1 file changed, 58 insertions(+), 49 deletions(-) diff --git a/arch/xtensa/src/common/xtensa_schedsigaction.c b/arch/xtensa/src/common/xtensa_schedsigaction.c index 2dd3991335..9747d201d3 100644 --- a/arch/xtensa/src/common/xtensa_schedsigaction.c +++ b/arch/xtensa/src/common/xtensa_schedsigaction.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/xtensa/src/common/arm_schedulesigaction.c * - * Copyright (C) 2016-2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2016-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -114,7 +114,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) if (tcb == this_task()) { /* CASE 1: We are not in an interrupt handler and a task is - * signalling itself for some reason. + * signaling itself for some reason. */ if (!CURRENT_REGS) @@ -131,7 +131,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) * * Hmmm... there looks like a latent bug here: The following logic * would fail in the strange case where we are in an interrupt - * handler, the thread is signalling itself, but a context switch + * handler, the thread is signaling itself, but a context switch * to another task has occurred so that CURRENT_REGS does not * refer to the thread of this_task()! */ @@ -169,7 +169,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) /* Otherwise, we are (1) signaling a task is not running from an * interrupt handler or (2) we are not in an interrupt handler and the - * running task is signalling some non-running task. + * running task is signaling some non-running task. */ else @@ -230,7 +230,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) cpu = tcb->cpu; /* CASE 1: We are not in an interrupt handler and a task is - * signalling itself for some reason. + * signaling itself for some reason. */ if (cpu == me && !CURRENT_REGS) @@ -246,61 +246,63 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) * CPU. In the former case, we will have to PAUSE the other CPU * first. But in either case, we will have to modify the return * state as well as the state in the TCB. - * - * Hmmm... there looks like a latent bug here: The following logic - * would fail in the strange case where we are in an interrupt - * handler, the thread is signalling itself, but a context switch - * to another task has occurred so that CURRENT_REGS does not - * refer to the thread of this_task()! */ else { - /* If we signalling a task running on the other CPU, we have + /* If we signaling a task running on the other CPU, we have * to PAUSE the other CPU. */ if (cpu != me) { + /* Pause the CPU */ + up_cpu_pause(cpu); - } - /* Save the return pc and ps. These will be restored by the - * signal trampoline after the signals have been delivered. - * - * NOTE: that hi-priority interrupts are not disabled. - */ + /* Wait while the pause request is pending */ - tcb->xcp.sigdeliver = sigdeliver; - tcb->xcp.saved_pc = CURRENT_REGS[REG_PC]; - tcb->xcp.saved_ps = CURRENT_REGS[REG_PS]; + while (up_cpu_pausereq(cpu)) + { + } - /* Increment the IRQ lock count so that when the task is restarted, - * it will hold the IRQ spinlock. - */ + /* Now tcb on the other CPU can be accessed safely */ - DEBUGASSERT(tcb->irqcount < INT16_MAX); - tcb->irqcount++; + /* Copy tcb->xcp.regs to tcp.xcp.saved. These will be restored + * by the signal trampoline after the signal has been delivered. + * + * NOTE: that hi-priority interrupts are not disabled. + */ - /* Handle a possible race condition where the TCB was suspended - * just before we paused the other CPU. The critical section - * established above will prevent new threads from running on - * that CPU, but it will not guarantee that the running thread - * did not suspend itself (allowing any threads "assigned" to - * the CPU to run). - */ + tcb->xcp.sigdeliver = sigdeliver; + tcb->xcp.saved_pc = tcb->xcp.regs[REG_PC]; + tcb->xcp.saved_ps = tcb->xcp.regs[REG_PS]; - if (tcb->task_state != TSTATE_TASK_RUNNING) - { - tcb->xcp.regs[REG_PC] = (uint32_t)_xtensa_sig_trampoline; + /* Then set up to vector to the trampoline with interrupts + * disabled + */ + + CURRENT_REGS[REG_PC] = (uint32_t)_xtensa_sig_trampoline; #ifdef __XTENSA_CALL0_ABI__ - tcb->xcp.regs[REG_PS] = (uint32_t)(PS_INTLEVEL(XCHAL_EXCM_LEVEL) | PS_UM); + CURRENT_REGS[REG_PS] = (uint32_t)(PS_INTLEVEL(XCHAL_EXCM_LEVEL) | PS_UM); #else - tcb->xcp.regs[REG_PS] = (uint32_t)(PS_INTLEVEL(XCHAL_EXCM_LEVEL) | PS_UM | PS_WOE); + CURRENT_REGS[REG_PS] = (uint32_t)(PS_INTLEVEL(XCHAL_EXCM_LEVEL) | PS_UM | PS_WOE); #endif } else { + /* tcb is running on the same CPU */ + + /* Copy tcb->xcp.regs to tcp.xcp.saved. These will be restored + * by the signal trampoline after the signal has been delivered. + * + * NOTE: that hi-priority interrupts are not disabled. + */ + + tcb->xcp.sigdeliver = sigdeliver; + tcb->xcp.saved_pc = CURRENT_REGS[REG_PC]; + tcb->xcp.saved_ps = CURRENT_REGS[REG_PS]; + /* Then set up to vector to the trampoline with interrupts * disabled */ @@ -311,16 +313,6 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) #else CURRENT_REGS[REG_PS] = (uint32_t)(PS_INTLEVEL(XCHAL_EXCM_LEVEL) | PS_UM | PS_WOE); #endif - /* In an SMP configuration, the interrupt disable logic also - * involves spinlocks that are configured per the TCB irqcount - * field. This is logically equivalent to enter_critical_section(). - * The matching call to leave_critical_section() will be - * performed in up_sigdeliver(). - */ - - spin_setbit(&g_cpu_irqset, cpu, &g_cpu_irqsetlock, - &g_cpu_irqlock); - /* And make sure that the saved context in the TCB is the same * as the interrupt return context. */ @@ -328,6 +320,23 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) xtensa_savestate(tcb->xcp.regs); } + /* Increment the IRQ lock count so that when the task is restarted, + * it will hold the IRQ spinlock. + */ + + DEBUGASSERT(tcb->irqcount < INT16_MAX); + tcb->irqcount++; + + /* In an SMP configuration, the interrupt disable logic also + * involves spinlocks that are configured per the TCB irqcount + * field. This is logically equivalent to enter_critical_section(). + * The matching call to leave_critical_section() will be + * performed in up_sigdeliver(). + */ + + spin_setbit(&g_cpu_irqset, cpu, &g_cpu_irqsetlock, + &g_cpu_irqlock); + /* RESUME the other CPU if it was PAUSED */ if (cpu != me) @@ -339,7 +348,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) /* Otherwise, we are (1) signaling a task is not running from an * interrupt handler or (2) we are not in an interrupt handler and the - * running task is signalling some other non-running task. + * running task is signaling some other non-running task. */ else -- GitLab From 2c17bf21afb4f3ccb09559f3eee0ad50b8ac0c8e Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 14 Feb 2018 09:23:55 -0600 Subject: [PATCH 218/228] net/tcp: Missing header file inclusion in tcp_wrbuffer.c --- net/tcp/tcp_wrbuffer.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/tcp/tcp_wrbuffer.c b/net/tcp/tcp_wrbuffer.c index 9cd8e798b3..c203285ce7 100644 --- a/net/tcp/tcp_wrbuffer.c +++ b/net/tcp/tcp_wrbuffer.c @@ -51,6 +51,7 @@ #include #include #include +#include #include #include -- GitLab From 1ee0f0518b10a3ab92fdcbf9688e16f5081dee0f Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 14 Feb 2018 11:49:56 -0600 Subject: [PATCH 219/228] stm32f103-minimum/src/: Fix newly introduced errors and warnings. Most cause by removing illegal inclusions from board.h. --- configs/stm32f103-minimum/src/stm32_buttons.c | 1 + configs/stm32f103-minimum/src/stm32_pwm.c | 3 ++- configs/stm32f103-minimum/src/stm32_rgbled.c | 3 ++- configs/stm32f103-minimum/src/stm32f103_minimum.h | 12 +++++++----- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/configs/stm32f103-minimum/src/stm32_buttons.c b/configs/stm32f103-minimum/src/stm32_buttons.c index 154f24225e..b22347c003 100644 --- a/configs/stm32f103-minimum/src/stm32_buttons.c +++ b/configs/stm32f103-minimum/src/stm32_buttons.c @@ -46,6 +46,7 @@ #include #include +#include "stm32_gpio.h" #include "stm32f103_minimum.h" #if defined(CONFIG_ARCH_BUTTONS) diff --git a/configs/stm32f103-minimum/src/stm32_pwm.c b/configs/stm32f103-minimum/src/stm32_pwm.c index dec2597991..eac41ab675 100644 --- a/configs/stm32f103-minimum/src/stm32_pwm.c +++ b/configs/stm32f103-minimum/src/stm32_pwm.c @@ -1,7 +1,7 @@ /************************************************************************************ * configs/stm32f103-minimum/src/stm32_pwm.c * - * Copyright (C) 2013, 2015, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2013, 2015, 2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * Alan Carvalho de Assis * @@ -40,6 +40,7 @@ #include +#include #include #include diff --git a/configs/stm32f103-minimum/src/stm32_rgbled.c b/configs/stm32f103-minimum/src/stm32_rgbled.c index 21b7a0b78c..024772a20e 100644 --- a/configs/stm32f103-minimum/src/stm32_rgbled.c +++ b/configs/stm32f103-minimum/src/stm32_rgbled.c @@ -1,7 +1,7 @@ /************************************************************************************ * configs/stm32f4discovery/src/stm32_rgbled.c * - * Copyright (C) 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2016, 2018 Gregory Nutt. All rights reserved. * Author: Alan Carvalho de Assis * * Redistribution and use in source and binary forms, with or without @@ -39,6 +39,7 @@ #include +#include #include #include diff --git a/configs/stm32f103-minimum/src/stm32f103_minimum.h b/configs/stm32f103-minimum/src/stm32f103_minimum.h index af3228c30e..8355bae9c1 100644 --- a/configs/stm32f103-minimum/src/stm32f103_minimum.h +++ b/configs/stm32f103-minimum/src/stm32f103_minimum.h @@ -1,7 +1,7 @@ /************************************************************************************ * configs/stm32f103-minimum/src/stm32f103_minimum.h * - * Copyright (C) 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2016, 2018 Gregory Nutt. All rights reserved. * Author: Laurent Latil * * Redistribution and use in source and binary forms, with or without @@ -44,6 +44,12 @@ #include #include +#include + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + #define HAVE_AT24 1 /* AT24 Serial EEPROM */ @@ -77,10 +83,6 @@ # undef HAVE_AT24 #endif -/************************************************************************************ - * Pre-processor Definitions - ************************************************************************************/ - /* How many SPI modules does this chip support? The LM3S6918 supports 2 SPI * modules (others may support more -- in such case, the following must be * expanded). -- GitLab From b2d156af0641387267f8b3cb3ca0387a7820e15e Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 14 Feb 2018 13:10:40 -0600 Subject: [PATCH 220/228] Documentation: Add discussion of the scope of header files to the porting guide. --- Documentation/NuttxPortingGuide.html | 29 ++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/Documentation/NuttxPortingGuide.html b/Documentation/NuttxPortingGuide.html index 04b746b598..27d60da644 100644 --- a/Documentation/NuttxPortingGuide.html +++ b/Documentation/NuttxPortingGuide.html @@ -12,7 +12,7 @@

    NuttX RTOS Porting Guide

    -

    Last Updated: January 31, 2018

    +

    Last Updated: February 14, 2018

    @@ -1563,6 +1563,31 @@ The specific environmental definitions are unique for each board but should incl Sometimes the board name is too long so stm32_ would be okay too. These should be prototyped in configs/<board>/src/<board>.h and should not be used outside of that directory since board-specific definitions have no meaning outside of the board directory. +
  • +

    + Scope of Inclusions. + Header files are made accessible to internal OS logic and to applications through include paths that are provided to the C/C++ compiler. + Through these include paths, the NuttX build system also enforces modularity in the design. + For example, one important design principle is architectural layering. + In this case I am referring to the OS as layered in to application interface, common internal OS logic, and lower level platform-specific layers. + The platform-specific layers all reside in the either arch/ sub-directorories on the config/ subdirectories: The former sub-directories are reserved for microcontroller-specific logic and the latter for board-specific logic. +

    +

    + In the strict, layered NuttX architecture, the upper level OS services are always available to platform-specific logic. However, the opposite is not true: Common OS logic must never have any dependency on the lower level platform-specific code. The OS logic must be totally agnostic about its hardware environment. Similarly, microcontroller-specific logic was be completely ignorant of board-specific logic. +

    +

    + This strict layering is enforced in the NuttX build system by controlling the compiler include paths: Higher level code can never include header files from either; of the platform-specific source directories; microcontroller-specific code can never include header files from the board-specific source directories. The board-specific directories are, then, at the bottom of the layered hierarchy. +

    +

    + An exception to these inclusion restrictions is the platform-specific include/. These are made available to higher level OS logic. The microcontroller-specific include directory will be linked at include/arch/chip and, hence, can be included like #include <arch/chip/chip.h. + Similarly, the board-specific include directory will be linked at include/arch/board and, hence, can be included like #include <arch/board/board.h. +

    +

    + Keeping in the spirit of the layered architecture, this publicly visible header files must not export platform-specific definitions; Only standardized definitions should be visible such as those provided in include/nuttx/arch.h or include/nuttx/board.h. + And, similarly, these publicly visible header file must not include files that reside in the inaccessible platform-specific source directories. + That practice will cause inclusion failures when the publicly visiable file is included in common logic outside of the platform-specific source directories. +

    +
  • 4.2 APIs Exported by Architecture-Specific Logic to NuttX

    @@ -3852,7 +3877,7 @@ void sched_timer_expiration(void);

    NOTE: The other interfaces described in this document are internal OS interface. boardctl() is an application interface to the OS. - There is not point, in fact, of using boardctl() within the OS; + There is no point, in fact, of using boardctl() within the OS; the board interfaces prototyped in include/nuttx/board.h may be called directly from within the OS.

    -- GitLab From b13367be1eaaffdb7f7bb6d8d0ada9b840bce2ef Mon Sep 17 00:00:00 2001 From: Alan Carvalho de Assis Date: Wed, 14 Feb 2018 13:12:27 -0600 Subject: [PATCH 221/228] configs/stm32f103-minimum: Remove CONFIG_NX_LCDDRIVER dependence from stm32_ssd1306.c --- configs/stm32f103-minimum/src/stm32_ssd1306.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/configs/stm32f103-minimum/src/stm32_ssd1306.c b/configs/stm32f103-minimum/src/stm32_ssd1306.c index 3c1cbf5487..0bd49bf03a 100644 --- a/configs/stm32f103-minimum/src/stm32_ssd1306.c +++ b/configs/stm32f103-minimum/src/stm32_ssd1306.c @@ -50,8 +50,6 @@ #include "stm32_i2c.h" #include "stm32f103_minimum.h" -#ifdef CONFIG_NX_LCDDRIVER - /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -130,6 +128,3 @@ void board_lcd_uninitialize(void) { /* TO-FIX */ } - -#endif /* CONFIG_NX_LCDDRIVER */ - -- GitLab From 75ae584922d1cc932b12fd590bdfa4a3dbf6a849 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 14 Feb 2018 13:28:00 -0600 Subject: [PATCH 222/228] Minor spelling fix --- Documentation/NuttxPortingGuide.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/NuttxPortingGuide.html b/Documentation/NuttxPortingGuide.html index 27d60da644..cecaaef7b9 100644 --- a/Documentation/NuttxPortingGuide.html +++ b/Documentation/NuttxPortingGuide.html @@ -1566,7 +1566,7 @@ The specific environmental definitions are unique for each board but should incl

  • Scope of Inclusions. - Header files are made accessible to internal OS logic and to applications through include paths that are provided to the C/C++ compiler. + Header files are made accessible to internal OS logic and to applications through symbolic links and through include paths that are provided to the C/C++ compiler. Through these include paths, the NuttX build system also enforces modularity in the design. For example, one important design principle is architectural layering. In this case I am referring to the OS as layered in to application interface, common internal OS logic, and lower level platform-specific layers. @@ -1585,7 +1585,7 @@ The specific environmental definitions are unique for each board but should incl

    Keeping in the spirit of the layered architecture, this publicly visible header files must not export platform-specific definitions; Only standardized definitions should be visible such as those provided in include/nuttx/arch.h or include/nuttx/board.h. And, similarly, these publicly visible header file must not include files that reside in the inaccessible platform-specific source directories. - That practice will cause inclusion failures when the publicly visiable file is included in common logic outside of the platform-specific source directories. + That practice will cause inclusion failures when the publicly visible file is included in common logic outside of the platform-specific source directories.

  • -- GitLab From b8a47f9b0f5cb5e50e87b6e8abbcbc300409e656 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 14 Feb 2018 14:17:44 -0600 Subject: [PATCH 223/228] Documentation: Minor improve to improve readability of text. --- Documentation/NuttxPortingGuide.html | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Documentation/NuttxPortingGuide.html b/Documentation/NuttxPortingGuide.html index cecaaef7b9..7aeb146db1 100644 --- a/Documentation/NuttxPortingGuide.html +++ b/Documentation/NuttxPortingGuide.html @@ -1569,8 +1569,8 @@ The specific environmental definitions are unique for each board but should incl Header files are made accessible to internal OS logic and to applications through symbolic links and through include paths that are provided to the C/C++ compiler. Through these include paths, the NuttX build system also enforces modularity in the design. For example, one important design principle is architectural layering. - In this case I am referring to the OS as layered in to application interface, common internal OS logic, and lower level platform-specific layers. - The platform-specific layers all reside in the either arch/ sub-directorories on the config/ subdirectories: The former sub-directories are reserved for microcontroller-specific logic and the latter for board-specific logic. + In this case I am referring to the OS as layered into application interface, common internal OS logic, and lower level platform-specific layers. + The platform-specific layers all reside in the either arch/ sub-directories on the config/ subdirectories: The former sub-directories are reserved for microcontroller-specific logic and the latter for board-specific logic.

    In the strict, layered NuttX architecture, the upper level OS services are always available to platform-specific logic. However, the opposite is not true: Common OS logic must never have any dependency on the lower level platform-specific code. The OS logic must be totally agnostic about its hardware environment. Similarly, microcontroller-specific logic was be completely ignorant of board-specific logic. @@ -1583,8 +1583,10 @@ The specific environmental definitions are unique for each board but should incl Similarly, the board-specific include directory will be linked at include/arch/board and, hence, can be included like #include <arch/board/board.h.

    - Keeping in the spirit of the layered architecture, this publicly visible header files must not export platform-specific definitions; Only standardized definitions should be visible such as those provided in include/nuttx/arch.h or include/nuttx/board.h. - And, similarly, these publicly visible header file must not include files that reside in the inaccessible platform-specific source directories. + Keeping in the spirit of the layered architecture, these publicly visible header files must not export platform-specific definitions; Only platform-specific realizations of standardized declarations should be visible. + Those standardized declarations should appear in common header files such as those provided by include/nuttx/arch.h and include/nuttx/board.h. + Similarly, these publicly visible header file must not include files that reside in the inaccessible platform-specific source directories. + For example, the board-specific configs/<board>/include/board.h header file must never include microcontroller-specific header files that reside in arch/<arch>/src/. That practice will cause inclusion failures when the publicly visible file is included in common logic outside of the platform-specific source directories.

    -- GitLab From 75f68b9d3a044832457c89c648566233110830d7 Mon Sep 17 00:00:00 2001 From: Matt Thompson Date: Wed, 14 Feb 2018 20:27:48 +0000 Subject: [PATCH 224/228] Merged in extent3d/nuttx/lis3dh-fix (pull request #600) LIS3DH: Fix missing shift when writing output data rate to register Approved-by: Gregory Nutt --- drivers/sensors/lis3dh.c | 2 +- include/nuttx/sensors/lis3dh.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/sensors/lis3dh.c b/drivers/sensors/lis3dh.c index 40de1125d3..af66ceec4d 100644 --- a/drivers/sensors/lis3dh.c +++ b/drivers/sensors/lis3dh.c @@ -644,7 +644,7 @@ static int lis3dh_set_odr(FAR struct lis3dh_dev_s *dev, uint8_t odr) } lis3dh_read_register(dev, LIS3DH_CTRL_REG1, &ctrl1); - ctrl1 |= odr & LIS3DH_CTRL_REG1_ODR_MASK; + ctrl1 |= LIS3DH_CTRL_REG1_ODR(odr) & LIS3DH_CTRL_REG1_ODR_MASK; lis3dh_write_register(dev, LIS3DH_CTRL_REG1, ctrl1); /* Cache the current ODR in the device structure */ diff --git a/include/nuttx/sensors/lis3dh.h b/include/nuttx/sensors/lis3dh.h index 2fea0dc10f..849d7a72d3 100644 --- a/include/nuttx/sensors/lis3dh.h +++ b/include/nuttx/sensors/lis3dh.h @@ -124,6 +124,7 @@ #define LIS3DH_CTRL_REG1_ODR_SHIFT (4) #define LIS3DH_CTRL_REG1_ODR_MASK (0xf << LIS3DH_CTRL_REG1_ODR_SHIFT) +#define LIS3DH_CTRL_REG1_ODR(n) ((n) << LIS3DH_CTRL_REG1_ODR_SHIFT) #define LIS3DH_CTRL_REG1_ODR_POWER_DOWN (0) #define LIS3DH_CTRL_REG1_ODR_1HZ (0x1 << LIS3DH_CTRL_REG1_ODR_SHIFT) #define LIS3DH_CTRL_REG1_ODR_10HZ (0x2 << LIS3DH_CTRL_REG1_ODR_SHIFT) -- GitLab From 7062ca2c0379715c887d69d3c36c4033b29c753a Mon Sep 17 00:00:00 2001 From: Masayuki Ishikawa Date: Thu, 15 Feb 2018 14:18:25 +0000 Subject: [PATCH 225/228] Merged in masayuki2009/nuttx.nuttx/lc823450_smp_test (pull request #601) lc823450 smp test * sched/clock: Replace critical section APIs with spin lock APIs in clock_gettime.c This change will improve performance for SMP systems but nothing changes for non-SMP systems. (Pls see include/nuttx/irq.h) Signed-off-by: Masayuki Ishikawa * sched/sched: Remove unnecessary DEBUGASSERT in sched_removereadytorun.c In SMP mode, rtrtcb is not always at the g_readytorun.head. This change removes DEBUGASSERT() to avoid this condition. Signed-off-by: Masayuki Ishikawa Approved-by: Gregory Nutt --- sched/clock/clock_gettime.c | 8 ++++---- sched/sched/sched_removereadytorun.c | 2 -- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/sched/clock/clock_gettime.c b/sched/clock/clock_gettime.c index 731c6a2ae3..d3f1cd34a7 100644 --- a/sched/clock/clock_gettime.c +++ b/sched/clock/clock_gettime.c @@ -110,12 +110,12 @@ int clock_gettime(clockid_t clock_id, struct timespec *tp) * CLOCK_MONOTONIC be introduced additional increases to systime. */ - flags = enter_critical_section(); + flags = spin_lock_irqsave(); tp->tv_sec += (uint32_t)g_monotonic_basetime.tv_sec; tp->tv_nsec += (uint32_t)g_monotonic_basetime.tv_nsec; - leave_critical_section(flags); + spin_unlock_irqrestore(flags); /* Handle carry to seconds. */ @@ -163,12 +163,12 @@ int clock_gettime(clockid_t clock_id, struct timespec *tp) * was last set, this gives us the current time. */ - flags = enter_critical_section(); + flags = spin_lock_irqsave(); ts.tv_sec += (uint32_t)g_basetime.tv_sec; ts.tv_nsec += (uint32_t)g_basetime.tv_nsec; - leave_critical_section(flags); + spin_unlock_irqrestore(flags); /* Handle carry to seconds. */ diff --git a/sched/sched/sched_removereadytorun.c b/sched/sched/sched_removereadytorun.c index da4c24a352..aab359aa7d 100644 --- a/sched/sched/sched_removereadytorun.c +++ b/sched/sched/sched_removereadytorun.c @@ -238,8 +238,6 @@ bool sched_removereadytorun(FAR struct tcb_s *rtcb) tmptcb = (FAR struct tcb_s *) dq_remfirst((FAR dq_queue_t *)&g_readytorun); - DEBUGASSERT(tmptcb == rtrtcb); - dq_addfirst((FAR dq_entry_t *)tmptcb, tasklist); tmptcb->cpu = cpu; -- GitLab From 46e5f292dd3a65a2432669e7b44b6189130b573b Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 15 Feb 2018 09:17:27 -0600 Subject: [PATCH 226/228] drivers/lcd: lcd_framebuffer.c does not need to include board-specific board.h. --- Documentation/NuttxPortingGuide.html | 2 +- drivers/lcd/lcd_framebuffer.c | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Documentation/NuttxPortingGuide.html b/Documentation/NuttxPortingGuide.html index 7aeb146db1..016d43a9cd 100644 --- a/Documentation/NuttxPortingGuide.html +++ b/Documentation/NuttxPortingGuide.html @@ -1586,7 +1586,7 @@ The specific environmental definitions are unique for each board but should incl Keeping in the spirit of the layered architecture, these publicly visible header files must not export platform-specific definitions; Only platform-specific realizations of standardized declarations should be visible. Those standardized declarations should appear in common header files such as those provided by include/nuttx/arch.h and include/nuttx/board.h. Similarly, these publicly visible header file must not include files that reside in the inaccessible platform-specific source directories. - For example, the board-specific configs/<board>/include/board.h header file must never include microcontroller-specific header files that reside in arch/<arch>/src/. + For example, the board-specific configs/<board>/include/board.h header file must never include microcontroller-specific header files that reside in arch/<arch>/src/<mcu>. That practice will cause inclusion failures when the publicly visible file is included in common logic outside of the platform-specific source directories.

    diff --git a/drivers/lcd/lcd_framebuffer.c b/drivers/lcd/lcd_framebuffer.c index db9c27ffaa..b97b10d25e 100644 --- a/drivers/lcd/lcd_framebuffer.c +++ b/drivers/lcd/lcd_framebuffer.c @@ -51,7 +51,6 @@ #include #include #include -#include #ifdef CONFIG_LCD_FRAMEBUFFER -- GitLab From 3dfb5e962b7591a2245f7c6a6ed97282a623419c Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 15 Feb 2018 10:43:05 -0600 Subject: [PATCH 227/228] Fix a few typos --- drivers/lcd/ssd1306.h | 2 +- drivers/lcd/ssd1306_base.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/lcd/ssd1306.h b/drivers/lcd/ssd1306.h index 105e84d098..787ec92312 100644 --- a/drivers/lcd/ssd1306.h +++ b/drivers/lcd/ssd1306.h @@ -283,7 +283,7 @@ struct ssd1306_dev_s #ifdef CONFIG_LCD_SSD1306_SPI FAR struct spi_dev_s *spi; /* Cached SPI device reference */ #else - FAR struct i2c_master_s *i2c; /* Cached SPI device reference */ + FAR struct i2c_master_s *i2c; /* Cached I2C device reference */ uint8_t addr; /* 7-bit I2C address */ #endif uint8_t contrast; /* Current contrast setting */ diff --git a/drivers/lcd/ssd1306_base.c b/drivers/lcd/ssd1306_base.c index 9c3817f606..6c98742264 100644 --- a/drivers/lcd/ssd1306_base.c +++ b/drivers/lcd/ssd1306_base.c @@ -1,5 +1,5 @@ /************************************************************************************** - * drivers/lcd/ssd1306.c + * drivers/lcd/ssd1306_base.c * Driver for Univision UG-2864HSWEG01 OLED display or UG-2832HSWEG04 both with the * Univision SSD1306 controller in SPI mode and Densitron DD-12864WO-4A with SSD1309 * in SPI mode. -- GitLab From d04031614370fd047fa5eb74f232bf0eea1d8e3c Mon Sep 17 00:00:00 2001 From: Sebastien Lorquet Date: Thu, 15 Feb 2018 13:54:57 -0600 Subject: [PATCH 228/228] include/lcd: Eliminate a warning from an SSD1306 header file by adding a forward reference to struct i2c_master_s. --- include/nuttx/lcd/ssd1306.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/nuttx/lcd/ssd1306.h b/include/nuttx/lcd/ssd1306.h index fa1117828d..9a8433c68a 100644 --- a/include/nuttx/lcd/ssd1306.h +++ b/include/nuttx/lcd/ssd1306.h @@ -244,8 +244,10 @@ extern "C" * **************************************************************************************/ -struct lcd_dev_s; /* See include/nuttx/lcd/lcd.h */ -struct spi_dev_s; /* See include/nuttx/spi/spi.h */ +struct lcd_dev_s; /* See include/nuttx/lcd/lcd.h */ +struct spi_dev_s; /* See include/nuttx/spi/spi.h */ +struct i2c_master_s; /* See include/nuttx/i2c/i2c_master.h */ + #ifdef CONFIG_LCD_SSD1306_SPI FAR struct lcd_dev_s *ssd1306_initialize(FAR struct spi_dev_s *dev, FAR const struct ssd1306_priv_s *board_priv, -- GitLab