Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Zynq Ultrascale port for V4.x and Clean up #1187

Merged
merged 14 commits into from
Oct 3, 2024
Merged
2 changes: 2 additions & 0 deletions .github/.cSpellWords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ DIVIDEBY
DIVIDEDBY
DLPSTATE
DMAARBITRATION
DMAB
DMABD
DMABMR
DMAC
Expand Down Expand Up @@ -1562,6 +1563,7 @@ x
xaxiemacif
XCOL
xemac
XEMACMAP
xemacps
XEMACPS
xemacpsp
Expand Down
88 changes: 54 additions & 34 deletions source/portable/NetworkInterface/Zynq/NetworkInterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,42 +254,56 @@ static BaseType_t xZynqNetworkInterfaceInitialise( NetworkInterface_t * pxInterf
/* Initialize the mac and set the MAC address at position 1. */
XEmacPs_SetMacAddress( pxEMAC_PS, ( void * ) pxEndPoint->xMACAddress.ucBytes, 1 );

#if ( ipconfigUSE_LLMNR == 1 )
#if ( ipconfigIS_ENABLED( ipconfigUSE_LLMNR ) )
{
/* Also add LLMNR multicast MAC address. */
#if ( ipconfigUSE_IPv6 == 0 )
#if ( ipconfigIS_ENABLED( ipconfigUSE_IPv4 ) )
{
XEmacPs_SetHash( pxEMAC_PS, ( void * ) xLLMNR_MacAddress.ucBytes );
}
#else
#endif /* ( ipconfigIS_ENABLED( ipconfigUSE_IPv4 ) */

#if ( ipconfigIS_ENABLED( ipconfigUSE_IPv6 ) )
{
NetworkEndPoint_t * pxEndPoint;
NetworkInterface_t * pxInterface = pxMyInterfaces[ xEMACIndex ];
XEmacPs_SetHash( pxEMAC_PS, ( void * ) xLLMNR_MacAddressIPv6.ucBytes );
}
#endif /* ( ipconfigIS_ENABLED( ipconfigUSE_IPv6 ) ) */
}
#endif /* ( ipconfigIS_ENABLED( ipconfigUSE_LLMNR ) ) */

for( pxEndPoint = FreeRTOS_FirstEndPoint( pxInterface );
pxEndPoint != NULL;
pxEndPoint = FreeRTOS_NextEndPoint( pxInterface, pxEndPoint ) )
{
if( pxEndPoint->bits.bIPv6 != pdFALSE_UNSIGNED )
{
unsigned char ucMACAddress[ 6 ] = { 0x33, 0x33, 0xff, 0, 0, 0 };
ucMACAddress[ 3 ] = pxEndPoint->ipv6_settings.xIPAddress.ucBytes[ 13 ];
ucMACAddress[ 4 ] = pxEndPoint->ipv6_settings.xIPAddress.ucBytes[ 14 ];
ucMACAddress[ 5 ] = pxEndPoint->ipv6_settings.xIPAddress.ucBytes[ 15 ];
XEmacPs_SetHash( pxEMAC_PS, ( void * ) ucMACAddress );
}
}
#if ( ipconfigIS_ENABLED( ipconfigUSE_MDNS ) )
{
#if ( ipconfigIS_ENABLED( ipconfigUSE_IPv4 ) )
{
XEmacPs_SetHash( pxEMAC_PS, ( void * ) xMDNS_MacAddress.ucBytes );
}
#endif /* ( ipconfigIS_ENABLED( ipconfigUSE_IPv4 ) */

XEmacPs_SetHash( pxEMAC_PS, ( void * ) xLLMNR_MacAddressIPv6.ucBytes );
#if ( ipconfigIS_ENABLED( ipconfigUSE_IPv6 ) )
{
XEmacPs_SetHash( pxEMAC_PS, ( void * ) xMDNS_MacAddressIPv6.ucBytes );
}
#endif /* if ( ipconfigUSE_IPv6 == 0 ) */
#endif /* ( ipconfigIS_ENABLED( ipconfigUSE_IPv6 ) ) */
}
#endif /* ipconfigUSE_LLMNR == 1 */
#endif /* ( ipconfigIS_ENABLED( ipconfigUSE_MDNS) ) */

#if ( ( ipconfigUSE_MDNS == 1 ) && ( ipconfigUSE_IPv6 != 0 ) )
XEmacPs_SetHash( pxEMAC_PS, ( void * ) xMDNS_MacAddress.ucBytes );
XEmacPs_SetHash( pxEMAC_PS, ( void * ) xMDNS_MacAddressIPv6.ucBytes );
#endif
#if ( ipconfigIS_ENABLED( ipconfigUSE_IPv6 ) )
{
/* set the solicited-node multicast address */
for( NetworkEndPoint_t * pxEndPointIter = FreeRTOS_FirstEndPoint( pxInterface );
pxEndPointIter != NULL;
pxEndPointIter = FreeRTOS_NextEndPoint( pxInterface, pxEndPointIter ) )
{
if( pxEndPointIter->bits.bIPv6 != pdFALSE_UNSIGNED )
{
unsigned char ucSsolicitedNodeMAC[ 6 ] = { 0x33, 0x33, 0xff, 0, 0, 0 };
ucSsolicitedNodeMAC[ 3 ] = pxEndPointIter->ipv6_settings.xIPAddress.ucBytes[ 13 ];
ucSsolicitedNodeMAC[ 4 ] = pxEndPointIter->ipv6_settings.xIPAddress.ucBytes[ 14 ];
ucSsolicitedNodeMAC[ 5 ] = pxEndPointIter->ipv6_settings.xIPAddress.ucBytes[ 15 ];
XEmacPs_SetHash( pxEMAC_PS, ( void * ) ucSsolicitedNodeMAC );
}
}
}
#endif /* ( ipconfigIS_ENABLED( ipconfigUSE_IPv6 ) ) */

pxEndPoint = FreeRTOS_NextEndPoint( pxInterface, pxEndPoint );

Expand Down Expand Up @@ -378,7 +392,8 @@ static BaseType_t xZynqNetworkInterfaceOutput( NetworkInterface_t * pxInterface,
* the protocol checksum to have a value of zero. */
pxPacket = ( ProtocolPacket_t * ) ( pxBuffer->pucEthernetBuffer );

#if ( ipconfigUSE_IPv6 != 0 )
#if ( ipconfigIS_ENABLED( ipconfigUSE_IPv6 ) )
{
ICMPPacket_IPv6_t * pxICMPPacket = ( ICMPPacket_IPv6_t * ) pxBuffer->pucEthernetBuffer;

if( ( pxPacket->xICMPPacket.xEthernetHeader.usFrameType == ipIPv6_FRAME_TYPE ) &&
Expand All @@ -389,16 +404,21 @@ static BaseType_t xZynqNetworkInterfaceOutput( NetworkInterface_t * pxInterface,
* so for ICMP and other protocols it must be done manually. */
usGenerateProtocolChecksum( pxBuffer->pucEthernetBuffer, pxBuffer->xDataLength, pdTRUE );
}
#endif
}
#endif /* ( ipconfigIS_ENABLED( ipconfigUSE_IPv6 ) ) */

if( ( pxPacket->xICMPPacket.xEthernetHeader.usFrameType == ipIPv4_FRAME_TYPE ) &&
( pxPacket->xICMPPacket.xIPHeader.ucProtocol == ipPROTOCOL_ICMP ) )
#if ( ipconfigIS_ENABLED( ipconfigUSE_IPv4 ) )
{
/* The EMAC will calculate the checksum of the IP-header.
* It can only calculate protocol checksums of UDP and TCP,
* so for ICMP and other protocols it must be done manually. */
usGenerateProtocolChecksum( pxBuffer->pucEthernetBuffer, pxBuffer->xDataLength, pdTRUE );
if( ( pxPacket->xICMPPacket.xEthernetHeader.usFrameType == ipIPv4_FRAME_TYPE ) &&
( pxPacket->xICMPPacket.xIPHeader.ucProtocol == ipPROTOCOL_ICMP ) )
{
/* The EMAC will calculate the checksum of the IP-header.
* It can only calculate protocol checksums of UDP and TCP,
* so for ICMP and other protocols it must be done manually. */
usGenerateProtocolChecksum( pxBuffer->pucEthernetBuffer, pxBuffer->xDataLength, pdTRUE );
}
}
#endif /* ( ipconfigIS_ENABLED( ipconfigUSE_IPv4 ) ) */
}
#endif /* ipconfigDRIVER_INCLUDED_TX_IP_CHECKSUM */

Expand Down
Loading
Loading