mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #18248 from gschorcht/cpu/esp32/inverse_MCU_CPU_conditionals
cpu/esp32: invert MCU_* and CPU* conditionals
This commit is contained in:
commit
61d17d5601
@ -615,7 +615,7 @@ static int _esp_wifi_send(netdev_t *netdev, const iolist_t *iolist)
|
||||
/* send the the packet to the peer(s) mac address */
|
||||
if (esp_wifi_internal_tx(ESP_IF_WIFI_STA, dev->tx_buf, dev->tx_len) == ESP_OK) {
|
||||
#endif
|
||||
#ifdef MCU_ESP32
|
||||
#ifndef MCU_ESP8266
|
||||
/* for ESP8266 it is done in _esp_wifi_tx_cb */
|
||||
_esp_wifi_send_is_in = false;
|
||||
netdev->event_callback(netdev, NETDEV_EVENT_TX_COMPLETE);
|
||||
@ -872,7 +872,7 @@ void esp_wifi_setup (esp_wifi_netdev_t* dev)
|
||||
|
||||
#ifndef MODULE_ESP_NOW
|
||||
/* if module esp_now is used, the following part is already done */
|
||||
#ifdef MCU_ESP32
|
||||
#ifndef MCU_ESP8266
|
||||
extern portMUX_TYPE g_intr_lock_mux;
|
||||
mutex_init(&g_intr_lock_mux);
|
||||
#endif
|
||||
|
@ -45,7 +45,7 @@ extern "C" {
|
||||
#define RTC_BSS_ATTR __attribute__((section(".rtc.bss")))
|
||||
#endif
|
||||
|
||||
#ifndef MCU_ESP32
|
||||
#ifdef MCU_ESP8266
|
||||
#ifndef RTC_DATA_ATTR
|
||||
#define RTC_DATA_ATTR __attribute__((section(".rtc.data")))
|
||||
#endif
|
||||
|
@ -39,12 +39,12 @@ extern "C" {
|
||||
typedef enum
|
||||
{
|
||||
_GPIO = 0, /**< pin used as standard GPIO */
|
||||
#ifdef MCU_ESP32
|
||||
#ifndef MCU_ESP8266
|
||||
_ADC, /**< pin is used as ADC input */
|
||||
_CAN, /**< pin is used as CAN signal */
|
||||
_DAC, /**< pin is used as DAC output */
|
||||
_EMAC, /**< pin is used as EMAC signal */
|
||||
#endif /* MCU_ESP32 */
|
||||
#endif /* !MCU_ESP8266 */
|
||||
_I2C, /**< pin is used as I2C signal */
|
||||
_PWM, /**< pin is used as PWM output */
|
||||
_SPI, /**< pin is used as SPI interface */
|
||||
|
@ -45,7 +45,7 @@
|
||||
#include "gpio_arch.h"
|
||||
#include "rom/ets_sys.h"
|
||||
|
||||
#ifdef MCU_ESP32
|
||||
#ifndef MCU_ESP8266
|
||||
|
||||
#include "soc/gpio_reg.h"
|
||||
#include "soc/gpio_struct.h"
|
||||
@ -57,7 +57,7 @@
|
||||
#define GPIO_SET(l,h,b) if (b < 32) GPIO.l = BIT(b); else GPIO.h.val = BIT(b-32)
|
||||
#define GPIO_GET(l,h,b) ((b < 32) ? GPIO.l & BIT(b) : GPIO.h.val & BIT(b-32))
|
||||
|
||||
#else /* MCU_ESP32 */
|
||||
#else /* MCU_ESP8266 */
|
||||
|
||||
#include "esp/gpio_regs.h"
|
||||
#include "sdk/ets.h"
|
||||
@ -79,7 +79,7 @@
|
||||
extern uint8_t system_get_cpu_freq(void);
|
||||
extern bool system_update_cpu_freq(uint8_t freq);
|
||||
|
||||
#endif /* MCU_ESP32 */
|
||||
#endif /* MCU_ESP8266 */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -203,7 +203,7 @@ void i2c_init(i2c_t dev)
|
||||
}
|
||||
|
||||
/* Configure and initialize SDA and SCL pin. */
|
||||
#ifdef MCU_ESP32
|
||||
#ifndef MCU_ESP8266
|
||||
/*
|
||||
* ESP32 pins are used in input/output mode with open-drain output driver.
|
||||
* Signal levels are then realized as following:
|
||||
@ -225,7 +225,7 @@ void i2c_init(i2c_t dev)
|
||||
}
|
||||
gpio_set(i2c_config[dev].sda);
|
||||
|
||||
#else /* MCU_ESP32 */
|
||||
#else /* !MCU_ESP8266 */
|
||||
/*
|
||||
* Due to critical timing required by the I2C software implementation,
|
||||
* the ESP8266 GPIOs can not be used directly in GPIO_OD_PU mode.
|
||||
@ -245,7 +245,7 @@ void i2c_init(i2c_t dev)
|
||||
gpio_init(_i2c_bus[dev].sda, GPIO_IN_PU)) {
|
||||
return;
|
||||
}
|
||||
#endif /* MCU_ESP32 */
|
||||
#endif /* !MCU_ESP8266 */
|
||||
|
||||
/* store the usage type in GPIO table */
|
||||
gpio_set_pin_usage(_i2c_bus[dev].scl, _I2C);
|
||||
@ -438,29 +438,29 @@ static inline void _i2c_delay(_i2c_bus_t* bus)
|
||||
static inline bool _i2c_scl_read(_i2c_bus_t* bus)
|
||||
{
|
||||
/* read SCL status (pin is in open-drain mode and set) */
|
||||
#ifdef MCU_ESP32
|
||||
#ifndef MCU_ESP8266
|
||||
return GPIO_GET(in, in1, bus->scl);
|
||||
#else /* MCU_ESP32 */
|
||||
#else /* !MCU_ESP8266 */
|
||||
return GPIO.IN & bus->scl_bit;
|
||||
#endif /* MCU_ESP32 */
|
||||
#endif /* !MCU_ESP8266 */
|
||||
}
|
||||
|
||||
static inline bool _i2c_sda_read(_i2c_bus_t* bus)
|
||||
{
|
||||
/* read SDA status (pin is in open-drain mode and set) */
|
||||
#ifdef MCU_ESP32
|
||||
#ifndef MCU_ESP8266
|
||||
return GPIO_GET(in, in1, bus->sda);
|
||||
#else /* MCU_ESP32 */
|
||||
#else /* !MCU_ESP8266 */
|
||||
return GPIO.IN & bus->sda_bit;
|
||||
#endif /* MCU_ESP32 */
|
||||
#endif /* !MCU_ESP8266 */
|
||||
}
|
||||
|
||||
static inline void _i2c_scl_high(_i2c_bus_t* bus)
|
||||
{
|
||||
#ifdef MCU_ESP32
|
||||
#ifndef MCU_ESP8266
|
||||
/* set SCL signal high (pin is in open-drain mode and pulled-up) */
|
||||
GPIO_SET(out_w1ts, out1_w1ts, bus->scl);
|
||||
#else /* MCU_ESP32 */
|
||||
#else /* !MCU_ESP8266 */
|
||||
#if I2C_CLOCK_STRETCH > 0
|
||||
/*
|
||||
* set SCL signal high (switch back to GPIO_IN_PU mode, that is the pin is
|
||||
@ -471,15 +471,15 @@ static inline void _i2c_scl_high(_i2c_bus_t* bus)
|
||||
/* No clock stretching supported, always drive the SCL pin. */
|
||||
GPIO.OUT_SET = bus->scl_bit;
|
||||
#endif /* I2C_CLOCK_STRETCH > 0 */
|
||||
#endif /* MCU_ESP32 */
|
||||
#endif /* !MCU_ESP8266 */
|
||||
}
|
||||
|
||||
static inline void _i2c_scl_low(_i2c_bus_t* bus)
|
||||
{
|
||||
#ifdef MCU_ESP32
|
||||
#ifndef MCU_ESP8266
|
||||
/* set SCL signal low (actively driven to low) */
|
||||
GPIO_SET(out_w1tc, out1_w1tc, bus->scl);
|
||||
#else /* MCU_ESP32 */
|
||||
#else /* !MCU_ESP8266 */
|
||||
#if I2C_CLOCK_STRETCH > 0
|
||||
/*
|
||||
* set SCL signal low (switch temporarily to GPIO_OD_PU where the
|
||||
@ -490,35 +490,35 @@ static inline void _i2c_scl_low(_i2c_bus_t* bus)
|
||||
/* No clock stretching supported, always drive the SCL pin. */
|
||||
GPIO.OUT_CLEAR = bus->scl_bit;
|
||||
#endif /* I2C_CLOCK_STRETCH > 0 */
|
||||
#endif /* MCU_ESP32 */
|
||||
#endif /* !MCU_ESP8266 */
|
||||
}
|
||||
|
||||
static inline void _i2c_sda_high(_i2c_bus_t* bus)
|
||||
{
|
||||
#ifdef MCU_ESP32
|
||||
#ifndef MCU_ESP8266
|
||||
/* set SDA signal high (pin is in open-drain mode and pulled-up) */
|
||||
GPIO_SET(out_w1ts, out1_w1ts, bus->sda);
|
||||
#else /* MCU_ESP32 */
|
||||
#else /* !MCU_ESP8266 */
|
||||
/*
|
||||
* set SDA signal high (switch back to GPIO_IN_PU mode, that is the pin is
|
||||
* in open-drain mode and pulled-up to high)
|
||||
*/
|
||||
GPIO.ENABLE_OUT_CLEAR = bus->sda_bit;
|
||||
#endif /* MCU_ESP32 */
|
||||
#endif /* !MCU_ESP8266 */
|
||||
}
|
||||
|
||||
static inline void _i2c_sda_low(_i2c_bus_t* bus)
|
||||
{
|
||||
#ifdef MCU_ESP32
|
||||
#ifndef MCU_ESP8266
|
||||
/* set SDA signal low (actively driven to low) */
|
||||
GPIO_SET(out_w1tc, out1_w1tc, bus->sda);
|
||||
#else /* MCU_ESP32 */
|
||||
#else /* !MCU_ESP8266 */
|
||||
/*
|
||||
* set SDA signal low (switch temporarily to GPIO_OD_PU where the
|
||||
* written output value 0 drives the pin actively to low)
|
||||
*/
|
||||
GPIO.ENABLE_OUT_SET = bus->sda_bit;
|
||||
#endif /* MCU_ESP32 */
|
||||
#endif /* !MCU_ESP8266 */
|
||||
}
|
||||
|
||||
static void _i2c_clear(_i2c_bus_t* bus)
|
||||
|
@ -1,14 +1,13 @@
|
||||
ifneq ($(CPU),esp32)
|
||||
|
||||
ifneq (,$(filter esp_log_colored,$(USEMODULE)))
|
||||
BOOTLOADER_COLOR = _colors
|
||||
endif
|
||||
ifneq (,$(filter esp_log_startup,$(USEMODULE)))
|
||||
BOOTLOADER_INFO = _info
|
||||
endif
|
||||
# Full path to the bootloader binary. In the ESP32 case this is set by the
|
||||
# esp_bootloader module.
|
||||
BOOTLOADER_BIN ?= $(RIOTCPU)/$(CPU)/bin/bootloader$(BOOTLOADER_COLOR)$(BOOTLOADER_INFO).bin
|
||||
ifeq ($(CPU),esp8266)
|
||||
ifneq (,$(filter esp_log_colored,$(USEMODULE)))
|
||||
BOOTLOADER_COLOR = _colors
|
||||
endif
|
||||
ifneq (,$(filter esp_log_startup,$(USEMODULE)))
|
||||
BOOTLOADER_INFO = _info
|
||||
endif
|
||||
# Full path to the bootloader binary. In the ESP32 case this is set by the
|
||||
# esp_bootloader module.
|
||||
BOOTLOADER_BIN ?= $(RIOTCPU)/$(CPU)/bin/bootloader$(BOOTLOADER_COLOR)$(BOOTLOADER_INFO).bin
|
||||
endif
|
||||
|
||||
ESPTOOL ?= $(RIOTTOOLS)/esptools/esptool.py
|
||||
@ -33,7 +32,7 @@ endif
|
||||
.PHONY: esp-qemu
|
||||
|
||||
esp-qemu:
|
||||
ifneq (,$(filter esp32,$(CPU_FAM)))
|
||||
ifeq (esp32,$(CPU))
|
||||
$(Q)echo \
|
||||
"--flash_mode $(FLASH_MODE) --flash_freq $(FLASH_FREQ) " \
|
||||
"--flash_size $(FLASH_SIZE)MB" \
|
||||
@ -41,7 +40,7 @@ ifneq (,$(filter esp32,$(CPU_FAM)))
|
||||
"0x8000 $(BINDIR)/partitions.bin" \
|
||||
"0x10000 $(FLASHFILE)" > $(BINDIR)/qemu_flash_args
|
||||
$(Q)$(ESPTOOL) \
|
||||
--chip esp32 merge_bin \
|
||||
--chip $(CPU_FAM) merge_bin \
|
||||
--fill-flash-size 4MB \
|
||||
-o $(BINDIR)/qemu_flash_image.bin @$(BINDIR)/qemu_flash_args
|
||||
$(Q)cp $(RIOTCPU)/$(CPU)/bin/rom_0x3ff90000_0x00010000.bin $(BINDIR)/rom1.bin
|
||||
|
Loading…
Reference in New Issue
Block a user