备份-网线热拔插问题
This commit is contained in:
parent
d2628866f4
commit
852d47483b
|
@ -222,28 +222,30 @@ void start_ch438_task(void const *argument)
|
|||
uint32_t phyreg = 0;
|
||||
uint8_t tcp_hart_num = 0;
|
||||
HAL_ETH_ReadPHYRegister(&heth, 0x00, PHY_BSR, &phyreg);
|
||||
if (((phyreg >> 2) & 0x1) != 0x1) // PHY_BSR寄存器的第2位表示PHY是否连接 PHY_LINKED_STATUS
|
||||
{
|
||||
/* When the netif link is down this function must be called */
|
||||
|
||||
netif_set_link_down(&gnetif);
|
||||
netif_set_down(&gnetif); // 热插拔下线时调用
|
||||
for (tcp_hart_num = 0; tcp_hart_num < TCP_MAX; tcp_hart_num++)
|
||||
for (tcp_hart_num = 0; tcp_hart_num < TCP_MAX; tcp_hart_num++)
|
||||
{
|
||||
if (tcp_echo_flags[tcp_hart_num] == 1)
|
||||
{
|
||||
if (tcp_echo_flags[tcp_hart_num] == 1)
|
||||
if (((phyreg >> 2) & 0x1) != 0x1) // PHY_BSR寄存器的第2位表示PHY是否连接 PHY_LINKED_STATUS
|
||||
{
|
||||
/* When the netif link is down this function must be called */
|
||||
|
||||
netif_set_link_down(&gnetif);
|
||||
netif_set_down(&gnetif); // 热插拔下线时调用
|
||||
tcp_abort(server_pcb_hart[tcp_hart_num]); // 热插拔下线时调用
|
||||
tcp_echo_flags[tcp_hart_num] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* When the netif is fully configured this function must be called */
|
||||
netif_set_link_up(&gnetif);
|
||||
netif_set_up(&gnetif); // 热插拔上线时调用
|
||||
}
|
||||
}
|
||||
|
||||
vTaskDelay(500);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* When the netif is fully configured this function must be called */
|
||||
netif_set_link_up(&gnetif);
|
||||
netif_set_up(&gnetif); // 热插拔上线时调用
|
||||
}
|
||||
vTaskDelay(500);
|
||||
}
|
||||
/* USER CODE END start_ch438_task */
|
||||
}
|
||||
|
|
|
@ -250,6 +250,11 @@
|
|||
<WinNumber>1</WinNumber>
|
||||
<ItemText>ch438_1_int_flag</ItemText>
|
||||
</Ww>
|
||||
<Ww>
|
||||
<count>20</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>current_buff</ItemText>
|
||||
</Ww>
|
||||
</WatchWindow1>
|
||||
<WatchWindow2>
|
||||
<Ww>
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
<html>
|
||||
<body>
|
||||
<pre>
|
||||
<h1>µVision Build Log</h1>
|
||||
<h2>Tool Versions:</h2>
|
||||
IDE-Version: ¦ÌVision V5.38.0.0
|
||||
Copyright (C) 2022 ARM Ltd and ARM Germany GmbH. All rights reserved.
|
||||
License Information: admin, , LIC=IC93N-YMBVW-HRFXN-YQEV3-SZ4P1-XNWP8
|
||||
|
||||
Tool Versions:
|
||||
Toolchain: MDK-ARM Professional Version: 5.38.0.0
|
||||
Toolchain Path: D:\app\Keil_v5\ARM\ARMCC\Bin
|
||||
C Compiler: Armcc.exe V5.06 update 7 (build 960)
|
||||
Assembler: Armasm.exe V5.06 update 7 (build 960)
|
||||
Linker/Locator: ArmLink.exe V5.06 update 7 (build 960)
|
||||
Library Manager: ArmAr.exe V5.06 update 7 (build 960)
|
||||
Hex Converter: FromElf.exe V5.06 update 7 (build 960)
|
||||
CPU DLL: SARMCM3.DLL V5.38.0.0
|
||||
Dialog DLL: DCM.DLL V1.17.5.0
|
||||
Target DLL: STLink\ST-LINKIII-KEIL_SWO.dll V3.1.0.0
|
||||
Dialog DLL: TCM.DLL V1.56.4.0
|
||||
|
||||
<h2>Project:</h2>
|
||||
D:\1-workshop\valve_debugging\MDK-ARM\valve_debugging.uvprojx
|
||||
Project File Date: 06/26/2025
|
||||
|
||||
<h2>Output:</h2>
|
||||
*** Using Compiler 'V5.06 update 7 (build 960)', folder: 'D:\app\Keil_v5\ARM\ARMCC\Bin'
|
||||
Build target 'valve_debugging'
|
||||
compiling freertos.c...
|
||||
linking...
|
||||
Program Size: Code=83940 RO-data=1404 RW-data=432 ZI-data=116892
|
||||
FromELF: creating hex file...
|
||||
"valve_debugging\valve_debugging.axf" - 0 Error(s), 0 Warning(s).
|
||||
|
||||
<h2>Software Packages used:</h2>
|
||||
|
||||
Package Vendor: ARM
|
||||
http://www.keil.com/pack/ARM.CMSIS.5.9.0.pack
|
||||
ARM.CMSIS.5.9.0
|
||||
CMSIS (Common Microcontroller Software Interface Standard)
|
||||
* Component: CORE Version: 5.6.0
|
||||
|
||||
Package Vendor: Keil
|
||||
http://www.keil.com/pack/Keil.STM32F4xx_DFP.2.16.0.pack
|
||||
Keil.STM32F4xx_DFP.2.16.0
|
||||
STMicroelectronics STM32F4 Series Device Support, Drivers and Examples
|
||||
|
||||
<h2>Collection of Component include folders:</h2>
|
||||
./RTE/_valve_debugging
|
||||
D:/app/Keil_v5/Packs/ARM/CMSIS/5.9.0/CMSIS/Core/Include
|
||||
D:/app/Keil_v5/Packs/Keil/STM32F4xx_DFP/2.16.0/Drivers/CMSIS/Device/ST/STM32F4xx/Include
|
||||
|
||||
<h2>Collection of Component Files used:</h2>
|
||||
|
||||
* Component: ARM::CMSIS:CORE:5.6.0
|
||||
Include file: CMSIS/Core/Include/tz_context.h
|
||||
Build Time Elapsed: 00:00:03
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
File diff suppressed because it is too large
Load Diff
|
@ -262,8 +262,8 @@ void ch438_send_data(uint8_t uart_num, uint8_t *data, uint16_t len)
|
|||
{
|
||||
hart_ht1200m_rts_io_send(uart_num);
|
||||
uint8_t ch438_num = 0;
|
||||
data[len] = 0x00; // 因为发送数据RHART的RTS需要延时,这里用多一个字节的发送来代替延时
|
||||
data[len + 1] = 0x00; // 因为发送数据RHART的RTS需要延时,这里用多两个字节的发送来代替延时
|
||||
data[len] = 0xFF; // 因为发送数据RHART的RTS需要延时,这里用多一个字节的发送来代替延时
|
||||
data[len + 1] = 0xFF; // 因为发送数据RHART的RTS需要延时,这里用多两个字节的发送来代替延时
|
||||
if (uart_num < 8)
|
||||
{
|
||||
ch438_num = CH438_CHIP0;
|
||||
|
@ -273,7 +273,8 @@ void ch438_send_data(uint8_t uart_num, uint8_t *data, uint16_t len)
|
|||
ch438_num = CH438_CHIP1;
|
||||
uart_num -= 8;
|
||||
}
|
||||
for (uint8_t i = 0; i < len + 2; i++)
|
||||
ch438_write_reg(ch438_num, offsetadd[uart_num] | REG_THR_ADDR, data[len], 1);
|
||||
for (uint8_t i = 0; i < len + 1; i++)
|
||||
{
|
||||
ch438_write_reg(ch438_num, offsetadd[uart_num] | REG_THR_ADDR, data[i], 1);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue