Skip to content

Fix assertion failure when disconnecting the Ethernet cable (NXP1060 - NetworkInterface.c) #1002

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

Merged
merged 10 commits into from
Aug 22, 2023
13 changes: 9 additions & 4 deletions source/portable/NetworkInterface/NXP1060/NetworkInterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,11 @@ static BaseType_t prvNXP1060_NetworkInterfaceInitialise( NetworkInterface_t * px

if( xStatus != kStatus_Success )
{
if( !xFirstCall )
{
xTaskNotify( receiveTaskHandle, DRIVER_READY, eSetValueWithOverwrite );
}

break;
}
else
Expand All @@ -370,7 +375,7 @@ static BaseType_t prvNXP1060_NetworkInterfaceInitialise( NetworkInterface_t * px
xTaskCreated = xTaskCreate( prvEMACHandlerTask,
"EMAC-Handler",
configMINIMAL_STACK_SIZE * 3,
NULL,
pxInterface,
configMAX_PRIORITIES - 1,
&receiveTaskHandle );

Expand Down Expand Up @@ -505,7 +510,7 @@ static void prvEMACHandlerTask( void * parameter )
if( ulTaskNotifyTake( pdTRUE, pdMS_TO_TICKS( 500 ) ) == pdFALSE )
{
/* No RX packets for a bit so check for a link. */
const IPStackEvent_t xNetworkEventDown = { .eEventType = eNetworkDownEvent, .pvData = NULL };
const IPStackEvent_t xNetworkEventDown = { .eEventType = eNetworkDownEvent, .pvData = parameter };

do
{
Expand Down Expand Up @@ -568,13 +573,13 @@ static void prvEMACHandlerTask( void * parameter )
break;

case kStatus_ENET_RxFrameError: /* Received an error frame. Read & drop it */
PRINTF( "RX Receive Error\n" );
FreeRTOS_printf( ( "RX Receive Error\n" ) );
ENET_ReadFrame( ethernetifLocal->base, &( ethernetifLocal->handle ), NULL, 0, 0, NULL );
/* Not sure if a trace is required. The MAC had an error and needed to dump bytes */
break;

default:
PRINTF( "RX Receive default" );
FreeRTOS_printf( ( "RX Receive default" ) );
break;
}
}
Expand Down