Compare commits

...

20 Commits

Author SHA1 Message Date
Ivan Grokhotkov 3f8f618df5 Merge branch 'feature/lwip_expose_more_config' into 'master'
lwip: Expose more config in IDF menuconfig

See merge request !909
2017-06-27 12:53:42 +08:00
Ivan Grokhotkov aeeb6cff17 Merge branch 'test/add_dual_core_dport_access_unit_test_case' into 'master'
test: add UT case for accessing dport and apb at the same time

See merge request !910
2017-06-27 12:47:37 +08:00
Ivan Grokhotkov 19b7158a9a Merge branch 'bugfix/gpio_set_direction_sets_matrix' into 'master'
gpio driver: Clear GPIO matrix output config when setting pin as input

See merge request !919
2017-06-27 11:42:56 +08:00
Ivan Grokhotkov ff6a3b1a11 Merge branch 'bugfix/default_vfs_paths' into 'master'
Make relative paths match the default VFS, if provided

See merge request !913
2017-06-26 14:03:22 +08:00
Ivan Grokhotkov 9716447fcc Merge branch 'bugfix/esp32d2wd_gpio0' into 'master'
esptool: Update to v2.0.1, fix ESP32-D2WD GPIO0 issue

See merge request !918
2017-06-26 14:02:48 +08:00
Jiang Jiang Jian f9abf98f46 Merge branch 'bugfix/l2cap_disconnect_timeout' into 'master'
component/bt: bugfix for L2CAP state machine to access NULL lcb during disconnection

See merge request !920
2017-06-26 14:02:36 +08:00
Jiang Jiang Jian e033b018d4 Merge branch 'bugfix/wrong_macro_uart_base_addr' into 'master'
fix bug that uart register base address macro was wrong

See merge request !912
2017-06-26 13:55:37 +08:00
Jiang Jiang Jian 5aa5b820f9 Merge branch 'bugfix/tw13402_sniffer_fail_ratio_high' into 'master'
esp32: update wifi lib to fix a sniffer issue

See merge request !914
2017-06-26 13:52:47 +08:00
Angus Gratton 17747b3358 gpio driver: Clear GPIO matrix output config when setting pin as input
Otherwise, if a non-GPIO peripheral has been routed to this pin
(as an output), output driver can remain enabled.
2017-06-26 12:47:08 +10:00
Angus Gratton c26baeb610 esptool: Update to v2.0.1
Fixes issue with GPIO 0 being enabled as an output on ESP32D2WD (or when setting SPI pins in efuse)
and not using Quad-I/O modes.

