1 /* 2 * Copyright (c) 2022 HPMicro 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #ifndef HPM_LWIP_H 16 #define HPM_LWIP_H 17 #include "hpm_enet_drv.h" 18 #include "hpm_rtl8211.h" 19 #include "hpm_rtl8211_regs.h" 20 #include "hpm_rtl8201.h" 21 #include "hpm_rtl8201_regs.h" 22 #include "board.h" 23 24 #include "lwip/err.h" 25 #include "lwip/netif.h" 26 27 #define ENET_TX_BUFF_COUNT (10) 28 #define ENET_RX_BUFF_COUNT (64) 29 #define ENET_RX_BUFF_SIZE ENET_MAX_FRAME_SIZE 30 #define ENET_TX_BUFF_SIZE ENET_MAX_FRAME_SIZE 31 32 struct HpmEnetDevice { 33 int isEnable; 34 int isDefault; 35 const char *name; 36 struct netif netif; 37 uint8_t macAddr[6]; 38 uint8_t ip[4]; 39 uint8_t gw[4]; 40 uint8_t netmask[4]; 41 ENET_Type * base; 42 uint32_t irqNum; 43 enet_inf_type_t infType; 44 enet_desc_t desc; 45 enet_mac_config_t mac; 46 uint32_t rxSemHandle; 47 }; 48 49 #endif 50 51