以太网驱动优化,TCP客户端进行优化

This commit is contained in:
冯佳
2026-02-27 08:04:12 +08:00
parent 23254ae44f
commit 23bb103fb5
7 changed files with 702 additions and 7534 deletions

View File

@ -10,6 +10,10 @@
#include "board.h"
#include <rtthread.h>
#include "stm32f4xx_hal.h"
/* Forward declaration */
void HAL_ETH_MspInit(ETH_HandleTypeDef *heth);
/* System Clock Configuration */
void SystemClock_Config(void)
@ -108,6 +112,39 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* uartHandle)
}
}
/* Ethernet MSP Init */
void HAL_ETH_MspInit(ETH_HandleTypeDef *heth)
{
(void)heth;
GPIO_InitTypeDef GPIO_InitStructure;
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_SYSCFG_CLK_ENABLE();
__HAL_RCC_ETH_CLK_ENABLE();
/* PA1, PA2, PA7 */
GPIO_InitStructure.Pin = GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_7;
GPIO_InitStructure.Mode = GPIO_MODE_AF_PP;
GPIO_InitStructure.Pull = GPIO_NOPULL;
GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStructure.Alternate = GPIO_AF11_ETH;
HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);
/* PC1, PC4, PC5 */
GPIO_InitStructure.Pin = GPIO_PIN_1 | GPIO_PIN_4 | GPIO_PIN_5;
HAL_GPIO_Init(GPIOC, &GPIO_InitStructure);
/* PB11, PB12, PB13 */
GPIO_InitStructure.Pin = GPIO_PIN_11 | GPIO_PIN_12 | GPIO_PIN_13;
HAL_GPIO_Init(GPIOB, &GPIO_InitStructure);
HAL_NVIC_SetPriority(ETH_IRQn, 0x07, 0);
HAL_NVIC_EnableIRQ(ETH_IRQn);
}
/**
* This is the timer interrupt service routine.
*