Compare commits

..

No commits in common. "master" and "2022.04-devel" have entirely different histories.

289 changed files with 1158 additions and 5865 deletions

View File

@ -33,10 +33,6 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
boards: boards:
- riot: dwm1001
iotlab:
archi: dwm1001:dw1000
site: saclay
- riot: iotlab-m3 - riot: iotlab-m3
iotlab: iotlab:
archi: m3:at86rf231 archi: m3:at86rf231
@ -57,18 +53,10 @@ jobs:
iotlab: iotlab:
archi: nrf52832mdk:ble archi: nrf52832mdk:ble
site: saclay site: saclay
- riot: nucleo-wl55jc
iotlab:
archi: nucleo-wl55jc:stm32wl
site: grenoble
- riot: samr21-xpro - riot: samr21-xpro
iotlab: iotlab:
archi: samr21:at86rf233 archi: samr21:at86rf233
site: saclay site: saclay
- riot: samr34-xpro
iotlab:
archi: samr34:sx1276
site: grenoble
- riot: b-l072z-lrwan1 - riot: b-l072z-lrwan1
iotlab: iotlab:
archi: st-lrwan1:sx1276 archi: st-lrwan1:sx1276
@ -82,6 +70,10 @@ jobs:
env: env:
IOTLAB_NODE: auto IOTLAB_NODE: auto
BUILD_IN_DOCKER: 1 BUILD_IN_DOCKER: 1
# Force .bin files generation because these files are used to flash on IoT-LAB and
# because compile_and_test_for_board forces RIOT_CI_BUILD which skip .bin
# files generation
DOCKER_ENVIRONMENT_CMDLINE: -e BUILD_FILES=\$$\(BINFILE\)
COMPILE_AND_TEST_FOR_BOARD: ./dist/tools/compile_and_test_for_board/compile_and_test_for_board.py COMPILE_AND_TEST_FOR_BOARD: ./dist/tools/compile_and_test_for_board/compile_and_test_for_board.py
COMPILE_AND_TEST_ARGS: --with-test-only --jobs=2 --report-xml COMPILE_AND_TEST_ARGS: --with-test-only --jobs=2 --report-xml
# Exclude applications that are expected to fail or cannot run on iotlab # Exclude applications that are expected to fail or cannot run on iotlab

View File

@ -585,7 +585,7 @@ basename_list () {
update_changed_modules() { update_changed_modules() {
# early out if there's no base commit info # early out if there's no base commit info
if [ -z "${CI_BASE_COMMIT}" ]; then if [ -z "${CI_BASE_COMMIT}" ]; then
return 0 exit 0
fi fi
# early out if a full build is requested # early out if a full build is requested

View File

@ -97,8 +97,8 @@ compile-commands: | $(DIRS:%=COMPILE-COMMANDS--%)
$(file >>$(BINDIR)/$(MODULE)/compile_cmds.txt,TARGET_ARCH: $(TARGET_ARCH)) $(file >>$(BINDIR)/$(MODULE)/compile_cmds.txt,TARGET_ARCH: $(TARGET_ARCH))
$(file >>$(BINDIR)/$(MODULE)/compile_cmds.txt,TARGET_ARCH_LLVM: $(TARGET_ARCH_LLVM)) $(file >>$(BINDIR)/$(MODULE)/compile_cmds.txt,TARGET_ARCH_LLVM: $(TARGET_ARCH_LLVM))
# include makefile snippets for packages in $(PKG_PATHS) that modify GENSRC: # include makefile snippets for packages in $(USEPKG) that modify GENSRC:
-include $(PKG_PATHS:%=%Makefile.gensrc) -include $(USEPKG:%=$(RIOTPKG)/%/Makefile.gensrc)
GENOBJC := $(GENSRC:%.c=%.o) GENOBJC := $(GENSRC:%.c=%.o)
OBJC_LTO := $(SRC:%.c=$(BINDIR)/$(MODULE)/%.o) OBJC_LTO := $(SRC:%.c=$(BINDIR)/$(MODULE)/%.o)

View File

@ -20,7 +20,7 @@ include $(RIOTBASE)/drivers/Makefile.dep
-include $(sort $(USEMODULE:%=$(RIOTBASE)/drivers/%/Makefile.dep)) -include $(sort $(USEMODULE:%=$(RIOTBASE)/drivers/%/Makefile.dep))
# pull dependencies from packages # pull dependencies from packages
-include $(PKG_PATHS:%=%Makefile.dep) -include $(USEPKG:%=$(RIOTPKG)/%/Makefile.dep)
ifneq (,$(filter mpu_stack_guard,$(USEMODULE))) ifneq (,$(filter mpu_stack_guard,$(USEMODULE)))
FEATURES_REQUIRED += cortexm_mpu FEATURES_REQUIRED += cortexm_mpu

View File

@ -386,17 +386,6 @@ ifneq (,$(IOTLAB_NODE))
PROGRAMMER ?= iotlab PROGRAMMER ?= iotlab
# iotlab uses ELFFILE by default for flashing boards. # iotlab uses ELFFILE by default for flashing boards.
FLASHFILE ?= $(ELFFILE) FLASHFILE ?= $(ELFFILE)
# RIOT_CI_BUILD disables the build of BINFILE which is required for flashing
# on IoT-LAB
ifeq (1,$(RIOT_CI_BUILD))
BUILD_FILES += $(BINFILE)
endif
# Disable IOTLAB_NODE if inside Docker to avoid including the
# iotlab.single.inc.mk file which is useless there: it's only useful for
# flashing and this is done outside of Docker.
ifeq (1,$(INSIDE_DOCKER))
IOTLAB_NODE :=
endif
endif endif
# Add standard include directories # Add standard include directories
@ -427,10 +416,6 @@ ifeq (1,$(TEST_KCONFIG))
USEMODULE := $(KCONFIG_MODULES) USEMODULE := $(KCONFIG_MODULES)
KCONFIG_PACKAGES := $(call lowercase,$(patsubst CONFIG_PACKAGE_%,%,$(filter CONFIG_PACKAGE_%,$(.VARIABLES)))) KCONFIG_PACKAGES := $(call lowercase,$(patsubst CONFIG_PACKAGE_%,%,$(filter CONFIG_PACKAGE_%,$(.VARIABLES))))
USEPKG := $(KCONFIG_PACKAGES) USEPKG := $(KCONFIG_PACKAGES)
# Locate used packages in $(RIOTPKG).
PKG_PATHS := $(sort $(foreach dir,$(RIOTPKG),\
$(foreach pkg,$(USEPKG),$(dir $(wildcard $(dir)/$(pkg)/Makefile)))))
else else
# always select provided architecture features # always select provided architecture features
FEATURES_REQUIRED += $(filter arch_%,$(FEATURES_PROVIDED)) FEATURES_REQUIRED += $(filter arch_%,$(FEATURES_PROVIDED))
@ -574,8 +559,8 @@ include $(RIOTBASE)/sys/Makefile.include
# include Makefile.includes of each driver modules if they exist # include Makefile.includes of each driver modules if they exist
-include $(USEMODULE:%=$(RIOTBASE)/drivers/%/Makefile.include) -include $(USEMODULE:%=$(RIOTBASE)/drivers/%/Makefile.include)
# include Makefile.includes for packages in $(PKG_PATHS) # include Makefile.includes for packages in $(USEPKG)
-include $(PKG_PATHS:%=%Makefile.include) -include $(USEPKG:%=$(RIOTPKG)/%/Makefile.include)
# include external modules configuration # include external modules configuration
-include $(EXTERNAL_MODULE_PATHS:%=%/Makefile.include) -include $(EXTERNAL_MODULE_PATHS:%=%/Makefile.include)
@ -775,30 +760,31 @@ endif
# The `clean` needs to be serialized before everything else. # The `clean` needs to be serialized before everything else.
all $(BASELIBS) $(ARCHIVES) $(BUILDDEPS) ..in-docker-container: | $(CLEAN) all $(BASELIBS) $(ARCHIVES) $(BUILDDEPS) ..in-docker-container: | $(CLEAN)
.PHONY: pkg-prepare pkg-build .PHONY: pkg-prepare pkg-build pkg-build-%
pkg-prepare: pkg-prepare:
-@$(foreach dir,$(PKG_PATHS),"$(MAKE)" -C $(dir) prepare $(NEWLINE)) -@for i in $(USEPKG) ; do "$(MAKE)" -C $(RIOTPKG)/$$i prepare ; done
pkg-build: $(BUILDDEPS) pkg-build: $(USEPKG:%=pkg-build-%)
$(foreach dir,$(PKG_PATHS),$(QQ)"$(MAKE)" -C $(dir) $(NEWLINE)) pkg-build-%: $(BUILDDEPS)
$(QQ)"$(MAKE)" -C $(RIOTPKG)/$*
clean: clean:
ifndef MAKE_RESTARTS ifndef MAKE_RESTARTS
-@$(foreach dir,$(PKG_PATHS),"$(MAKE)" -C $(dir) clean $(NEWLINE)) -@for i in $(USEPKG) ; do "$(MAKE)" -C $(RIOTPKG)/$$i clean ; done
-@rm -rf $(BINDIR) -@rm -rf $(BINDIR)
-@rm -rf $(SCANBUILD_OUTPUTDIR) -@rm -rf $(SCANBUILD_OUTPUTDIR)
endif endif
# Remove intermediates, but keep the .elf, .hex and .map etc. # Remove intermediates, but keep the .elf, .hex and .map etc.
clean-intermediates: clean-intermediates:
-@$(foreach dir,$(PKG_PATHS),"$(MAKE)" -C $(dir) distclean $(NEWLINE)) -@for i in $(USEPKG) ; do "$(MAKE)" -C $(RIOTPKG)/$$i distclean ; done
-@rm -rf $(BINDIR)/*.a $(BINDIR)/*/ -@rm -rf $(BINDIR)/*.a $(BINDIR)/*/
clean-pkg: clean-pkg:
-@$(foreach dir,$(PKG_PATHS),"$(MAKE)" -C $(dir) distclean $(NEWLINE)) -@for i in $(USEPKG) ; do "$(MAKE)" -C $(RIOTPKG)/$$i distclean ; done
distclean: distclean:
-@$(foreach dir,$(PKG_PATHS),"$(MAKE)" -C $(dir) distclean $(NEWLINE)) -@for i in $(USEPKG) ; do "$(MAKE)" -C $(RIOTPKG)/$$i distclean ; done
-@rm -rf $(BINDIRBASE) -@rm -rf $(BINDIRBASE)
# Include PROGRAMMER_FLASH/PROGRAMMER_RESET variables # Include PROGRAMMER_FLASH/PROGRAMMER_RESET variables

View File

@ -9,8 +9,6 @@
2. [Hardware](#cc1352_launchpad_hardware) 2. [Hardware](#cc1352_launchpad_hardware)
3. [Board pinout](#cc1352_launcpad_pinout) 3. [Board pinout](#cc1352_launcpad_pinout)
4. [Flashing the Device](#cc1352_launchpad_flashing) 4. [Flashing the Device](#cc1352_launchpad_flashing)
5. [Accessing RIOT shell](#cc1352_launchpad_shell)
6. [More information](#cc1352_launchpad_moreinfo)
## <a name="cc1352_launchpad_overview"> Overview </a> &nbsp;[[TOC]](#cc1352_launchpad_toc) ## <a name="cc1352_launchpad_overview"> Overview </a> &nbsp;[[TOC]](#cc1352_launchpad_toc)
@ -65,22 +63,6 @@ export PROGRAMMER=openocd
Now we can just do `make flash` and `make debug`, this all using OpenOCD. Now we can just do `make flash` and `make debug`, this all using OpenOCD.
## <a name="cc1352_launchpad_shell"> Accessing RIOT shell </a> &nbsp;[[TOC]](#cc1352_launchpad_toc)
Default RIOT shell access utilize XDS110 debug probe integrated with launchpad board.
It provides virtual serials via USB interface - for connecting to RIOT shell, use
the first one.
If a physical connection to UART is needed, disconnect jumpers RXD and TXD joining
cc1352 microcontroller with XDS110 and connect UART to pin RXD/DIO12 and TXD/DIO13.
The default baud rate is 115 200 - in both connection types.
@warning Launchpad cc1352 board is not 5V tolerant. Use voltage divider or logic
level shifter when connecting to 5V UART.
## <a name="cc1352_launchpad_moreinfo"> More information </a> &nbsp;[[TOC]](#cc1352_launchpad_toc)
For detailed information about CC1352R1 MCUs as well as configuring, compiling For detailed information about CC1352R1 MCUs as well as configuring, compiling
RIOT and installation of flashing tools for CC1352R1 boards, RIOT and installation of flashing tools for CC1352R1 boards,
see \ref cc26xx_cc13xx_riot. see \ref cc26xx_cc13xx_riot.

View File

@ -28,8 +28,7 @@
#include "periph/spi.h" #include "periph/spi.h"
#include "nvram-spi.h" #include "nvram-spi.h"
#include "nvram.h" #include "nvram.h"
#include "ztimer.h" #include "xtimer.h"
#include "timex.h"
#include "vfs.h" #include "vfs.h"
#include "fs/devfs.h" #include "fs/devfs.h"
#include "mtd_spi_nor.h" #include "mtd_spi_nor.h"
@ -116,7 +115,7 @@ void board_init(void)
/* NVRAM requires xtimer for timing */ /* NVRAM requires xtimer for timing */
ztimer_init(); xtimer_init();
/* Initialize NVRAM */ /* Initialize NVRAM */
status = mulle_nvram_init(); status = mulle_nvram_init();

View File

@ -198,12 +198,12 @@ static const eth_conf_t eth_config = {
* @{ * @{
*/ */
static const adc_conf_t adc_config[] = { static const adc_conf_t adc_config[] = {
{GPIO_PIN(PORT_A, 3), 2, 3}, {GPIO_PIN(PORT_A, 3), 0, 0},
{GPIO_PIN(PORT_C, 0), 2, 10}, {GPIO_PIN(PORT_C, 0), 0, 1},
{GPIO_PIN(PORT_C, 3), 2, 13}, {GPIO_PIN(PORT_C, 3), 0, 4},
{GPIO_PIN(PORT_F, 3), 2, 9}, {GPIO_PIN(PORT_F, 3), 0, 8},
{GPIO_PIN(PORT_F, 5), 2, 15}, {GPIO_PIN(PORT_F, 5), 0, 11},
{GPIO_PIN(PORT_F, 10), 2, 8}, {GPIO_PIN(PORT_F, 10), 0, 10},
}; };
#define ADC_NUMOF ARRAY_SIZE(adc_config) #define ADC_NUMOF ARRAY_SIZE(adc_config)

View File

@ -1,6 +1,6 @@
/** /**
@defgroup boards_p-nucleo-wb55 STM32 p-nucleo-wb55 @defgroup boards_p-nucleo-wb55 STM32 p-nucleo-wb55
@ingroup boards @ingroup boards_common_nucleo
@brief Support for the STM32 p-nucleo-wb55 @brief Support for the STM32 p-nucleo-wb55
Hardware Hardware
@ -45,7 +45,11 @@ Flashing the device
------------------- -------------------
The ST p-nucleo-wb55 board includes an on-board ST-LINK programmer and can be The ST p-nucleo-wb55 board includes an on-board ST-LINK programmer and can be
flashed using OpenOCD (use version 0.11.0 at least). flashed using OpenOCD.
@note The latest release of OpenOCD doesn't contain support for this board,
so a recent development version must be built from source to be able to flash
this board.
To flash this board, just use the following command: To flash this board, just use the following command:
@ -98,8 +102,8 @@ Implementation Status
| | RTC | yes | | | | RTC | yes | |
| | RNG | yes | | | | RNG | yes | |
| | Timer | yes | TIM2 | | | Timer | yes | TIM2 |
| | WDT | yes | | | | WDT | no | |
| | USB | yes | | | | USB | no | |
| | PWM | no | | | | PWM | no | |
| | AES | no | | | | AES | no | |

View File

@ -1,40 +0,0 @@
/**
@defgroup boards_samr34-xpro Microchip SAM R34 Xplained Pro
@ingroup boards
@brief Support for the Microchip SAM R34 Xplained Pro and WLR089 Xplained Pro
## Overview
The `SAMR34 Xplained Pro` is a compact evaluation board by Microchip featuring a
SAMR34J18 SoC. The SoC includes a SAML21 ARM Cortex-M0+ micro-controller
bundled with Semtech's SX1276, a 868/915 MHz LoRa compatible radio.
For programming the MCU comes with 40Kb of RAM and 256Kb of flash memory.
## Hardware
![samr34-xpro image](https://www.microchip.com/content/dam/mchp/mrt-dam/devtools/3072-180605-wpd-dm320111-2.jpg)
An evaluation board for the radio certified WLR089 module exists as the WLR089 Xplained Pro, it is compatible with the `samr34-xpro`.
![wlr089-xpro](https://www.microchip.com/content/dam/mchp/mrt-dam/devtools/3411-264438-1598368489-c14679-200616-wsg-ev23m25a-wlr089-explained-pro-evaluation-board.jpg)
### MCU
| MCU | SAMR34J18B |
|:---------- |:--------------------- |
| Family | ARM Cortex-M0+ |
| Vendor | Atmel |
| RAM | 32 kiB + 8 kiB battery RAM |
| Flash | 256 KiB |
| Frequency | up to 48MHz |
| FPU | no |
| Timers | 6 (3xTC (8,16,32 bit), 3xTCC (16 bit)) |
| ADCs | 1x 12-bit (8 channels)|
| UARTs | max 5 (shared with SPI and I2C) |
| SPIs | max 5 (see UART) |
| I2Cs | max 5 (see UART) |
| Vcc | 1.8V - 3.6V |
| Datasheet | [Datasheet](https://ww1.microchip.com/downloads/en/DeviceDoc/SAMR34-R35-Low-Power-LoRa-Sub-GHz-SiP-Data-Sheet-DS70005356B.pdf) |
| Board Manual | [SAM R34 XPro](https://www.microchip.com/en-us/development-tool/DM320111)<br>[WLR089 XPro](https://www.microchip.com/en-us/development-tool/EV23M25A)|
*/

View File

@ -7,7 +7,9 @@
*/ */
/** /**
* @ingroup boards_samr34-xpro * @defgroup boards_samr34-xpro Microchip SAM R34 Xplained Pro
* @ingroup boards
* @brief Support for the Microchip SAM R34 Xplained Pro board.
* @{ * @{
* *
* @file * @file
@ -30,50 +32,50 @@ extern "C" {
* @name Semtech SX1276 configuration * @name Semtech SX1276 configuration
* @{ * @{
*/ */
#define SX127X_PARAM_SPI SPI_DEV(0) /**< internal SPI */ #define SX127X_PARAM_SPI (SPI_DEV(0))
#define SX127X_PARAM_SPI_NSS GPIO_PIN(1, 31) /**< D10 */ #define SX127X_PARAM_SPI_NSS GPIO_PIN(1, 31) /* D10 */
#define SX127X_PARAM_RESET GPIO_PIN(1, 15) /**< A0 */ #define SX127X_PARAM_RESET GPIO_PIN(1, 15) /* A0 */
#define SX127X_PARAM_DIO0 GPIO_PIN(1, 16) /**< D2 */ #define SX127X_PARAM_DIO0 GPIO_PIN(1, 16) /* D2 */
#define SX127X_PARAM_DIO1 GPIO_PIN(0, 11) /**< D3 */ #define SX127X_PARAM_DIO1 GPIO_PIN(0, 11) /* D3 */
#define SX127X_PARAM_DIO2 GPIO_PIN(0, 12) /**< D4 */ #define SX127X_PARAM_DIO2 GPIO_PIN(0, 12) /* D4 */
#define SX127X_PARAM_DIO3 GPIO_PIN(1, 17) /**< D5 */ #define SX127X_PARAM_DIO3 GPIO_PIN(1, 17) /* D5 */
#define SX127X_PARAM_PASELECT SX127X_PA_RFO /**< no boost */ #define SX127X_PARAM_PASELECT (SX127X_PA_RFO)
/** @}*/ /** @}*/
/** /**
* @name Board specific configuration * @name Board specific configuration
* @{ * @{
*/ */
#define TCXO_PWR_PIN GPIO_PIN(PA, 9) /**< 32 MHz oscillator for radio enable */ #define TCXO_PWR_PIN GPIO_PIN(PA, 9)
#define TX_OUTPUT_SEL_PIN GPIO_PIN(PA, 13) /**< BAND_SEL */ #define TX_OUTPUT_SEL_PIN GPIO_PIN(PA, 13)
/** @}*/ /** @}*/
/** /**
* @name LED pin definitions and handlers * @name LED pin definitions and handlers
* @{ * @{
*/ */
#define LED_PORT PORT->Group[0] /**< GPIO port */ #define LED_PORT PORT->Group[0]
#define LED0_PIN GPIO_PIN(PA, 18) /**< GPIO pin */ #define LED0_PIN GPIO_PIN(PA, 18)
#define LED0_MASK (1 << 18) /**< GPIO pin mask */ #define LED0_MASK (1 << 18)
#define LED0_ON (LED_PORT.OUTCLR.reg = LED0_MASK) /**< enable LED */ #define LED0_ON (LED_PORT.OUTCLR.reg = LED0_MASK)
#define LED0_OFF (LED_PORT.OUTSET.reg = LED0_MASK) /**< disable LED */ #define LED0_OFF (LED_PORT.OUTSET.reg = LED0_MASK)
#define LED0_TOGGLE (LED_PORT.OUTTGL.reg = LED0_MASK) /**< toggle LED */ #define LED0_TOGGLE (LED_PORT.OUTTGL.reg = LED0_MASK)
#define LED1_PIN GPIO_PIN(PA, 19) /**< GPIO pin */ #define LED1_PIN GPIO_PIN(PA, 19)
#define LED1_MASK (1 << 19) /**< GPIO pin mask */ #define LED1_MASK (1 << 19)
#define LED1_ON (LED_PORT.OUTCLR.reg = LED1_MASK) /**< enable LED */ #define LED1_ON (LED_PORT.OUTCLR.reg = LED1_MASK)
#define LED1_OFF (LED_PORT.OUTSET.reg = LED1_MASK) /**< disable LED */ #define LED1_OFF (LED_PORT.OUTSET.reg = LED1_MASK)
#define LED1_TOGGLE (LED_PORT.OUTTGL.reg = LED1_MASK) /**< toggle LED */ #define LED1_TOGGLE (LED_PORT.OUTTGL.reg = LED1_MASK)
/** @} */ /** @} */
/** /**
* @name BTN0 (SW0 Button) pin definitions * @name BTN0 (SW0 Button) pin definitions
* @{ * @{
*/ */
#define BTN0_PORT PORT->Group[0] /**< GPIO port */ #define BTN0_PORT PORT->Group[0]
#define BTN0_PIN GPIO_PIN(PA, 28) /**< GPIO pin */ #define BTN0_PIN GPIO_PIN(PA, 28)
#define BTN0_MODE GPIO_IN_PU /**< Pull Up GPIO */ #define BTN0_MODE GPIO_IN_PU
/** @} */ /** @} */
/** /**

View File

@ -29,7 +29,5 @@ config BOARD_STM32F429I_DISC1
select BOARD_HAS_LSE select BOARD_HAS_LSE
select HAVE_SAUL_GPIO select HAVE_SAUL_GPIO
select HAVE_ILI9341
select HAVE_STMPE811_I2C
source "$(RIOTBOARD)/common/stm32/Kconfig" source "$(RIOTBOARD)/common/stm32/Kconfig"

View File

@ -28,7 +28,7 @@ config BOARD_STM32F723E_DISCO
select BOARD_HAS_LSE select BOARD_HAS_LSE
select HAVE_SAUL_GPIO select HAVE_SAUL_GPIO
select HAVE_FT5X06 select HAVE_FT6X06
select MODULE_PERIPH_UART_HW_FC if TEST_KCONFIG && HAS_PERIPH_UART_HW_FC select MODULE_PERIPH_UART_HW_FC if TEST_KCONFIG && HAS_PERIPH_UART_HW_FC
# Workaround due to stdout only working with stdin enabled # Workaround due to stdout only working with stdin enabled
select MODULE_STDIN if TEST_KCONFIG select MODULE_STDIN if TEST_KCONFIG

View File

@ -5,7 +5,7 @@ ifneq (,$(filter saul_default,$(USEMODULE)))
endif endif
ifneq (,$(filter touch_dev,$(USEMODULE))) ifneq (,$(filter touch_dev,$(USEMODULE)))
USEMODULE += ft5x06 USEMODULE += ft6x06
endif endif
# TODO: remove the stdin dependency # TODO: remove the stdin dependency

View File

@ -68,7 +68,6 @@ extern "C" {
#define FT5X06_PARAM_INT_PIN GPIO_PIN(PORT_I, 9) /**< Interrupt pin */ #define FT5X06_PARAM_INT_PIN GPIO_PIN(PORT_I, 9) /**< Interrupt pin */
#define FT5X06_PARAM_XMAX (240) /**< Max width */ #define FT5X06_PARAM_XMAX (240) /**< Max width */
#define FT5X06_PARAM_YMAX (240) /**< Max height */ #define FT5X06_PARAM_YMAX (240) /**< Max height */
#define FT5X06_PARAM_TYPE FT5X06_TYPE_FT6X06 /**< Device type */
/** @} */ /** @} */
/** /**

View File

@ -29,6 +29,6 @@ config BOARD_STM32F746G_DISCO
select BOARD_HAS_LSE select BOARD_HAS_LSE
select HAVE_SAUL_GPIO select HAVE_SAUL_GPIO
select HAVE_FT5X06 select HAVE_FT5336
source "$(RIOTBOARD)/common/stm32/Kconfig" source "$(RIOTBOARD)/common/stm32/Kconfig"

View File

@ -11,5 +11,5 @@ ifneq (,$(filter disp_dev,$(USEMODULE)))
endif endif
ifneq (,$(filter touch_dev,$(USEMODULE))) ifneq (,$(filter touch_dev,$(USEMODULE)))
USEMODULE += ft5x06 USEMODULE += ft5336
endif endif

View File

@ -73,7 +73,6 @@ extern "C" {
#define FT5X06_PARAM_INT_PIN GPIO_PIN(PORT_I, 13) /**< Interrupt pin */ #define FT5X06_PARAM_INT_PIN GPIO_PIN(PORT_I, 13) /**< Interrupt pin */
#define FT5X06_PARAM_XMAX (480) /**< Max width */ #define FT5X06_PARAM_XMAX (480) /**< Max width */
#define FT5X06_PARAM_YMAX (272) /**< Max height */ #define FT5X06_PARAM_YMAX (272) /**< Max height */
#define FT5X06_PARAM_TYPE FT5X06_TYPE_FT5336 /**< Device type */
/** @} */ /** @} */
/** /**

View File

@ -375,9 +375,6 @@ unsigned msg_avail(void);
* not be NULL. * not be NULL.
* @param[in] num Number of ``msg_t`` structures in array. * @param[in] num Number of ``msg_t`` structures in array.
* **MUST BE POWER OF TWO!** * **MUST BE POWER OF TWO!**
*
* If array resides on the stack, the containing stack frame must never be
* left, not even if it is the current thread's entry function.
*/ */
void msg_init_queue(msg_t *array, int num); void msg_init_queue(msg_t *array, int num);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2014-2017 Freie Universität Berlin * Copyright (C) 2014 Freie Universität Berlin
* *
* This file is subject to the terms and conditions of the GNU Lesser * This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level * General Public License v2.1. See the file LICENSE in the top level
@ -75,7 +75,6 @@
* @brief Scheduler API definition * @brief Scheduler API definition
* *
* @author Kaspar Schleiser <kaspar@schleiser.de> * @author Kaspar Schleiser <kaspar@schleiser.de>
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
*/ */
#ifndef SCHED_H #ifndef SCHED_H
@ -253,19 +252,6 @@ extern clist_node_t sched_runqueues[SCHED_PRIO_LEVELS];
*/ */
NORETURN void sched_task_exit(void); NORETURN void sched_task_exit(void);
/**
* @brief Change the priority of the given thread
*
* @note This functions expects interrupts to be disabled when called!
*
* @pre (thread != NULL)
* @pre (priority < SCHED_PRIO_LEVELS)
*
* @param[in,out] thread target thread
* @param[in] priority new priority to assign to @p thread
*/
void sched_change_priority(thread_t *thread, uint8_t priority);
/** /**
* @brief Set CPU to idle mode (CPU dependent) * @brief Set CPU to idle mode (CPU dependent)
* *

View File

@ -444,7 +444,7 @@ const char *thread_getname(kernel_pid_t pid);
* *
* Only works if the thread was created with the flag THREAD_CREATE_STACKTEST. * Only works if the thread was created with the flag THREAD_CREATE_STACKTEST.
* *
* @param[in] stack the stack you want to measure. Try `thread_get_stackstart(thread_get_active())` * @param[in] stack the stack you want to measure. Try `thread_get_active()->stack_start`
* *
* @return the amount of unused space of the thread's stack * @return the amount of unused space of the thread's stack
*/ */

View File

@ -19,16 +19,19 @@
* @} * @}
*/ */
#include <errno.h>
#include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <stdbool.h>
#include "auto_init.h" #include <errno.h>
#include "irq.h"
#include "kernel_init.h" #include "kernel_init.h"
#include "log.h"
#include "periph/pm.h"
#include "thread.h" #include "thread.h"
#include "irq.h"
#include "log.h"
#include "periph/pm.h"
#ifdef MODULE_AUTO_INIT
#include <auto_init.h>
#endif
#define ENABLE_DEBUG 0 #define ENABLE_DEBUG 0
#include "debug.h" #include "debug.h"
@ -44,9 +47,9 @@ static void *main_trampoline(void *arg)
{ {
(void)arg; (void)arg;
if (IS_USED(MODULE_AUTO_INIT)) { #ifdef MODULE_AUTO_INIT
auto_init(); auto_init();
} #endif
if (!IS_ACTIVE(CONFIG_SKIP_BOOT_MSG)) { if (!IS_ACTIVE(CONFIG_SKIP_BOOT_MSG)) {
LOG_INFO(CONFIG_BOOT_MSG_STRING "\n"); LOG_INFO(CONFIG_BOOT_MSG_STRING "\n");

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2014-2017 Freie Universität Berlin * Copyright (C) 2014 Freie Universität Berlin
* *
* This file is subject to the terms and conditions of the GNU Lesser * This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level * General Public License v2.1. See the file LICENSE in the top level
@ -15,7 +15,6 @@
* *
* @author Kaspar Schleiser <kaspar@schleiser.de> * @author Kaspar Schleiser <kaspar@schleiser.de>
* @author René Kijewski <rene.kijewski@fu-berlin.de> * @author René Kijewski <rene.kijewski@fu-berlin.de>
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
* *
* @} * @}
*/ */
@ -87,21 +86,21 @@ static void (*sched_cb)(kernel_pid_t active_thread,
* and readout away, switching between the two orders depending on the CLZ * and readout away, switching between the two orders depending on the CLZ
* instruction availability * instruction availability
*/ */
static inline void _set_runqueue_bit(uint8_t priority) static inline void _set_runqueue_bit(thread_t *process)
{ {
#if defined(BITARITHM_HAS_CLZ) #if defined(BITARITHM_HAS_CLZ)
runqueue_bitcache |= BIT31 >> priority; runqueue_bitcache |= BIT31 >> process->priority;
#else #else
runqueue_bitcache |= 1 << priority; runqueue_bitcache |= 1 << process->priority;
#endif #endif
} }
static inline void _clear_runqueue_bit(uint8_t priority) static inline void _clear_runqueue_bit(thread_t *process)
{ {
#if defined(BITARITHM_HAS_CLZ) #if defined(BITARITHM_HAS_CLZ)
runqueue_bitcache &= ~(BIT31 >> priority); runqueue_bitcache &= ~(BIT31 >> process->priority);
#else #else
runqueue_bitcache &= ~(1 << priority); runqueue_bitcache &= ~(1 << process->priority);
#endif #endif
} }
@ -219,54 +218,41 @@ thread_t *__attribute__((used)) sched_run(void)
return next_thread; return next_thread;
} }
/* Note: Forcing the compiler to inline this function will reduce .text for applications void sched_set_status(thread_t *process, thread_status_t status)
* not linking in sched_change_priority(), which benefits the vast majority of apps.
*/
static inline __attribute__((always_inline)) void _runqueue_push(thread_t *thread, uint8_t priority)
{ {
DEBUG("sched_set_status: adding thread %" PRIkernel_pid " to runqueue %" PRIu8 ".\n", if (status >= STATUS_ON_RUNQUEUE) {
thread->pid, priority); if (!(process->status >= STATUS_ON_RUNQUEUE)) {
clist_rpush(&sched_runqueues[priority], &(thread->rq_entry)); DEBUG(
_set_runqueue_bit(priority); "sched_set_status: adding thread %" PRIkernel_pid " to runqueue %" PRIu8 ".\n",
process->pid, process->priority);
clist_rpush(&sched_runqueues[process->priority],
&(process->rq_entry));
_set_runqueue_bit(process);
/* some thread entered a runqueue /* some thread entered a runqueue
* if it is the active runqueue * if it is the active runqueue
* inform the runqueue_change callback */ * inform the runqueue_change callback */
#if (IS_USED(MODULE_SCHED_RUNQ_CALLBACK)) #if (IS_USED(MODULE_SCHED_RUNQ_CALLBACK))
thread_t *active_thread = thread_get_active(); thread_t *active_thread = thread_get_active();
if (active_thread && active_thread->priority == priority) { if (active_thread && active_thread->priority == process->priority) {
sched_runq_callback(priority); sched_runq_callback(process->priority);
} }
#endif #endif
}
/* Note: Forcing the compiler to inline this function will reduce .text for applications
* not linking in sched_change_priority(), which benefits the vast majority of apps.
*/
static inline __attribute__((always_inline)) void _runqueue_pop(thread_t *thread)
{
DEBUG("sched_set_status: removing thread %" PRIkernel_pid " from runqueue %" PRIu8 ".\n",
thread->pid, thread->priority);
clist_lpop(&sched_runqueues[thread->priority]);
if (!sched_runqueues[thread->priority].next) {
_clear_runqueue_bit(thread->priority);
#if (IS_USED(MODULE_SCHED_RUNQ_CALLBACK))
sched_runq_callback(thread->priority);
#endif
}
}
void sched_set_status(thread_t *process, thread_status_t status)
{
if (status >= STATUS_ON_RUNQUEUE) {
if (!(process->status >= STATUS_ON_RUNQUEUE)) {
_runqueue_push(process, process->priority);
} }
} }
else { else {
if (process->status >= STATUS_ON_RUNQUEUE) { if (process->status >= STATUS_ON_RUNQUEUE) {
_runqueue_pop(process); DEBUG(
"sched_set_status: removing thread %" PRIkernel_pid " from runqueue %" PRIu8 ".\n",
process->pid, process->priority);
clist_lpop(&sched_runqueues[process->priority]);
if (!sched_runqueues[process->priority].next) {
_clear_runqueue_bit(process);
#if (IS_USED(MODULE_SCHED_RUNQ_CALLBACK))
sched_runq_callback(process->priority);
#endif
}
} }
} }
@ -320,40 +306,3 @@ void sched_register_cb(void (*callback)(kernel_pid_t, kernel_pid_t))
sched_cb = callback; sched_cb = callback;
} }
#endif #endif
void sched_change_priority(thread_t *thread, uint8_t priority)
{
assert(thread && (priority < SCHED_PRIO_LEVELS));
if (thread->priority == priority) {
return;
}
unsigned irq_state = irq_disable();
if (thread_is_active(thread)) {
_runqueue_pop(thread);
_runqueue_push(thread, priority);
}
thread->priority = priority;
irq_restore(irq_state);
thread_t *active = thread_get_active();
if ((active == thread)
|| ((active != NULL) && (active->priority > priority) && thread_is_active(thread))
) {
/* If the change in priority would result in a different decision of
* the scheduler, we need to yield to make sure the change in priority
* takes effect immediately. This can be due to one of the following:
*
* 1) The priority of the thread currently running has been reduced
* (higher numeric value), so that other threads now have priority
* over the currently running.
* 2) The priority of a pending thread has been increased (lower numeric value) so that it
* now has priority over the running thread.
*/
thread_yield_higher();
}
}

View File

@ -92,7 +92,7 @@ uint32_t rtt_get_counter(void)
void rtt_set_counter(uint32_t counter) void rtt_set_counter(uint32_t counter)
{ {
rtt_alarm -= rtt_offset; rtt_alarm -= rtt_offset;
rtt_offset = _rtt_get_counter() - counter; rtt_offset = _rtt_get_counter() + counter;
rtt_alarm += rtt_offset; rtt_alarm += rtt_offset;
/* re-set the overflow callback */ /* re-set the overflow callback */

View File

@ -137,9 +137,6 @@ void reset_handler_default(void)
} }
#ifdef CPU_HAS_BACKUP_RAM #ifdef CPU_HAS_BACKUP_RAM
#if BACKUP_RAM_HAS_INIT
backup_ram_init();
#endif
if (!cpu_woke_from_backup() || if (!cpu_woke_from_backup() ||
CPU_BACKUP_RAM_NOT_RETAINED) { CPU_BACKUP_RAM_NOT_RETAINED) {
@ -161,7 +158,10 @@ void reset_handler_default(void)
#endif /* CPU_HAS_BACKUP_RAM */ #endif /* CPU_HAS_BACKUP_RAM */
#ifdef MODULE_MPU_NOEXEC_RAM #ifdef MODULE_MPU_NOEXEC_RAM
/* This marks the memory region from 0x20000000 to 0x3FFFFFFF as non /* Mark the RAM non executable. This is a protection mechanism which
* makes exploitation of buffer overflows significantly harder.
*
* This marks the memory region from 0x20000000 to 0x3FFFFFFF as non
* executable. This is the Cortex-M SRAM region used for on-chip RAM. * executable. This is the Cortex-M SRAM region used for on-chip RAM.
*/ */
mpu_configure( mpu_configure(

View File

@ -18,8 +18,6 @@ config CPU_FAM_ESP32
select HAS_ESP_WIFI_ENTERPRISE select HAS_ESP_WIFI_ENTERPRISE
select HAS_PERIPH_ADC_CTRL select HAS_PERIPH_ADC_CTRL
select PACKAGE_ESP32_SDK if TEST_KCONFIG
select PACKAGE_ESP32_SDK_LIBS if TEST_KCONFIG
select MODULE_PERIPH_RTT if HAS_PERIPH_RTT && MODULE_PM_LAYERED select MODULE_PERIPH_RTT if HAS_PERIPH_RTT && MODULE_PM_LAYERED
select MODULE_RTT_RTC if HAS_PERIPH_RTT && MODULE_PERIPH_RTC select MODULE_RTT_RTC if HAS_PERIPH_RTT && MODULE_PERIPH_RTC
select MODULE_PS if MODULE_SHELL select MODULE_PS if MODULE_SHELL

View File

@ -2,9 +2,6 @@
include $(RIOTCPU)/esp_common/Makefile.dep include $(RIOTCPU)/esp_common/Makefile.dep
USEPKG += esp32_sdk
USEPKG += esp32_sdk_libs
USEMODULE += esp_idf_driver USEMODULE += esp_idf_driver
USEMODULE += esp_idf_esp32 USEMODULE += esp_idf_esp32
USEMODULE += esp_idf_soc USEMODULE += esp_idf_soc

View File

@ -1,3 +1,12 @@
# check some environment variables first
ifndef ESP32_SDK_DIR
$(info ESP32_SDK_DIR should be defined as /path/to/esp-idf directory)
$(info ESP32_SDK_DIR is set by default to /opt/esp/esp-idf)
export ESP32_SDK_DIR=/opt/esp/esp-idf
endif
ESP_SDK_DIR = $(ESP32_SDK_DIR)
# ESP32 specific flashing options # ESP32 specific flashing options
FLASH_CHIP = esp32 FLASH_CHIP = esp32
FLASH_MODE ?= dout FLASH_MODE ?= dout
@ -26,23 +35,21 @@ INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/esp32
INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/heap INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/heap
INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/spi_flash INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/spi_flash
INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/tcpip_adapter INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/tcpip_adapter
INCLUDES += -I$(ESP32_SDK_DIR)/components/
INCLUDES += -I$(ESP32_SDK_DIR)/components/driver/include
INCLUDES += -I$(ESP32_SDK_DIR)/components/esp32/include
INCLUDES += -I$(ESP32_SDK_DIR)/components/heap/include
INCLUDES += -I$(ESP32_SDK_DIR)/components/soc/esp32/include
INCLUDES += -I$(ESP32_SDK_DIR)/components/soc/include
INCLUDES += -I$(RIOTCPU)/$(CPU) INCLUDES += -I$(RIOTCPU)/$(CPU)
ifneq (,$(filter esp_eth,$(USEMODULE))) ifneq (,$(filter esp_eth,$(USEMODULE)))
INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/ethernet INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/ethernet
INCLUDES += -I$(ESP32_SDK_DIR)/components/ethernet/include
endif endif
CFLAGS += -DSDK_NOT_USED -DCONFIG_FREERTOS_UNICORE=1 -DESP_PLATFORM CFLAGS += -DSDK_NOT_USED -DCONFIG_FREERTOS_UNICORE=1 -DESP_PLATFORM
CFLAGS += -DLOG_TAG_IN_BRACKETS CFLAGS += -DLOG_TAG_IN_BRACKETS
CFLAGS += -D_CONST=const
ifneq (,$(filter pthread,$(USEMODULE)))
# The toolchain provides POSIX type definitions for pthread which
# conflicts with that in RIOT. With the following CFLAGS/CXXFLAGS skip
# the inclusion of the types shipped by the toolchain.
CFLAGS += -D_SYS__PTHREADTYPES_H_
CXXFLAGS += -D_SYS__PTHREADTYPES_H_
endif
LINKFLAGS += -L$(RIOTCPU)/$(CPU)/ld/ LINKFLAGS += -L$(RIOTCPU)/$(CPU)/ld/
LINKFLAGS += -T$(RIOTCPU)/$(CPU)/ld/esp32.ld LINKFLAGS += -T$(RIOTCPU)/$(CPU)/ld/esp32.ld

View File

@ -408,13 +408,31 @@ export PATH=$PATH:$HOME/esp/xtensa-esp32-elf/bin
[Back to table of contents](#esp32_toc) [Back to table of contents](#esp32_toc)
### ESP-IDF (Espressif IoT Development Framework) {#esp32_installation_of_esp_idf} ### Installation of ESP-IDF (Espressif IoT Development Framework) {#esp32_installation_of_esp_idf}
RIOT-OS uses the ESP-IDF, the official SDK from Espressif, as part of the ESP-IDF, the official SDK from Espressif, can be downloaded and installed as GIT repository.
build. It is downloaded as a package at build-time and there is no need to
install it separately.
### Installation of `esptool.py` (ESP flash programmer tool) {#esp32_installation_of_esptool} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cd $HOME/esp
git clone https://github.com/espressif/esp-idf.git
cd esp-idf
git checkout f198339ec09e90666150672884535802304d23ec
git submodule init
git submodule update
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@note Please take care to checkout correct branches which were used for the port. Newer versions
might also work but were not tested.
Since we only use a few header files, ESP-IDF does not need to be compiled in any way. To use the
installed ESP-IDF, just set the variable `ESP32_SDK_DIR` accordingly.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export ESP32_SDK_DIR=$HOME/esp/esp-idf
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[Back to table of contents](#esp32_toc)
### Installation of esptool.py (ESP flash programmer tool) {#esp32_installation_of_esptool}
The RIOT port does not work with the `esptool.py` ESP flasher program The RIOT port does not work with the `esptool.py` ESP flasher program
available on [GitHub](https://github.com/espressif/esptool) or available on [GitHub](https://github.com/espressif/esptool) or

View File

@ -28,15 +28,6 @@
extern "C" { extern "C" {
#endif #endif
/**
* @brief SDK version number
*
* Determined with `git describe --tags` in `$ESP32_SDK_DIR`
*/
#if !defined(IDF_VER) || DOXYGEN
#include "esp32_idf_version.h"
#endif
/** /**
* @name Clock configuration * @name Clock configuration
* @{ * @{
@ -111,9 +102,7 @@ extern "C" {
#define CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE 2048 #define CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE 2048
#define CONFIG_NUMBER_OF_UNIVERSAL_MAC_ADDRESS 4 #define CONFIG_NUMBER_OF_UNIVERSAL_MAC_ADDRESS 4
#ifdef MODULE_NEWLIB_NANO
#define CONFIG_NEWLIB_NANO_FORMAT 1 #define CONFIG_NEWLIB_NANO_FORMAT 1
#endif
#define CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY 2000 #define CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY 2000
/** /**

View File

@ -1,73 +0,0 @@
/*
* Copyright (C) 2022 Gunar Schorcht
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup cpu_esp32
* @{
*
* @file
* @brief Wrapper for sys/lock.h
*
* @author Gunar Schorcht <gunar@schorcht.net>
*
* This file is a wrapper for sys/lock.h to ensure source code compatibility
* even if retargetable locking is enabled in newlib.
*/
#ifndef SYS_LOCK_H
#define SYS_LOCK_H
#ifndef DOXYGEN
#ifdef __cplusplus
extern "C" {
#endif
#include_next <sys/lock.h>
#if defined(_RETARGETABLE_LOCKING)
/*
* The structured lock type has to be large enough to hold a recursive mutex.
* Since `rmutex.h` cannot be included in this stage of header inclusion,
* `sizeof` cannot be used here and an array of sufficient size has to be
* defined. This is ensured by a `static_assert` in `cpu/esp_common/syscalls.c`.
*/
typedef struct __lock {
void *reserved[2];
} __lock_t;
#endif /* defined(_RETARGETABLE_LOCKING) */
/*
* Declarations for source code compatibility. These functions were used
* in earlier newlib versions. In newer newlib versions, either the
* __lock_* or __retarget_* functions are used. They are still used in
* ESP-IDF.
*/
typedef _LOCK_T _lock_t;
void _lock_init(_lock_t *lock);
void _lock_init_recursive(_lock_t *lock);
void _lock_close(_lock_t *lock);
void _lock_close_recursive(_lock_t *lock);
void _lock_acquire(_lock_t *lock);
void _lock_acquire_recursive(_lock_t *lock);
int _lock_try_acquire(_lock_t *lock);
int _lock_try_acquire_recursive(_lock_t *lock);
void _lock_release(_lock_t *lock);
void _lock_release_recursive(_lock_t *lock);
#ifdef __cplusplus
}
#endif
#endif /* DOXYGEN */
#endif /* SYS_LOCK_H */
/** @} */

View File

@ -28,7 +28,7 @@ extern "C" {
#endif #endif
/** Time since boot in us (64bit version) */ /** Time since boot in us (64bit version) */
int64_t system_get_time_64 (void); uint64_t system_get_time_64 (void);
/** initialize system watchdog timer and start it */ /** initialize system watchdog timer and start it */
void system_wdt_init (void); void system_wdt_init (void);

View File

@ -82,6 +82,14 @@ struct _pwm_hw_t {
const gpio_t* gpios; /* GPIOs used as channel outputs */ const gpio_t* gpios; /* GPIOs used as channel outputs */
}; };
#ifdef PWM0_GPIOS
static const gpio_t _pwm_channel_gpios_0[] = PWM0_GPIOS;
#endif
#ifdef PWM1_GPIOS
static const gpio_t _pwm_channel_gpios_1[] = PWM1_GPIOS;
#endif
/* static configuration of PWM devices */ /* static configuration of PWM devices */
static const struct _pwm_hw_t _pwm_hw[] = static const struct _pwm_hw_t _pwm_hw[] =
{ {

View File

@ -24,7 +24,6 @@
#include <string.h> #include <string.h>
#include <sys/reent.h> #include <sys/reent.h>
#include "macros/units.h"
#include "board.h" #include "board.h"
#include "esp_attr.h" #include "esp_attr.h"
#include "exceptions.h" #include "exceptions.h"
@ -70,6 +69,7 @@
#define ENABLE_DEBUG 0 #define ENABLE_DEBUG 0
#include "debug.h" #include "debug.h"
#define MHZ 1000000UL
#define STRINGIFY(s) STRINGIFY2(s) #define STRINGIFY(s) STRINGIFY2(s)
#define STRINGIFY2(s) #s #define STRINGIFY2(s) #s
@ -156,9 +156,6 @@ NORETURN void IRAM call_start_cpu0 (void)
ets_printf("%02x", cpu_id[i]); ets_printf("%02x", cpu_id[i]);
} }
ets_printf("\n"); ets_printf("\n");
extern char* esp_get_idf_version(void);
LOG_STARTUP("ESP-IDF SDK Version %s\n\n", esp_get_idf_version());
#endif #endif
if (reset_reason == DEEPSLEEP_RESET) { if (reset_reason == DEEPSLEEP_RESET) {
@ -170,7 +167,7 @@ NORETURN void IRAM call_start_cpu0 (void)
LOG_STARTUP("Current clocks in Hz: CPU=%d APB=%d XTAL=%d SLOW=%d\n", LOG_STARTUP("Current clocks in Hz: CPU=%d APB=%d XTAL=%d SLOW=%d\n",
rtc_clk_cpu_freq_value(rtc_clk_cpu_freq_get()), rtc_clk_cpu_freq_value(rtc_clk_cpu_freq_get()),
rtc_clk_apb_freq_get(), MHZ(rtc_clk_xtal_freq_get()), rtc_clk_apb_freq_get(), rtc_clk_xtal_freq_get()*MHZ,
rtc_clk_slow_freq_get_hz()); rtc_clk_slow_freq_get_hz());
if (IS_ACTIVE(ENABLE_DEBUG)) { if (IS_ACTIVE(ENABLE_DEBUG)) {
@ -259,7 +256,7 @@ static void IRAM system_clk_init (void)
set to 2 MHz and handled later */ set to 2 MHz and handled later */
} }
uint32_t freq_before = rtc_clk_cpu_freq_value(rtc_clk_cpu_freq_get()) / MHZ(1); uint32_t freq_before = rtc_clk_cpu_freq_value(rtc_clk_cpu_freq_get()) / MHZ;
if (freq_before != CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ) { if (freq_before != CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ) {
/* set configured CPU frequency */ /* set configured CPU frequency */
@ -327,7 +324,7 @@ static NORETURN void IRAM system_init (void)
/* print some infos */ /* print some infos */
LOG_STARTUP("Used clocks in Hz: CPU=%d APB=%d XTAL=%d FAST=%d SLOW=%d\n", LOG_STARTUP("Used clocks in Hz: CPU=%d APB=%d XTAL=%d FAST=%d SLOW=%d\n",
rtc_clk_cpu_freq_value(rtc_clk_cpu_freq_get()), rtc_clk_cpu_freq_value(rtc_clk_cpu_freq_get()),
rtc_clk_apb_freq_get(), MHZ(rtc_clk_xtal_freq_get()), rtc_clk_apb_freq_get(), rtc_clk_xtal_freq_get()*MHZ,
RTC_FAST_FREQ_8M_MHZ, rtc_clk_slow_freq_get_hz()); RTC_FAST_FREQ_8M_MHZ, rtc_clk_slow_freq_get_hz());
LOG_STARTUP("XTAL calibration value: %d\n", esp_clk_slowclk_cal_get()); LOG_STARTUP("XTAL calibration value: %d\n", esp_clk_slowclk_cal_get());
LOG_STARTUP("Heap free: %u bytes\n", get_free_heap_size()); LOG_STARTUP("Heap free: %u bytes\n", get_free_heap_size());
@ -336,10 +333,6 @@ static NORETURN void IRAM system_init (void)
/* initialize stdio */ /* initialize stdio */
stdio_init(); stdio_init();
/* disable buffering in stdio */
setvbuf(_stdout_r(_REENT), NULL, _IONBF, 0);
setvbuf(_stderr_r(_REENT), NULL, _IONBF, 0);
/* trigger static peripheral initialization */ /* trigger static peripheral initialization */
periph_init(); periph_init();

View File

@ -18,12 +18,8 @@
* @} * @}
*/ */
#include <stdlib.h>
#include <sys/lock.h>
#include <sys/unistd.h> #include <sys/unistd.h>
#include <sys/time.h>
#include "div.h"
#include "esp/common_macros.h" #include "esp/common_macros.h"
#include "irq_arch.h" #include "irq_arch.h"
#include "periph_cpu.h" #include "periph_cpu.h"
@ -31,7 +27,6 @@
#include "syscalls.h" #include "syscalls.h"
#include "timex.h" #include "timex.h"
#include "macros/units.h"
#include "rom/ets_sys.h" #include "rom/ets_sys.h"
#include "rom/libc_stubs.h" #include "rom/libc_stubs.h"
#include "soc/rtc.h" #include "soc/rtc.h"
@ -48,6 +43,8 @@
#define ENABLE_DEBUG 0 #define ENABLE_DEBUG 0
#include "debug.h" #include "debug.h"
#define MHZ 1000000UL
#ifdef MODULE_ESP_IDF_HEAP #ifdef MODULE_ESP_IDF_HEAP
/* if module esp_idf_heap is used, this function has to be defined for ESP32 */ /* if module esp_idf_heap is used, this function has to be defined for ESP32 */
@ -94,55 +91,6 @@ void _exit_r(struct _reent *r, int status)
_exit(status); _exit(status);
} }
#if !IS_USED(MODULE_VFS)
int _fcntl_r(struct _reent *r, int fd, int cmd, int arg)
__attribute__((weak,alias("_no_sys_func")));
#endif
#ifndef CLOCK_REALTIME
#define CLOCK_REALTIME (clockid_t)1
#endif
#ifndef CLOCK_MONOTONIC
#define CLOCK_MONOTONIC (clockid_t)4
#endif
int clock_gettime_r(struct _reent *r, clockid_t clock_id, struct timespec *tp)
{
if (tp == NULL) {
r->_errno = EINVAL;
return -1;
}
struct timeval tv;
uint64_t now = 0;
switch (clock_id) {
case CLOCK_REALTIME:
if (_gettimeofday_r(r, &tv, NULL)) {
return -1;
}
tp->tv_sec = tv.tv_sec;
tp->tv_nsec = tv.tv_usec * NS_PER_US;
break;
case CLOCK_MONOTONIC:
now = system_get_time_64();
tp->tv_sec = div_u64_by_1000000(now);
tp->tv_nsec = (now - (tp->tv_sec * US_PER_SEC)) * NS_PER_US;
break;
default:
r->_errno = EINVAL;
return -1;
}
return 0;
}
int clock_gettime(clockid_t clock_id, struct timespec *tp)
{
return clock_gettime_r(_GLOBAL_REENT, clock_id, tp);
}
static int _no_sys_func(struct _reent *r) static int _no_sys_func(struct _reent *r)
{ {
DEBUG("%s: system function does not exist\n", __func__); DEBUG("%s: system function does not exist\n", __func__);
@ -172,8 +120,8 @@ static struct syscall_stub_table s_stub_table =
._calloc_r = &_calloc_r, ._calloc_r = &_calloc_r,
._sbrk_r = &_sbrk_r, ._sbrk_r = &_sbrk_r,
._system_r = (void *)&_no_sys_func, ._system_r = (int (*)(struct _reent *, const char*))&_no_sys_func,
._raise_r = (void *)&_no_sys_func, ._raise_r = (void (*)(struct _reent *))&_no_sys_func,
._abort = &_abort, ._abort = &_abort,
._exit_r = &_exit_r, ._exit_r = &_exit_r,
._getpid_r = &_getpid_r, ._getpid_r = &_getpid_r,
@ -190,8 +138,8 @@ static struct syscall_stub_table s_stub_table =
._write_r = (int (*)(struct _reent *r, int, const void *, int))&_write_r, ._write_r = (int (*)(struct _reent *r, int, const void *, int))&_write_r,
._read_r = (int (*)(struct _reent *r, int, void *, int))&_read_r, ._read_r = (int (*)(struct _reent *r, int, void *, int))&_read_r,
._unlink_r = &_unlink_r, ._unlink_r = &_unlink_r,
._link_r = (void *)&_no_sys_func, ._link_r = (int (*)(struct _reent *r, const char*, const char*))&_no_sys_func,
._rename_r = (void *)&_no_sys_func, ._rename_r = (int (*)(struct _reent *r, const char*, const char*))&_no_sys_func,
._lock_init = &_lock_init, ._lock_init = &_lock_init,
._lock_init_recursive = &_lock_init_recursive, ._lock_init_recursive = &_lock_init_recursive,
@ -216,7 +164,7 @@ static struct syscall_stub_table s_stub_table =
void IRAM syscalls_init_arch(void) void IRAM syscalls_init_arch(void)
{ {
/* enable the system timer in us (TMG0 is enabled by default) */ /* enable the system timer in us (TMG0 is enabled by default) */
TIMER_SYSTEM.config.divider = rtc_clk_apb_freq_get() / MHZ(1); TIMER_SYSTEM.config.divider = rtc_clk_apb_freq_get()/MHZ;
TIMER_SYSTEM.config.autoreload = 0; TIMER_SYSTEM.config.autoreload = 0;
TIMER_SYSTEM.config.enable = 1; TIMER_SYSTEM.config.enable = 1;
@ -237,7 +185,7 @@ uint32_t system_get_time_ms(void)
return system_get_time_64() / US_PER_MS; return system_get_time_64() / US_PER_MS;
} }
int64_t system_get_time_64(void) uint64_t system_get_time_64(void)
{ {
uint64_t ret; uint64_t ret;
/* latch 64 bit timer value before read */ /* latch 64 bit timer value before read */

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#include <stdlib.h> #include <stddef.h>
#include <sys/lock.h> #include <sys/lock.h>
#include <sys/param.h> #include <sys/param.h>
#include "esp_attr.h" #include "esp_attr.h"

View File

@ -411,8 +411,8 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
._version = ESP_WIFI_OS_ADAPTER_VERSION, ._version = ESP_WIFI_OS_ADAPTER_VERSION,
._set_isr = set_isr_wrapper, ._set_isr = set_isr_wrapper,
#ifdef RIOT_VERSION #ifdef RIOT_VERSION
._ints_on = (void *)xt_ints_on, ._ints_on = (void (*)(unsigned int))xt_ints_on,
._ints_off = (void *)xt_ints_off, ._ints_off = (void (*)(unsigned int))xt_ints_off,
#else #else
._ints_on = xt_ints_on, ._ints_on = xt_ints_on,
._ints_off = xt_ints_off, ._ints_off = xt_ints_off,

View File

@ -482,11 +482,6 @@ void IRAM_ATTR esp_restart_noos(void)
} }
} }
const char* esp_get_idf_version(void)
{
return IDF_VER;
}
/* /*
* source: /path/to/esp-idf/components/wpa_supplicant/port/os_xtensa.c * source: /path/to/esp-idf/components/wpa_supplicant/port/os_xtensa.c
*/ */

View File

@ -309,7 +309,7 @@ IRAM_ATTR void *heap_caps_calloc( size_t n, size_t size, uint32_t caps)
void *r; void *r;
r = heap_caps_malloc(n*size, caps); r = heap_caps_malloc(n*size, caps);
if (r != NULL) { if (r != NULL) {
memset(r, 0, n*size); bzero(r, n*size);
} }
return r; return r;
} }
@ -347,7 +347,7 @@ size_t heap_caps_get_largest_free_block( uint32_t caps )
void heap_caps_get_info( multi_heap_info_t *info, uint32_t caps ) void heap_caps_get_info( multi_heap_info_t *info, uint32_t caps )
{ {
memset(info, 0, sizeof(multi_heap_info_t)); bzero(info, sizeof(multi_heap_info_t));
heap_t *heap; heap_t *heap;
SLIST_FOREACH(heap, &registered_heaps, next) { SLIST_FOREACH(heap, &registered_heaps, next) {

View File

@ -290,7 +290,7 @@ inline static uint32_t get_ccount(void)
static IRAM_ATTR __attribute__((noinline)) void get_call_stack(void **callers) static IRAM_ATTR __attribute__((noinline)) void get_call_stack(void **callers)
{ {
const int offset = 2; // Caller is 2 stack frames deeper than we care about const int offset = 2; // Caller is 2 stack frames deeper than we care about
memset(callers, 0, sizeof(void *) * STACK_DEPTH); bzero(callers, sizeof(void *) * STACK_DEPTH);
TEST_STACK(0); TEST_STACK(0);
TEST_STACK(1); TEST_STACK(1);
TEST_STACK(2); TEST_STACK(2);

View File

@ -9,7 +9,6 @@ config MODULE_ESP_IDF_NVS_FLASH
bool bool
depends on TEST_KCONFIG depends on TEST_KCONFIG
depends on MODULE_ESP_IDF depends on MODULE_ESP_IDF
select MODULE_CPP
select MODULE_MTD select MODULE_MTD
help help
Non-volatile storage library. Non-volatile storage library.

View File

@ -3,6 +3,7 @@ MODULE=esp_idf_nvs_flash
include $(RIOTBASE)/Makefile.base include $(RIOTBASE)/Makefile.base
CFLAGS += -DESP_PLATFORM CFLAGS += -DESP_PLATFORM
CXXFLAGS += -std=c++11
INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/log INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/log
INCLUDES += -I$(ESP32_SDK_DIR)/components/nvs_flash/include INCLUDES += -I$(ESP32_SDK_DIR)/components/nvs_flash/include
INCLUDES += -I$(ESP32_SDK_DIR)/components/spi_flash/include INCLUDES += -I$(ESP32_SDK_DIR)/components/spi_flash/include

View File

@ -4,13 +4,13 @@ include $(RIOTBASE)/Makefile.base
# we have to do it in that way to avoid that $(RIOTBASE)/sys/include/crypto # we have to do it in that way to avoid that $(RIOTBASE)/sys/include/crypto
# is found first # is found first
PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/port/include INCLUDES = -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/port/include
PRE_INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/include INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/include
PRE_INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/port/include INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/port/include
CFLAGS += -D__ets__ CFLAGS += -D__ets__
include $(RIOTCPU)/$(CPU)/Makefile.include include $(RIOTCPU)/$(CPU)/Makefile.include
# This converts INCLUDES to a simply evaluated variable instead of a recursively INCLUDES += -I$(RIOTBASE)/core/include
# one but only for this module. INCLUDES += -I$(RIOTBASE)/drivers/include
INCLUDES := $(PRE_INCLUDES) $(INCLUDES) INCLUDES += -I$(RIOTCPU)/$(CPU)/include

View File

@ -1,240 +0,0 @@
/*-
* Copyright (c) 2002 Thomas Moestl <tmm@FreeBSD.org>
* All rights reserved.
*
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
*
* $FreeBSD$
*/
#ifndef ENDIAN_H
#define ENDIAN_H
#ifdef __cplusplus
extern "C" {
#endif
#include "byteswap.h"
#ifndef BIG_ENDIAN
#define BIG_ENDIAN 4321
#endif
#ifndef LITTLE_ENDIAN
#define LITTLE_ENDIAN 1234
#endif
#ifndef BYTE_ORDER
#ifdef __IEEE_LITTLE_ENDIAN
#define BYTE_ORDER LITTLE_ENDIAN
#else
#define BYTE_ORDER BIG_ENDIAN
#endif
#endif
#define _UINT8_T_DECLARED
#ifndef _UINT8_T_DECLARED
typedef __uint8_t uint8_t;
#define _UINT8_T_DECLARED
#endif
#define _UINT16_T_DECLARED
#ifndef _UINT16_T_DECLARED
typedef __uint16_t uint16_t;
#define _UINT16_T_DECLARED
#endif
#define _UINT32_T_DECLARED
#ifndef _UINT32_T_DECLARED
typedef __uint32_t uint32_t;
#define _UINT32_T_DECLARED
#endif
#define _UINT64_T_DECLARED
#ifndef _UINT64_T_DECLARED
typedef __uint64_t uint64_t;
#define _UINT64_T_DECLARED
#endif
/*
* General byte order swapping functions.
*/
#define bswap16(x) __bswap16(x)
#define bswap32(x) __bswap32(x)
#define bswap64(x) __bswap64(x)
/*
* Host to big endian, host to little endian, big endian to host, and little
* endian to host byte order functions as detailed in byteorder(9).
*/
#if 1 //BYTE_ORDER == _LITTLE_ENDIAN
#if __GNUC__ <= 5
#define __bswap16 __bswap_16
#define __bswap32 __bswap_32
#endif
#define htobe16(x) bswap16((x))
#define htobe32(x) bswap32((x))
#define htobe64(x) bswap64((x))
#define htole16(x) ((uint16_t)(x))
#define htole32(x) ((uint32_t)(x))
#define htole64(x) ((uint64_t)(x))
#define be16toh(x) bswap16((x))
#define be32toh(x) bswap32((x))
#define be64toh(x) bswap64((x))
#define le16toh(x) ((uint16_t)(x))
#define le32toh(x) ((uint32_t)(x))
#define le64toh(x) ((uint64_t)(x))
#ifndef htons
#define htons htobe16
#endif //htons
#else /* _BYTE_ORDER != _LITTLE_ENDIAN */
#define htobe16(x) ((uint16_t)(x))
#define htobe32(x) ((uint32_t)(x))
#define htobe64(x) ((uint64_t)(x))
#define htole16(x) bswap16((x))
#define htole32(x) bswap32((x))
#define htole64(x) bswap64((x))
#define be16toh(x) ((uint16_t)(x))
#define be32toh(x) ((uint32_t)(x))
#define be64toh(x) ((uint64_t)(x))
#define le16toh(x) bswap16((x))
#define le32toh(x) bswap32((x))
#define le64toh(x) bswap64((x))
#endif /* _BYTE_ORDER == _LITTLE_ENDIAN */
/* Alignment-agnostic encode/decode bytestream to/from little/big endian. */
#define INLINE __inline__
static INLINE uint16_t
be16dec(const void *pp)
{
uint8_t const *p = (uint8_t const *)pp;
return ((p[0] << 8) | p[1]);
}
static INLINE uint32_t
be32dec(const void *pp)
{
uint8_t const *p = (uint8_t const *)pp;
return (((unsigned)p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]);
}
static INLINE uint64_t
be64dec(const void *pp)
{
uint8_t const *p = (uint8_t const *)pp;
return (((uint64_t)be32dec(p) << 32) | be32dec(p + 4));
}
static INLINE uint16_t
le16dec(const void *pp)
{
uint8_t const *p = (uint8_t const *)pp;
return ((p[1] << 8) | p[0]);
}
static INLINE uint32_t
le32dec(const void *pp)
{
uint8_t const *p = (uint8_t const *)pp;
return (((unsigned)p[3] << 24) | (p[2] << 16) | (p[1] << 8) | p[0]);
}
static INLINE uint64_t
le64dec(const void *pp)
{
uint8_t const *p = (uint8_t const *)pp;
return (((uint64_t)le32dec(p + 4) << 32) | le32dec(p));
}
static INLINE void
be16enc(void *pp, uint16_t u)
{
uint8_t *p = (uint8_t *)pp;
p[0] = (u >> 8) & 0xff;
p[1] = u & 0xff;
}
static INLINE void
be32enc(void *pp, uint32_t u)
{
uint8_t *p = (uint8_t *)pp;
p[0] = (u >> 24) & 0xff;
p[1] = (u >> 16) & 0xff;
p[2] = (u >> 8) & 0xff;
p[3] = u & 0xff;
}
static INLINE void
be64enc(void *pp, uint64_t u)
{
uint8_t *p = (uint8_t *)pp;
be32enc(p, (uint32_t)(u >> 32));
be32enc(p + 4, (uint32_t)(u & 0xffffffffU));
}
static INLINE void
le16enc(void *pp, uint16_t u)
{
uint8_t *p = (uint8_t *)pp;
p[0] = u & 0xff;
p[1] = (u >> 8) & 0xff;
}
static INLINE void
le32enc(void *pp, uint32_t u)
{
uint8_t *p = (uint8_t *)pp;
p[0] = u & 0xff;
p[1] = (u >> 8) & 0xff;
p[2] = (u >> 16) & 0xff;
p[3] = (u >> 24) & 0xff;
}
static INLINE void
le64enc(void *pp, uint64_t u)
{
uint8_t *p = (uint8_t *)pp;
le32enc(p, (uint32_t)(u & 0xffffffffU));
le32enc(p + 4, (uint32_t)(u >> 32));
}
#ifdef __cplusplus
}
#endif
#endif /* ENDIAN_H */

View File

@ -26,7 +26,6 @@ extern "C" {
#include "esp_types.h" #include "esp_types.h"
#include <string.h> #include <string.h>
#include <strings.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "esp_err.h" #include "esp_err.h"
@ -214,7 +213,7 @@ char * os_readfile(const char *name, size_t *len);
#endif #endif
#ifndef os_bzero #ifndef os_bzero
#define os_bzero(s, n) memset(s, 0, n) #define os_bzero(s, n) bzero(s, n)
#endif #endif
@ -222,7 +221,6 @@ char * os_readfile(const char *name, size_t *len);
#ifdef _MSC_VER #ifdef _MSC_VER
#define os_strdup(s) _strdup(s) #define os_strdup(s) _strdup(s)
#else #else
char *strdup(const char *s);
#define os_strdup(s) strdup(s) #define os_strdup(s) strdup(s)
#endif #endif
#endif #endif

View File

@ -4,16 +4,15 @@ include $(RIOTBASE)/Makefile.base
# we have to do it in that way to avoid that $(RIOTBASE)/sys/include/crypto # we have to do it in that way to avoid that $(RIOTBASE)/sys/include/crypto
# is found first # is found first
PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/log INCLUDES = -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include
PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include/wpa
PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include/wpa INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/port/include
PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/port/include INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/include
PRE_INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/include INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/port/include
PRE_INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/port/include
CFLAGS += -D__ets__ -DESPRESSIF_USE -DESP32_IDF_CODE=1 CFLAGS += -D__ets__ -DESPRESSIF_USE -DESP32_IDF_CODE=1
include $(RIOTCPU)/$(CPU)/Makefile.include include $(RIOTCPU)/$(CPU)/Makefile.include
# This converts INCLUDES to a simply evaluated variable instead of a recursively INCLUDES += -I$(RIOTBASE)/core/include
# one but only for this module. INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/log
INCLUDES := $(PRE_INCLUDES) $(INCLUDES) INCLUDES += -I$(RIOTCPU)/$(CPU)/include

View File

@ -4,18 +4,16 @@ include $(RIOTBASE)/Makefile.base
# we have to do it in that way to avoid that $(RIOTBASE)/sys/include/crypto # we have to do it in that way to avoid that $(RIOTBASE)/sys/include/crypto
# is found first # is found first
PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/log INCLUDES = -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include
PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include/wpa
PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include/wpa INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/port/include
PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/port/include INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/include
PRE_INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/include INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/port/include
PRE_INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/port/include
CFLAGS += -D__ets__ -DESPRESSIF_USE -DESP32_IDF_CODE=1 CFLAGS += -D__ets__ -DESPRESSIF_USE -DESP32_IDF_CODE=1
CFLAGS += -DEAP_PEER_METHOD -DEAP_TLS -DEAP_PEAP -DEAP_TTLS -DEAP_MSCHAPv2 -DUSE_WPA2_TASK CFLAGS += -DEAP_PEER_METHOD -DEAP_TLS -DEAP_PEAP -DEAP_TTLS -DEAP_MSCHAPv2 -DUSE_WPA2_TASK
CFLAGS += -Wno-stringop-truncation
include $(RIOTCPU)/$(CPU)/Makefile.include include $(RIOTCPU)/$(CPU)/Makefile.include
# This converts INCLUDES to a simply evaluated variable instead of a recursively INCLUDES += -I$(RIOTBASE)/core/include
# one but only for this module. INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/log
INCLUDES := $(PRE_INCLUDES) $(INCLUDES) INCLUDES += -I$(RIOTCPU)/$(CPU)/include

View File

@ -4,17 +4,15 @@ include $(RIOTBASE)/Makefile.base
# we have to do it in that way to avoid that $(RIOTBASE)/sys/include/crypto # we have to do it in that way to avoid that $(RIOTBASE)/sys/include/crypto
# is found first # is found first
PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/log INCLUDES = -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include
PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include/wpa
PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include/wpa INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/port/include
PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/port/include INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/include
PRE_INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/include INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/port/include
PRE_INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/port/include
CFLAGS += -D__ets__ -DESPRESSIF_USE -DESP32_IDF_CODE=1 CFLAGS += -D__ets__ -DESPRESSIF_USE -DESP32_IDF_CODE=1
CFLAGS += -Wno-implicit-fallthrough
include $(RIOTCPU)/$(CPU)/Makefile.include include $(RIOTCPU)/$(CPU)/Makefile.include
# This converts INCLUDES to a simply evaluated variable instead of a recursively INCLUDES += -I$(RIOTBASE)/core/include
# one but only for this module. INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/log
INCLUDES := $(PRE_INCLUDES) $(INCLUDES) INCLUDES += -I$(RIOTCPU)/$(CPU)/include

View File

@ -4,16 +4,15 @@ include $(RIOTBASE)/Makefile.base
# we have to do it in that way to avoid that $(RIOTBASE)/sys/include/crypto # we have to do it in that way to avoid that $(RIOTBASE)/sys/include/crypto
# is found first # is found first
PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/log INCLUDES = -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include
PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include/wpa
PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include/wpa INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/port/include
PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/port/include INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/include
PRE_INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/include INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/port/include
PRE_INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/port/include
CFLAGS += -D__ets__ -DESPRESSIF_USE -DESP32_IDF_CODE=1 CFLAGS += -D__ets__ -DESPRESSIF_USE -DESP32_IDF_CODE=1
include $(RIOTCPU)/$(CPU)/Makefile.include include $(RIOTCPU)/$(CPU)/Makefile.include
# This converts INCLUDES to a simply evaluated variable instead of a recursively INCLUDES += -I$(RIOTBASE)/core/include
# one but only for this module. INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/log
INCLUDES := $(PRE_INCLUDES) $(INCLUDES) INCLUDES += -I$(RIOTCPU)/$(CPU)/include

View File

@ -9,6 +9,5 @@ config MODULE_ESP_IDF_NVS_FLASH
bool bool
depends on TEST_KCONFIG depends on TEST_KCONFIG
depends on MODULE_ESP_IDF depends on MODULE_ESP_IDF
select MODULE_CPP
help help
Non-volatile storage library. Non-volatile storage library.

View File

@ -3,5 +3,6 @@ MODULE=esp_idf_nvs_flash
include $(RIOTBASE)/Makefile.base include $(RIOTBASE)/Makefile.base
CFLAGS += -DESP_PLATFORM -DNVS_CRC_HEADER_FILE=\"crc.h\" CFLAGS += -DESP_PLATFORM -DNVS_CRC_HEADER_FILE=\"crc.h\"
CXXFLAGS += -std=c++11
INCLUDES += -I$(ESP8266_RTOS_SDK_DIR)/components/nvs_flash/include INCLUDES += -I$(ESP8266_RTOS_SDK_DIR)/components/nvs_flash/include
INCLUDES += -I$(ESP8266_RTOS_SDK_DIR)/components/util/include INCLUDES += -I$(ESP8266_RTOS_SDK_DIR)/components/util/include

View File

@ -25,10 +25,7 @@ USEMODULE += xtensa
# Features used by ESP* # Features used by ESP*
FEATURES_REQUIRED += newlib FEATURES_REQUIRED += newlib
FEATURES_REQUIRED += cpp # Vendor code uses C++
ifneq (,$(filter esp_idf_nvs_flash,$(USEMODULE)))
FEATURES_REQUIRED += cpp
endif
ifneq (,$(filter esp_wifi_ap,$(USEMODULE))) ifneq (,$(filter esp_wifi_ap,$(USEMODULE)))
FEATURES_REQUIRED += esp_wifi_ap FEATURES_REQUIRED += esp_wifi_ap

View File

@ -81,11 +81,11 @@ CFLAGS += $(if $(findstring dout,$(FLASH_MODE)),-DFLASH_MODE_DOUT=1)
ARCHIVES += -lhal -lg -lc ARCHIVES += -lhal -lg -lc
LINKFLAGS += $(CFLAGS_OPT) $(CFLAGS_DBG) LINKFLAGS += $(CFLAGS_OPT) $(CFLAGS_DBG)
#ifneq ($(CPU),esp8266) ifneq ($(CPU),esp8266)
# esp8266 flags are added by the SDK pkg in pkg/esp8266_sdk # esp8266 flags are added by the SDK pkg in pkg/esp8266_sdk
#LINKFLAGS += -L$(ESP_SDK_DIR)/components/$(CPU) LINKFLAGS += -L$(ESP_SDK_DIR)/components/$(CPU)
#LINKFLAGS += -L$(ESP_SDK_DIR)/components/$(CPU)/lib LINKFLAGS += -L$(ESP_SDK_DIR)/components/$(CPU)/lib
#endif endif
LINKFLAGS += -nostdlib -Wl,-gc-sections -Wl,-static LINKFLAGS += -nostdlib -Wl,-gc-sections -Wl,-static
# use the wrapper functions for calloc to add correct overflow detection missing # use the wrapper functions for calloc to add correct overflow detection missing

View File

@ -6,3 +6,6 @@ CONFIG_MODULE_PRNG_MUSL_LCG=y
CONFIG_MODULE_PERIPH_HWRNG=y CONFIG_MODULE_PERIPH_HWRNG=y
CONFIG_MODULE_PERIPH_UART=y CONFIG_MODULE_PERIPH_UART=y
CONFIG_MODULE_NEWLIB=y CONFIG_MODULE_NEWLIB=y
# Vendor code uses C++
CONFIG_MODULE_CPP=y

View File

@ -78,7 +78,7 @@ BaseType_t xTaskCreatePinnedToCore (TaskFunction_t pvTaskCode,
uxPriority, uxPriority,
THREAD_CREATE_WOUT_YIELD | THREAD_CREATE_WOUT_YIELD |
THREAD_CREATE_STACKTEST, THREAD_CREATE_STACKTEST,
(void *)pvTaskCode, (thread_task_func_t)pvTaskCode,
pvParameters, pcName); pvParameters, pcName);
DEBUG("pid=%d\n", pid); DEBUG("pid=%d\n", pid);

View File

@ -88,7 +88,6 @@ static uint32_t _flash_size; /* resulting size of the flash drive in SPI flash *
static esp_rom_spiflash_chip_t* _flashchip = NULL; static esp_rom_spiflash_chip_t* _flashchip = NULL;
#ifdef MCU_ESP8266
/* flash_id determines the flash size in kByte */ /* flash_id determines the flash size in kByte */
static const uint32_t flash_sizes[] = { static const uint32_t flash_sizes[] = {
256, /* last byte of id is 0x12 */ 256, /* last byte of id is 0x12 */
@ -99,7 +98,6 @@ static const uint32_t flash_sizes[] = {
8 * 1024, /* last byte of id is 0x17 */ 8 * 1024, /* last byte of id is 0x17 */
16 * 1024 /* last byte of id is 0x18 */ 16 * 1024 /* last byte of id is 0x18 */
}; };
#endif
void spi_flash_drive_init (void) void spi_flash_drive_init (void)
{ {
@ -462,7 +460,7 @@ const esp_partition_t* esp_partition_find_first(esp_partition_type_t type,
part->address = info->pos.offset; part->address = info->pos.offset;
part->size = info->pos.size; part->size = info->pos.size;
part->encrypted = info->flags & PART_FLAG_ENCRYPTED; part->encrypted = info->flags & PART_FLAG_ENCRYPTED;
strncpy(part->label, (const char*)info->label, sizeof(part->label)); strncpy(part->label, (const char*)info->label, sizeof(info->label));
part->label[sizeof(part->label) - 1] = 0x0; part->label[sizeof(part->label) - 1] = 0x0;
return part; return part;

View File

@ -252,77 +252,6 @@ void IRAM_ATTR _lock_release_recursive(_lock_t *lock)
rmutex_unlock((rmutex_t*)*lock); rmutex_unlock((rmutex_t*)*lock);
} }
#if defined(_RETARGETABLE_LOCKING)
/* check whether `struct __lock` is large enough to hold a recursive mutex */
static_assert(sizeof(struct __lock) >= sizeof(rmutex_t),
"struct __lock is too small to hold a recursive mutex of type rmutex_t");
/* definition of locks required by the newlib if retargetable locking is used */
struct __lock __lock___sinit_recursive_mutex;
struct __lock __lock___sfp_recursive_mutex;
struct __lock __lock___atexit_recursive_mutex;
struct __lock __lock___at_quick_exit_mutex;
struct __lock __lock___malloc_recursive_mutex;
struct __lock __lock___env_recursive_mutex;
struct __lock __lock___tz_mutex;
struct __lock __lock___dd_hash_mutex;
struct __lock __lock___arc4random_mutex;
/* map newlib's `__retarget_*` functions to the existing `_lock_*` functions */
void __retarget_lock_init(_LOCK_T *lock)
{
_lock_init(lock);
}
extern void __retarget_lock_init_recursive(_LOCK_T *lock)
{
_lock_init_recursive(lock);
}
void __retarget_lock_close(_LOCK_T lock)
{
_lock_close(&lock);
}
void __retarget_lock_close_recursive(_LOCK_T lock)
{
_lock_close_recursive(&lock);
}
void __retarget_lock_acquire(_LOCK_T lock)
{
_lock_acquire(&lock);
}
void __retarget_lock_acquire_recursive(_LOCK_T lock)
{
_lock_acquire_recursive(&lock);
}
int __retarget_lock_try_acquire(_LOCK_T lock)
{
return _lock_try_acquire(&lock);
}
int __retarget_lock_try_acquire_recursive(_LOCK_T lock)
{
return _lock_try_acquire_recursive(&lock);
}
void __retarget_lock_release(_LOCK_T lock)
{
_lock_release(&lock);
}
void __retarget_lock_release_recursive(_LOCK_T lock)
{
_lock_release(&lock);
}
#endif /* _RETARGETABLE_LOCKING */
/** /**
* @name Memory allocation functions * @name Memory allocation functions
*/ */
@ -355,7 +284,7 @@ void* IRAM_ATTR __wrap__calloc_r(struct _reent *r, size_t count, size_t size)
} }
void *result = heap_caps_malloc_default(size_total); void *result = heap_caps_malloc_default(size_total);
if (result) { if (result) {
memset(result, 0, size_total); bzero(result, size_total);
} }
return result; return result;
} }

View File

@ -3,8 +3,7 @@ USEMODULE += bitfield
USEMODULE += periph USEMODULE += periph
ifneq (,$(filter mci,$(USEMODULE))) ifneq (,$(filter mci,$(USEMODULE)))
USEMODULE += ztimer USEMODULE += xtimer
USEMODULE += ztimer_usec
endif endif
include $(RIOTCPU)/arm7_common/Makefile.dep include $(RIOTCPU)/arm7_common/Makefile.dep

View File

@ -9,4 +9,4 @@ config MODULE_MCI
bool "LPC23XX Multimedia Card Interface (MCI) driver" bool "LPC23XX Multimedia Card Interface (MCI) driver"
depends on CPU_FAM_LPC23XX depends on CPU_FAM_LPC23XX
depends on TEST_KCONFIG depends on TEST_KCONFIG
select ZTIMER_USEC select MODULE_XTIMER

View File

@ -16,8 +16,7 @@
#include <string.h> #include <string.h>
#include "cpu.h" #include "cpu.h"
#include "VIC.h" #include "VIC.h"
#include "ztimer.h" #include "xtimer.h"
#include "timex.h"
#include "diskio.h" #include "diskio.h"
#define ENABLE_DEBUG 0 #define ENABLE_DEBUG 0
@ -320,7 +319,7 @@ static void power_on(void)
MCI_POWER = 0x01; /* Power on */ MCI_POWER = 0x01; /* Power on */
//for (Timer[0] = 10; Timer[0]; ) ; /* 10ms */ //for (Timer[0] = 10; Timer[0]; ) ; /* 10ms */
ztimer_sleep(ZTIMER_USEC, 1 * US_PER_MS); xtimer_usleep(1000);
MCI_POWER = 0x03; /* Enable signals */ MCI_POWER = 0x03; /* Enable signals */
} }
@ -401,12 +400,12 @@ static int send_cmd(unsigned int idx, unsigned long arg, unsigned int rt, unsign
MCI_COMMAND = mc; /* Initiate command transaction */ MCI_COMMAND = mc; /* Initiate command transaction */
//Timer[1] = 100; //Timer[1] = 100;
uint32_t timerstart = ztimer_now(ZTIMER_USEC); uint32_t timerstart = xtimer_now_usec();
while (1) { /* Wait for end of the cmd/resp transaction */ while (1) { /* Wait for end of the cmd/resp transaction */
//if (!Timer[1]) return 0; //if (!Timer[1]) return 0;
if ((ztimer_now(ZTIMER_USEC) - timerstart) > 10 * US_PER_MS) { if ((xtimer_now_usec() - timerstart) > 10000) {
return 0; return 0;
} }
@ -460,10 +459,10 @@ static int wait_ready(unsigned short tmr)
{ {
unsigned long rc; unsigned long rc;
uint32_t stoppoll = ztimer_now(ZTIMER_USEC) + tmr * US_PER_MS; uint32_t stoppoll = xtimer_now_usec() + tmr * US_PER_MS;
bool bBreak = false; bool bBreak = false;
while (ztimer_now(ZTIMER_USEC) < stoppoll/*Timer[0]*/) { while (xtimer_now_usec() < stoppoll/*Timer[0]*/) {
if (send_cmd(CMD13, (unsigned long) CardRCA << 16, 1, &rc) && ((rc & 0x01E00) == 0x00800)) { if (send_cmd(CMD13, (unsigned long) CardRCA << 16, 1, &rc) && ((rc & 0x01E00) == 0x00800)) {
bBreak = true; bBreak = true;
break; break;
@ -510,12 +509,12 @@ diskio_sta_t mci_initialize(void)
power_off(); power_off();
ztimer_sleep(ZTIMER_USEC, 1 * US_PER_MS); xtimer_usleep(1000);
power_on(); /* Force socket power on */ power_on(); /* Force socket power on */
MCI_CLOCK = 0x100 | (PCLK / MCLK_ID / 2 - 1); /* Set MCICLK = MCLK_ID */ MCI_CLOCK = 0x100 | (PCLK / MCLK_ID / 2 - 1); /* Set MCICLK = MCLK_ID */
//for (Timer[0] = 2; Timer[0]; ); //for (Timer[0] = 2; Timer[0]; );
ztimer_sleep(ZTIMER_USEC, 250); xtimer_usleep(250);
send_cmd(CMD0, 0, 0, resp); /* Enter idle state */ send_cmd(CMD0, 0, 0, resp); /* Enter idle state */
CardRCA = 0; CardRCA = 0;
@ -523,7 +522,7 @@ diskio_sta_t mci_initialize(void)
/*---- Card is 'idle' state ----*/ /*---- Card is 'idle' state ----*/
/* Initialization timeout of 1000 msec */ /* Initialization timeout of 1000 msec */
uint32_t start = ztimer_now(ZTIMER_USEC); uint32_t start = xtimer_now_usec();
/* SDC Ver2 */ /* SDC Ver2 */
if (send_cmd(CMD8, 0x1AA, 1, resp) && (resp[0] & 0xFFF) == 0x1AA) { if (send_cmd(CMD8, 0x1AA, 1, resp) && (resp[0] & 0xFFF) == 0x1AA) {
@ -533,7 +532,7 @@ diskio_sta_t mci_initialize(void)
do { do {
/* Wait while card is busy state (use ACMD41 with HCS bit) */ /* Wait while card is busy state (use ACMD41 with HCS bit) */
/* This loop will take a time. Insert wai_tsk(1) here for multitask envilonment. */ /* This loop will take a time. Insert wai_tsk(1) here for multitask envilonment. */
if (ztimer_now(ZTIMER_USEC) > (start + 1 * US_PER_SEC /* !Timer[0] */)) { if (xtimer_now_usec() > (start + 1000000/* !Timer[0] */)) {
DEBUG("%s, %d: Timeout #1\n", RIOT_FILE_RELATIVE, __LINE__); DEBUG("%s, %d: Timeout #1\n", RIOT_FILE_RELATIVE, __LINE__);
goto di_fail; goto di_fail;
} }
@ -559,9 +558,9 @@ diskio_sta_t mci_initialize(void)
DEBUG("%s, %d: %lX\n", RIOT_FILE_RELATIVE, __LINE__, resp[0]); DEBUG("%s, %d: %lX\n", RIOT_FILE_RELATIVE, __LINE__, resp[0]);
/* This loop will take a time. Insert wai_tsk(1) here for multitask envilonment. */ /* This loop will take a time. Insert wai_tsk(1) here for multitask envilonment. */
if (ztimer_now(ZTIMER_USEC) > (start + 1 * US_PER_SEC/* !Timer[0] */)) { if (xtimer_now_usec() > (start + 1000000/* !Timer[0] */)) {
DEBUG("now: %" PRIu32 "us, started at: %" PRIu32 "\n", DEBUG("now: %" PRIu32 ", started at: %" PRIu32 "\n",
(uint32_t) ztimer_now(ZTIMER_USEC), start); xtimer_now_usec(), start);
DEBUG("%s, %d: Timeout #2\n", RIOT_FILE_RELATIVE, __LINE__); DEBUG("%s, %d: Timeout #2\n", RIOT_FILE_RELATIVE, __LINE__);
goto di_fail; goto di_fail;
} }

View File

@ -102,10 +102,11 @@ int thread_isr_stack_usage(void)
return -1; return -1;
} }
static inline void *align_stack(uintptr_t start, int *stacksize) static inline void *align_stack(void *stack_start, int *stacksize)
{ {
const size_t alignment = sizeof(uintptr_t); const size_t alignment = sizeof(uintptr_t);
const uintptr_t align_mask = alignment - 1; const uintptr_t align_mask = alignment - 1;
uintptr_t start = (uintptr_t)stack_start;
size_t unalignment = (start & align_mask) size_t unalignment = (start & align_mask)
? (alignment - (start & align_mask)) : 0; ? (alignment - (start & align_mask)) : 0;
start += unalignment; start += unalignment;
@ -116,9 +117,10 @@ static inline void *align_stack(uintptr_t start, int *stacksize)
char *thread_stack_init(thread_task_func_t task_func, void *arg, void *stack_start, int stacksize) char *thread_stack_init(thread_task_func_t task_func, void *arg, void *stack_start, int stacksize)
{ {
char *stk;
ucontext_t *p; ucontext_t *p;
stack_start = align_stack((uintptr_t)stack_start, &stacksize); stack_start = align_stack(stack_start, &stacksize);
VALGRIND_STACK_REGISTER(stack_start, (char *)stack_start + stacksize); VALGRIND_STACK_REGISTER(stack_start, (char *)stack_start + stacksize);
VALGRIND_DEBUG("VALGRIND_STACK_REGISTER(%p, %p)\n", VALGRIND_DEBUG("VALGRIND_STACK_REGISTER(%p, %p)\n",
@ -126,16 +128,18 @@ char *thread_stack_init(thread_task_func_t task_func, void *arg, void *stack_sta
DEBUG("thread_stack_init\n"); DEBUG("thread_stack_init\n");
stk = stack_start;
/* Use intermediate cast to uintptr_t to silence -Wcast-align. The stack /* Use intermediate cast to uintptr_t to silence -Wcast-align. The stack
* is aligned to word size above. */ * is aligned to word size above. */
p = (ucontext_t *)(uintptr_t)((uint8_t *)stack_start + (stacksize - sizeof(ucontext_t))); p = (ucontext_t *)(uintptr_t)(stk + (stacksize - sizeof(ucontext_t)));
stacksize -= sizeof(ucontext_t); stacksize -= sizeof(ucontext_t);
if (getcontext(p) == -1) { if (getcontext(p) == -1) {
err(EXIT_FAILURE, "thread_stack_init: getcontext"); err(EXIT_FAILURE, "thread_stack_init: getcontext");
} }
p->uc_stack.ss_sp = stack_start; p->uc_stack.ss_sp = stk;
p->uc_stack.ss_size = stacksize; p->uc_stack.ss_size = stacksize;
p->uc_stack.ss_flags = 0; p->uc_stack.ss_flags = 0;
p->uc_link = &end_context; p->uc_link = &end_context;

View File

@ -259,7 +259,6 @@ static int _confirm_op(ieee802154_dev_t *dev, ieee802154_hal_op_t op, void *ctx)
int radio_state = NRF_RADIO->STATE; int radio_state = NRF_RADIO->STATE;
switch (op) { switch (op) {
case IEEE802154_HAL_OP_TRANSMIT: case IEEE802154_HAL_OP_TRANSMIT:
info = ctx;
eagain = (state != STATE_IDLE eagain = (state != STATE_IDLE
&& state != STATE_CCA_BUSY && NRF_RADIO->STATE != RADIO_STATE_STATE_Disabled); && state != STATE_CCA_BUSY && NRF_RADIO->STATE != RADIO_STATE_STATE_Disabled);

View File

@ -12,7 +12,7 @@ config CPU_ARCH_RISCV
select HAS_NEWLIB select HAS_NEWLIB
select HAS_PERIPH_CORETIMER select HAS_PERIPH_CORETIMER
select HAS_PICOLIBC if '$(RIOT_CI_BUILD)' != '1' select HAS_PICOLIBC if '$(RIOT_CI_BUILD)' != '1'
select HAS_RUST_TARGET #select HAS_RUST_TARGET
select HAS_SSP select HAS_SSP
select MODULE_MALLOC_THREAD_SAFE if TEST_KCONFIG select MODULE_MALLOC_THREAD_SAFE if TEST_KCONFIG

View File

@ -8,7 +8,7 @@ FEATURES_PROVIDED += cpp
FEATURES_PROVIDED += libstdcpp FEATURES_PROVIDED += libstdcpp
FEATURES_PROVIDED += newlib FEATURES_PROVIDED += newlib
FEATURES_PROVIDED += periph_coretimer FEATURES_PROVIDED += periph_coretimer
FEATURES_PROVIDED += rust_target #FEATURES_PROVIDED += rust_target
FEATURES_PROVIDED += ssp FEATURES_PROVIDED += ssp
# RISC-V toolchain on CI does not work properly with picolibc yet # RISC-V toolchain on CI does not work properly with picolibc yet

View File

@ -35,8 +35,8 @@ SECTIONS
__stack_size = DEFINED(__stack_size) ? __stack_size : 256; __stack_size = DEFINED(__stack_size) ? __stack_size : 256;
/* Populate information about rom size */ /* Populate information about rom size */
_srom = ORIGIN(flash); _srom = ORIGIN(rom);
_erom = ORIGIN(flash) + LENGTH(flash); _erom = ORIGIN(rom) + LENGTH(rom);
.init : .init :
{ {
@ -220,5 +220,5 @@ SECTIONS
.end_fw (NOLOAD) : ALIGN(4) { .end_fw (NOLOAD) : ALIGN(4) {
_end_fw = . ; _end_fw = . ;
} > flash } > rom
} }

View File

@ -24,16 +24,6 @@ ifneq (,$(filter $(CPU_FAM),f0 f2 f3 f4 f7 l0 l1 l4 l5 u5 wb wl))
endif endif
endif endif
STM32_WITH_BKPRAM = stm32f205% stm32f207% stm32f215% stm32f217% \
stm32f405% stm32f407% stm32f415% stm32f417% \
stm32f427% stm32f429% stm32f437% stm32f439% \
stm32f446% stm32f469% stm32f479% \
stm32f7% \
stm32u5%
ifneq (,$(filter $(STM32_WITH_BKPRAM),$(CPU_MODEL)))
FEATURES_PROVIDED += backup_ram
endif
# The f2, f4 and f7 do not support the pagewise api # The f2, f4 and f7 do not support the pagewise api
ifneq (,$(filter $(CPU_FAM),f2 f4 f7)) ifneq (,$(filter $(CPU_FAM),f2 f4 f7))
FEATURES_PROVIDED += periph_flashpage FEATURES_PROVIDED += periph_flashpage

View File

@ -372,43 +372,3 @@ void cpu_init(void)
_wlx5xx_init_subghz_debug_pins(); _wlx5xx_init_subghz_debug_pins();
} }
} }
void backup_ram_init(void)
{
/* see reference manual "Battery backup domain" */
#if defined(RCC_APB1ENR_PWREN)
periph_clk_en(APB1, RCC_APB1ENR_PWREN);
#elif defined(RCC_APBENR1_PWREN)
periph_clk_en(APB1, RCC_APBENR1_PWREN);
#elif defined(RCC_APB1ENR1_PWREN)
periph_clk_en(APB1, RCC_APB1ENR1_PWREN);
#elif defined(RCC_AHB3ENR_PWREN)
periph_clk_en(AHB3, RCC_AHB3ENR_PWREN);
#endif
stmclk_dbp_unlock();
#if defined(RCC_AHB1ENR_BKPSRAMEN)
periph_clk_en(AHB1, RCC_AHB1ENR_BKPSRAMEN);
#endif
}
#ifndef BACKUP_RAM_MAGIC
#define BACKUP_RAM_MAGIC {'R', 'I', 'O', 'T'}
#endif
bool cpu_woke_from_backup(void)
{
#if IS_ACTIVE(CPU_HAS_BACKUP_RAM)
static const char _signature[] BACKUP_RAM_DATA = BACKUP_RAM_MAGIC;
/* switch off regulator to save power */
#ifndef RIOTBOOT
pm_backup_regulator_off();
#endif
for (unsigned i = 0; i < sizeof(_signature); i++) {
if (_signature[i] != ((char[])BACKUP_RAM_MAGIC)[i]) {
return false;
}
}
return true;
#endif /* CPU_HAS_BACKUP_RAM */
return false;
}

View File

@ -67,7 +67,7 @@
#elif CPU_FAM_STM32U5 #elif CPU_FAM_STM32U5
#include "stm32u5xx.h" #include "stm32u5xx.h"
#include "irqs/u5/irqs.h" #include "irqs/u5/irqs.h"
#define NUM_HEAPS 3 #define NUM_HEAPS 2
#elif CPU_FAM_STM32WB #elif CPU_FAM_STM32WB
#include "stm32wbxx.h" #include "stm32wbxx.h"
#include "irqs/wb/irqs.h" #include "irqs/wb/irqs.h"

View File

@ -1,46 +0,0 @@
/*
* Copyright (C) 2022 Otto-von-Guericke-Universität Magdeburg
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup cpu_stm32
* @{
*
* @file
* @brief Backup SRAM CPU specific definitions for the STM32 family
*
* @author Fabian Hüßler <fabian.huessler@ovgu.de>
*/
#ifndef PERIPH_CPU_BACKUP_RAM_H
#define PERIPH_CPU_BACKUP_RAM_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Backup RAM must be initialized with @ref backup_ram_init on reset
*/
#define BACKUP_RAM_HAS_INIT 1
/**
* @brief Enable backup RAM access
*/
void backup_ram_init(void);
/**
* @brief Returns true if the CPU woke up from deep sleep (backup/standby)
*/
bool cpu_woke_from_backup(void);
#ifdef __cplusplus
}
#endif
#endif /* PERIPH_CPU_BACKUP_RAM_H */
/** @} */

View File

@ -50,22 +50,6 @@ extern "C" {
#endif #endif
/** @} */ /** @} */
/**
* @brief Check whether the backup domain voltage regulator is on
*/
bool pm_backup_regulator_is_on(void);
/**
* @brief Enable the backup domain voltage regulator to retain backup
* register content during standby and VBAT mode
*/
void pm_backup_regulator_on(void);
/**
* @brief Disable the backup domain voltage regulator
*/
void pm_backup_regulator_off(void);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -58,7 +58,6 @@
#include "periph/wl/periph_cpu.h" #include "periph/wl/periph_cpu.h"
#endif #endif
#include "periph/cpu_backup_ram.h"
#include "periph/cpu_common.h" #include "periph/cpu_common.h"
#include "periph/cpu_dma.h" #include "periph/cpu_dma.h"
#include "periph/cpu_eth.h" #include "periph/cpu_eth.h"

View File

@ -22,8 +22,6 @@
#ifndef STMCLK_H #ifndef STMCLK_H
#define STMCLK_H #define STMCLK_H
#include <stdbool.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
@ -86,14 +84,6 @@ void stmclk_dbp_unlock(void);
*/ */
void stmclk_dbp_lock(void); void stmclk_dbp_lock(void);
/**
* @brief Check whether write access to the backup domain is locked
*
* @retval true: locked
* @retval false: unlocked
*/
bool stmclk_dbp_is_locked(void);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -9,7 +9,6 @@ config CPU_FAM_F2
bool bool
select CPU_STM32 select CPU_STM32
select CPU_CORE_CORTEX_M3 select CPU_CORE_CORTEX_M3
select HAS_BACKUP_RAM
select HAS_CPU_STM32F2 select HAS_CPU_STM32F2
select HAS_CORTEXM_MPU select HAS_CORTEXM_MPU
select HAS_PERIPH_FLASHPAGE select HAS_PERIPH_FLASHPAGE

View File

@ -23,14 +23,12 @@ config CPU_LINE_STM32F401XE
config CPU_LINE_STM32F405XX config CPU_LINE_STM32F405XX
bool bool
select CPU_FAM_F4 select CPU_FAM_F4
select HAS_BACKUP_RAM
select HAS_PERIPH_HWRNG select HAS_PERIPH_HWRNG
select CLOCK_MAX_180MHZ select CLOCK_MAX_180MHZ
config CPU_LINE_STM32F407XX config CPU_LINE_STM32F407XX
bool bool
select CPU_FAM_F4 select CPU_FAM_F4
select HAS_BACKUP_RAM
select HAS_PERIPH_HWRNG select HAS_PERIPH_HWRNG
select CLOCK_MAX_180MHZ select CLOCK_MAX_180MHZ
@ -85,14 +83,12 @@ config CPU_LINE_STM32F413XX
config CPU_LINE_STM32F415XX config CPU_LINE_STM32F415XX
bool bool
select CPU_FAM_F4 select CPU_FAM_F4
select HAS_BACKUP_RAM
select HAS_PERIPH_HWRNG select HAS_PERIPH_HWRNG
select CLOCK_MAX_180MHZ select CLOCK_MAX_180MHZ
config CPU_LINE_STM32F417XX config CPU_LINE_STM32F417XX
bool bool
select CPU_FAM_F4 select CPU_FAM_F4
select HAS_BACKUP_RAM
select CLOCK_MAX_180MHZ select CLOCK_MAX_180MHZ
config CPU_LINE_STM32F423XX config CPU_LINE_STM32F423XX
@ -103,44 +99,37 @@ config CPU_LINE_STM32F423XX
config CPU_LINE_STM32F427XX config CPU_LINE_STM32F427XX
bool bool
select CPU_FAM_F4 select CPU_FAM_F4
select HAS_BACKUP_RAM
select CLOCK_MAX_180MHZ select CLOCK_MAX_180MHZ
config CPU_LINE_STM32F429XX config CPU_LINE_STM32F429XX
bool bool
select CPU_FAM_F4 select CPU_FAM_F4
select HAS_BACKUP_RAM
select HAS_PERIPH_HWRNG select HAS_PERIPH_HWRNG
select CLOCK_MAX_180MHZ select CLOCK_MAX_180MHZ
config CPU_LINE_STM32F437XX config CPU_LINE_STM32F437XX
bool bool
select CPU_FAM_F4 select CPU_FAM_F4
select HAS_BACKUP_RAM
select HAS_PERIPH_HWRNG select HAS_PERIPH_HWRNG
select CLOCK_MAX_180MHZ select CLOCK_MAX_180MHZ
config CPU_LINE_STM32F439XX config CPU_LINE_STM32F439XX
bool bool
select CPU_FAM_F4 select CPU_FAM_F4
select HAS_BACKUP_RAM
select CLOCK_MAX_180MHZ select CLOCK_MAX_180MHZ
config CPU_LINE_STM32F446XX config CPU_LINE_STM32F446XX
bool bool
select CPU_FAM_F4 select CPU_FAM_F4
select HAS_BACKUP_RAM
select CLOCK_MAX_180MHZ select CLOCK_MAX_180MHZ
config CPU_LINE_STM32F469XX config CPU_LINE_STM32F469XX
bool bool
select CPU_FAM_F4 select CPU_FAM_F4
select HAS_BACKUP_RAM
select HAS_PERIPH_HWRNG select HAS_PERIPH_HWRNG
select CLOCK_MAX_180MHZ select CLOCK_MAX_180MHZ
config CPU_LINE_STM32F479XX config CPU_LINE_STM32F479XX
bool bool
select CPU_FAM_F4 select CPU_FAM_F4
select HAS_BACKUP_RAM
select CLOCK_MAX_180MHZ select CLOCK_MAX_180MHZ

View File

@ -9,7 +9,6 @@ config CPU_FAM_F7
bool bool
select CPU_STM32 select CPU_STM32
select CPU_CORE_CORTEX_M7 select CPU_CORE_CORTEX_M7
select HAS_BACKUP_RAM
select HAS_CPU_STM32F7 select HAS_CPU_STM32F7
select HAS_CORTEXM_MPU select HAS_CORTEXM_MPU
select HAS_PERIPH_FLASHPAGE select HAS_PERIPH_FLASHPAGE

View File

@ -9,7 +9,6 @@ config CPU_FAM_U5
bool bool
select CPU_STM32 select CPU_STM32
select CPU_CORE_CORTEX_M33 select CPU_CORE_CORTEX_M33
select HAS_BACKUP_RAM
select HAS_CPU_STM32U5 select HAS_CPU_STM32U5
select HAS_PERIPH_FLASHPAGE select HAS_PERIPH_FLASHPAGE
select HAS_PERIPH_FLASHPAGE_PAGEWISE select HAS_PERIPH_FLASHPAGE_PAGEWISE

View File

@ -31,8 +31,8 @@ SECTIONS
{ {
.heap2 ALIGN(4) (NOLOAD) : .heap2 ALIGN(4) (NOLOAD) :
{ {
_sheap2 = . ; _sheap1 = . ;
_eheap2 = ORIGIN(sram4) + LENGTH(sram4); _eheap1 = ORIGIN(sram4) + LENGTH(sram4);
} > sram4 } > sram4
} }

View File

@ -29,7 +29,6 @@
#include "irq.h" #include "irq.h"
#include "periph/pm.h" #include "periph/pm.h"
#include "periph/cpu_pm.h"
#include "stmclk.h" #include "stmclk.h"
#define ENABLE_DEBUG 0 #define ENABLE_DEBUG 0
@ -138,7 +137,6 @@ void pm_set(unsigned mode)
PWR_WUP_REG |= PM_EWUP_CONFIG; PWR_WUP_REG |= PM_EWUP_CONFIG;
/* Set SLEEPDEEP bit of system control block */ /* Set SLEEPDEEP bit of system control block */
deep = 1; deep = 1;
pm_backup_regulator_on();
break; break;
#endif #endif
case STM32_PM_STOP: case STM32_PM_STOP:
@ -161,61 +159,3 @@ void pm_set(unsigned mode)
#endif #endif
} }
} }
/**
* @name Registers and related configuration bits to retain
* the backup domain registers, using the backup regulator
* @{
*/
#if defined(PWR_CSR1_BRE)
#define PWR_BACKUP_REGULATOR_REG PWR->CSR1
#define BKPREG_CONFIG (PWR_CSR1_BRE | PWR_CSR1_EIWUP)
#define BKPREG_READY (PWR_CSR1_BRR)
#elif defined(PWR_CSR_BRE)
#define PWR_BACKUP_REGULATOR_REG PWR->CSR
#define BKPREG_CONFIG (PWR_CSR_BRE)
#define BKPREG_READY (PWR_CSR_BRR)
#elif defined(PWR_CR2_BREN)
#define PWR_BACKUP_REGULATOR_REG PWR->CR2
#define BKPREG_CONFIG (PWR_CR2_BREN)
#define BKPREG_READY (PWR_CR2_BRRDY)
#endif
/** @} */
bool pm_backup_regulator_is_on(void)
{
#if defined(PWR_BACKUP_REGULATOR_REG)
return (PWR_BACKUP_REGULATOR_REG & BKPREG_READY) == BKPREG_READY;
#else
return false;
#endif
}
void pm_backup_regulator_on(void)
{
#if defined(PWR_BACKUP_REGULATOR_REG)
bool locked = stmclk_dbp_is_locked();
if (locked) {
stmclk_dbp_unlock();
}
PWR_BACKUP_REGULATOR_REG |= BKPREG_CONFIG;
while (!(PWR_BACKUP_REGULATOR_REG & BKPREG_READY));
if (locked) {
stmclk_dbp_lock();
}
#endif
}
void pm_backup_regulator_off(void)
{
#if defined(PWR_BACKUP_REGULATOR_REG)
bool locked = stmclk_dbp_is_locked();
if (locked) {
stmclk_dbp_unlock();
}
PWR_BACKUP_REGULATOR_REG &= ~BKPREG_CONFIG;
if (locked) {
stmclk_dbp_lock();
}
#endif
}

View File

@ -192,7 +192,7 @@ int spi_init_cs(spi_t bus, spi_cs_t cs)
} }
#ifdef MODULE_PERIPH_SPI_GPIO_MODE #ifdef MODULE_PERIPH_SPI_GPIO_MODE
int spi_init_with_gpio_mode(spi_t bus, const spi_gpio_mode_t* mode) int spi_init_with_gpio_mode(spi_t bus, spi_gpio_mode_t mode)
{ {
assert(bus < SPI_NUMOF); assert(bus < SPI_NUMOF);
@ -203,17 +203,17 @@ int spi_init_with_gpio_mode(spi_t bus, const spi_gpio_mode_t* mode)
return ret; return ret;
#else #else
if (gpio_is_valid(spi_config[bus].mosi_pin)) { if (gpio_is_valid(spi_config[bus].mosi_pin)) {
ret += gpio_init(spi_config[bus].mosi_pin, mode->mosi); ret += gpio_init(spi_config[bus].mosi_pin, mode.mosi);
gpio_init_af(spi_config[bus].mosi_pin, spi_config[bus].mosi_af); gpio_init_af(spi_config[bus].mosi_pin, spi_config[bus].mosi_af);
} }
if (gpio_is_valid(spi_config[bus].miso_pin)) { if (gpio_is_valid(spi_config[bus].miso_pin)) {
ret += gpio_init(spi_config[bus].miso_pin, mode->miso); ret += gpio_init(spi_config[bus].miso_pin, mode.miso);
gpio_init_af(spi_config[bus].miso_pin, spi_config[bus].miso_af); gpio_init_af(spi_config[bus].miso_pin, spi_config[bus].miso_af);
} }
if (gpio_is_valid(spi_config[bus].sclk_pin)) { if (gpio_is_valid(spi_config[bus].sclk_pin)) {
ret += gpio_init(spi_config[bus].sclk_pin, mode->sclk); ret += gpio_init(spi_config[bus].sclk_pin, mode.sclk);
gpio_init_af(spi_config[bus].sclk_pin, spi_config[bus].sclk_af); gpio_init_af(spi_config[bus].sclk_pin, spi_config[bus].sclk_af);
} }
return ret; return ret;

View File

@ -90,10 +90,6 @@ ifeq ($(STM32_TYPE), F)
else ifeq ($(STM32_MODEL3), 7) else ifeq ($(STM32_MODEL3), 7)
RAM_LEN = 128K RAM_LEN = 128K
endif endif
ifneq (, $(filter $(STM32_MODEL), 205 207 215 217))
BACKUP_RAM_ADDR = 0x40024000
BACKUP_RAM_LEN = 0x4K
endif
else ifeq ($(STM32_FAMILY), 3) else ifeq ($(STM32_FAMILY), 3)
ifeq ($(STM32_MODEL), 301) ifeq ($(STM32_MODEL), 301)
RAM_LEN = 16K RAM_LEN = 16K
@ -171,10 +167,6 @@ ifeq ($(STM32_TYPE), F)
ifneq (, $(filter $(STM32_MODEL3), 5 7 9)) ifneq (, $(filter $(STM32_MODEL3), 5 7 9))
CCMRAM_LEN = 64K CCMRAM_LEN = 64K
endif endif
ifneq (, $(filter $(STM32_MODEL), 405 407 415 417 427 429 437 439 446 469 479))
BACKUP_RAM_ADDR = 0x40024000
BACKUP_RAM_LEN = 0x4K
endif
else ifeq ($(STM32_FAMILY),7) else ifeq ($(STM32_FAMILY),7)
ifneq (, $(filter $(STM32_MODEL2), 2 3)) ifneq (, $(filter $(STM32_MODEL2), 2 3))
RAM_LEN = 256K RAM_LEN = 256K
@ -183,8 +175,6 @@ ifeq ($(STM32_TYPE), F)
else ifneq (, $(filter $(STM32_MODEL2), 6 7)) else ifneq (, $(filter $(STM32_MODEL2), 6 7))
RAM_LEN = 512K RAM_LEN = 512K
endif endif
BACKUP_RAM_ADDR = 0x40024000
BACKUP_RAM_LEN = 0x4K
endif endif
else ifeq ($(STM32_TYPE), G) else ifeq ($(STM32_TYPE), G)
ifeq ($(STM32_FAMILY), 0) ifeq ($(STM32_FAMILY), 0)
@ -281,8 +271,6 @@ else ifeq ($(STM32_TYPE), U)
ifneq (, $(filter $(STM32_MODEL2), 7 8)) ifneq (, $(filter $(STM32_MODEL2), 7 8))
RAM_LEN = 768K RAM_LEN = 768K
SRAM4_LEN = 16K SRAM4_LEN = 16K
BACKUP_RAM_ADDR = 0x40036400
BACKUP_RAM_LEN = 0x2K
endif endif
endif endif
else ifeq ($(STM32_TYPE), W) else ifeq ($(STM32_TYPE), W)

View File

@ -115,14 +115,5 @@ void stmclk_dbp_unlock(void)
void stmclk_dbp_lock(void) void stmclk_dbp_lock(void)
{ {
if (!IS_ACTIVE(CPU_HAS_BACKUP_RAM)) {
/* The DBP must be unlocked all the time, if we modify
backup RAM content by comfortable BACKUP_RAM variables */
PWR->REG_PWR_CR &= ~(BIT_CR_DBP); PWR->REG_PWR_CR &= ~(BIT_CR_DBP);
}
}
bool stmclk_dbp_is_locked(void)
{
return !(PWR->REG_PWR_CR & BIT_CR_DBP);
} }

View File

@ -246,11 +246,6 @@ void stmclk_init_sysclk(void)
/* Wait Until the Voltage Regulator is ready */ /* Wait Until the Voltage Regulator is ready */
while (!(PWR->VOSR & PWR_VOSR_VOSRDY)) {} while (!(PWR->VOSR & PWR_VOSR_VOSRDY)) {}
/* Backup RAM retention in Standby and VBAT modes:
This bit can be written only when the regulator is LDO,
which must be configured before switching to SMPS */
PWR->BDCR1 |= PWR_BDCR1_BREN;
/* Switch to SMPS regulator instead of LDO */ /* Switch to SMPS regulator instead of LDO */
PWR->CR3 |= PWR_CR3_REGSEL; PWR->CR3 |= PWR_CR3_REGSEL;
while (!(PWR->SVMSR & PWR_SVMSR_REGS)) {} while (!(PWR->SVMSR & PWR_SVMSR_REGS)) {}

View File

@ -13,10 +13,8 @@ IOTLAB_ARCHI_nrf52dk = nrf52dk:ble
IOTLAB_ARCHI_nrf52832-mdk = nrf52832mdk:ble IOTLAB_ARCHI_nrf52832-mdk = nrf52832mdk:ble
IOTLAB_ARCHI_nrf52840dk = nrf52840dk:multi IOTLAB_ARCHI_nrf52840dk = nrf52840dk:multi
IOTLAB_ARCHI_nrf52840-mdk = nrf52840mdk:multi IOTLAB_ARCHI_nrf52840-mdk = nrf52840mdk:multi
IOTLAB_ARCHI_nucleo-wl55jc = nucleo-wl55jc:stm32wl
IOTLAB_ARCHI_pba-d-01-kw2x = phynode:kw2xrf IOTLAB_ARCHI_pba-d-01-kw2x = phynode:kw2xrf
IOTLAB_ARCHI_samr21-xpro = samr21:at86rf233 IOTLAB_ARCHI_samr21-xpro = samr21:at86rf233
IOTLAB_ARCHI_samr30-xpro = samr30:at86rf212b IOTLAB_ARCHI_samr30-xpro = samr30:at86rf212b
IOTLAB_ARCHI_samr34-xpro = samr34:sx1276
IOTLAB_ARCHI_zigduino = zigduino:atmega128rfa1 IOTLAB_ARCHI_zigduino = zigduino:atmega128rfa1
IOTLAB_ARCHI := $(IOTLAB_ARCHI_$(BOARD)) IOTLAB_ARCHI := $(IOTLAB_ARCHI_$(BOARD))

View File

@ -228,9 +228,6 @@ def generate_module_compile_commands(path, state, args):
except ValueError: except ValueError:
pass pass
if args.clangd:
cdetails.cflags.append('-Wno-unknown-warning-option')
c_extra_includes = [] c_extra_includes = []
cxx_extra_includes = [] cxx_extra_includes = []
@ -291,16 +288,14 @@ if __name__ == '__main__':
help='Drop the given flag, if present (repeatable)') help='Drop the given flag, if present (repeatable)')
parser.add_argument('--clangd', default=False, action='store_const', const=True, parser.add_argument('--clangd', default=False, action='store_const', const=True,
help='Shorthand for --add-built-in-includes --add-libstdxx-includes ' + help='Shorthand for --add-built-in-includes --add-libstdxx-includes ' +
'and some CFLAG adjustments throughy --filter-out, and ignores ' + '--filter-out=-Wformat-truncation --filter-out=-Wformat-overflow ' +
'unknown warning flags') '--filter-out=-mno-thumb-interwork')
_args = parser.parse_args() _args = parser.parse_args()
if _args.clangd: if _args.clangd:
_args.add_built_in_includes = True _args.add_built_in_includes = True
_args.add_libstdcxx_includes = True _args.add_libstdcxx_includes = True
_args.filter_out = ['-mno-thumb-interwork', _args.filter_out = ['-Wformat-truncation', '-Wformat-overflow', '-mno-thumb-interwork',
# Only even included for versions of GCC that support it # Only even included for versions of GCC that support it
'-malign-data=natural', '-malign-data=natural',
# Only supported starting with clang 11
'-msmall-data-limit=8',
] ]
generate_compile_commands(_args) generate_compile_commands(_args)

View File

@ -13357,7 +13357,6 @@ drivers/sx127x/include/sx127x_registers\.h:[0-9]+: warning: Member SX127X_RNG_RE
drivers/sx127x/include/sx127x_registers\.h:[0-9]+: warning: Member SX127X_RNG_REG_MODEM_CONFIG2 \(macro definition\) of file sx127x_registers\.h is not documented\. drivers/sx127x/include/sx127x_registers\.h:[0-9]+: warning: Member SX127X_RNG_REG_MODEM_CONFIG2 \(macro definition\) of file sx127x_registers\.h is not documented\.
drivers/sx127x/include/sx127x_registers\.h:[0-9]+: warning: Member VERSION_SX1272 \(macro definition\) of file sx127x_registers\.h is not documented\. drivers/sx127x/include/sx127x_registers\.h:[0-9]+: warning: Member VERSION_SX1272 \(macro definition\) of file sx127x_registers\.h is not documented\.
drivers/sx127x/include/sx127x_registers\.h:[0-9]+: warning: Member VERSION_SX1276 \(macro definition\) of file sx127x_registers\.h is not documented\. drivers/sx127x/include/sx127x_registers\.h:[0-9]+: warning: Member VERSION_SX1276 \(macro definition\) of file sx127x_registers\.h is not documented\.
drivers/sx127x/include/sx127x_registers\.h:[0-9]+: warning: Member VERSION_SX1276_WLR089 \(macro definition\) of file sx127x_registers\.h is not documented\.
drivers/tcs37727/include/tcs37727\-internal\.h:[0-9]+: warning: Member B_COEF_IF \(macro definition\) of file tcs37727\-internal\.h is not documented\. drivers/tcs37727/include/tcs37727\-internal\.h:[0-9]+: warning: Member B_COEF_IF \(macro definition\) of file tcs37727\-internal\.h is not documented\.
drivers/tcs37727/include/tcs37727\-internal\.h:[0-9]+: warning: Member CT_COEF_IF \(macro definition\) of file tcs37727\-internal\.h is not documented\. drivers/tcs37727/include/tcs37727\-internal\.h:[0-9]+: warning: Member CT_COEF_IF \(macro definition\) of file tcs37727\-internal\.h is not documented\.
drivers/tcs37727/include/tcs37727\-internal\.h:[0-9]+: warning: Member CT_OFFSET_IF \(macro definition\) of file tcs37727\-internal\.h is not documented\. drivers/tcs37727/include/tcs37727\-internal\.h:[0-9]+: warning: Member CT_OFFSET_IF \(macro definition\) of file tcs37727\-internal\.h is not documented\.
@ -14369,22 +14368,22 @@ sys/include/net/iana/portrange\.h:[0-9]+: warning: Member IANA_SYSTEM_PORTRANGE_
sys/include/net/iana/portrange\.h:[0-9]+: warning: Member IANA_SYSTEM_PORTRANGE_MIN \(macro definition\) of group net_iana_portrange is not documented\. sys/include/net/iana/portrange\.h:[0-9]+: warning: Member IANA_SYSTEM_PORTRANGE_MIN \(macro definition\) of group net_iana_portrange is not documented\.
sys/include/net/iana/portrange\.h:[0-9]+: warning: Member IANA_USER_PORTRANGE_MAX \(macro definition\) of group net_iana_portrange is not documented\. sys/include/net/iana/portrange\.h:[0-9]+: warning: Member IANA_USER_PORTRANGE_MAX \(macro definition\) of group net_iana_portrange is not documented\.
sys/include/net/iana/portrange\.h:[0-9]+: warning: Member IANA_USER_PORTRANGE_MIN \(macro definition\) of group net_iana_portrange is not documented\. sys/include/net/iana/portrange\.h:[0-9]+: warning: Member IANA_USER_PORTRANGE_MIN \(macro definition\) of group net_iana_portrange is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCF_DST_ADDR_MASK \(macro definition\) of group net_ieee802154_header is not documented\. sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCF_DST_ADDR_MASK \(macro definition\) of group net_ieee802154 is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCF_LEN \(macro definition\) of group net_ieee802154_header is not documented\. sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCF_LEN \(macro definition\) of group net_ieee802154 is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCF_SRC_ADDR_MASK \(macro definition\) of group net_ieee802154_header is not documented\. sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCF_SRC_ADDR_MASK \(macro definition\) of group net_ieee802154 is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCF_TYPE_ACK \(macro definition\) of group net_ieee802154_header is not documented\. sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCF_TYPE_ACK \(macro definition\) of group net_ieee802154 is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCF_TYPE_BEACON \(macro definition\) of group net_ieee802154_header is not documented\. sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCF_TYPE_BEACON \(macro definition\) of group net_ieee802154 is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCF_TYPE_DATA \(macro definition\) of group net_ieee802154_header is not documented\. sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCF_TYPE_DATA \(macro definition\) of group net_ieee802154 is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCF_TYPE_MACCMD \(macro definition\) of group net_ieee802154_header is not documented\. sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCF_TYPE_MACCMD \(macro definition\) of group net_ieee802154 is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCF_TYPE_MASK \(macro definition\) of group net_ieee802154_header is not documented\. sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCF_TYPE_MASK \(macro definition\) of group net_ieee802154 is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCF_VERS_MASK \(macro definition\) of group net_ieee802154_header is not documented\. sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCF_VERS_MASK \(macro definition\) of group net_ieee802154 is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCF_VERS_V0 \(macro definition\) of group net_ieee802154_header is not documented\. sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCF_VERS_V0 \(macro definition\) of group net_ieee802154 is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCF_VERS_V1 \(macro definition\) of group net_ieee802154_header is not documented\. sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCF_VERS_V1 \(macro definition\) of group net_ieee802154 is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCS_LEN \(macro definition\) of group net_ieee802154_header is not documented\. sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCS_LEN \(macro definition\) of group net_ieee802154 is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_MIN_FRAME_LEN \(macro definition\) of group net_ieee802154_header is not documented\. sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_MIN_FRAME_LEN \(macro definition\) of group net_ieee802154 is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_PHY_MR_FSK_2FSK_CODED_SFD_1 \(macro definition\) of group net_ieee802154_header is not documented\. sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_PHY_MR_FSK_2FSK_CODED_SFD_1 \(macro definition\) of group net_ieee802154 is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_PHY_MR_FSK_2FSK_UNCODED_SFD_0 \(macro definition\) of group net_ieee802154_header is not documented\. sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_PHY_MR_FSK_2FSK_UNCODED_SFD_0 \(macro definition\) of group net_ieee802154 is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_PHY_MR_FSK_2FSK_UNCODED_SFD_1 \(macro definition\) of group net_ieee802154_header is not documented\. sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_PHY_MR_FSK_2FSK_UNCODED_SFD_1 \(macro definition\) of group net_ieee802154 is not documented\.
sys/include/net/lora\.h:[0-9]+: warning: unbalanced grouping commands sys/include/net/lora\.h:[0-9]+: warning: unbalanced grouping commands
sys/include/net/loramac\.h:[0-9]+: warning: unbalanced grouping commands sys/include/net/loramac\.h:[0-9]+: warning: unbalanced grouping commands
sys/include/net/mqttsn\.h:[0-9]+: warning: Member MQTTSN_CLI_ID_MAXLEN \(macro definition\) of group net_mqttsn is not documented\. sys/include/net/mqttsn\.h:[0-9]+: warning: Member MQTTSN_CLI_ID_MAXLEN \(macro definition\) of group net_mqttsn is not documented\.
@ -14706,4 +14705,3 @@ drivers/ft5x06/include/ft5x06_constants\.h:[0-9]+: warning: Member FT5X06_G_MODE
drivers/ft5x06/include/ft5x06_constants\.h:[0-9]+: warning: Member FT5X06_G_MODE_INTERRUPT_SHIFT \(macro definition\) of file ft5x06_constants\.h is not documented\. drivers/ft5x06/include/ft5x06_constants\.h:[0-9]+: warning: Member FT5X06_G_MODE_INTERRUPT_SHIFT \(macro definition\) of file ft5x06_constants\.h is not documented\.
drivers/ft5x06/include/ft5x06_constants\.h:[0-9]+: warning: Member FT5X06_G_MODE_INTERRUPT_POLLING \(macro definition\) of file ft5x06_constants\.h is not documented\. drivers/ft5x06/include/ft5x06_constants\.h:[0-9]+: warning: Member FT5X06_G_MODE_INTERRUPT_POLLING \(macro definition\) of file ft5x06_constants\.h is not documented\.
drivers/ft5x06/include/ft5x06_constants\.h:[0-9]+: warning: Member FT5X06_G_MODE_INTERRUPT_TRIGGER \(macro definition\) of file ft5x06_constants\.h is not documented\. drivers/ft5x06/include/ft5x06_constants\.h:[0-9]+: warning: Member FT5X06_G_MODE_INTERRUPT_TRIGGER \(macro definition\) of file ft5x06_constants\.h is not documented\.
drivers/ft5x06/include/ft5x06_params\.h:[0-9]+: warning: Member FT5X06_PARAM_TYPE \(macro definition\) of file ft5x06_params\.h is not documented\.

View File

@ -144,20 +144,3 @@ instance [0 | Iface: 7 | mop: 2 | ocp: 0 | mhri: 256 | mri 0]
``` ```
This should also be visible in Foren6. This should also be visible in Foren6.
Topology generation
-------------------
To generate a random topology use the `topogen.sh` script.
This will randomly distribute *N* nodes on on a *W* × *H* map.
Each node has a radio range *R* ± *V* where *V* is a random variance that can also be set to 0.
The further away a node is from a sending node, the higher the packet loss probability.
Nodes outside the sending radius have a zero probability of receiving a packet.
If you have `gnuplot` installed this will also generate a plot of the resulting node distribution:
![example topology](https://gist.githubusercontent.com/benpicco/6fd6f7c79a30cbbc41c3a65e53ed3682/raw/33afb859b65d949238129096858d14e2319fb5fb/network.topo.svg)
A light color means that a node only has a one-way connection to the network, gray means a node is
entirely isolated.

View File

@ -16,11 +16,11 @@ else
CRESET= CRESET=
fi fi
WIDTH=100 # X dimension of the simulated world WIDTH=100
HEIGHT=100 # Y dimension of the simulated world HEIGHT=100
RANGE=30 # base node radio range RANGE=30
VARIANCE=15 # random offset to radio range VARIANCE=15
NUM=10 # number of nodes NUM=10
echo "writing to $FILE" echo "writing to $FILE"

View File

@ -41,8 +41,7 @@
* The following list of what `DEVELHELP=1` enables is not comprehensive, but * The following list of what `DEVELHELP=1` enables is not comprehensive, but
* should give a rough impression of what to expect: * should give a rough impression of what to expect:
* *
* * Many runtime checks are enabled (stack overflow protection by means of * * Many runtime checks are enabled (stack overflow protection, warnings when
* @ref pseudomodule_mpu_stack_guard or @ref SCHED_TEST_STACK, warnings when
* sending messages to invalid PIDs, …), some of which just log errors to * sending messages to invalid PIDs, …), some of which just log errors to
* stdout, some even halt the system. * stdout, some even halt the system.
* * Some structures contain additional information, e.g. threads store their * * Some structures contain additional information, e.g. threads store their

View File

@ -32,7 +32,7 @@ DOXYFILE_ENCODING = UTF-8
# title of most generated pages and in a few other places. # title of most generated pages and in a few other places.
# The default value is: My Project. # The default value is: My Project.
PROJECT_NAME = "RIOT OS" PROJECT_NAME =
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This # The PROJECT_NUMBER tag can be used to enter a project or revision number. This
# could be handy for archiving the generated documentation or if some version # could be handy for archiving the generated documentation or if some version
@ -275,9 +275,7 @@ OPTIMIZE_OUTPUT_VHDL = NO
# Note that for custom extensions you also need to set FILE_PATTERNS otherwise # Note that for custom extensions you also need to set FILE_PATTERNS otherwise
# the files are not read by doxygen. # the files are not read by doxygen.
# Python is close enough that we can have Makefile comments starting with `##` EXTENSION_MAPPING =
# that are both recognized by Doxygen and comments to Make
EXTENSION_MAPPING = mk=Python
# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments # If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
# according to the Markdown format, which allows for more readable # according to the Markdown format, which allows for more readable
@ -773,8 +771,7 @@ INPUT = ../../doc.txt \
src/emulators.md \ src/emulators.md \
src/release-cycle.md \ src/release-cycle.md \
src/changelog.md \ src/changelog.md \
../../LOSTANDFOUND.md \ ../../LOSTANDFOUND.md
../../makefiles/pseudomodules.inc.mk
# This tag can be used to specify the character encoding of the source files # This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses

View File

@ -125,7 +125,7 @@ $ rustup component add --toolchain nightly-2019-12-05 rustfmt rustc-dev
$ cargo +nightly-2019-12-05 install c2rust $ cargo +nightly-2019-12-05 install c2rust
$ git clone https://github.com/chrysn-pull-requests/c2rust -b for-riot $ git clone https://github.com/chrysn-pull-requests/c2rust -b for-riot
$ cd c2rust $ cd c2rust
$ cargo +nightly-2019-12-05 install --locked --path c2rust $ cargo +nightly-2019-12-05 install --path c2rust
``` ```
[cargo]: https://doc.rust-lang.org/cargo/ [cargo]: https://doc.rust-lang.org/cargo/

View File

@ -174,7 +174,7 @@ int at_send_cmd(at_dev_t *dev, const char *command, uint32_t timeout)
uart_write(dev->uart, (const uint8_t *)command, cmdlen); uart_write(dev->uart, (const uint8_t *)command, cmdlen);
uart_write(dev->uart, (const uint8_t *)CONFIG_AT_SEND_EOL, AT_SEND_EOL_LEN); uart_write(dev->uart, (const uint8_t *)CONFIG_AT_SEND_EOL, AT_SEND_EOL_LEN);
if (!IS_ACTIVE(CONFIG_AT_SEND_SKIP_ECHO)) { if (AT_SEND_ECHO) {
if (at_expect_bytes(dev, command, timeout)) { if (at_expect_bytes(dev, command, timeout)) {
return -1; return -1;
} }

View File

@ -372,7 +372,7 @@ static int _atwinc15x0_get(netdev_t *netdev, netopt_t opt, void *val,
return sizeof(uint16_t); return sizeof(uint16_t);
case NETOPT_RSSI: case NETOPT_RSSI:
assert(max_len == sizeof(int16_t)); assert(max_len == sizeof(int8_t));
_rssi_info_ready = false; _rssi_info_ready = false;
/* trigger the request current RSSI (asynchronous function) */ /* trigger the request current RSSI (asynchronous function) */
if (m2m_wifi_req_curr_rssi() != M2M_SUCCESS) { if (m2m_wifi_req_curr_rssi() != M2M_SUCCESS) {
@ -384,8 +384,8 @@ static int _atwinc15x0_get(netdev_t *netdev, netopt_t opt, void *val,
ztimer_sleep(ZTIMER_MSEC, ATWINC15X0_WAIT_TIME_MS); ztimer_sleep(ZTIMER_MSEC, ATWINC15X0_WAIT_TIME_MS);
} }
/* return the RSSI */ /* return the RSSI */
*((int16_t *)val) = dev->rssi; *((int8_t *)val) = dev->rssi;
return sizeof(int16_t); return sizeof(int8_t);
default: default:
return netdev_eth_get(netdev, opt, val, max_len); return netdev_eth_get(netdev, opt, val, max_len);

View File

@ -3,13 +3,8 @@ FEATURES_REQUIRED += periph_uart
FEATURES_OPTIONAL += periph_uart_collision FEATURES_OPTIONAL += periph_uart_collision
FEATURES_OPTIONAL += periph_uart_rxstart_irq FEATURES_OPTIONAL += periph_uart_rxstart_irq
ifneq (,$(filter dose_watchdog,$(USEMODULE)))
FEATURES_REQUIRED += periph_timer_periodic
endif
USEMODULE += chunked_ringbuffer
USEMODULE += eui_provider USEMODULE += eui_provider
USEMODULE += iolist USEMODULE += iolist
USEMODULE += netdev_eth USEMODULE += netdev_eth
USEMODULE += random USEMODULE += random
USEMODULE += ztimer_usec USEMODULE += xtimer

View File

@ -1,4 +1,2 @@
USEMODULE_INCLUDES_dose := $(LAST_MAKEFILEDIR)/include USEMODULE_INCLUDES_dose := $(LAST_MAKEFILEDIR)/include
USEMODULE_INCLUDES += $(USEMODULE_INCLUDES_dose) USEMODULE_INCLUDES += $(USEMODULE_INCLUDES_dose)
PSEUDOMODULES += dose_watchdog

View File

@ -14,7 +14,7 @@
* @brief Implementation of the Differentially Operated Serial Ethernet driver * @brief Implementation of the Differentially Operated Serial Ethernet driver
* *
* @author Juergen Fitschen <me@jue.yt> * @author Juergen Fitschen <me@jue.yt>
* Benjamin Valentin <benjamin.valentin@ml-pa.com> *
* @} * @}
*/ */
@ -24,11 +24,9 @@
#include "dose.h" #include "dose.h"
#include "random.h" #include "random.h"
#include "irq.h" #include "irq.h"
#include "periph/timer.h"
#include "net/eui_provider.h" #include "net/eui_provider.h"
#include "net/netdev/eth.h" #include "net/netdev/eth.h"
#include "timex.h"
#define ENABLE_DEBUG 0 #define ENABLE_DEBUG 0
#include "debug.h" #include "debug.h"
@ -41,7 +39,7 @@ static dose_signal_t state_transit_send(dose_t *ctx, dose_signal_t signal);
static void state(dose_t *ctx, dose_signal_t src); static void state(dose_t *ctx, dose_signal_t src);
static void _isr_uart(void *arg, uint8_t c); static void _isr_uart(void *arg, uint8_t c);
static void _isr_gpio(void *arg); static void _isr_gpio(void *arg);
static void _isr_ztimer(void *arg); static void _isr_xtimer(void *arg);
static void clear_recv_buf(dose_t *ctx); static void clear_recv_buf(dose_t *ctx);
static void _isr(netdev_t *netdev); static void _isr(netdev_t *netdev);
static int _recv(netdev_t *dev, void *buf, size_t len, void *info); static int _recv(netdev_t *dev, void *buf, size_t len, void *info);
@ -64,14 +62,6 @@ static uint16_t crc16_update(uint16_t crc, uint8_t octet)
return crc; return crc;
} }
static void _crc_cb(void *ctx, uint8_t *data, size_t len)
{
uint16_t *crc = ctx;
for (uint8_t *end = data + len; data != end; ++data) {
*crc = crc16_update(*crc, *data);
}
}
static void _init_standby(dose_t *ctx, const dose_params_t *params) static void _init_standby(dose_t *ctx, const dose_params_t *params)
{ {
ctx->standby_pin = params->standby_pin; ctx->standby_pin = params->standby_pin;
@ -117,76 +107,35 @@ static inline void _disable_sense(dose_t *ctx)
#endif #endif
} }
#ifdef MODULE_DOSE_WATCHDOG
static unsigned _watchdog_users;
static dose_t *_dose_base;
static uint8_t _dose_numof;
static inline void _watchdog_start(void)
{
if (_watchdog_users) {
return;
}
_watchdog_users++;
timer_start(DOSE_TIMER_DEV);
}
static inline void _watchdog_stop(void)
{
if (_watchdog_users == 0 || --_watchdog_users) {
return;
}
timer_stop(DOSE_TIMER_DEV);
}
static void _dose_watchdog_cb(void *arg, int chan)
{
(void) chan;
(void) arg;
for (unsigned i = 0; i < _dose_numof; ++i) {
dose_t *ctx = &_dose_base[i];
switch (ctx->state) {
case DOSE_STATE_RECV:
if (ctx->recv_buf_ptr_last != ctx->rb.cur) {
ctx->recv_buf_ptr_last = ctx->rb.cur;
break;
}
if (ctx->flags & DOSE_FLAG_RECV_BUF_DIRTY) {
break;
}
DEBUG_PUTS("timeout");
state(&_dose_base[i], DOSE_SIGNAL_ZTIMER);
break;
default:
break;
}
}
}
static void _watchdog_init(unsigned timeout_us)
{
timer_init(DOSE_TIMER_DEV, US_PER_SEC, _dose_watchdog_cb, NULL);
timer_set_periodic(DOSE_TIMER_DEV, 0, timeout_us, TIM_FLAG_RESET_ON_MATCH);
timer_stop(DOSE_TIMER_DEV);
}
#else
static inline void _watchdog_start(void) {}
static inline void _watchdog_stop(void) {}
#endif
static dose_signal_t state_transit_blocked(dose_t *ctx, dose_signal_t signal) static dose_signal_t state_transit_blocked(dose_t *ctx, dose_signal_t signal)
{ {
(void) signal;
uint32_t backoff; uint32_t backoff;
(void) signal;
backoff = random_uint32_range(0, 2 * ctx->timeout_base); if (ctx->state == DOSE_STATE_RECV) {
ztimer_set(ZTIMER_USEC, &ctx->timeout, backoff); /* We got here from RECV state. The driver's thread has to look
* if this frame should be processed. By queuing NETDEV_EVENT_ISR,
* the netif thread will call _isr at some time. */
SETBIT(ctx->flags, DOSE_FLAG_RECV_BUF_DIRTY);
netdev_trigger_event_isr(&ctx->netdev);
}
/* Enable interrupt for start bit sensing */
_enable_sense(ctx);
/* The timeout will bring us back into IDLE state by a random time.
* If we entered this state from RECV state, the random time lays
* in the interval [1 * timeout, 2 * timeout]. If we came from
* SEND state, a time in the interval [2 * timeout, 3 * timeout]
* will be picked. This ensures that responding nodes get preferred
* bus access and sending nodes do not overwhelm listening nodes. */
if (ctx->state == DOSE_STATE_SEND) {
backoff = random_uint32_range(2 * ctx->timeout_base, 3 * ctx->timeout_base);
}
else {
backoff = random_uint32_range(1 * ctx->timeout_base, 2 * ctx->timeout_base);
}
xtimer_set(&ctx->timeout, backoff);
return DOSE_SIGNAL_NONE; return DOSE_SIGNAL_NONE;
} }
@ -196,30 +145,6 @@ static dose_signal_t state_transit_idle(dose_t *ctx, dose_signal_t signal)
(void) ctx; (void) ctx;
(void) signal; (void) signal;
_watchdog_stop();
if (ctx->state == DOSE_STATE_RECV) {
bool dirty = ctx->flags & DOSE_FLAG_RECV_BUF_DIRTY;
bool done = ctx->flags & DOSE_FLAG_END_RECEIVED;
/* We got here from RECV state. The driver's thread has to look
* if this frame should be processed. By queuing NETDEV_EVENT_ISR,
* the netif thread will call _isr at some time. */
if (crb_end_chunk(&ctx->rb, !dirty && done)) {
netdev_trigger_event_isr(&ctx->netdev);
}
clear_recv_buf(ctx);
}
/* Enable interrupt for start bit sensing */
_enable_sense(ctx);
/* Execute pending send */
if (ctx->flags & DOSE_FLAG_SEND_PENDING) {
return DOSE_SIGNAL_SEND;
}
return DOSE_SIGNAL_NONE; return DOSE_SIGNAL_NONE;
} }
@ -231,14 +156,11 @@ static dose_signal_t state_transit_recv(dose_t *ctx, dose_signal_t signal)
/* We freshly entered this state. Thus, no start bit sensing is required /* We freshly entered this state. Thus, no start bit sensing is required
* anymore. Disable RX Start IRQs during the transmission. */ * anymore. Disable RX Start IRQs during the transmission. */
_disable_sense(ctx); _disable_sense(ctx);
_watchdog_start();
crb_start_chunk(&ctx->rb);
} }
if (signal == DOSE_SIGNAL_UART) { if (signal == DOSE_SIGNAL_UART) {
/* We received a new octet */ /* We received a new octet */
bool esc = ctx->flags & DOSE_FLAG_ESC_RECEIVED; int esc = (ctx->flags & DOSE_FLAG_ESC_RECEIVED);
bool dirty = ctx->flags & DOSE_FLAG_RECV_BUF_DIRTY;
if (!esc && ctx->uart_octet == DOSE_OCTET_ESC) { if (!esc && ctx->uart_octet == DOSE_OCTET_ESC) {
SETBIT(ctx->flags, DOSE_FLAG_ESC_RECEIVED); SETBIT(ctx->flags, DOSE_FLAG_ESC_RECEIVED);
} }
@ -250,16 +172,19 @@ static dose_signal_t state_transit_recv(dose_t *ctx, dose_signal_t signal)
if (esc) { if (esc) {
CLRBIT(ctx->flags, DOSE_FLAG_ESC_RECEIVED); CLRBIT(ctx->flags, DOSE_FLAG_ESC_RECEIVED);
} }
/* Since the dirty flag is set after the RECV state is left,
if (!dirty && !crb_add_byte(&ctx->rb, ctx->uart_octet)) { * it indicates that the receive buffer contains unprocessed data
SETBIT(ctx->flags, DOSE_FLAG_RECV_BUF_DIRTY); * from a previously received frame. Thus, we just ignore new data. */
if (!(ctx->flags & DOSE_FLAG_RECV_BUF_DIRTY)
&& ctx->recv_buf_ptr < DOSE_FRAME_LEN) {
ctx->recv_buf[ctx->recv_buf_ptr++] = ctx->uart_octet;
} }
} }
} }
if (rc == DOSE_SIGNAL_NONE && !IS_ACTIVE(MODULE_DOSE_WATCHDOG)) { if (rc == DOSE_SIGNAL_NONE) {
/* No signal is returned. We stay in the RECV state. */ /* No signal is returned. We stay in the RECV state. */
ztimer_set(ZTIMER_USEC, &ctx->timeout, ctx->timeout_base); xtimer_set(&ctx->timeout, ctx->timeout_base);
} }
return rc; return rc;
@ -278,9 +203,8 @@ static dose_signal_t state_transit_send(dose_t *ctx, dose_signal_t signal)
* will bring us back to the BLOCKED state after _send has emitted * will bring us back to the BLOCKED state after _send has emitted
* its last octet. */ * its last octet. */
#ifndef MODULE_PERIPH_UART_COLLISION #ifndef MODULE_PERIPH_UART_COLLISION
ztimer_set(ZTIMER_USEC, &ctx->timeout, ctx->timeout_base); xtimer_set(&ctx->timeout, ctx->timeout_base);
#endif #endif
return DOSE_SIGNAL_NONE; return DOSE_SIGNAL_NONE;
} }
@ -296,16 +220,16 @@ static void state(dose_t *ctx, dose_signal_t signal)
* last 4 bits of a uint8_t, they can be added together and hence * last 4 bits of a uint8_t, they can be added together and hence
* be checked together. */ * be checked together. */
switch (ctx->state + signal) { switch (ctx->state + signal) {
case DOSE_STATE_IDLE + DOSE_SIGNAL_SEND: case DOSE_STATE_INIT + DOSE_SIGNAL_INIT:
case DOSE_STATE_RECV + DOSE_SIGNAL_END:
case DOSE_STATE_RECV + DOSE_SIGNAL_XTIMER:
case DOSE_STATE_SEND + DOSE_SIGNAL_END:
case DOSE_STATE_SEND + DOSE_SIGNAL_XTIMER:
signal = state_transit_blocked(ctx, signal); signal = state_transit_blocked(ctx, signal);
ctx->state = DOSE_STATE_BLOCKED; ctx->state = DOSE_STATE_BLOCKED;
break; break;
case DOSE_STATE_SEND + DOSE_SIGNAL_END: case DOSE_STATE_BLOCKED + DOSE_SIGNAL_XTIMER:
case DOSE_STATE_SEND + DOSE_SIGNAL_ZTIMER:
case DOSE_STATE_INIT + DOSE_SIGNAL_INIT:
case DOSE_STATE_RECV + DOSE_SIGNAL_END:
case DOSE_STATE_RECV + DOSE_SIGNAL_ZTIMER:
signal = state_transit_idle(ctx, signal); signal = state_transit_idle(ctx, signal);
ctx->state = DOSE_STATE_IDLE; ctx->state = DOSE_STATE_IDLE;
break; break;
@ -319,14 +243,14 @@ static void state(dose_t *ctx, dose_signal_t signal)
ctx->state = DOSE_STATE_RECV; ctx->state = DOSE_STATE_RECV;
break; break;
case DOSE_STATE_BLOCKED + DOSE_SIGNAL_ZTIMER: case DOSE_STATE_IDLE + DOSE_SIGNAL_SEND:
case DOSE_STATE_SEND + DOSE_SIGNAL_UART: case DOSE_STATE_SEND + DOSE_SIGNAL_UART:
signal = state_transit_send(ctx, signal); signal = state_transit_send(ctx, signal);
ctx->state = DOSE_STATE_SEND; ctx->state = DOSE_STATE_SEND;
break; break;
default: default:
DEBUG("dose state(): unexpected state transition (STATE=0x%02x SIGNAL=0x%02x)\n", ctx->state, signal); DEBUG("dose state(): unexpected state transition (STATE=0x%02d SIGNAL=0x%02d)\n", ctx->state, signal);
signal = DOSE_SIGNAL_NONE; signal = DOSE_SIGNAL_NONE;
} }
} while (signal != DOSE_SIGNAL_NONE); } while (signal != DOSE_SIGNAL_NONE);
@ -351,30 +275,18 @@ static void _isr_gpio(void *arg)
state(dev, DOSE_SIGNAL_GPIO); state(dev, DOSE_SIGNAL_GPIO);
} }
static void _isr_ztimer(void *arg) static void _isr_xtimer(void *arg)
{ {
dose_t *dev = arg; dose_t *dev = arg;
switch (dev->state) { state(dev, DOSE_SIGNAL_XTIMER);
#ifndef MODULE_DOSE_WATCHDOG
case DOSE_STATE_RECV:
#endif
case DOSE_STATE_BLOCKED:
case DOSE_STATE_SEND:
state(dev, DOSE_SIGNAL_ZTIMER);
break;
default:
;
}
} }
static void clear_recv_buf(dose_t *ctx) static void clear_recv_buf(dose_t *ctx)
{ {
unsigned irq_state = irq_disable(); unsigned irq_state = irq_disable();
#ifdef MODULE_DOSE_WATCHDOG ctx->recv_buf_ptr = 0;
ctx->recv_buf_ptr_last = NULL;
#endif
CLRBIT(ctx->flags, DOSE_FLAG_RECV_BUF_DIRTY); CLRBIT(ctx->flags, DOSE_FLAG_RECV_BUF_DIRTY);
CLRBIT(ctx->flags, DOSE_FLAG_END_RECEIVED); CLRBIT(ctx->flags, DOSE_FLAG_END_RECEIVED);
CLRBIT(ctx->flags, DOSE_FLAG_ESC_RECEIVED); CLRBIT(ctx->flags, DOSE_FLAG_ESC_RECEIVED);
@ -383,39 +295,58 @@ static void clear_recv_buf(dose_t *ctx)
static void _isr(netdev_t *netdev) static void _isr(netdev_t *netdev)
{ {
uint8_t dst[ETHERNET_ADDR_LEN];
dose_t *ctx = container_of(netdev, dose_t, netdev); dose_t *ctx = container_of(netdev, dose_t, netdev);
size_t len; unsigned irq_state;
int dirty, end;
/* Get current flags atomically */
irq_state = irq_disable();
dirty = (ctx->flags & DOSE_FLAG_RECV_BUF_DIRTY);
end = (ctx->flags & DOSE_FLAG_END_RECEIVED);
irq_restore(irq_state);
/* If the receive buffer does not contain any data just abort ... */
if (!dirty) {
DEBUG("dose _isr(): no frame -> drop\n");
return;
}
/* If we haven't received a valid END octet just drop the incomplete frame. */
if (!end) {
DEBUG("dose _isr(): incomplete frame -> drop\n");
clear_recv_buf(ctx);
return;
}
/* The set dirty flag prevents recv_buf or recv_buf_ptr from being
* touched in ISR context. Thus, it is safe to work with them without
* IRQs being disabled or mutexes being locked. */
/* Check for minimum length of an Ethernet packet */ /* Check for minimum length of an Ethernet packet */
if (!crb_get_chunk_size(&ctx->rb, &len) || if (ctx->recv_buf_ptr < sizeof(ethernet_hdr_t) + DOSE_FRAME_CRC_LEN) {
len < sizeof(ethernet_hdr_t) + DOSE_FRAME_CRC_LEN) {
DEBUG("dose _isr(): frame too short -> drop\n"); DEBUG("dose _isr(): frame too short -> drop\n");
crb_consume_chunk(&ctx->rb, NULL, 0); clear_recv_buf(ctx);
return; return;
} }
/* Check the dst mac addr if the iface is not in promiscuous mode */ /* Check the dst mac addr if the iface is not in promiscuous mode */
if (!(ctx->opts & DOSE_OPT_PROMISCUOUS)) { if (!(ctx->opts & DOSE_OPT_PROMISCUOUS)) {
ethernet_hdr_t *hdr = (ethernet_hdr_t *) ctx->recv_buf;
/* get destination address - length of RX frame has ben checked before */ if ((hdr->dst[0] & 0x1) == 0 && memcmp(hdr->dst, ctx->mac_addr.uint8, ETHERNET_ADDR_LEN) != 0) {
crb_peek_bytes(&ctx->rb, dst, offsetof(ethernet_hdr_t, dst), sizeof(dst));
/* destination has to be either broadcast or our address */
if ((dst[0] & 0x1) == 0 && memcmp(dst, ctx->mac_addr.uint8, ETHERNET_ADDR_LEN) != 0) {
DEBUG("dose _isr(): dst mac not matching -> drop\n"); DEBUG("dose _isr(): dst mac not matching -> drop\n");
crb_consume_chunk(&ctx->rb, NULL, 0); clear_recv_buf(ctx);
return; return;
} }
} }
/* Check the CRC */ /* Check the CRC */
uint16_t crc = 0xffff; uint16_t crc = 0xffff;
crb_chunk_foreach(&ctx->rb, _crc_cb, &crc); for (size_t i = 0; i < ctx->recv_buf_ptr; i++) {
crc = crc16_update(crc, ctx->recv_buf[i]);
}
if (crc != 0x0000) { if (crc != 0x0000) {
DEBUG("dose _isr(): wrong crc 0x%04x -> drop\n", crc); DEBUG("dose _isr(): wrong crc 0x%04x -> drop\n", crc);
crb_consume_chunk(&ctx->rb, NULL, 0); clear_recv_buf(ctx);
return; return;
} }
@ -430,21 +361,28 @@ static int _recv(netdev_t *dev, void *buf, size_t len, void *info)
(void)info; (void)info;
size_t pktlen = ctx->recv_buf_ptr - DOSE_FRAME_CRC_LEN;
if (!buf && !len) { if (!buf && !len) {
size_t pktlen;
/* Return the amount of received bytes */ /* Return the amount of received bytes */
if (crb_get_chunk_size(&ctx->rb, &pktlen)) { return pktlen;
return pktlen - DOSE_FRAME_CRC_LEN;
} else {
return 0;
} }
else if (!buf && len) {
/* The user drops the packet */
clear_recv_buf(ctx);
return pktlen;
} }
else if (len < pktlen) {
if (crb_consume_chunk(&ctx->rb, buf, len)) { /* The provided buffer is too small! */
return len; DEBUG("dose _recv(): receive buffer too small\n");
} else { clear_recv_buf(ctx);
return -1; return -1;
} }
else {
/* Copy the packet to the provided buffer. */
memcpy(buf, ctx->recv_buf, pktlen);
clear_recv_buf(ctx);
return pktlen;
}
} }
static uint8_t wait_for_state(dose_t *ctx, uint8_t state) static uint8_t wait_for_state(dose_t *ctx, uint8_t state)
@ -513,7 +451,7 @@ static inline void _send_done(dose_t *ctx, bool collision)
#ifdef MODULE_PERIPH_UART_COLLISION #ifdef MODULE_PERIPH_UART_COLLISION
uart_collision_detect_disable(ctx->uart); uart_collision_detect_disable(ctx->uart);
if (collision) { if (collision) {
state(ctx, DOSE_SIGNAL_ZTIMER); state(ctx, DOSE_SIGNAL_XTIMER);
} }
#else #else
(void)ctx; (void)ctx;
@ -542,13 +480,11 @@ send:
crc = 0xffff; crc = 0xffff;
pktlen = 0; pktlen = 0;
/* Indicate intention to send */ /* Switch to state SEND */
SETBIT(ctx->flags, DOSE_FLAG_SEND_PENDING); do {
wait_for_state(ctx, DOSE_STATE_IDLE);
state(ctx, DOSE_SIGNAL_SEND); state(ctx, DOSE_SIGNAL_SEND);
} while (wait_for_state(ctx, DOSE_STATE_ANY) != DOSE_STATE_SEND);
/* Wait for transition to SEND state */
wait_for_state(ctx, DOSE_STATE_SEND);
CLRBIT(ctx->flags, DOSE_FLAG_SEND_PENDING);
_send_start(ctx); _send_start(ctx);
@ -731,9 +667,9 @@ static int _init(netdev_t *dev)
/* Set state machine to defaults */ /* Set state machine to defaults */
irq_state = irq_disable(); irq_state = irq_disable();
ctx->opts = 0; ctx->opts = 0;
ctx->recv_buf_ptr = 0;
ctx->flags = 0; ctx->flags = 0;
ctx->state = DOSE_STATE_INIT; ctx->state = DOSE_STATE_INIT;
crb_init(&ctx->rb, ctx->recv_buf, sizeof(ctx->recv_buf));
irq_restore(irq_state); irq_restore(irq_state);
state(ctx, DOSE_SIGNAL_INIT); state(ctx, DOSE_SIGNAL_INIT);
@ -752,6 +688,8 @@ static const netdev_driver_t netdev_driver_dose = {
void dose_setup(dose_t *ctx, const dose_params_t *params, uint8_t index) void dose_setup(dose_t *ctx, const dose_params_t *params, uint8_t index)
{ {
static const xtimer_ticks32_t min_timeout = {.ticks32 = XTIMER_BACKOFF};
ctx->netdev.driver = &netdev_driver_dose; ctx->netdev.driver = &netdev_driver_dose;
mutex_init(&ctx->state_mtx); mutex_init(&ctx->state_mtx);
@ -772,21 +710,17 @@ void dose_setup(dose_t *ctx, const dose_params_t *params, uint8_t index)
); );
/* The timeout base is the minimal timeout base used for this driver. /* The timeout base is the minimal timeout base used for this driver.
* We have to ensure it is above the XTIMER_BACKOFF. Otherwise state
* transitions are triggered from another state transition setting up the
* timeout.
* To calculate how long it takes to transfer one byte we assume * To calculate how long it takes to transfer one byte we assume
* 8 data bits + 1 start bit + 1 stop bit per byte. * 8 data bits + 1 start bit + 1 stop bit per byte.
*/ */
ctx->timeout_base = CONFIG_DOSE_TIMEOUT_BYTES * 10UL * US_PER_SEC / params->baudrate; ctx->timeout_base = CONFIG_DOSE_TIMEOUT_BYTES * 10UL * US_PER_SEC / params->baudrate;
if (ctx->timeout_base < xtimer_usec_from_ticks(min_timeout)) {
ctx->timeout_base = xtimer_usec_from_ticks(min_timeout);
}
DEBUG("dose timeout set to %" PRIu32 " µs\n", ctx->timeout_base); DEBUG("dose timeout set to %" PRIu32 " µs\n", ctx->timeout_base);
ctx->timeout.callback = _isr_ztimer; ctx->timeout.callback = _isr_xtimer;
ctx->timeout.arg = ctx; ctx->timeout.arg = ctx;
#ifdef MODULE_DOSE_WATCHDOG
if (index >= _dose_numof) {
_dose_numof = index + 1;
}
if (index == 0) {
_dose_base = ctx;
_watchdog_init(ctx->timeout_base * 2);
}
#endif /* MODULE_DOSE_WATCHDOG */
} }

View File

@ -13,12 +13,97 @@ config MODULE_FT5X06
select MODULE_PERIPH_I2C select MODULE_PERIPH_I2C
select MODULE_ZTIMER select MODULE_ZTIMER
select MODULE_ZTIMER_MSEC select MODULE_ZTIMER_MSEC
help
This driver is compatible with the following controllers: ft5x06, ft5606, ft5x16, ft6x06,
ft6x36, ft5x06i, ft5336, ft3316, ft5436i, ft5336i and ft5x46.
config HAVE_FT5X06 config MODULE_FT5606
bool "FT5606 touch panel driver"
select MODULE_FT5X06
config MODULE_FT5X16
bool "FT5X16 touch panel driver"
select MODULE_FT5X06
config MODULE_FT6X06
bool "FT6X06 touch panel driver"
select MODULE_FT5X06
config MODULE_FT6X36
bool "FT6X36 touch panel driver"
select MODULE_FT5X06
config MODULE_FT5X06I
bool "FT5X06I touch panel driver"
select MODULE_FT5X06
config MODULE_FT5336
bool "FT5336 touch panel driver"
select MODULE_FT5X06
config MODULE_FT3316
bool "FT3316 touch panel driver"
select MODULE_FT5X06
config MODULE_FT5436I
bool "FT5436I touch panel driver"
select MODULE_FT5X06
config MODULE_FT5336I
bool "FT5336I touch panel driver"
select MODULE_FT5X06
config MODULE_FT5X46
bool "FT5X46 touch panel driver"
select MODULE_FT5X06
config HAVE_FT5606
bool bool
select MODULE_FT5X06 if MODULE_TOUCH_DEV select MODULE_FT5606 if MODULE_TOUCH_DEV
help help
Indicates that an FT5X06 touch panel is present. Indicates that an FT5606 touch panel is present.
config HAVE_FT5X16
bool
select MODULE_FT5X16 if MODULE_TOUCH_DEV
help
Indicates that an FT5X16 touch panel is present.
config HAVE_FT6X06
bool
select MODULE_FT6X06 if MODULE_TOUCH_DEV
help
Indicates that an FT6X06 touch panel is present.
config HAVE_FT6X36
bool
select MODULE_FT6X36 if MODULE_TOUCH_DEV
help
Indicates that an FT6X36 touch panel is present.
config HAVE_FT5X06I
bool
select MODULE_FT5X06I if MODULE_TOUCH_DEV
help
Indicates that an FT5X06I touch panel is present.
config HAVE_FT5336
bool
select MODULE_FT5336 if MODULE_TOUCH_DEV
help
Indicates that an FT5336 touch panel is present.
config HAVE_FT3316
bool
select MODULE_FT3316 if MODULE_TOUCH_DEV
help
Indicates that an FT3316 touch panel is present.
config HAVE_FT5436I
bool
select MODULE_FT5436I if MODULE_TOUCH_DEV
help
Indicates that an FT5436I touch panel is present.
config HAVE_FT5X46
bool
select MODULE_FT5X46 if MODULE_TOUCH_DEV
help
Indicates that an FT5X46 touch panel is present.

View File

@ -1,2 +1,13 @@
USEMODULE_INCLUDES_ft5x06 := $(LAST_MAKEFILEDIR)/include USEMODULE_INCLUDES_ft5x06 := $(LAST_MAKEFILEDIR)/include
USEMODULE_INCLUDES += $(USEMODULE_INCLUDES_ft5x06) USEMODULE_INCLUDES += $(USEMODULE_INCLUDES_ft5x06)
PSEUDOMODULES += ft5606
PSEUDOMODULES += ft5x16
PSEUDOMODULES += ft6x06
PSEUDOMODULES += ft6x36
PSEUDOMODULES += ft5x06i
PSEUDOMODULES += ft5336
PSEUDOMODULES += ft3316
PSEUDOMODULES += ft5436i
PSEUDOMODULES += ft5336i
PSEUDOMODULES += ft5x46

View File

@ -27,7 +27,6 @@
#include "ztimer.h" #include "ztimer.h"
#include "ft5x06.h" #include "ft5x06.h"
#include "ft5x06_internal.h"
#include "ft5x06_constants.h" #include "ft5x06_constants.h"
#include "ft5x06_params.h" #include "ft5x06_params.h"
@ -54,24 +53,15 @@ int ft5x06_init(ft5x06_t *dev, const ft5x06_params_t *params, ft5x06_event_cb_t
return -EPROTO; return -EPROTO;
} }
uint8_t expected_id; if (vendor_id != FT5X06_VENDOR_ID) {
if (dev->params.type == FT5X06_TYPE_FT6X06 || dev->params.type == FT5X06_TYPE_FT6X36) {
expected_id = FT6XX6_VENDOR_ID;
}
else {
expected_id = FT5X06_VENDOR_ID;
}
if (expected_id != vendor_id) {
DEBUG("[ft5x06] init: invalid vendor ID: '0x%02x' (expected: 0x%02x)\n", DEBUG("[ft5x06] init: invalid vendor ID: '0x%02x' (expected: 0x%02x)\n",
vendor_id, expected_id); vendor_id, FT5X06_VENDOR_ID);
i2c_release(FT5X06_BUS); i2c_release(FT5X06_BUS);
return -ENODEV; return -ENODEV;
} }
/* Auto-calibrate if needed */ /* Auto-calibrate if needed */
if (dev->params.type == FT5X06_TYPE_FT5606|| dev->params.type == FT5X06_TYPE_FT5X16 || if (IS_ACTIVE(FT5X06_AUTO_CALIB_NEEDED)) {
dev->params.type == FT5X06_TYPE_FT5X06I) {
DEBUG("[ft5x06] init: enable device auto-calibration\n"); DEBUG("[ft5x06] init: enable device auto-calibration\n");
i2c_write_reg(FT5X06_BUS, FT5X06_ADDR, FT5X06_G_AUTO_CLB_MODE_REG, 0, 0); i2c_write_reg(FT5X06_BUS, FT5X06_ADDR, FT5X06_G_AUTO_CLB_MODE_REG, 0, 0);
} }
@ -91,9 +81,11 @@ int ft5x06_init(ft5x06_t *dev, const ft5x06_params_t *params, ft5x06_event_cb_t
static const uint8_t touch_reg_map[FT5X06_TOUCHES_COUNT_MAX] = { static const uint8_t touch_reg_map[FT5X06_TOUCHES_COUNT_MAX] = {
FT5X06_TOUCH1_XH_REG, FT5X06_TOUCH1_XH_REG,
FT5X06_TOUCH2_XH_REG, FT5X06_TOUCH2_XH_REG,
#if FT5X06_TOUCHES_COUNT_MAX > 2
FT5X06_TOUCH3_XH_REG, FT5X06_TOUCH3_XH_REG,
FT5X06_TOUCH4_XH_REG, FT5X06_TOUCH4_XH_REG,
FT5X06_TOUCH5_XH_REG, FT5X06_TOUCH5_XH_REG,
#endif
}; };
int ft5x06_read_touch_positions(const ft5x06_t *dev, ft5x06_touch_position_t *positions, size_t len) int ft5x06_read_touch_positions(const ft5x06_t *dev, ft5x06_touch_position_t *positions, size_t len)
@ -121,7 +113,7 @@ int ft5x06_read_touch_count(const ft5x06_t *dev, uint8_t *count)
i2c_release(FT5X06_BUS); i2c_release(FT5X06_BUS);
*count &= FT5X06_TD_STATUS_MASK; *count &= FT5X06_TD_STATUS_MASK;
if (*count > ft5x06_get_touches_count_max(dev)) { if (*count > FT5X06_TOUCHES_COUNT_MAX) {
*count = 0; *count = 0;
} }

View File

@ -1,29 +0,0 @@
/*
* Copyright (c) 2022 HAW Hamburg
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @{
* @file
* @brief Implementation of internal functions for ft5x06
*
* @author Leandro Lanzieri <leandro.lanzieri@haw-hamburg.de>
* @}
*/
#include <inttypes.h>
#include "ft5x06.h"
#include "ft5x06_internal.h"
uint8_t ft5x06_get_touches_count_max(const ft5x06_t *dev) {
if (dev->params.type == FT5X06_TYPE_FT6X06 || dev->params.type == FT5X06_TYPE_FT6X36) {
return FT6XX6_TOUCHES_COUNT_MAX;
}
else {
return FT5X06_TOUCHES_COUNT_MAX;
}
}

Some files were not shown because too many files have changed in this diff Show More