feat(esp8266): Refactor ets system headler file

This commit is contained in:
Zhang Jun Hao
2018-06-27 11:27:40 +08:00
parent fa6ec956ef
commit 9d0b024433
17 changed files with 74 additions and 110 deletions

View File

@ -17,7 +17,7 @@
#include "esp8266/eagle_soc.h" #include "esp8266/eagle_soc.h"
#include "esp8266/pin_mux_register.h" #include "esp8266/pin_mux_register.h"
#include "esp8266/ets_sys.h" #include "rom/ets_sys.h"
#include "FreeRTOS.h" #include "FreeRTOS.h"

View File

@ -16,7 +16,7 @@
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include "esp8266/ets_sys.h" #include "rom/ets_sys.h"
#include "esp8266/eagle_soc.h" #include "esp8266/eagle_soc.h"
#include "esp8266/timer_register.h" #include "esp8266/timer_register.h"

View File

@ -15,8 +15,7 @@
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include "esp8266/ets_sys.h" #include "rom/ets_sys.h"
#include "esp_misc.h"
#include "gpio.h" #include "gpio.h"
#include "i2c_master.h" #include "i2c_master.h"

View File

@ -19,7 +19,7 @@
#include <stdint.h> #include <stdint.h>
#include "esp8266/ets_sys.h" #include "rom/ets_sys.h"
#include "esp8266/pin_mux_register.h" #include "esp8266/pin_mux_register.h"
#include "spi_interface.h" #include "spi_interface.h"

View File

@ -19,9 +19,7 @@
#include "esp8266/pin_mux_register.h" #include "esp8266/pin_mux_register.h"
#include "esp8266/uart_register.h" #include "esp8266/uart_register.h"
#include "esp8266/rom_functions.h" #include "esp8266/rom_functions.h"
#include "esp8266/ets_sys.h" #include "rom/ets_sys.h"
#include "esp_misc.h"
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
#include "freertos/task.h" #include "freertos/task.h"

View File

@ -17,7 +17,7 @@
#include <stdint.h> #include <stdint.h>
#include "esp_misc.h" #include "rom/ets_sys.h"
#include "esp8266/pin_mux_register.h" #include "esp8266/pin_mux_register.h"
#include "gpio.h" #include "gpio.h"

View File

@ -1,93 +0,0 @@
/*
* ESPRSSIF MIT License
*
* Copyright (c) 2015 <ESPRESSIF SYSTEMS (SHANGHAI) PTE LTD>
*
* 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 __ESP_MISC_H__
#define __ESP_MISC_H__
#include <stdint.h>
#include "lwip/ip_addr.h"
#ifdef __cplusplus
extern "C" {
#endif
/** \defgroup Misc_APIs Misc APIs
* @brief misc APIs
*/
/** @addtogroup Misc_APIs
* @{
*/
#define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
#define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
#define IP2STR(ipaddr) ip4_addr1_16(ipaddr), \
ip4_addr2_16(ipaddr), \
ip4_addr3_16(ipaddr), \
ip4_addr4_16(ipaddr)
#define IPSTR "%d.%d.%d.%d"
/**
* @brief Delay function, maximum value: 65535 us.
*
* @param uint16_t us : delay time, uint: us, maximum value: 65535 us
*
* @return null
*/
void os_delay_us(uint16_t us);
/**
* @brief Register the print output function.
*
* @attention os_install_putc1((void *)uart1_write_char) in uart_init will set
* printf to print from UART 1, otherwise, printf will start from
* UART 0 by default.
*
* @param void(*p)(char c) - pointer of print function
*
* @return null
*/
void os_install_putc1(void (*p)(char c));
/**
* @brief Print a character. Start from from UART0 by default.
*
* @param char c - character to be printed
*
* @return null
*/
void os_putc(char c);
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,25 @@
// Copyright 2010-2016 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef __ESP_TYPES_H__
#define __ESP_TYPES_H__
#ifdef __GNUC__
#include <sys/cdefs.h>
#endif /*__GNUC__*/
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
#endif /* __ESP_TYPES_H__ */

View File

@ -82,4 +82,38 @@ extern uint32_t WDEV_INTEREST_EVENT;
} \ } \
} while(0) } while(0)
#define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
#define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
/**
* @brief Delay function, maximum value: 65535 us.
*
* @param uint16_t us : delay time, uint: us, maximum value: 65535 us
*
* @return null
*/
void os_delay_us(uint16_t us);
/**
* @brief Register the print output function.
*
* @attention os_install_putc1((void *)uart1_write_char) in uart_init will set
* printf to print from UART 1, otherwise, printf will start from
* UART 0 by default.
*
* @param void(*p)(char c) - pointer of print function
*
* @return null
*/
void os_install_putc1(void (*p)(char c));
/**
* @brief Print a character. Start from from UART0 by default.
*
* @param char c - character to be printed
*
* @return null
*/
void os_putc(char c);
#endif /* _ETS_SYS_H */ #endif /* _ETS_SYS_H */

View File

@ -16,9 +16,10 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "rom/ets_sys.h"
#include "esp_err.h" #include "esp_err.h"
#include "esp_wifi.h" #include "esp_wifi.h"
#include "esp_misc.h"
#include "esp_event.h" #include "esp_event.h"
#include "esp_event_loop.h" #include "esp_event_loop.h"
#include "esp_system.h" #include "esp_system.h"

View File

@ -118,7 +118,7 @@ task.h is included from an application file. */
#include "freertos/task.h" #include "freertos/task.h"
#include "esp8266/eagle_soc.h" #include "esp8266/eagle_soc.h"
#include "esp8266/ets_sys.h" #include "rom/ets_sys.h"
#include "esp8266/rom_functions.h" #include "esp8266/rom_functions.h"
#ifdef MEMLEAK_DEBUG #ifdef MEMLEAK_DEBUG

View File

@ -16,7 +16,7 @@
#include "esp_libc.h" #include "esp_libc.h"
#include "esp8266/eagle_soc.h" #include "esp8266/eagle_soc.h"
#include "esp8266/ets_sys.h" #include "rom/ets_sys.h"
#include "esp_err.h" #include "esp_err.h"
/* /*

View File

@ -83,7 +83,7 @@
#include "esp_libc.h" #include "esp_libc.h"
#include "esp8266/eagle_soc.h" #include "esp8266/eagle_soc.h"
#include "esp8266/ets_sys.h" #include "rom/ets_sys.h"
#include "esp8266/rom_functions.h" #include "esp8266/rom_functions.h"
#define PORT_ASSERT(x) do { if (!(x)) {ets_printf("%s %u\n", "rtos_port", __LINE__); while(1){}; }} while (0) #define PORT_ASSERT(x) do { if (!(x)) {ets_printf("%s %u\n", "rtos_port", __LINE__); while(1){}; }} while (0)

View File

@ -17,9 +17,10 @@
#include <strings.h> #include <strings.h>
#include "esp_libc.h" #include "esp_libc.h"
#include "esp_misc.h"
#include "esp_wifi.h" #include "esp_wifi.h"
#include "rom/ets_sys.h"
#include "sdkconfig.h" #include "sdkconfig.h"
#include "lwip/inet.h" #include "lwip/inet.h"
#include "lwip/err.h" #include "lwip/err.h"

View File

@ -35,7 +35,6 @@ typedef struct dhcps_msg {
u8_t options[312]; u8_t options[312];
}dhcps_msg; }dhcps_msg;
/* Defined in esp_misc.h */
typedef struct { typedef struct {
bool enable; bool enable;
ip4_addr_t start_ip; ip4_addr_t start_ip;

View File

@ -16,7 +16,7 @@
#include <string.h> #include <string.h>
#include <sys/stat.h> #include <sys/stat.h>
#include "esp8266/ets_sys.h" #include "rom/ets_sys.h"
#include "esp8266/eagle_soc.h" #include "esp8266/eagle_soc.h"
#include "esp8266/uart_register.h" #include "esp8266/uart_register.h"
#include "FreeRTOS.h" #include "FreeRTOS.h"

View File

@ -28,7 +28,7 @@
#include "netif/etharp.h" #include "netif/etharp.h"
#include "esp_wifi.h" #include "esp_wifi.h"
#include "esp_timer.h" #include "esp_timer.h"
#include "esp_misc.h" #include "rom/ets_sys.h"
#include "dhcpserver/dhcpserver.h" #include "dhcpserver/dhcpserver.h"
#include "dhcpserver/dhcpserver_options.h" #include "dhcpserver/dhcpserver_options.h"
#include "net/sockio.h" #include "net/sockio.h"