通讯断开后可以恢复

This commit is contained in:
王绪洁 2025-03-31 18:42:22 +08:00
parent aadb90b07d
commit b0bc99da14
5 changed files with 2900 additions and 2749 deletions

View File

@ -191,25 +191,30 @@ void start_tcp_task(void const *argument)
if (tcp_echo_flags_hart1 == 1)
{
tcp_abort(server_pcb_hart1); // 热插拔下线时调用
tcp_echo_flags_hart1 = 0;
}
if (tcp_echo_flags_hart2 == 1)
{
tcp_abort(server_pcb_hart2); // 热插拔下线时调用
tcp_echo_flags_hart2 = 0;
}
#if (BLE2_USART6 == 1)
if (tcp_echo_flags_ble1 == 1)
{
tcp_abort(server_pcb_ble1); // 热插拔下线时调用
tcp_echo_flags_ble1 = 0;
}
#endif
if (tcp_echo_flags_ble2 == 1)
{
tcp_abort(server_pcb_ble2); // 热插拔下线时调用
tcp_echo_flags_ble2 = 0;
}
if (tcp_echo_flags_control == 1)
{
tcp_abort(server_pcb_control); // 热插拔下线时调用
tcp_echo_flags_control = 0;
}
tcp_echo_flags_ble1 = 2;
}

View File

@ -22,7 +22,7 @@
#include "lwip.h"
#include "lwip/init.h"
#include "lwip/netif.h"
#if defined ( __CC_ARM ) /* MDK ARM Compiler */
#if defined(__CC_ARM) /* MDK ARM Compiler */
#include "lwip/sio.h"
#endif /* MDK ARM Compiler */
#include "ethernetif.h"
@ -71,15 +71,15 @@ void MX_LWIP_Init(void)
GATEWAY_ADDRESS[2] = 1;
GATEWAY_ADDRESS[3] = 29;
/* USER CODE BEGIN IP_ADDRESSES */
/* USER CODE END IP_ADDRESSES */
/* USER CODE BEGIN IP_ADDRESSES */
/* USER CODE END IP_ADDRESSES */
/* Initilialize the LwIP stack with RTOS */
tcpip_init( NULL, NULL );
tcpip_init(NULL, NULL);
/* IP addresses initialization without DHCP (IPv4) */
IP4_ADDR(&ipaddr, IP_ADDRESS[0], IP_ADDRESS[1], IP_ADDRESS[2], IP_ADDRESS[3]);
IP4_ADDR(&netmask, NETMASK_ADDRESS[0], NETMASK_ADDRESS[1] , NETMASK_ADDRESS[2], NETMASK_ADDRESS[3]);
IP4_ADDR(&netmask, NETMASK_ADDRESS[0], NETMASK_ADDRESS[1], NETMASK_ADDRESS[2], NETMASK_ADDRESS[3]);
IP4_ADDR(&gw, GATEWAY_ADDRESS[0], GATEWAY_ADDRESS[1], GATEWAY_ADDRESS[2], GATEWAY_ADDRESS[3]);
/* add the network interface (IPv4/IPv6) with RTOS */
@ -103,19 +103,19 @@ void MX_LWIP_Init(void)
netif_set_link_callback(&gnetif, ethernet_link_status_updated);
/* Create the Ethernet link handler thread */
/* USER CODE BEGIN H7_OS_THREAD_DEF_CREATE_CMSIS_RTOS_V1 */
/* USER CODE BEGIN H7_OS_THREAD_DEF_CREATE_CMSIS_RTOS_V1 */
osThreadDef(EthLink, ethernet_link_thread, osPriorityBelowNormal, 0, configMINIMAL_STACK_SIZE * 2);
osThreadCreate(osThread(EthLink), &gnetif);
/* USER CODE END H7_OS_THREAD_DEF_CREATE_CMSIS_RTOS_V1 */
/* USER CODE END H7_OS_THREAD_DEF_CREATE_CMSIS_RTOS_V1 */
/* USER CODE BEGIN 3 */
/* USER CODE BEGIN 3 */
flash_read_data(FLASH_USER_START_ADDR, IP_ADDRESS, 4);
if (IP_ADDRESS[0] == 192)
{
IP4_ADDR(&ipaddr, IP_ADDRESS[0], IP_ADDRESS[1], IP_ADDRESS[2], IP_ADDRESS[3]);
gnetif.ip_addr = ipaddr;
}
/* USER CODE END 3 */
/* USER CODE END 3 */
}
#ifdef USE_OBSOLETE_USER_CODE_SECTION_4
@ -134,17 +134,17 @@ static void ethernet_link_status_updated(struct netif *netif)
{
if (netif_is_up(netif))
{
/* USER CODE BEGIN 5 */
/* USER CODE END 5 */
/* USER CODE BEGIN 5 */
/* USER CODE END 5 */
}
else /* netif is down */
{
/* USER CODE BEGIN 6 */
/* USER CODE END 6 */
/* USER CODE BEGIN 6 */
/* USER CODE END 6 */
}
}
#if defined ( __CC_ARM ) /* MDK ARM Compiler */
#if defined(__CC_ARM) /* MDK ARM Compiler */
/**
* Opens a serial device for communication.
*
@ -155,9 +155,9 @@ sio_fd_t sio_open(u8_t devnum)
{
sio_fd_t sd;
/* USER CODE BEGIN 7 */
/* USER CODE BEGIN 7 */
sd = 0; // dummy code
/* USER CODE END 7 */
/* USER CODE END 7 */
return sd;
}
@ -172,8 +172,8 @@ sio_fd_t sio_open(u8_t devnum)
*/
void sio_send(u8_t c, sio_fd_t fd)
{
/* USER CODE BEGIN 8 */
/* USER CODE END 8 */
/* USER CODE BEGIN 8 */
/* USER CODE END 8 */
}
/**
@ -191,9 +191,9 @@ u32_t sio_read(sio_fd_t fd, u8_t *data, u32_t len)
{
u32_t recved_bytes;
/* USER CODE BEGIN 9 */
/* USER CODE BEGIN 9 */
recved_bytes = 0; // dummy code
/* USER CODE END 9 */
/* USER CODE END 9 */
return recved_bytes;
}
@ -210,10 +210,9 @@ u32_t sio_tryread(sio_fd_t fd, u8_t *data, u32_t len)
{
u32_t recved_bytes;
/* USER CODE BEGIN 10 */
/* USER CODE BEGIN 10 */
recved_bytes = 0; // dummy code
/* USER CODE END 10 */
/* USER CODE END 10 */
return recved_bytes;
}
#endif /* MDK ARM Compiler */

