From d0c7e2f1d0db77e6340ab7aafc4190aa90e6a99f Mon Sep 17 00:00:00 2001 From: Wu Jian Gang Date: Thu, 24 May 2018 20:40:50 +0800 Subject: [PATCH 1/2] feat(esp8266): Remove c_types.h --- components/esp8266/include/c_types.h | 48 ---------------------------- 1 file changed, 48 deletions(-) delete mode 100644 components/esp8266/include/c_types.h diff --git a/components/esp8266/include/c_types.h b/components/esp8266/include/c_types.h deleted file mode 100644 index 4d768350..00000000 --- a/components/esp8266/include/c_types.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * ESPRSSIF MIT License - * - * Copyright (c) 2015 - * - * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case, - * it is free of charge, to any person obtaining a copy of this software and associated - * documentation files (the "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the Software is furnished - * to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all copies or - * substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - */ - -#ifndef _C_TYPES_H_ -#define _C_TYPES_H_ - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define BIT(nr) (1UL << (nr)) - -#define REG_WRITE(_r, _v) (*(volatile uint32_t *)(_r)) = (_v) -#define REG_READ(_r) (*(volatile uint32_t *)(_r)) - -#define REG_SET_BIT(_r, _b) (*(volatile uint32_t *)(_r) |= (_b)) -#define REG_CLR_BIT(_r, _b) (*(volatile uint32_t *)(_r) &= ~(_b)) - -#ifdef __cplusplus -} -#endif - -#endif /* _C_TYPES_H_ */ From e518650b36e4091d050447962dd0b70c1a56aa31 Mon Sep 17 00:00:00 2001 From: Wu Jian Gang Date: Thu, 24 May 2018 20:41:09 +0800 Subject: [PATCH 2/2] feat: Don't use c_types.h in SDK --- components/esp8266/driver/gpio.c | 2 -- components/esp8266/include/driver/spi_interface.h | 1 - components/esp8266/include/esp8266/eagle_soc.h | 8 ++++++++ components/esp8266/include/esp8266/ets_sys.h | 2 -- components/esp8266/include/esp_common.h | 1 - components/freertos/port/esp8266/heap_5.c | 1 + components/freertos/port/esp8266/panic.c | 2 -- components/freertos/port/esp8266/port.c | 1 + components/lwip/port/esp8266/include/arch/cc.h | 2 -- components/newlib/newlib/port/syscall.c | 2 -- components/ssl/axtls/include/ssl/ssl_tls1.h | 1 - .../mbedtls/port/esp8266/include/mbedtls/esp_config.h | 1 - .../ssl/mbedtls/port/openssl/include/platform/ssl_port.h | 9 ++++++--- .../wifi/wifi_station_machine/main/wifi_state_machine.c | 1 - .../wifi/wifi_station_machine/main/wifi_state_machine.h | 2 +- 15 files changed, 17 insertions(+), 19 deletions(-) diff --git a/components/esp8266/driver/gpio.c b/components/esp8266/driver/gpio.c index 1fb3b441..6727ed2f 100644 --- a/components/esp8266/driver/gpio.c +++ b/components/esp8266/driver/gpio.c @@ -15,8 +15,6 @@ #include -#include "c_types.h" - #include "esp8266/eagle_soc.h" #include "esp8266/pin_mux_register.h" #include "esp8266/ets_sys.h" diff --git a/components/esp8266/include/driver/spi_interface.h b/components/esp8266/include/driver/spi_interface.h index 3e224f5b..fd0b2630 100644 --- a/components/esp8266/include/driver/spi_interface.h +++ b/components/esp8266/include/driver/spi_interface.h @@ -20,7 +20,6 @@ #define __SPI_INTERFACE_H__ #include "spi_register.h" -#include "c_types.h" //***************************************************************************** // diff --git a/components/esp8266/include/esp8266/eagle_soc.h b/components/esp8266/include/esp8266/eagle_soc.h index 9302cede..5ea3ddcd 100644 --- a/components/esp8266/include/esp8266/eagle_soc.h +++ b/components/esp8266/include/esp8266/eagle_soc.h @@ -62,6 +62,14 @@ #define BIT0 0x00000001 //}} +#define BIT(nr) (1UL << (nr)) + +#define REG_WRITE(_r, _v) (*(volatile uint32_t *)(_r)) = (_v) +#define REG_READ(_r) (*(volatile uint32_t *)(_r)) + +#define REG_SET_BIT(_r, _b) (*(volatile uint32_t *)(_r) |= (_b)) +#define REG_CLR_BIT(_r, _b) (*(volatile uint32_t *)(_r) &= ~(_b)) + //Registers Operation {{ #define ETS_UNCACHED_ADDR(addr) (addr) #define ETS_CACHED_ADDR(addr) (addr) diff --git a/components/esp8266/include/esp8266/ets_sys.h b/components/esp8266/include/esp8266/ets_sys.h index 45ebdf5e..82e04e19 100644 --- a/components/esp8266/include/esp8266/ets_sys.h +++ b/components/esp8266/include/esp8266/ets_sys.h @@ -27,8 +27,6 @@ #include -#include "c_types.h" - /* interrupt related */ #define ETS_SPI_INUM 2 #define ETS_GPIO_INUM 4 diff --git a/components/esp8266/include/esp_common.h b/components/esp8266/include/esp_common.h index 8f285625..833fc5d8 100644 --- a/components/esp8266/include/esp_common.h +++ b/components/esp8266/include/esp_common.h @@ -91,7 +91,6 @@ * inside the RTOS SDK, users can not change it. */ -#include "c_types.h" #include "esp_libc.h" #include "esp_misc.h" #include "esp_wifi.h" diff --git a/components/freertos/port/esp8266/heap_5.c b/components/freertos/port/esp8266/heap_5.c index bb54ee53..8809d619 100644 --- a/components/freertos/port/esp8266/heap_5.c +++ b/components/freertos/port/esp8266/heap_5.c @@ -117,6 +117,7 @@ task.h is included from an application file. */ #include "freertos/FreeRTOS.h" #include "freertos/task.h" +#include "esp8266/eagle_soc.h" #include "esp8266/ets_sys.h" #include "esp8266/rom_functions.h" diff --git a/components/freertos/port/esp8266/panic.c b/components/freertos/port/esp8266/panic.c index 901b0c9e..010781bd 100644 --- a/components/freertos/port/esp8266/panic.c +++ b/components/freertos/port/esp8266/panic.c @@ -14,8 +14,6 @@ #include -#include "c_types.h" - #include "esp8266/ets_sys.h" #include "esp8266/eagle_soc.h" #include "esp8266/uart_register.h" diff --git a/components/freertos/port/esp8266/port.c b/components/freertos/port/esp8266/port.c index 01e07aae..d4167226 100644 --- a/components/freertos/port/esp8266/port.c +++ b/components/freertos/port/esp8266/port.c @@ -82,6 +82,7 @@ #include "esp_attr.h" #include "esp_libc.h" +#include "esp8266/eagle_soc.h" #include "esp8266/ets_sys.h" #include "esp8266/rom_functions.h" diff --git a/components/lwip/port/esp8266/include/arch/cc.h b/components/lwip/port/esp8266/include/arch/cc.h index fc12ca0a..5470cd27 100644 --- a/components/lwip/port/esp8266/include/arch/cc.h +++ b/components/lwip/port/esp8266/include/arch/cc.h @@ -34,8 +34,6 @@ #ifndef __ARCH_CC_H__ #define __ARCH_CC_H__ -#include "c_types.h" - #define EFAULT 14 #define LWIP_ERRNO_INCLUDE "sys/errno.h" diff --git a/components/newlib/newlib/port/syscall.c b/components/newlib/newlib/port/syscall.c index 75423cdb..f88d39f7 100644 --- a/components/newlib/newlib/port/syscall.c +++ b/components/newlib/newlib/port/syscall.c @@ -16,8 +16,6 @@ #include #include -#include "c_types.h" - #include "esp8266/ets_sys.h" #include "esp8266/eagle_soc.h" #include "esp8266/uart_register.h" diff --git a/components/ssl/axtls/include/ssl/ssl_tls1.h b/components/ssl/axtls/include/ssl/ssl_tls1.h index 48e90b8c..4f4b66e5 100644 --- a/components/ssl/axtls/include/ssl/ssl_tls1.h +++ b/components/ssl/axtls/include/ssl/ssl_tls1.h @@ -40,7 +40,6 @@ extern "C" { #endif -#include "c_types.h" #include "ssl/ssl_version.h" #include "ssl/ssl_config.h" diff --git a/components/ssl/mbedtls/port/esp8266/include/mbedtls/esp_config.h b/components/ssl/mbedtls/port/esp8266/include/mbedtls/esp_config.h index fad99c6e..acc36537 100644 --- a/components/ssl/mbedtls/port/esp8266/include/mbedtls/esp_config.h +++ b/components/ssl/mbedtls/port/esp8266/include/mbedtls/esp_config.h @@ -29,7 +29,6 @@ #ifndef MBEDTLS_CONFIG_H #define MBEDTLS_CONFIG_H -#include "c_types.h" #include "sdkconfig.h" #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) diff --git a/components/ssl/mbedtls/port/openssl/include/platform/ssl_port.h b/components/ssl/mbedtls/port/openssl/include/platform/ssl_port.h index 6481f15d..637bae84 100644 --- a/components/ssl/mbedtls/port/openssl/include/platform/ssl_port.h +++ b/components/ssl/mbedtls/port/openssl/include/platform/ssl_port.h @@ -15,13 +15,16 @@ #ifndef _SSL_PORT_H_ #define _SSL_PORT_H_ +#include + +#include "esp_system.h" + + #ifdef __cplusplus extern "C" { #endif -#include "c_types.h" -#include "esp_system.h" -#include "string.h" + #ifdef MEMLEAK_DEBUG diff --git a/examples/wifi/wifi_station_machine/main/wifi_state_machine.c b/examples/wifi/wifi_station_machine/main/wifi_state_machine.c index 57074f78..5bfeff30 100644 --- a/examples/wifi/wifi_station_machine/main/wifi_state_machine.c +++ b/examples/wifi/wifi_station_machine/main/wifi_state_machine.c @@ -8,7 +8,6 @@ */ #include -#include "c_types.h" #include "lwipopts.h" #include "lwip/ip_addr.h" #include "esp_libc.h" diff --git a/examples/wifi/wifi_station_machine/main/wifi_state_machine.h b/examples/wifi/wifi_station_machine/main/wifi_state_machine.h index 1b82c199..d8195463 100644 --- a/examples/wifi/wifi_station_machine/main/wifi_state_machine.h +++ b/examples/wifi/wifi_station_machine/main/wifi_state_machine.h @@ -10,7 +10,7 @@ #define _WIFI_STATE_MACHINE_H_ #include -#include "c_types.h" + #include "esp_wifi.h" typedef void (* wifi_state_cb_t)();