6 #include "stm32/stm32f4xx_eth.h"
7 #include "stm32/stm32f4xx_misc.h"
13 static uint32_t EthStatus = 0;
15 static void eth_config(
void)
20 RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_ETH_MAC | RCC_AHB1Periph_ETH_MAC_Tx |
21 RCC_AHB1Periph_ETH_MAC_Rx, ENABLE);
30 while (ETH_GetSoftwareResetStatus() == SET);
34 ETH_StructInit(Ð_InitStructure);
48 ETH_BroadcastFramesReception_Enable;
51 ETH_MulticastFramesFilter_Perfect;
53 #ifdef CHECKSUM_BY_HARDWARE
63 ETH_DropTCPIPChecksumErrorFrame_Enable;
66 ETH_TransmitStoreForward_Enable;
70 ETH_ForwardUndersizedGoodFrames_Disable;
77 ETH_DMAArbitration_RoundRobin_RxTx_2_1;
83 if (ETH_Init(Ð_InitStructure, LAN8720_PHY_ADDRESS) == ETH_SUCCESS)
85 EthStatus = ETH_INIT_FLAG | ETH_LINK_FLAG;
97 static void gpio_config(
void)
100 RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
103 SYSCFG_ETH_MediaInterfaceConfig(SYSCFG_ETH_MediaInterface_RMII);
105 const struct gpio_t gpios[] =
107 PIN_RESET_NOT_ETHERNET,
111 GPIO_ETH_MII_RX_CLK_PA1,
113 GPIO_ETH_RMII_CRS_DV_PA7,
114 GPIO_ETH_RMII_RXD0_PC4,
115 GPIO_ETH_RMII_RXD1_PC5,
116 GPIO_ETH_RMII_TXD0_PG13,
117 GPIO_ETH_RMII_TXD1_PG14,
118 GPIO_ETH_RMII_TX_EN_PG11,
129 static void interrupt_config(
void)
131 extern void ETH_IRQ_Handler(
void);
140 NVIC_InitStructure.NVIC_Handler = ETH_IRQ_Handler;
141 NVIC_Init(&NVIC_InitStructure);
164 RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_ETH_MAC | RCC_AHB1Periph_ETH_MAC_Tx | RCC_AHB1Periph_ETH_MAC_Rx, ENABLE);
167 while (ETH_GetSoftwareResetStatus() == SET);
170 ETH_WritePHYRegister(LAN8720_PHY_ADDRESS, 0, 1 << 11);
171 RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_ETH_MAC | RCC_AHB1Periph_ETH_MAC_Tx | RCC_AHB1Periph_ETH_MAC_Rx, DISABLE);
This file contains all the functions prototypes for the RCC firmware library.
uint32_t ETH_RxDMABurstLength
uint32_t ETH_AddressAlignedBeats
uint32_t ETH_MulticastFramesFilter
uint32_t ETH_ForwardErrorFrames
uint32_t ETH_ChecksumOffload
Header for stm32f4x7_eth_bsp.c file.
uint32_t ETH_TransmitStoreForward
uint32_t ETH_DMAArbitration
uint8_t NVIC_IRQChannelSubPriority
uint32_t ETH_ReceiveStoreForward
NVIC Init Structure definition.
static void gpio_set(const struct gpio_t *gpio, uint32_t value)
Set a gpio.
This file contains all the functions prototypes for the SYSCFG firmware library.
uint32_t ETH_TxDMABurstLength
uint32_t ETH_UnicastFramesFilter
uint32_t ETH_SecondFrameOperate
#define ETH_TxDMABurstLength_32Beat
uint32_t bsp_eth_status(void)
Get the status (link, ...) of the Ethernet.
ETH MAC Init structure definition.
BSP for ARMEBS4 Ethernet.
void bsp_eth_config(void)
configure the Ethernet interface
uint32_t ETH_BroadcastFramesReception
uint32_t ETH_AutoNegotiation
/ * MAC
FunctionalState NVIC_IRQChannelCmd
uint8_t NVIC_IRQChannelPreemptionPriority
uint32_t ETH_RetryTransmission
uint32_t ETH_ForwardUndersizedGoodFrames
uint32_t ETH_LoopbackMode
uint32_t ETH_PromiscuousMode
void delay_wait_us(uint32_t us)
Wait for at least that time.
void bsp_eth_powerdown(void)
Shutdown the Ethernet interface.
status_e gpio_setup_list(const struct gpio_t gpio[], size_t len)
Setup an array of gpio.
uint32_t ETH_AutomaticPadCRCStrip
#define ARRAY_SIZE(x)
Number of elements in the array.
#define ETH_RxDMABurstLength_32Beat
uint32_t ETH_DropTCPIPChecksumErrorFrame
/ * DMA