Ref: https://esp32.com/viewtopic.php?f=2&t=2205
2017-06-26 12:16:09 +10:00
Liu Zhi Fu a7ef510551 esp32: update wifi lib to fix a sniffer issue
Fix sniffer only receives the first MDPU in AMPDU when the AMPDU is not for our station/soft-AP
2017-06-24 10:45:20 +08:00
Deomid Ryabkov ee5eba793f Make relative paths match the default VFS, if provided
https://github.com/espressif/esp-idf/issues/158
2017-06-23 13:12:28 +01:00
Jack ab9f63aba7 fix bug that uart register base address macro was wrong 2017-06-23 19:56:12 +08:00
wangmengyang 6da84eff76 component/bt: fix a bug for L2CAP state machine to access lcb after it is released 2017-06-23 17:26:43 +08:00
He Yin Ling 7c6208c9e0 test: add UT case for dual dport and apb access 2017-06-23 16:15:57 +08:00
Angus Gratton 0c301206cf lwip debug: fix typo 2017-06-23 16:28:38 +10:00
Angus Gratton 8f4fc209a1 lwip: Enable LWIP assertions unless they are disabled globally 2017-06-23 16:26:11 +10:00
Angus Gratton 1c6510ed96 lwip: Allow configuring/disabling some TCP options to save RAM
RAM savings are small, but may add up when running large numbers of sockets.
2017-06-23 16:26:11 +10:00
Angus Gratton 8aa09aea10 event handler: Add debug event handler for confirmed IPv6 LL address 2017-06-23 16:15:16 +10:00
Angus Gratton 1ea0ddb025 lwip: Expose broadcast/multicast ping enable options in menuconfig 2017-06-23 16:15:00 +10:00
14 changed files with 253 additions and 24 deletions
@@ -926,6 +926,11 @@ void l2cu_send_peer_disc_rsp (tL2C_LCB *p_lcb, UINT8 remote_id, UINT16 local_cid
BT_HDR *p_buf;
UINT8 *p;
if (!p_lcb) {
L2CAP_TRACE_WARNING("lcb already released\n");
return;
}
if ((p_buf = l2cu_build_header(p_lcb, L2CAP_DISC_RSP_LEN, L2CAP_CMD_DISC_RSP, remote_id)) == NULL) {
L2CAP_TRACE_WARNING ("L2CAP - no buffer for disc_rsp");
return;
@@ -1606,7 +1611,9 @@ void l2cu_release_ccb (tL2C_CCB *p_ccb)
p_ccb->should_free_rcb = false;
}
btm_sec_clr_temp_auth_service (p_lcb->remote_bd_addr);
if (p_lcb) {
btm_sec_clr_temp_auth_service (p_lcb->remote_bd_addr);
}
/* Stop the timer */
btu_stop_timer (&p_ccb->timer_entry);
+8 -11
View File
@@ -164,6 +164,11 @@ static esp_err_t gpio_output_disable(gpio_num_t gpio_num)
} else {
GPIO.enable1_w1tc.data = (0x1 << (gpio_num - 32));
}
// Ensure no other output signal is routed via GPIO matrix to this pin
REG_WRITE(GPIO_FUNC0_OUT_SEL_CFG_REG + (gpio_num * 4),
SIG_GPIO_OUT_IDX);
return ESP_OK;
}
@@ -175,6 +180,7 @@ static esp_err_t gpio_output_enable(gpio_num_t gpio_num)
} else {
GPIO.enable1_w1ts.data = (0x1 << (gpio_num - 32));
}
gpio_matrix_out(gpio_num, SIG_GPIO_OUT_IDX, false, false);
return ESP_OK;
}
@@ -250,17 +256,9 @@ esp_err_t gpio_set_direction(gpio_num_t gpio_num, gpio_mode_t mode)
PIN_INPUT_DISABLE(GPIO_PIN_MUX_REG[gpio_num]);
}
if (mode & GPIO_MODE_DEF_OUTPUT) {
if (gpio_num < 32) {
GPIO.enable_w1ts = (0x1 << gpio_num);
} else {
GPIO.enable1_w1ts.data = (0x1 << (gpio_num - 32));
}
gpio_output_enable(gpio_num);
} else {
if (gpio_num < 32) {
GPIO.enable_w1tc = (0x1 << gpio_num);
} else {
GPIO.enable1_w1tc.data = (0x1 << (gpio_num - 32));
}
gpio_output_disable(gpio_num);
}
if (mode & GPIO_MODE_DEF_OD) {
GPIO.pin[gpio_num].pad_driver = 1;
@@ -311,7 +309,6 @@ esp_err_t gpio_config(const gpio_config_t *pGPIOConfig)
}
if ((pGPIOConfig->mode) & GPIO_MODE_DEF_OUTPUT) {
output_en = 1;
gpio_matrix_out(io_num, SIG_GPIO_OUT_IDX, 0, 0);
gpio_output_enable(io_num);
} else {
gpio_output_disable(io_num);
+14 -1
View File
@@ -345,6 +345,19 @@ static esp_err_t esp_system_event_debug(system_event_t *event)
MAC2STR(ap_probereqrecved->mac));
break;
}
case SYSTEM_EVENT_AP_STA_GOT_IP6: {
ip6_addr_t *addr = &event->event_info.got_ip6.ip6_info.ip;
ESP_LOGD(TAG, "SYSTEM_EVENT_AP_STA_GOT_IP6 address %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x",
IP6_ADDR_BLOCK1(addr),
IP6_ADDR_BLOCK2(addr),
IP6_ADDR_BLOCK3(addr),
IP6_ADDR_BLOCK4(addr),
IP6_ADDR_BLOCK5(addr),
IP6_ADDR_BLOCK6(addr),
IP6_ADDR_BLOCK7(addr),
IP6_ADDR_BLOCK8(addr));
break;
}
case SYSTEM_EVENT_ETH_START: {
ESP_LOGD(TAG, "SYSTEM_EVENT_ETH_START");
break;
@@ -367,7 +380,7 @@ static esp_err_t esp_system_event_debug(system_event_t *event)
}
default: {
ESP_LOGW(TAG, "no such kind of event!");
ESP_LOGW(TAG, "unexpected system event %d!", event->event_id);
break;
}
}
+93
View File
@@ -0,0 +1,93 @@
#include <esp_types.h>
#include <stdio.h>
#include <stdlib.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/semphr.h"
#include "unity.h"
#include "soc/uart_reg.h"
#include "soc/dport_reg.h"
static volatile bool exit_flag;
static bool dport_test_result;
static bool apb_test_result;
static void accessDPORT(void *pvParameters)
{
xSemaphoreHandle *sema = (xSemaphoreHandle *) pvParameters;
uint32_t dport_date = DPORT_REG_READ(DPORT_DATE_REG);
dport_test_result = true;
// although exit flag is set in another task, checking (exit_flag == false) is safe
while (exit_flag == false) {
if (dport_date != DPORT_REG_READ(DPORT_DATE_REG)) {
dport_test_result = false;
break;
}
}
xSemaphoreGive(*sema);
vTaskDelete(NULL);
}
static void accessAPB(void *pvParameters)
{
xSemaphoreHandle *sema = (xSemaphoreHandle *) pvParameters;
uint32_t uart_date = REG_READ(UART_DATE_REG(0));
apb_test_result = true;
// although exit flag is set in another task, checking (exit_flag == false) is safe
while (exit_flag == false) {
if (uart_date != REG_READ(UART_DATE_REG(0))) {
apb_test_result = false;
break;
}
}
xSemaphoreGive(*sema);
vTaskDelete(NULL);
}
TEST_CASE("access DPORT and APB at same time", "[esp32]")
{
int i;
TaskHandle_t th[2];
xSemaphoreHandle exit_sema[2];
for (i=0; i<2; i++) {
exit_sema[i] = xSemaphoreCreateMutex();
xSemaphoreTake(exit_sema[i], portMAX_DELAY);
}
exit_flag = false;
#ifndef CONFIG_FREERTOS_UNICORE
printf("assign task accessing DPORT to core 0 and task accessing APB to core 1\n");
xTaskCreatePinnedToCore(accessDPORT , "accessDPORT" , 2048, &exit_sema[0], UNITY_FREERTOS_PRIORITY - 1, &th[0], 0);
xTaskCreatePinnedToCore(accessAPB , "accessAPB" , 2048, &exit_sema[1], UNITY_FREERTOS_PRIORITY - 1, &th[1], 1);
#else
printf("assign task accessing DPORT and accessing APB\n");
xTaskCreate(accessDPORT , "accessDPORT" , 2048, &exit_sema[0], UNITY_FREERTOS_PRIORITY - 1, &th[0]);
xTaskCreate(accessAPB , "accessAPB" , 2048, &exit_sema[1], UNITY_FREERTOS_PRIORITY - 1, &th[1]);
#endif
printf("start wait for 10 seconds\n");
vTaskDelay(10000 / portTICK_PERIOD_MS);
// set exit flag to let thread exit
exit_flag = true;
for (i=0; i<2; i++) {
xSemaphoreTake(exit_sema[i], portMAX_DELAY);
vSemaphoreDelete(exit_sema[i]);
}
TEST_ASSERT(dport_test_result == true && apb_test_result == true);
}
+87
View File
@@ -68,6 +68,8 @@ config LWIP_IP_REASSEMBLY
help
Enabling this option allows reassemblying incoming fragmented IP packets.
menu "TCP"
config TCP_MAXRTX
int "Maximum number of retransmissions of data segments"
default 12
@@ -82,6 +84,79 @@ config TCP_SYNMAXRTX
help
Set maximum number of retransmissions of SYN segments.
config TCP_MSS
int "Maximum Segment Size (MSS)"
default 1436
range 1220 1436
help
Set maximum segment size for TCP transmission.
Can be set lower to save RAM, the default value 1436 will give best throughput.
config TCP_SND_BUF_DEFAULT
int "Default send buffer size"
default 5744 # 4 * default MSS
range 2440 65535
help
Set default send buffer size for new TCP sockets.
Per-socket send buffer size can be changed at runtime
with lwip_setsockopt(s, TCP_SNDBUF, ...).
This value must be at least 2x the MSS size, and the default
is 4x the default MSS size.
Setting a smaller default SNDBUF size can save some RAM, but
will decrease performance.
config TCP_WND_DEFAULT
int "Default receive window size"
default 5744 # 4 * default MSS
range 2440 65535
help
Set default TCP receive window size for new TCP sockets.
Per-socket receive window size can be changed at runtime
with lwip_setsockopt(s, TCP_WINDOW, ...).
Setting a smaller default receive window size can save some RAM,
but will significantly decrease performance.
config TCP_QUEUE_OOSEQ
bool "Queue incoming out-of-order segments"
default y
help
Queue incoming out-of-order segments for later use.
Disable this option to save some RAM during TCP sessions, at the expense
of increased retransmissions if segments arrive out of order.
choice TCP_OVERSIZE
prompt "Pre-allocate transmit PBUF size"
default TCP_OVERSIZE_MSS
help
Allows enabling "oversize" allocation of TCP transmission pbufs ahead of time,
which can reduce the length of pbuf chains used for transmission.
This will not make a difference to sockets where Nagle's algorithm
is disabled.
Default value of MSS is fine for most applications, 25% MSS may save
some RAM when only transmitting small amounts of data. Disabled will
have worst performance and fragmentation characteristics, but uses
least RAM overall.
config TCP_OVERSIZE_MSS
bool "MSS"
config TCP_OVERSIZE_QUARTER_MSS
bool "25% MSS"
config TCP_OVERSIZE_DISABLE
bool "Disabled"
endchoice
endmenu # TCP
config LWIP_DHCP_DOES_ARP_CHECK
bool "Enable an ARP check on the offered address"
default y
@@ -139,4 +214,16 @@ config PPP_DEBUG_ON
help
Enable PPP debug log output
menu "ICMP"
config LWIP_MULTICAST_PING
bool "Respond to multicast pings"
default n
config LWIP_BROADCAST_PING
bool "Respond to broadcast pings"
default n
endmenu # ICMP
endmenu
+1 -1
View File
@@ -69,7 +69,7 @@
#include "lwip/memp.h"
#include "lwip/pbuf.h"
#include "lwip/sys.h"
#if LWIP_TCP && TCP_QUEUE_OOSEQ
#if LWIP_TCP && (TCP_QUEUE_OOSEQ || ESP_LWIP)
#include "lwip/priv/tcp_priv.h"
#endif
#if LWIP_CHECKSUM_ON_COPY
+2 -1
View File
@@ -69,8 +69,9 @@ typedef int sys_prot_t;
#define LWIP_PLATFORM_DIAG(x) do {printf x;} while(0)
#define LWIP_PLATFORM_ASSERT(x) do {printf(x); sys_arch_assert(__FILE__, __LINE__);} while(0)
//#define LWIP_DEBUG
#ifdef NDEBUG
#define LWIP_NOASSERT
#endif
//#define LWIP_ERROR
#endif /* __ARCH_CC_H__ */
+26 -4
View File
@@ -184,6 +184,10 @@
----------------------------------
*/
#define LWIP_BROADCAST_PING CONFIG_LWIP_BROADCAST_PING
#define LWIP_MULTICAST_PING CONFIG_LWIP_MULTICAST_PING
/*
---------------------------------
---------- RAW options ----------
@@ -280,7 +284,7 @@
* TCP_QUEUE_OOSEQ==1: TCP will queue segments that arrive out of order.
* Define to 0 if your device is low on memory.
*/
#define TCP_QUEUE_OOSEQ 1
#define TCP_QUEUE_OOSEQ CONFIG_TCP_QUEUE_OOSEQ
/*
* LWIP_EVENT_API==1: The user defines lwip_tcp_event() to receive all
@@ -288,7 +292,7 @@
* LWIP_CALLBACK_API==1: The PCB callback function is called directly
* for the event. This is the default.
*/
#define TCP_MSS 1460
#define TCP_MSS CONFIG_TCP_MSS
/**
* TCP_MAXRTX: Maximum number of retransmissions of data segments.
@@ -305,6 +309,24 @@
*/
#define TCP_LISTEN_BACKLOG 1
/**
* TCP_OVERSIZE: The maximum number of bytes that tcp_write may
* allocate ahead of time
*/
#ifdef CONFIG_TCP_OVERSIZE_MSS
#define TCP_OVERSIZE TCP_MSS
#endif
#ifdef CONFIG_TCP_OVERSIZE_QUARTER_MSS
#define TCP_OVERSIZE (TCP_MSS/4)
#endif
#ifdef CONFIG_TCP_OVERSIZE_DISABLE
#define TCP_OVERSIZE 0
#endif
#ifndef TCP_OVERSIZE
#error "One of CONFIG_TCP_OVERSIZE_xxx options should be set by sdkconfig"
#endif
/*
----------------------------------
---------- Pbuf options ----------
@@ -669,8 +691,8 @@
#define ESP_DHCP_TIMER 1
#define ESP_LWIP_LOGI(...) ESP_LOGI("lwip", __VA_ARGS__)
#define TCP_WND_DEFAULT (4*TCP_MSS)
#define TCP_SND_BUF_DEFAULT (4*TCP_MSS)
#define TCP_WND_DEFAULT CONFIG_TCP_WND_DEFAULT
#define TCP_SND_BUF_DEFAULT CONFIG_TCP_SND_BUF_DEFAULT
#if ESP_PERF
#define DBG_PERF_PATH_SET(dir, point)
+3 -1
View File
@@ -110,9 +110,11 @@ static void dbg_lwip_tcp_pcb_one_show(struct tcp_pcb* pcb)
seg = pcb->unacked;
DBG_LWIP_SEG_SHOW(seg);
ESP_LWIP_LOGI("ooseg semengts:");
#if TCP_QUEUE_OOSEQ
ESP_LWIP_LOGI("ooseq segments:");
seg = pcb->ooseq;
DBG_LWIP_SEG_SHOW(seg);
#endif
ESP_LWIP_LOGI("refused data=%p", pcb->refused_data);
+2 -2
View File
@@ -17,8 +17,8 @@
#include "soc.h"
#define REG_UART_BASE( i ) (DR_REG_UART_BASE + (i) * 0x10000 + ( i > 1 ? 0xe000 : 0 ) )
#define REG_UART_AHB_BASE(i) (0x60000000 + (i) * 0x10000 + ( i > 1 ? 0xe000 : 0 ) )
#define REG_UART_BASE( i ) (DR_REG_UART_BASE + (i) * 0x10000 + ( (i) > 1 ? 0xe000 : 0 ) )
#define REG_UART_AHB_BASE(i) (0x60000000 + (i) * 0x10000 + ( (i) > 1 ? 0xe000 : 0 ) )
#define UART_FIFO_AHB_REG(i) (REG_UART_AHB_BASE(i) + 0x0)
#define UART_FIFO_REG(i) (REG_UART_BASE(i) + 0x0)
+2
View File
@@ -197,6 +197,8 @@ TEST_CASE("vfs parses paths correctly", "[vfs]")
test_dir_opened(&inst_foobar, "/foo/bar/file");
inst_toplevel.match_path = "/tmp/foo";
test_opened(&inst_toplevel, "/tmp/foo");
inst_toplevel.match_path = "foo";
test_opened(&inst_toplevel, "foo");
TEST_ESP_OK( esp_vfs_unregister("/foo") );
TEST_ESP_OK( esp_vfs_unregister("/foo1") );
+5
View File
@@ -142,6 +142,11 @@ static const vfs_entry_t* get_vfs_for_path(const char* path)
memcmp(path, vfs->path_prefix, vfs->path_prefix_len) != 0) {
continue;
}
// this is the default VFS and we don't have a better match yet.
if (vfs->path_prefix_len == 0 && !best_match) {
best_match = vfs;
continue;
}
// if path is not equal to the prefix, expect to see a path separator
// i.e. don't match "/data" prefix for "/data1/foo.txt" path
if (len > vfs->path_prefix_len &&