View File

@ -170,6 +170,11 @@
<WinNumber>1</WinNumber>
<ItemText>phyreg</ItemText>
</Ww>
<Ww>
<count>4</count>
<WinNumber>1</WinNumber>
<ItemText>lwip_taskHandle,0x0A</ItemText>
</Ww>
</WatchWindow1>
<MemoryWindow1>
<Mm>

View File

@ -27,6 +27,147 @@ Project File Date: 03/31/2025
<h2>Output:</h2>
*** Using Compiler 'V5.06 update 7 (build 960)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin'
Build target 'semi-finished_product_testing'
assembling startup_stm32f407xx.s...
compiling lan8742.c...
compiling gpio.c...
compiling dma.c...
compiling tim.c...
compiling stm32f4xx_hal_msp.c...
compiling stm32f4xx_hal_timebase_tim.c...
compiling usart.c...
compiling main.c...
compiling lwip.c...
compiling ethernetif.c...
compiling stm32f4xx_hal_rcc.c...
compiling freertos.c...
compiling spi.c...
compiling stm32f4xx_it.c...
compiling stm32f4xx_hal_rcc_ex.c...
compiling stm32f4xx_hal_flash.c...
compiling stm32f4xx_hal_flash_ex.c...
compiling stm32f4xx_hal_flash_ramfunc.c...
compiling stm32f4xx_hal_gpio.c...
compiling stm32f4xx_hal_dma_ex.c...
compiling stm32f4xx_hal_dma.c...
compiling stm32f4xx_hal_pwr_ex.c...
compiling stm32f4xx_hal_pwr.c...
compiling stm32f4xx_hal_cortex.c...
compiling stm32f4xx_hal_exti.c...
compiling stm32f4xx_hal_eth.c...
compiling stm32f4xx_hal.c...
compiling stm32f4xx_hal_spi.c...
compiling croutine.c...
compiling stm32f4xx_hal_tim_ex.c...
compiling stm32f4xx_hal_tim.c...
compiling event_groups.c...
compiling stream_buffer.c...
compiling list.c...
compiling stm32f4xx_hal_uart.c...
compiling timers.c...
compiling heap_4.c...
compiling tasks.c...
compiling queue.c...
compiling system_stm32f4xx.c...
compiling cmsis_os.c...
compiling port.c...
compiling ccp.c...
compiling auth.c...
compiling chap_ms.c...
compiling chap-md5.c...
compiling demand.c...
compiling chap-new.c...
compiling eui64.c...
compiling fsm.c...
compiling eap.c...
compiling ipcp.c...
compiling ipv6cp.c...
compiling lcp.c...
compiling magic.c...
compiling multilink.c...
compiling mppe.c...
compiling ppp.c...
compiling pppapi.c...
compiling pppoe.c...
compiling pppcrypt.c...
compiling pppol2tp.c...
compiling pppos.c...
compiling upap.c...
compiling utils.c...
compiling vj.c...
compiling bridgeif.c...
compiling bridgeif_fdb.c...
compiling ethernet.c...
compiling lowpan6.c...
compiling lowpan6_ble.c...
compiling lowpan6_common.c...
compiling zepif.c...
compiling slipif.c...
compiling ecp.c...
compiling if_api.c...
compiling netdb.c...
compiling err.c...
compiling netbuf.c...
compiling api_msg.c...
compiling api_lib.c...
compiling netifapi.c...
compiling tcpip.c...
compiling altcp.c...
compiling sockets.c...
compiling altcp_tcp.c...
compiling altcp_alloc.c...
compiling def.c...
compiling dns.c...
compiling mem.c...
compiling ip.c...
compiling inet_chksum.c...
compiling init.c...
compiling memp.c...
compiling raw.c...
compiling netif.c...
compiling stats.c...
compiling pbuf.c...
compiling sys.c...
compiling tcp.c...
compiling tcp_in.c...
compiling tcp_out.c...
compiling timeouts.c...
compiling udp.c...
compiling autoip.c...
compiling etharp.c...
compiling igmp.c...
compiling icmp.c...
compiling dhcp.c...
compiling ip4.c...
compiling ip4_addr.c...
compiling ip4_frag.c...
compiling dhcp6.c...
compiling ethip6.c...
compiling icmp6.c...
compiling ble_mx_02.c...
compiling inet6.c...
compiling ip6.c...
compiling ip6_addr.c...
compiling ip6_frag.c...
compiling mld6.c...
compiling user_lib.c...
compiling nd6.c...
compiling sys_arch.c...
compiling leds.c...
compiling linear_encoder.c...
compiling communication_protocol.c...
compiling mqtt.c...
compiling tcpclient.c...
compiling tcpserverc.c...
compiling ad7124.c...
compiling dac161s997.c...
compiling ht1200m.c...
compiling user_gpio.c...
compiling user_spi.c...
compiling user_flash.c...
compiling uart_lcd.c...
linking...
Program Size: Code=93900 RO-data=1472 RW-data=1640 ZI-data=62880
FromELF: creating hex file...
"semi-finished_product_testing\semi-finished_product_testing.axf" - 0 Error(s), 0 Warning(s).
<h2>Software Packages used:</h2>
@ -51,7 +192,7 @@ Package Vendor: Keil
* Component: ARM::CMSIS:CORE:5.5.0
Include file: CMSIS\Core\Include\tz_context.h
Build Time Elapsed: 00:00:00
Build Time Elapsed: 00:00:09
</pre>
</body>
</html>