主题中讨论的其他器件:C2000WARE
您好!
我设法将以太网校验和卸载引擎(COE)与 lwIP 结合使用(我甚至关闭了 lwIP 为器件传出流量提供的软件校验和生成、并且仍然从器件获取 TCP 响应) 在数据包描述符链中的第一个数据包描述符中设置适当的标志。
但是、当我想从 MSS 大于400字节的设备发送 TCP 数据包时、我开始遇到无法在 PC 端获取任何数据的问题。 我仍然不知道通过和失败之间的确切大小边界( 它看起来不 是固定值)、 但我确信、在发送 长度为500字节或更大的有效负载数据时、会生成错误的校验和、COE 将拒绝生成校验和、或者我 还没有考虑一些未命名的以太网问题。 无论情况如何、PC 端的插槽都将悬空、因为它会等待从未到达的数据。
我需要帮助来确定问题的原因并进行修复、或者至少 确认解决问题超出任何软件修复的范围。
现在、 对于以太网配置、它基本上与 C2000Ware 3.04中的 lwip 示例保持不变。
unsigned long ulUser0, ulUser1;
unsigned char pucMACArray[8];
SYSTICK_setPeriod(systickPeriodValue);
SYSTICK_enableCounter();
SYSTICK_registerInterruptHandler(SysTickIntHandler);
SYSTICK_enableInterrupt();
//
// Enable processor interrupts.
//
Interrupt_enableInProcessor();
// Set user/company specific MAC octets
// (for this code we are using A8-63-F2-00-00-80)
// 0x00 MACOCT3 MACOCT2 MACOCT1
ulUser0 = 0x00F263A8;
// 0x00 MACOCT6 MACOCT5 MACOCT4
ulUser1 = 0x00800000;
//
// Convert the 24/24 split MAC address from NV ram into a 32/16 split MAC
// address needed to program the hardware registers, then program the MAC
// address into the Ethernet Controller registers.
//
pucMACArray[0] = ((ulUser0 >> 0) & 0xff);
pucMACArray[1] = ((ulUser0 >> 8) & 0xff);
pucMACArray[2] = ((ulUser0 >> 16) & 0xff);
pucMACArray[3] = ((ulUser1 >> 0) & 0xff);
pucMACArray[4] = ((ulUser1 >> 8) & 0xff);
pucMACArray[5] = ((ulUser1 >> 16) & 0xff);
unsigned char * mac = pucMACArray;
Ethernet_InitInterfaceConfig initInterfaceConfig;
uint32_t macLower;
uint32_t macHigher;
uint8_t *temp;
initInterfaceConfig.ssbase = EMAC_SS_BASE;
initInterfaceConfig.enet_base = EMAC_BASE;
initInterfaceConfig.phyMode = ETHERNET_SS_PHY_INTF_SEL_MII;
//
// Assign SoC specific functions for Enabling,Disabling interrupts
// and for enabling the Peripheral at system level
//
initInterfaceConfig.ptrPlatformInterruptDisable = &Platform_disableInterrupt;
initInterfaceConfig.ptrPlatformInterruptEnable = &Platform_enableInterrupt;
initInterfaceConfig.ptrPlatformPeripheralEnable = &Platform_enablePeripheral;
initInterfaceConfig.ptrPlatformPeripheralReset = &Platform_resetPeripheral;
//
// Assign the peripheral number at the SoC
//
initInterfaceConfig.peripheralNum = SYSCTL_PERIPH_CLK_ENET;
//
// Assign the default SoC specific interrupt numbers of Ethernet interrupts
//
initInterfaceConfig.interruptNum[0] = INT_EMAC;
initInterfaceConfig.interruptNum[1] = INT_EMAC_TX0;
initInterfaceConfig.interruptNum[2] = INT_EMAC_TX1;
initInterfaceConfig.interruptNum[3] = INT_EMAC_RX0;
initInterfaceConfig.interruptNum[4] = INT_EMAC_RX1;
Ethernet_InitConfig * pInitCfg = Ethernet_initInterface(initInterfaceConfig);
Ethernet_getInitConfig(pInitCfg);
pInitCfg->numChannels = 1;
pInitCfg->dmaMode.InterruptMode = ETHERNET_DMA_MODE_INTM_MODE2;
//
// Assign the callbacks for Getting packet buffer when needed
// Releasing the TxPacketBuffer on Transmit interrupt callbacks
// Receive packet callback on Receive packet completion interrupt
//
pInitCfg->pfcbRxPacket = &Ethernet_receivePacketCallbackCustom;
pInitCfg->pfcbGetPacket = &Ethernet_getPacketBufferCustom;
pInitCfg->pfcbFreePacket = &Ethernet_releaseTxPacketBufferCustom;
//
//Assign the Buffer to be used by the Low level driver for receiving
//Packets. This should be accessible by the Ethernet DMA
//
// pInitCfg->rxBuffer = Ethernet_rxBuffer;
pInitCfg->macFilterConfig.hashUnicast = ETHERNET_ENABLE; //
pInitCfg->macFilterConfig.hashMulticast = ETHERNET_ENABLE; //
pInitCfg->macFilterConfig.hashPerfectFilter = ETHERNET_ENABLE; //
//pInitCfg->macFilterConfig.disableBroadCastPackets = ETHERNET_ENABLE; //
pInitCfg->macFilterConfig.l3L4FilterEnable = ETHERNET_ENABLE; //
//
// The Application handle is not used by this application
// Hence using a dummy value of 1
//
Ethernet_getHandle((Ethernet_Handle)1, pInitCfg , &emac_handle);
//
//Do global Interrupt Enable
//
(void)Interrupt_enableInProcessor();
//
//Assign default ISRs
//
Interrupt_registerHandler(INT_EMAC_TX0, Ethernet_transmitISR);
Interrupt_registerHandler(INT_EMAC_RX0, Ethernet_receiveISR);
// Interrupt_registerHandler(INT_EMAC, Ethernet_genericISR);
//
//Enable the default interrupt handlers
//
Interrupt_enable(INT_EMAC_TX0);
Interrupt_enable(INT_EMAC_RX0);
Ethernet_configureMDIO(EMAC_BASE,0,5,0);
//
//The DP83822 External PHY in Control Card
//takes a PHY address of 1 by default
//Configure the MDIO module to use PHY address of 0x1
//
Ethernet_configurePHYAddress(EMAC_BASE,1);
// Interrupt_enable(INT_EMAC);
//
// Convert the mac address string into the 32/16 split variables format
// that is required by the driver to program into hardware registers.
// Note: This step is done after the Ethernet_getHandle function because
// a dummy MAC address is programmed in that function.
//
temp = (uint8_t *)&macLower;
temp[0] = mac[0];
temp[1] = mac[1];
temp[2] = mac[2];
temp[3] = mac[3];
temp = (uint8_t *)&macHigher;
temp[0] = mac[4];
temp[1] = mac[5];
//
// Program the unicast mac address.
//
Ethernet_setMACAddr(EMAC_BASE,
0,
macHigher,
macLower,
ETHERNET_CHANNEL_0);
此致、
李孝华