Unverified Commit 310faf7f authored by Terry Ellison's avatar Terry Ellison Committed by GitHub
Browse files

Merge pull request #2886 from nodemcu/dev

Next master drop
parents 68c425c0 a08e74d9
...@@ -38,11 +38,6 @@ STD_CFLAGS=-std=gnu11 -Wimplicit ...@@ -38,11 +38,6 @@ STD_CFLAGS=-std=gnu11 -Wimplicit
# Required for each makefile to inherit from the parent # Required for each makefile to inherit from the parent
# #
INCLUDES := $(INCLUDES) -I $(PDIR)include
INCLUDES += -I ./
INCLUDES += -I ./include
INCLUDES += -I ../include
INCLUDES += -I ../../include
PDIR := ../$(PDIR) PDIR := ../$(PDIR)
sinclude $(PDIR)Makefile sinclude $(PDIR)Makefile
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
*/ */
#include "osapi.h" #include "osapi.h"
#include "../libc/c_stdio.h" #include <stdio.h>
#include "user_interface.h" #include "user_interface.h"
#include "espconn.h" #include "espconn.h"
#include "mem.h" #include "mem.h"
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#define __ARCH_CC_H__ #define __ARCH_CC_H__
//#include <string.h> //#include <string.h>
#include "c_types.h" #include <stdint.h>
#include "ets_sys.h" #include "ets_sys.h"
#include "osapi.h" #include "osapi.h"
#define EFAULT 14 #define EFAULT 14
......
#ifndef __I2C_MASTER_H__ #ifndef __I2C_MASTER_H__
#define __I2C_MASTER_H__ #define __I2C_MASTER_H__
#define I2C_MASTER_SDA_MUX (pin_mux[sda]) uint32 i2c_master_setup(uint16 id, uint8 sda, uint8 scl, uint32 speed);
#define I2C_MASTER_SCL_MUX (pin_mux[scl]) void i2c_master_init(uint16 id);
#define I2C_MASTER_SDA_GPIO (pinSDA) bool i2c_master_configured(uint16 id);
#define I2C_MASTER_SCL_GPIO (pinSCL) void i2c_master_stop(uint16 id);
#define I2C_MASTER_SDA_FUNC (pin_func[sda]) void i2c_master_start(uint16 id);
#define I2C_MASTER_SCL_FUNC (pin_func[scl]) uint8 i2c_master_readByte(uint16 id, sint16 ack);
uint8 i2c_master_writeByte(uint16 id, uint8 wrdata);
// #define I2C_MASTER_SDA_MUX PERIPHS_IO_MUX_GPIO2_U
// #define I2C_MASTER_SCL_MUX PERIPHS_IO_MUX_MTDO_U #endif //__I2C_MASTER_H__
// #define I2C_MASTER_SDA_GPIO 2
// #define I2C_MASTER_SCL_GPIO 15
// #define I2C_MASTER_SDA_FUNC FUNC_GPIO2
// #define I2C_MASTER_SCL_FUNC FUNC_GPIO15
// #define I2C_MASTER_SDA_MUX PERIPHS_IO_MUX_GPIO2_U
// #define I2C_MASTER_SCL_MUX PERIPHS_IO_MUX_MTMS_U
// #define I2C_MASTER_SDA_GPIO 2
// #define I2C_MASTER_SCL_GPIO 14
// #define I2C_MASTER_SDA_FUNC FUNC_GPIO2
// #define I2C_MASTER_SCL_FUNC FUNC_GPIO14
//#define I2C_MASTER_SDA_MUX PERIPHS_IO_MUX_GPIO2_U
//#define I2C_MASTER_SCL_MUX PERIPHS_IO_MUX_GPIO0_U
//#define I2C_MASTER_SDA_GPIO 2
//#define I2C_MASTER_SCL_GPIO 0
//#define I2C_MASTER_SDA_FUNC FUNC_GPIO2
//#define I2C_MASTER_SCL_FUNC FUNC_GPIO0
#if 0
#define I2C_MASTER_GPIO_SET(pin) \
gpio_output_set(1<<pin,0,1<<pin,0)
#define I2C_MASTER_GPIO_CLR(pin) \
gpio_output_set(0,1<<pin,1<<pin,0)
#define I2C_MASTER_GPIO_OUT(pin,val) \
if(val) I2C_MASTER_GPIO_SET(pin);\
else I2C_MASTER_GPIO_CLR(pin)
#endif
#define I2C_MASTER_SDA_HIGH_SCL_HIGH() \
gpio_output_set(1<<I2C_MASTER_SDA_GPIO | 1<<I2C_MASTER_SCL_GPIO, 0, 1<<I2C_MASTER_SDA_GPIO | 1<<I2C_MASTER_SCL_GPIO, 0)
#define I2C_MASTER_SDA_HIGH_SCL_LOW() \
gpio_output_set(1<<I2C_MASTER_SDA_GPIO, 1<<I2C_MASTER_SCL_GPIO, 1<<I2C_MASTER_SDA_GPIO | 1<<I2C_MASTER_SCL_GPIO, 0)
#define I2C_MASTER_SDA_LOW_SCL_HIGH() \
gpio_output_set(1<<I2C_MASTER_SCL_GPIO, 1<<I2C_MASTER_SDA_GPIO, 1<<I2C_MASTER_SDA_GPIO | 1<<I2C_MASTER_SCL_GPIO, 0)
#define I2C_MASTER_SDA_LOW_SCL_LOW() \
gpio_output_set(0, 1<<I2C_MASTER_SDA_GPIO | 1<<I2C_MASTER_SCL_GPIO, 1<<I2C_MASTER_SDA_GPIO | 1<<I2C_MASTER_SCL_GPIO, 0)
void i2c_master_gpio_init(uint8 sda, uint8 scl);
void i2c_master_init(void);
#define i2c_master_wait os_delay_us
void i2c_master_stop(void);
void i2c_master_start(void);
void i2c_master_setAck(uint8 level);
uint8 i2c_master_getAck(void);
uint8 i2c_master_readByte(void);
void i2c_master_writeByte(uint8 wrdata);
bool i2c_master_checkAck(void);
void i2c_master_send_ack(void);
void i2c_master_send_nack(void);
uint8 i2c_master_get_pinSDA();
uint8 i2c_master_get_pinSCL();
#endif
#ifndef __ONEWIRE_H__ #ifndef __ONEWIRE_H__
#define __ONEWIRE_H__ #define __ONEWIRE_H__
#include "c_types.h" #include <stdint.h>
#include <stdbool.h>
// You can exclude certain features from OneWire. In theory, this // You can exclude certain features from OneWire. In theory, this
// might save some space. In practice, the compiler automatically // might save some space. In practice, the compiler automatically
......
/*
* Software PWM using soft-interrupt timer1.
* Supports higher frequencies compared to Espressif provided one.
*
* Nikolay Fiykov
*/
#ifndef __PWM2_H__
#define __PWM2_H__
#include <stdint.h>
#include "pin_map.h"
typedef struct {
uint32_t offInterruptCounter;
uint32_t pulseInterruptCcounter;
uint32_t currentInterruptCounter;
uint16_t gpioMask;
} pwm2_pin_interrupt_t;
typedef struct {
pwm2_pin_interrupt_t pin[GPIO_PIN_NUM];
uint16_t enabledGpioMask;
} pwm2_interrupt_handler_data_t;
typedef struct {
uint32_t pulseResolutions;
uint32_t divisableFrequency;
uint32_t frequencyDivisor;
uint32_t duty;
uint32_t resolutionCPUTicks;
uint32_t resolutionInterruptCounterMultiplier;
} pwm2_pin_setup_t;
typedef struct {
pwm2_pin_setup_t pin[GPIO_PIN_NUM];
uint32_t interruptTimerCPUTicks;
uint32_t interruptTimerTicks;
bool isStarted;
} pwm2_setup_data_t;
typedef struct {
pwm2_interrupt_handler_data_t interruptData;
pwm2_setup_data_t setupData;
} pwm2_module_data_t;
// driver's public API
void pwm2_init();
pwm2_module_data_t *pwm2_get_module_data();
bool pwm2_is_pin_setup(const uint8_t pin);
void pwm2_setup_pin(
const uint8_t pin,
const uint32_t divisableFreq,
const uint32_t freqDivisor,
const uint32_t resolution,
const uint32_t initDuty
);
void pwm2_release_pin(const uint8_t pin);
void pwm2_stop();
bool pwm2_start();
bool pwm2_is_started();
void pwm2_set_duty(const uint8_t pin, const uint32_t duty);
#endif
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#ifndef __ROTARY_H__ #ifndef __ROTARY_H__
#define __ROTARY_H__ #define __ROTARY_H__
#include "c_types.h" #include <stdint.h>
#define ROTARY_CHANNEL_COUNT 3 #define ROTARY_CHANNEL_COUNT 3
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#ifndef __SWITEC_H__ #ifndef __SWITEC_H__
#define __SWITEC_H__ #define __SWITEC_H__
#include "c_types.h" #include <stdint.h>
#define SWITEC_CHANNEL_COUNT 3 #define SWITEC_CHANNEL_COUNT 3
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
#include "uart_register.h" #include "uart_register.h"
#include "eagle_soc.h" #include "eagle_soc.h"
#include "c_types.h" #include <stdint.h>
#include "os_type.h" #include "os_type.h"
#define RX_BUFF_SIZE 0x100 #define RX_BUFF_SIZE 0x100
......
...@@ -14,7 +14,8 @@ ...@@ -14,7 +14,8 @@
* Created on: Apr 22, 2016 * Created on: Apr 22, 2016
* Author: liuhan * Author: liuhan
*/ */
#include "c_types.h" #include <stdint.h>
#include <stddef.h>
#include "ets_sys.h" #include "ets_sys.h"
#include "os_type.h" #include "os_type.h"
......
...@@ -53,6 +53,7 @@ struct dhcp ...@@ -53,6 +53,7 @@ struct dhcp
ip_addr_t offered_ip_addr; ip_addr_t offered_ip_addr;
ip_addr_t offered_sn_mask; ip_addr_t offered_sn_mask;
ip_addr_t offered_gw_addr; ip_addr_t offered_gw_addr;
ip_addr_t offered_ntp_addr;
u32_t offered_t0_lease; /* lease period (in seconds) */ u32_t offered_t0_lease; /* lease period (in seconds) */
u32_t offered_t1_renew; /* recommended renew time (usually 50% of lease period) */ u32_t offered_t1_renew; /* recommended renew time (usually 50% of lease period) */
...@@ -207,6 +208,9 @@ void dhcp_fine_tmr(void); ...@@ -207,6 +208,9 @@ void dhcp_fine_tmr(void);
#define DHCP_OPTION_TCP_TTL 37 #define DHCP_OPTION_TCP_TTL 37
#define DHCP_OPTION_END 255 #define DHCP_OPTION_END 255
/* time */
#define DHCP_OPTION_NTP 42
/**add options for support more router by liuHan**/ /**add options for support more router by liuHan**/
#define DHCP_OPTION_DOMAIN_NAME 15 #define DHCP_OPTION_DOMAIN_NAME 15
#define DHCP_OPTION_PRD 31 #define DHCP_OPTION_PRD 31
......
...@@ -51,40 +51,39 @@ typedef size_t mem_size_t; ...@@ -51,40 +51,39 @@ typedef size_t mem_size_t;
* allow these defines to be overridden. * allow these defines to be overridden.
*/ */
#ifndef MEMLEAK_DEBUG #ifndef MEMLEAK_DEBUG
#ifndef mem_free #ifndef mem_free
#define mem_free vPortFree #define mem_free(s) vPortFree(s, "", __LINE__)
#endif #endif
#ifndef mem_malloc #ifndef mem_malloc
#define mem_malloc pvPortMalloc #define mem_malloc(s) pvPortMalloc(s, "", __LINE__,false)
#endif #endif
#ifndef mem_calloc #ifndef mem_calloc
#define mem_calloc pvPortCalloc #define mem_calloc(l, s) pvPortCalloc(l, s, "", __LINE__)
#endif #endif
#ifndef mem_realloc #ifndef mem_realloc
#define mem_realloc pvPortRealloc #define mem_realloc(p, s) pvPortRealloc(p, s, "", __LINE__)
#endif #endif
#ifndef mem_zalloc #ifndef mem_zalloc
#define mem_zalloc pvPortZalloc #define mem_zalloc(s) pvPortZalloc(s, "", __LINE__)
#endif #endif
#else #else
#ifndef mem_free #ifndef mem_free
#define mem_free(s) \ #define mem_free(s) vPortFree(s, mem_debug_file, __LINE__)
do{\
const char *file = mem_debug_file;\
vPortFree(s, file, __LINE__);\
}while(0)
#endif #endif
#ifndef mem_malloc #ifndef mem_malloc
#define mem_malloc(s) ({const char *file = mem_debug_file; pvPortMalloc(s, file, __LINE__);}) #define mem_malloc(s) pvPortMalloc(s, mem_debug_file, __LINE__,false)
#endif #endif
#ifndef mem_calloc #ifndef mem_calloc
#define mem_calloc(l, s) ({const char *file = mem_debug_file; pvPortCalloc(l, s, file, __LINE__);}) #define mem_calloc(l, s) pvPortCalloc(l, s, mem_debug_file, __LINE__)
#endif #endif
#ifndef mem_realloc #ifndef mem_realloc
#define mem_realloc(p, s) ({const char *file = mem_debug_file; pvPortRealloc(p, s, file, __LINE__);}) #define mem_realloc(p, s) pvPortRealloc(p, s, mem_debug_file, __LINE__)
#endif #endif
#ifndef mem_zalloc #ifndef mem_zalloc
#define mem_zalloc(s) ({const char *file = mem_debug_file; pvPortZalloc(s, file, __LINE__);}) #define mem_zalloc(s) pvPortZalloc(s, mem_debug_file, __LINE__)
#endif #endif
#endif #endif
......
...@@ -38,6 +38,12 @@ ...@@ -38,6 +38,12 @@
#ifndef MBEDTLS_BN_MUL_H #ifndef MBEDTLS_BN_MUL_H
#define MBEDTLS_BN_MUL_H #define MBEDTLS_BN_MUL_H
#if !defined(MBEDTLS_CONFIG_FILE)
#include "config.h"
#else
#include MBEDTLS_CONFIG_FILE
#endif
#include "bignum.h" #include "bignum.h"
#if defined(MBEDTLS_HAVE_ASM) #if defined(MBEDTLS_HAVE_ASM)
...@@ -734,7 +740,7 @@ ...@@ -734,7 +740,7 @@
"sw $10, %2 \n\t" \ "sw $10, %2 \n\t" \
: "=m" (c), "=m" (d), "=m" (s) \ : "=m" (c), "=m" (d), "=m" (s) \
: "m" (s), "m" (d), "m" (c), "m" (b) \ : "m" (s), "m" (d), "m" (c), "m" (b) \
: "$9", "$10", "$11", "$12", "$13", "$14", "$15" \ : "$9", "$10", "$11", "$12", "$13", "$14", "$15", "lo", "hi" \
); );
#endif /* MIPS */ #endif /* MIPS */
......
...@@ -122,6 +122,10 @@ ...@@ -122,6 +122,10 @@
#error "MBEDTLS_ECP_C defined, but not all prerequisites" #error "MBEDTLS_ECP_C defined, but not all prerequisites"
#endif #endif
#if defined(MBEDTLS_PK_PARSE_C) && !defined(MBEDTLS_ASN1_PARSE_C)
#error "MBEDTLS_PK_PARSE_C defined, but not all prerequesites"
#endif
#if defined(MBEDTLS_ENTROPY_C) && (!defined(MBEDTLS_SHA512_C) && \ #if defined(MBEDTLS_ENTROPY_C) && (!defined(MBEDTLS_SHA512_C) && \
!defined(MBEDTLS_SHA256_C)) !defined(MBEDTLS_SHA256_C))
#error "MBEDTLS_ENTROPY_C defined, but not all prerequisites" #error "MBEDTLS_ENTROPY_C defined, but not all prerequisites"
......
...@@ -28,6 +28,12 @@ ...@@ -28,6 +28,12 @@
#ifndef MBEDTLS_CTR_DRBG_H #ifndef MBEDTLS_CTR_DRBG_H
#define MBEDTLS_CTR_DRBG_H #define MBEDTLS_CTR_DRBG_H
#if !defined(MBEDTLS_CONFIG_FILE)
#include "config.h"
#else
#include MBEDTLS_CONFIG_FILE
#endif
#include "aes.h" #include "aes.h"
#if defined(MBEDTLS_THREADING_C) #if defined(MBEDTLS_THREADING_C)
......
...@@ -24,6 +24,12 @@ ...@@ -24,6 +24,12 @@
#ifndef MBEDTLS_HMAC_DRBG_H #ifndef MBEDTLS_HMAC_DRBG_H
#define MBEDTLS_HMAC_DRBG_H #define MBEDTLS_HMAC_DRBG_H
#if !defined(MBEDTLS_CONFIG_FILE)
#include "config.h"
#else
#include MBEDTLS_CONFIG_FILE
#endif
#include "md.h" #include "md.h"
#if defined(MBEDTLS_THREADING_C) #if defined(MBEDTLS_THREADING_C)
......
...@@ -24,6 +24,12 @@ ...@@ -24,6 +24,12 @@
#ifndef MBEDTLS_PKCS12_H #ifndef MBEDTLS_PKCS12_H
#define MBEDTLS_PKCS12_H #define MBEDTLS_PKCS12_H
#if !defined(MBEDTLS_CONFIG_FILE)
#include "config.h"
#else
#include MBEDTLS_CONFIG_FILE
#endif
#include "md.h" #include "md.h"
#include "cipher.h" #include "cipher.h"
#include "asn1.h" #include "asn1.h"
...@@ -46,6 +52,8 @@ ...@@ -46,6 +52,8 @@
extern "C" { extern "C" {
#endif #endif
#if defined(MBEDTLS_ASN1_PARSE_C)
/** /**
* \brief PKCS12 Password Based function (encryption / decryption) * \brief PKCS12 Password Based function (encryption / decryption)
* for pbeWithSHAAnd128BitRC4 * for pbeWithSHAAnd128BitRC4
...@@ -87,6 +95,8 @@ int mbedtls_pkcs12_pbe( mbedtls_asn1_buf *pbe_params, int mode, ...@@ -87,6 +95,8 @@ int mbedtls_pkcs12_pbe( mbedtls_asn1_buf *pbe_params, int mode,
const unsigned char *input, size_t len, const unsigned char *input, size_t len,
unsigned char *output ); unsigned char *output );
#endif /* MBEDTLS_ASN1_PARSE_C */
/** /**
* \brief The PKCS#12 derivation function uses a password and a salt * \brief The PKCS#12 derivation function uses a password and a salt
* to produce pseudo-random bits for a particular "purpose". * to produce pseudo-random bits for a particular "purpose".
......
...@@ -26,6 +26,12 @@ ...@@ -26,6 +26,12 @@
#ifndef MBEDTLS_PKCS5_H #ifndef MBEDTLS_PKCS5_H
#define MBEDTLS_PKCS5_H #define MBEDTLS_PKCS5_H
#if !defined(MBEDTLS_CONFIG_FILE)
#include "config.h"
#else
#include MBEDTLS_CONFIG_FILE
#endif
#include "asn1.h" #include "asn1.h"
#include "md.h" #include "md.h"
...@@ -44,6 +50,8 @@ ...@@ -44,6 +50,8 @@
extern "C" { extern "C" {
#endif #endif
#if defined(MBEDTLS_ASN1_PARSE_C)
/** /**
* \brief PKCS#5 PBES2 function * \brief PKCS#5 PBES2 function
* *
...@@ -62,6 +70,8 @@ int mbedtls_pkcs5_pbes2( const mbedtls_asn1_buf *pbe_params, int mode, ...@@ -62,6 +70,8 @@ int mbedtls_pkcs5_pbes2( const mbedtls_asn1_buf *pbe_params, int mode,
const unsigned char *data, size_t datalen, const unsigned char *data, size_t datalen,
unsigned char *output ); unsigned char *output );
#endif /* MBEDTLS_ASN1_PARSE_C */
/** /**
* \brief PKCS#5 PBKDF2 using HMAC * \brief PKCS#5 PBKDF2 using HMAC
* *
......
...@@ -1618,6 +1618,14 @@ void mbedtls_ssl_conf_ca_chain( mbedtls_ssl_config *conf, ...@@ -1618,6 +1618,14 @@ void mbedtls_ssl_conf_ca_chain( mbedtls_ssl_config *conf,
* whether it matches those preferences - the server can then * whether it matches those preferences - the server can then
* decide what it wants to do with it. * decide what it wants to do with it.
* *
* \note The provided \p pk_key needs to match the public key in the
* first certificate in \p own_cert, or all handshakes using
* that certificate will fail. It is your responsibility
* to ensure that; this function will not perform any check.
* You may use mbedtls_pk_check_pair() in order to perform
* this check yourself, but be aware that this function can
* be computationally expensive on some key types.
*
* \param conf SSL configuration * \param conf SSL configuration
* \param own_cert own public certificate chain * \param own_cert own public certificate chain
* \param pk_key own private key * \param pk_key own private key
......
...@@ -40,16 +40,16 @@ ...@@ -40,16 +40,16 @@
*/ */
#define MBEDTLS_VERSION_MAJOR 2 #define MBEDTLS_VERSION_MAJOR 2
#define MBEDTLS_VERSION_MINOR 7 #define MBEDTLS_VERSION_MINOR 7
#define MBEDTLS_VERSION_PATCH 8 #define MBEDTLS_VERSION_PATCH 9
/** /**
* The single version number has the following structure: * The single version number has the following structure:
* MMNNPP00 * MMNNPP00
* Major version | Minor version | Patch version * Major version | Minor version | Patch version
*/ */
#define MBEDTLS_VERSION_NUMBER 0x02070800 #define MBEDTLS_VERSION_NUMBER 0x02070900
#define MBEDTLS_VERSION_STRING "2.7.8" #define MBEDTLS_VERSION_STRING "2.7.9"
#define MBEDTLS_VERSION_STRING_FULL "mbed TLS 2.7.8" #define MBEDTLS_VERSION_STRING_FULL "mbed TLS 2.7.9"
#if defined(MBEDTLS_VERSION_C) #if defined(MBEDTLS_VERSION_C)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment