diff --git a/components/lwip/port/esp8266/freertos/heap.c b/components/lwip/port/esp8266/freertos/heap.c deleted file mode 100644 index 5d14dd74..00000000 --- a/components/lwip/port/esp8266/freertos/heap.c +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2018-2019 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. - -#include -#include "lwip/opt.h" -#include "lwip/memp.h" -#include "FreeRTOS.h" -#include "esp8266/eagle_soc.h" - -#ifdef ESP_LWIP -#if MEMP_SIZE != 0 -#error "MEMP_SIZE must be 0" -#else /* MEMP_SIZE != 0 */ -size_t memp_malloc_get_size(size_t type) -{ - return memp_pools[type]->size; -} -#endif /* MEMP_SIZE != 0 */ -#endif /* ESP_LWIP */ diff --git a/components/lwip/port/esp8266/freertos/sys_arch.c b/components/lwip/port/esp8266/freertos/sys_arch.c index f68908dc..621e1f37 100644 --- a/components/lwip/port/esp8266/freertos/sys_arch.c +++ b/components/lwip/port/esp8266/freertos/sys_arch.c @@ -196,11 +196,6 @@ sys_mbox_new(sys_mbox_t *mbox, int size) void sys_mbox_free(sys_mbox_t *mbox) { - if (uxQueueMessagesWaiting(*mbox)) { - /* Line for breakpoint. Should never break here! */ -// __asm volatile ( "NOP" ); - } - vQueueDelete(*mbox); } @@ -396,50 +391,6 @@ char *sys_current_task_name(void) return pcTaskGetTaskName(xTaskGetCurrentTaskHandle()); } -/* - This optional function does a "fast" critical region protection and returns - the previous protection level. This function is only called during very short - critical regions. An embedded system which supports ISR-based drivers might - want to implement this function by disabling interrupts. Task-based systems - might want to implement this by using a mutex or disabling tasking. This - function should support recursive calls from the same task or interrupt. In - other words, sys_arch_protect() could be called while already protected. In - that case the return value indicates that it is already protected. - - sys_arch_protect() is only required if your port is supporting an operating - system. -*/ -sys_prot_t -sys_arch_protect(void) -{ - vPortEnterCritical(); - return (sys_prot_t) 1; -} - -/* - This optional function does a "fast" set of critical region protection to the - value specified by pval. See the documentation for sys_arch_protect() for - more information. This function is only required if your port is supporting - an operating system. -*/ -void -sys_arch_unprotect(sys_prot_t pval) -{ - (void) pval; - vPortExitCritical(); -} - -/* - * Prints an assertion messages and aborts execution. - */ -void -sys_arch_assert(const char *file, int line) -{ - printf("\nAssertion: %d in %s\n", line, file); - - while(1); -} - void sys_arch_msleep(int ms) { diff --git a/components/lwip/port/esp8266/include/arch/cc.h b/components/lwip/port/esp8266/include/arch/cc.h index c815a670..3d405ab9 100644 --- a/components/lwip/port/esp8266/include/arch/cc.h +++ b/components/lwip/port/esp8266/include/arch/cc.h @@ -61,12 +61,11 @@ typedef int sys_prot_t; #define PACK_STRUCT_END #include +#include #ifdef LWIP_DEBUG -extern void sys_arch_assert(const char *file, int line); - #define LWIP_PLATFORM_DIAG(x) do {printf x;} while(0) -#define LWIP_PLATFORM_ASSERT(x) do {printf(x); sys_arch_assert(__ESP_FILE__, __LINE__);} while(0) +#define LWIP_PLATFORM_ASSERT(x) do {printf(x); assert(0);} while(0) #else #define LWIP_PLATFORM_DIAG(x) #define LWIP_PLATFORM_ASSERT(x) diff --git a/components/lwip/port/esp8266/include/lwipopts.h b/components/lwip/port/esp8266/include/lwipopts.h index 00c9fdd6..be7728a5 100644 --- a/components/lwip/port/esp8266/include/lwipopts.h +++ b/components/lwip/port/esp8266/include/lwipopts.h @@ -49,6 +49,7 @@ #include #include "esp_libc.h" #include "esp_system.h" +#include "driver/soc.h" #define ESP_LWIP 1 @@ -76,6 +77,13 @@ #define TCP_HIGH_SPEED_RETRANSMISSION CONFIG_TCP_HIGH_SPEED_RETRANSMISSION +/** + * @brief System + */ +#define SYS_ARCH_DECL_PROTECT(_lev) esp_irqflag_t _lev +#define SYS_ARCH_PROTECT(_lev) _lev = soc_save_local_irq() +#define SYS_ARCH_UNPROTECT(_lev) soc_restore_local_irq(_lev) + /* ------------------------------------ -------------- NO SYS -------------- @@ -237,7 +245,7 @@ size_t memp_malloc_get_size(size_t type); * * @return memory pool pointer */ -#define memp_malloc_ll(type) heap_caps_malloc(memp_malloc_get_size(type), MALLOC_CAP_8BIT) +#define memp_malloc_ll(type) heap_caps_malloc(memp_pools[type]->size, MALLOC_CAP_8BIT) #endif /**