mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-19 21:11:57 -04:00
Update version number in +TCP code.
This commit is contained in:
parent
5fe8465a35
commit
50e67a89f1
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* FreeRTOS+TCP V2.0.7
|
* FreeRTOS+TCP V2.0.11
|
||||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* FreeRTOS+TCP V2.0.7
|
* FreeRTOS+TCP V2.0.11
|
||||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* FreeRTOS+TCP V2.0.7
|
* FreeRTOS+TCP V2.0.11
|
||||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
@ -1340,7 +1340,7 @@ TickType_t xTimeoutTime = pdMS_TO_TICKS( 200 );
|
||||||
{
|
{
|
||||||
BaseType_t x;
|
BaseType_t x;
|
||||||
BaseType_t xFound = pdFALSE;
|
BaseType_t xFound = pdFALSE;
|
||||||
uint32_t ulCurrentTimeSeconds = ( xTaskGetTickCount() / portTICK_PERIOD_MS ) / 1000UL;
|
uint32_t ulCurrentTimeSeconds = ( xTaskGetTickCount() / portTICK_PERIOD_MS ) / 1000;
|
||||||
static BaseType_t xFreeEntry = 0;
|
static BaseType_t xFreeEntry = 0;
|
||||||
|
|
||||||
/* For each entry in the DNS cache table. */
|
/* For each entry in the DNS cache table. */
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* FreeRTOS+TCP V2.0.7
|
* FreeRTOS+TCP V2.0.11
|
||||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
@ -1288,6 +1288,11 @@ static void prvProcessNetworkDownEvent( void )
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Per the ARP Cache Validation section of https://tools.ietf.org/html/rfc1122,
|
||||||
|
treat network down as a "delivery problem" and flush the ARP cache for this
|
||||||
|
interface. */
|
||||||
|
FreeRTOS_ClearARP( );
|
||||||
|
|
||||||
/* The network has been disconnected (or is being initialised for the first
|
/* The network has been disconnected (or is being initialised for the first
|
||||||
time). Perform whatever hardware processing is necessary to bring it up
|
time). Perform whatever hardware processing is necessary to bring it up
|
||||||
again, or wait for it to be available again. This is hardware dependent. */
|
again, or wait for it to be available again. This is hardware dependent. */
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* FreeRTOS+TCP V2.0.7
|
* FreeRTOS+TCP V2.0.11
|
||||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* FreeRTOS+TCP V2.0.7
|
* FreeRTOS+TCP V2.0.11
|
||||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* FreeRTOS+TCP V2.0.7
|
* FreeRTOS+TCP V2.0.11
|
||||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* FreeRTOS+TCP V2.0.7
|
* FreeRTOS+TCP V2.0.11
|
||||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
@ -199,7 +199,7 @@ extern void vListInsertGeneric( List_t * const pxList, ListItem_t * const pxNewL
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/* TCP segement pool. */
|
/* TCP segment pool. */
|
||||||
#if( ipconfigUSE_TCP_WIN == 1 )
|
#if( ipconfigUSE_TCP_WIN == 1 )
|
||||||
static TCPSegment_t *xTCPSegments = NULL;
|
static TCPSegment_t *xTCPSegments = NULL;
|
||||||
#endif /* ipconfigUSE_TCP_WIN == 1 */
|
#endif /* ipconfigUSE_TCP_WIN == 1 */
|
||||||
|
@ -673,6 +673,23 @@ const int32_t l500ms = 500;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
#if( ipconfigUSE_TCP_WIN == 1 )
|
||||||
|
|
||||||
|
void vTCPSegmentCleanup( void )
|
||||||
|
{
|
||||||
|
/* Free and clear the TCP segments pointer. This function should only be called
|
||||||
|
* once FreeRTOS+TCP will no longer be used. No thread-safety is provided for this
|
||||||
|
* function. */
|
||||||
|
if( xTCPSegments != NULL )
|
||||||
|
{
|
||||||
|
vPortFreeLarge( xTCPSegments );
|
||||||
|
xTCPSegments = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* ipconfgiUSE_TCP_WIN == 1 */
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/*=============================================================================
|
/*=============================================================================
|
||||||
*
|
*
|
||||||
* ###### # #
|
* ###### # #
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* FreeRTOS+TCP V2.0.7
|
* FreeRTOS+TCP V2.0.11
|
||||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
Changes in V2.0.11
|
||||||
|
|
||||||
|
+ Updates some drivers in the portable layer.
|
||||||
|
|
||||||
Changes between 160919 and 180821 releases:
|
Changes between 160919 and 180821 releases:
|
||||||
|
|
||||||
+ Multiple security improvements and fixes in packet parsing routines, DNS
|
+ Multiple security improvements and fixes in packet parsing routines, DNS
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* FreeRTOS+TCP V2.0.7
|
* FreeRTOS+TCP V2.0.11
|
||||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* FreeRTOS+TCP V2.0.7
|
* FreeRTOS+TCP V2.0.11
|
||||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* FreeRTOS+TCP V2.0.7
|
* FreeRTOS+TCP V2.0.11
|
||||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* FreeRTOS+TCP V2.0.7
|
* FreeRTOS+TCP V2.0.11
|
||||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* FreeRTOS+TCP V2.0.7
|
* FreeRTOS+TCP V2.0.11
|
||||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* FreeRTOS+TCP V2.0.7
|
* FreeRTOS+TCP V2.0.11
|
||||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* FreeRTOS+TCP V2.0.7
|
* FreeRTOS+TCP V2.0.11
|
||||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* FreeRTOS+TCP V2.0.7
|
* FreeRTOS+TCP V2.0.11
|
||||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* FreeRTOS+TCP V2.0.7
|
* FreeRTOS+TCP V2.0.11
|
||||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* FreeRTOS+TCP V2.0.7
|
* FreeRTOS+TCP V2.0.11
|
||||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
@ -154,6 +154,9 @@ void vTCPWindowDestroy( TCPWindow_t *pxWindow );
|
||||||
/* Initialize a window */
|
/* Initialize a window */
|
||||||
void vTCPWindowInit( TCPWindow_t *pxWindow, uint32_t ulAckNumber, uint32_t ulSequenceNumber, uint32_t ulMSS );
|
void vTCPWindowInit( TCPWindow_t *pxWindow, uint32_t ulAckNumber, uint32_t ulSequenceNumber, uint32_t ulMSS );
|
||||||
|
|
||||||
|
/* Clean up allocated segments. Should only be called when FreeRTOS+TCP will no longer be used. */
|
||||||
|
void vTCPSegmentCleanup( void );
|
||||||
|
|
||||||
/*=============================================================================
|
/*=============================================================================
|
||||||
*
|
*
|
||||||
* Rx functions
|
* Rx functions
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* FreeRTOS+TCP V2.0.7
|
* FreeRTOS+TCP V2.0.11
|
||||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* FreeRTOS+TCP V2.0.7
|
* FreeRTOS+TCP V2.0.11
|
||||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* FreeRTOS+TCP V2.0.7
|
* FreeRTOS+TCP V2.0.11
|
||||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* FreeRTOS+TCP V2.0.7
|
* FreeRTOS+TCP V2.0.11
|
||||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* FreeRTOS+TCP V2.0.7
|
* FreeRTOS+TCP V2.0.11
|
||||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS+TCP V2.0.7
|
FreeRTOS+TCP V2.0.11
|
||||||
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* FreeRTOS+TCP V2.0.7
|
* FreeRTOS+TCP V2.0.11
|
||||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS+TCP V2.0.7
|
FreeRTOS+TCP V2.0.11
|
||||||
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS+TCP V2.0.7
|
FreeRTOS+TCP V2.0.11
|
||||||
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS+TCP V2.0.7
|
FreeRTOS+TCP V2.0.11
|
||||||
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS+TCP V2.0.7
|
FreeRTOS+TCP V2.0.11
|
||||||
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS+TCP V2.0.7
|
FreeRTOS+TCP V2.0.11
|
||||||
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS+TCP V2.0.7
|
FreeRTOS+TCP V2.0.11
|
||||||
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS+TCP V2.0.7
|
FreeRTOS+TCP V2.0.11
|
||||||
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS+TCP V2.0.7
|
FreeRTOS+TCP V2.0.11
|
||||||
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* FreeRTOS+TCP V2.0.3
|
* FreeRTOS+TCP V2.0.11
|
||||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS+TCP V2.0.7
|
FreeRTOS+TCP V2.0.11
|
||||||
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
|
|
@ -1,28 +1,27 @@
|
||||||
/*
|
/*
|
||||||
* FreeRTOS+TCP V2.0.3
|
FreeRTOS+TCP V2.0.11
|
||||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
||||||
* this software and associated documentation files (the "Software"), to deal in
|
|
||||||
* the Software without restriction, including without limitation the rights to
|
|
||||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
||||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
|
||||||
* subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in all
|
|
||||||
* copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
||||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
||||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*
|
|
||||||
* http://aws.amazon.com/freertos
|
|
||||||
* http://www.FreeRTOS.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
the Software without restriction, including without limitation the rights to
|
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
http://aws.amazon.com/freertos
|
||||||
|
http://www.FreeRTOS.org
|
||||||
|
*/
|
||||||
|
|
||||||
/* Standard includes. */
|
/* Standard includes. */
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
@ -230,11 +229,6 @@ static SemaphoreHandle_t xTXDescriptorSemaphore = NULL;
|
||||||
BaseType_t xNetworkInterfaceInitialise( void )
|
BaseType_t xNetworkInterfaceInitialise( void )
|
||||||
{
|
{
|
||||||
BaseType_t xReturn = pdPASS;
|
BaseType_t xReturn = pdPASS;
|
||||||
static BaseType_t xHasInitialised = pdFALSE;
|
|
||||||
|
|
||||||
if( xHasInitialised == pdFALSE )
|
|
||||||
{
|
|
||||||
xHasInitialised = pdTRUE;
|
|
||||||
|
|
||||||
/* The interrupt will be turned on when a link is established. */
|
/* The interrupt will be turned on when a link is established. */
|
||||||
NVIC_DisableIRQ( ETHERNET_IRQn );
|
NVIC_DisableIRQ( ETHERNET_IRQn );
|
||||||
|
@ -285,6 +279,14 @@ static BaseType_t xHasInitialised = pdFALSE;
|
||||||
|
|
||||||
if( xReturn == pdPASS )
|
if( xReturn == pdPASS )
|
||||||
{
|
{
|
||||||
|
/* Guard against the task being created more than once and the
|
||||||
|
descriptors being initialised more than once. */
|
||||||
|
if( xRxHanderTask == NULL )
|
||||||
|
{
|
||||||
|
xReturn = xTaskCreate( prvEMACHandlerTask, "EMAC", nwRX_TASK_STACK_SIZE, NULL, configMAX_PRIORITIES - 1, &xRxHanderTask );
|
||||||
|
configASSERT( xReturn );
|
||||||
|
}
|
||||||
|
|
||||||
if( xTXDescriptorSemaphore == NULL )
|
if( xTXDescriptorSemaphore == NULL )
|
||||||
{
|
{
|
||||||
/* Create a counting semaphore, with a value of 'configNUM_TX_DESCRIPTORS'
|
/* Create a counting semaphore, with a value of 'configNUM_TX_DESCRIPTORS'
|
||||||
|
@ -295,7 +297,10 @@ static BaseType_t xHasInitialised = pdFALSE;
|
||||||
|
|
||||||
/* Enable MAC interrupts. */
|
/* Enable MAC interrupts. */
|
||||||
LPC_ETHERNET->DMA_INT_EN = nwDMA_INTERRUPT_MASK;
|
LPC_ETHERNET->DMA_INT_EN = nwDMA_INTERRUPT_MASK;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( xReturn != pdFAIL )
|
||||||
|
{
|
||||||
/* Auto-negotiate was already started. Wait for it to complete. */
|
/* Auto-negotiate was already started. Wait for it to complete. */
|
||||||
xReturn = prvSetLinkSpeed();
|
xReturn = prvSetLinkSpeed();
|
||||||
|
|
||||||
|
@ -321,28 +326,6 @@ static BaseType_t xHasInitialised = pdFALSE;
|
||||||
NVIC_SetPriority( ETHERNET_IRQn, configMAC_INTERRUPT_PRIORITY );
|
NVIC_SetPriority( ETHERNET_IRQn, configMAC_INTERRUPT_PRIORITY );
|
||||||
NVIC_EnableIRQ( ETHERNET_IRQn );
|
NVIC_EnableIRQ( ETHERNET_IRQn );
|
||||||
}
|
}
|
||||||
/* Guard against the task being created more than once and the
|
|
||||||
descriptors being initialised more than once. */
|
|
||||||
if( xRxHanderTask == NULL )
|
|
||||||
{
|
|
||||||
xReturn = xTaskCreate( prvEMACHandlerTask, "EMAC", nwRX_TASK_STACK_SIZE, NULL, configMAX_PRIORITIES - 1, &xRxHanderTask );
|
|
||||||
configASSERT( xReturn );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Once prvEMACHandlerTask() has started, the variable
|
|
||||||
'ulPHYLinkStatus' will be updated by that task.
|
|
||||||
The IP-task will keep on calling this function untill
|
|
||||||
it finally returns pdPASS.
|
|
||||||
Only then can the DHCP-procedure start (if configured). */
|
|
||||||
if( ( ulPHYLinkStatus & PHY_LINK_CONNECTED ) != 0 )
|
|
||||||
{
|
|
||||||
xReturn = pdPASS;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
xReturn = pdFAIL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return xReturn;
|
return xReturn;
|
||||||
|
@ -461,7 +444,7 @@ const TickType_t xBlockTimeTicks = pdMS_TO_TICKS( 50 );
|
||||||
|
|
||||||
/* The DMA descriptor will 'own' this Network Buffer,
|
/* The DMA descriptor will 'own' this Network Buffer,
|
||||||
until it has been sent. So don't release it now. */
|
until it has been sent. So don't release it now. */
|
||||||
bReleaseAfterSend = pdFALSE;
|
bReleaseAfterSend = false;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
{
|
{
|
||||||
|
@ -667,6 +650,8 @@ BaseType_t xReturn;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
uint32_t ulDataAvailable;
|
||||||
|
|
||||||
configPLACE_IN_SECTION_RAM
|
configPLACE_IN_SECTION_RAM
|
||||||
static BaseType_t prvNetworkInterfaceInput()
|
static BaseType_t prvNetworkInterfaceInput()
|
||||||
{
|
{
|
||||||
|
@ -680,7 +665,9 @@ NetworkBufferDescriptor_t *pxDescriptor;
|
||||||
#if( ipconfigZERO_COPY_RX_DRIVER != 0 )
|
#if( ipconfigZERO_COPY_RX_DRIVER != 0 )
|
||||||
NetworkBufferDescriptor_t *pxNewDescriptor;
|
NetworkBufferDescriptor_t *pxNewDescriptor;
|
||||||
#endif /* ipconfigZERO_COPY_RX_DRIVER */
|
#endif /* ipconfigZERO_COPY_RX_DRIVER */
|
||||||
|
#if( ipconfigUSE_LINKED_RX_MESSAGES == 0 )
|
||||||
IPStackEvent_t xRxEvent = { eNetworkRxEvent, NULL };
|
IPStackEvent_t xRxEvent = { eNetworkRxEvent, NULL };
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Process each descriptor that is not still in use by the DMA. */
|
/* Process each descriptor that is not still in use by the DMA. */
|
||||||
ulStatus = xDMARxDescriptors[ ulNextRxDescriptorToProcess ].STATUS;
|
ulStatus = xDMARxDescriptors[ ulNextRxDescriptorToProcess ].STATUS;
|
||||||
|
@ -690,6 +677,7 @@ IPStackEvent_t xRxEvent = { eNetworkRxEvent, NULL };
|
||||||
if( ( ulStatus & nwRX_STATUS_ERROR_BITS ) != 0 )
|
if( ( ulStatus & nwRX_STATUS_ERROR_BITS ) != 0 )
|
||||||
{
|
{
|
||||||
/* There is some reception error. */
|
/* There is some reception error. */
|
||||||
|
intCount[ 3 ]++;
|
||||||
/* Clear error bits. */
|
/* Clear error bits. */
|
||||||
ulStatus &= ~( ( uint32_t )nwRX_STATUS_ERROR_BITS );
|
ulStatus &= ~( ( uint32_t )nwRX_STATUS_ERROR_BITS );
|
||||||
}
|
}
|
||||||
|
@ -775,10 +763,19 @@ IPStackEvent_t xRxEvent = { eNetworkRxEvent, NULL };
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
iptraceNETWORK_INTERFACE_RECEIVE();
|
iptraceNETWORK_INTERFACE_RECEIVE();
|
||||||
|
|
||||||
|
/* The data that was available at the top of this
|
||||||
|
loop has been sent, so is no longer available. */
|
||||||
|
ulDataAvailable = pdFALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* The packet is discarded as uninteresting. */
|
||||||
|
ulDataAvailable = pdFALSE;
|
||||||
|
}
|
||||||
/* Got here because received data was sent to the IP task or the
|
/* Got here because received data was sent to the IP task or the
|
||||||
data contained an error and was discarded. Give the descriptor
|
data contained an error and was discarded. Give the descriptor
|
||||||
back to the DMA. */
|
back to the DMA. */
|
||||||
|
@ -825,6 +822,7 @@ const uint32_t ulTxInterruptMask =
|
||||||
/* Remember that an RX event has happened. */
|
/* Remember that an RX event has happened. */
|
||||||
ulISREvents |= EMAC_IF_RX_EVENT;
|
ulISREvents |= EMAC_IF_RX_EVENT;
|
||||||
vTaskNotifyGiveFromISR( xRxHanderTask, &xHigherPriorityTaskWoken );
|
vTaskNotifyGiveFromISR( xRxHanderTask, &xHigherPriorityTaskWoken );
|
||||||
|
intCount[ 0 ]++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TX group interrupt(s). */
|
/* TX group interrupt(s). */
|
||||||
|
@ -833,6 +831,7 @@ const uint32_t ulTxInterruptMask =
|
||||||
/* Remember that a TX event has happened. */
|
/* Remember that a TX event has happened. */
|
||||||
ulISREvents |= EMAC_IF_TX_EVENT;
|
ulISREvents |= EMAC_IF_TX_EVENT;
|
||||||
vTaskNotifyGiveFromISR( xRxHanderTask, &xHigherPriorityTaskWoken );
|
vTaskNotifyGiveFromISR( xRxHanderTask, &xHigherPriorityTaskWoken );
|
||||||
|
intCount[ 1 ]++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Test for 'Abnormal interrupt summary'. */
|
/* Test for 'Abnormal interrupt summary'. */
|
||||||
|
@ -880,11 +879,11 @@ const TickType_t xAutoNegotiateDelay = pdMS_TO_TICKS( 5000UL );
|
||||||
|
|
||||||
if( ( ulPhyStatus & PHY_LINK_FULLDUPLX ) != 0x00 )
|
if( ( ulPhyStatus & PHY_LINK_FULLDUPLX ) != 0x00 )
|
||||||
{
|
{
|
||||||
Chip_ENET_SetDuplex( LPC_ETHERNET, pdTRUE );
|
Chip_ENET_SetDuplex( LPC_ETHERNET, true );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Chip_ENET_SetDuplex( LPC_ETHERNET, pdFALSE );
|
Chip_ENET_SetDuplex( LPC_ETHERNET, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
xReturn = pdPASS;
|
xReturn = pdPASS;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS+TCP V2.0.7
|
FreeRTOS+TCP V2.0.11
|
||||||
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* FreeRTOS+TCP V2.0.1
|
* FreeRTOS+TCP V2.0.11
|
||||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* FreeRTOS+TCP V2.0.3
|
* FreeRTOS+TCP V2.0.11
|
||||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
@ -28,7 +28,6 @@
|
||||||
* http://www.FreeRTOS.org
|
* http://www.FreeRTOS.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/* Standard includes. */
|
/* Standard includes. */
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -49,13 +48,21 @@
|
||||||
#include "NetworkInterface.h"
|
#include "NetworkInterface.h"
|
||||||
#include "phyHandling.h"
|
#include "phyHandling.h"
|
||||||
|
|
||||||
|
#define __STM32_HAL_LEGACY 1
|
||||||
|
|
||||||
/* ST includes. */
|
/* ST includes. */
|
||||||
#ifdef STM32F7xx
|
#if defined( STM32F7xx )
|
||||||
#include "stm32f7xx_hal.h"
|
#include "stm32f7xx_hal.h"
|
||||||
#else
|
#elif defined( STM32F4xx )
|
||||||
#include "stm32f4xx_hal.h"
|
#include "stm32f4xx_hal.h"
|
||||||
|
#elif defined( STM32F2xx )
|
||||||
|
#include "stm32f2xx_hal.h"
|
||||||
|
#else
|
||||||
|
#error What part?
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "stm32fxx_hal_eth.h"
|
||||||
|
|
||||||
/* Interrupt events to process. Currently only the Rx event is processed
|
/* Interrupt events to process. Currently only the Rx event is processed
|
||||||
although code for other events is included to allow for possible future
|
although code for other events is included to allow for possible future
|
||||||
expansion. */
|
expansion. */
|
||||||
|
@ -69,7 +76,9 @@ expansion. */
|
||||||
ETH_DMA_IT_FBE | ETH_DMA_IT_RWT | ETH_DMA_IT_RPS | ETH_DMA_IT_RBU | ETH_DMA_IT_R | \
|
ETH_DMA_IT_FBE | ETH_DMA_IT_RWT | ETH_DMA_IT_RPS | ETH_DMA_IT_RBU | ETH_DMA_IT_R | \
|
||||||
ETH_DMA_IT_TU | ETH_DMA_IT_RO | ETH_DMA_IT_TJT | ETH_DMA_IT_TPS | ETH_DMA_IT_T )
|
ETH_DMA_IT_TU | ETH_DMA_IT_RO | ETH_DMA_IT_TJT | ETH_DMA_IT_TPS | ETH_DMA_IT_T )
|
||||||
|
|
||||||
|
#ifndef niEMAC_HANDLER_TASK_PRIORITY
|
||||||
|
#define niEMAC_HANDLER_TASK_PRIORITY configMAX_PRIORITIES - 1
|
||||||
|
#endif
|
||||||
|
|
||||||
#define ipFRAGMENT_OFFSET_BIT_MASK ( ( uint16_t ) 0x0fff ) /* The bits in the two byte IP header field that make up the fragment offset value. */
|
#define ipFRAGMENT_OFFSET_BIT_MASK ( ( uint16_t ) 0x0fff ) /* The bits in the two byte IP header field that make up the fragment offset value. */
|
||||||
|
|
||||||
|
@ -124,7 +133,11 @@ and the index of the PHY in use ( between 0 and 31 ). */
|
||||||
#endif /* STM32F7xx */
|
#endif /* STM32F7xx */
|
||||||
#endif /* ipconfigUSE_RMII */
|
#endif /* ipconfigUSE_RMII */
|
||||||
|
|
||||||
|
#if( ipconfigUSE_RMII != 0 )
|
||||||
|
#warning Using RMII, make sure if this is correct
|
||||||
|
#else
|
||||||
|
#warning Using MII, make sure if this is correct
|
||||||
|
#endif
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -235,9 +248,6 @@ __attribute__ ((section(".first_data")))
|
||||||
static __IO ETH_DMADescTypeDef *DMATxDescToClear;
|
static __IO ETH_DMADescTypeDef *DMATxDescToClear;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ucMACAddress as it appears in main.c */
|
|
||||||
extern const uint8_t ucMACAddress[ 6 ];
|
|
||||||
|
|
||||||
/* Holds the handle of the task used as a deferred interrupt processor. The
|
/* Holds the handle of the task used as a deferred interrupt processor. The
|
||||||
handle is used so direct notifications can be sent to the task for all EMAC/DMA
|
handle is used so direct notifications can be sent to the task for all EMAC/DMA
|
||||||
related interrupts. */
|
related interrupts. */
|
||||||
|
@ -373,7 +383,7 @@ BaseType_t xResult;
|
||||||
/* Value of PhyAddress doesn't matter, will be probed for. */
|
/* Value of PhyAddress doesn't matter, will be probed for. */
|
||||||
xETH.Init.PhyAddress = 0;
|
xETH.Init.PhyAddress = 0;
|
||||||
|
|
||||||
xETH.Init.MACAddr = ( uint8_t *) ucMACAddress;
|
xETH.Init.MACAddr = ( uint8_t *)FreeRTOS_GetMACAddress();
|
||||||
xETH.Init.RxMode = ETH_RXINTERRUPT_MODE;
|
xETH.Init.RxMode = ETH_RXINTERRUPT_MODE;
|
||||||
|
|
||||||
/* using the ETH_CHECKSUM_BY_HARDWARE option:
|
/* using the ETH_CHECKSUM_BY_HARDWARE option:
|
||||||
|
@ -427,7 +437,7 @@ BaseType_t xResult;
|
||||||
possible priority to ensure the interrupt handler can return directly
|
possible priority to ensure the interrupt handler can return directly
|
||||||
to it. The task's handle is stored in xEMACTaskHandle so interrupts can
|
to it. The task's handle is stored in xEMACTaskHandle so interrupts can
|
||||||
notify the task when there is something to process. */
|
notify the task when there is something to process. */
|
||||||
xTaskCreate( prvEMACHandlerTask, "EMAC", configEMAC_TASK_STACK_SIZE, NULL, configMAX_PRIORITIES - 1, &xEMACTaskHandle );
|
xTaskCreate( prvEMACHandlerTask, "EMAC", configEMAC_TASK_STACK_SIZE, NULL, niEMAC_HANDLER_TASK_PRIORITY, &xEMACTaskHandle );
|
||||||
} /* if( xEMACTaskHandle == NULL ) */
|
} /* if( xEMACTaskHandle == NULL ) */
|
||||||
|
|
||||||
if( xPhyObject.ulLinkStatusMask != 0 )
|
if( xPhyObject.ulLinkStatusMask != 0 )
|
||||||
|
@ -580,6 +590,17 @@ __IO ETH_DMADescTypeDef *pxDmaTxDesc;
|
||||||
/* Do not wait too long for a free TX DMA buffer. */
|
/* Do not wait too long for a free TX DMA buffer. */
|
||||||
const TickType_t xBlockTimeTicks = pdMS_TO_TICKS( 50u );
|
const TickType_t xBlockTimeTicks = pdMS_TO_TICKS( 50u );
|
||||||
|
|
||||||
|
/* Open a do {} while ( 0 ) loop to be able to call break. */
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if( xCheckLoopback( pxDescriptor, bReleaseAfterSend ) != 0 )
|
||||||
|
{
|
||||||
|
/* The packet has been sent back to the IP-task.
|
||||||
|
The IP-task will further handle it.
|
||||||
|
Do not release the descriptor. */
|
||||||
|
bReleaseAfterSend = pdFALSE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
#if( ipconfigDRIVER_INCLUDED_TX_IP_CHECKSUM != 0 )
|
#if( ipconfigDRIVER_INCLUDED_TX_IP_CHECKSUM != 0 )
|
||||||
{
|
{
|
||||||
ProtocolPacket_t *pxPacket;
|
ProtocolPacket_t *pxPacket;
|
||||||
|
@ -599,11 +620,7 @@ const TickType_t xBlockTimeTicks = pdMS_TO_TICKS( 50u );
|
||||||
pxPacket->xICMPPacket.xICMPHeader.usChecksum = ( uint16_t )0u;
|
pxPacket->xICMPPacket.xICMPHeader.usChecksum = ( uint16_t )0u;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* ipconfigDRIVER_INCLUDED_TX_IP_CHECKSUM */
|
||||||
|
|
||||||
/* Open a do {} while ( 0 ) loop to be able to call break. */
|
|
||||||
do
|
|
||||||
{
|
|
||||||
if( xPhyObject.ulLinkStatusMask != 0 )
|
if( xPhyObject.ulLinkStatusMask != 0 )
|
||||||
{
|
{
|
||||||
if( xSemaphoreTake( xTXDescriptorSemaphore, xBlockTimeTicks ) != pdPASS )
|
if( xSemaphoreTake( xTXDescriptorSemaphore, xBlockTimeTicks ) != pdPASS )
|
||||||
|
@ -653,6 +670,15 @@ const TickType_t xBlockTimeTicks = pdMS_TO_TICKS( 50u );
|
||||||
pxDmaTxDesc->Status |= ETH_DMATXDESC_FS | ETH_DMATXDESC_LS;
|
pxDmaTxDesc->Status |= ETH_DMATXDESC_FS | ETH_DMATXDESC_LS;
|
||||||
/* Set frame size */
|
/* Set frame size */
|
||||||
pxDmaTxDesc->ControlBufferSize = ( ulTransmitSize & ETH_DMATXDESC_TBS1 );
|
pxDmaTxDesc->ControlBufferSize = ( ulTransmitSize & ETH_DMATXDESC_TBS1 );
|
||||||
|
|
||||||
|
#if( NETWORK_BUFFERS_CACHED != 0 )
|
||||||
|
{
|
||||||
|
BaseType_t xlength = CACHE_LINE_SIZE * ( ( ulTransmitSize + NETWORK_BUFFER_HEADER_SIZE + CACHE_LINE_SIZE - 1 ) / CACHE_LINE_SIZE );
|
||||||
|
uint32_t *pulBuffer = ( uint32_t )( pxDescriptor->pucEthernetBuffer - NETWORK_BUFFER_HEADER_SIZE );
|
||||||
|
cache_clean_invalidate_by_addr( pulBuffer, xlength );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Set Own bit of the Tx descriptor Status: gives the buffer back to ETHERNET DMA */
|
/* Set Own bit of the Tx descriptor Status: gives the buffer back to ETHERNET DMA */
|
||||||
pxDmaTxDesc->Status |= ETH_DMATXDESC_OWN;
|
pxDmaTxDesc->Status |= ETH_DMATXDESC_OWN;
|
||||||
|
|
||||||
|
@ -787,11 +813,16 @@ uint8_t *pucBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Obtain the size of the packet and put it into the "usReceivedLength" variable. */
|
/* Obtain the size of the packet and put it into the "usReceivedLength" variable. */
|
||||||
|
|
||||||
|
/* get received frame */
|
||||||
|
if( xReceivedLength > 0ul )
|
||||||
|
{
|
||||||
/* In order to make the code easier and faster, only packets in a single buffer
|
/* In order to make the code easier and faster, only packets in a single buffer
|
||||||
will be accepted. This can be done by making the buffers large enough to
|
will be accepted. This can be done by making the buffers large enough to
|
||||||
hold a complete Ethernet packet (1536 bytes). */
|
hold a complete Ethernet packet (1536 bytes).
|
||||||
if( xReceivedLength > 0ul && xReceivedLength < ETH_RX_BUF_SIZE )
|
Therefore, two sanity checks: */
|
||||||
{
|
configASSERT( xReceivedLength <= ETH_RX_BUF_SIZE );
|
||||||
|
|
||||||
if( ( pxDMARxDescriptor->Status & ( ETH_DMARXDESC_CE | ETH_DMARXDESC_IPV4HCE | ETH_DMARXDESC_FT ) ) != ETH_DMARXDESC_FT )
|
if( ( pxDMARxDescriptor->Status & ( ETH_DMARXDESC_CE | ETH_DMARXDESC_IPV4HCE | ETH_DMARXDESC_FT ) ) != ETH_DMARXDESC_FT )
|
||||||
{
|
{
|
||||||
/* Not an Ethernet frame-type or a checmsum error. */
|
/* Not an Ethernet frame-type or a checmsum error. */
|
||||||
|
@ -936,25 +967,6 @@ HAL_StatusTypeDef xHALResult;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
void phy_test()
|
|
||||||
{
|
|
||||||
BaseType_t xPhyCount;
|
|
||||||
BaseType_t xPhyIndex;
|
|
||||||
|
|
||||||
vPhyInitialise( &xPhyObject, xSTM32_PhyRead, xSTM32_PhyWrite );
|
|
||||||
xPhyCount = xPhyDiscover( &xPhyObject );
|
|
||||||
FreeRTOS_printf( ( "PHY count %ld\n", xPhyCount ) );
|
|
||||||
for( xPhyIndex = 0; xPhyIndex < xPhyCount; xPhyIndex++ )
|
|
||||||
{
|
|
||||||
FreeRTOS_printf( ( "PHY[%d] at address %d ( 0x%08X )\n",
|
|
||||||
xPhyIndex,
|
|
||||||
xPhyObject.ucPhyIndexes[ xPhyIndex ],
|
|
||||||
xPhyObject.ulPhyIDs[ xPhyIndex ] ) );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void vMACBProbePhy( void )
|
void vMACBProbePhy( void )
|
||||||
{
|
{
|
||||||
vPhyInitialise( &xPhyObject, xSTM32_PhyRead, xSTM32_PhyWrite );
|
vPhyInitialise( &xPhyObject, xSTM32_PhyRead, xSTM32_PhyWrite );
|
||||||
|
@ -1061,14 +1073,11 @@ BaseType_t xReturn;
|
||||||
|
|
||||||
/* Uncomment this in case BufferAllocation_1.c is used. */
|
/* Uncomment this in case BufferAllocation_1.c is used. */
|
||||||
|
|
||||||
/*
|
|
||||||
#define niBUFFER_1_PACKET_SIZE 1536
|
#define niBUFFER_1_PACKET_SIZE 1536
|
||||||
|
|
||||||
static __attribute__ ((section(".first_data"))) uint8_t ucNetworkPackets[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS * niBUFFER_1_PACKET_SIZE ] __attribute__ ( ( aligned( 32 ) ) );
|
|
||||||
|
|
||||||
void vNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ] )
|
void vNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ] )
|
||||||
{
|
{
|
||||||
|
static __attribute__ ((section(".first_data"))) uint8_t ucNetworkPackets[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS * niBUFFER_1_PACKET_SIZE ] __attribute__ ( ( aligned( 32 ) ) );
|
||||||
uint8_t *ucRAMBuffer = ucNetworkPackets;
|
uint8_t *ucRAMBuffer = ucNetworkPackets;
|
||||||
uint32_t ul;
|
uint32_t ul;
|
||||||
|
|
||||||
|
@ -1079,7 +1088,6 @@ uint32_t ul;
|
||||||
ucRAMBuffer += niBUFFER_1_PACKET_SIZE;
|
ucRAMBuffer += niBUFFER_1_PACKET_SIZE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static void prvEMACHandlerTask( void *pvParameters )
|
static void prvEMACHandlerTask( void *pvParameters )
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS+TCP V2.0.7
|
FreeRTOS+TCP V2.0.11
|
||||||
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS+TCP V2.0.7
|
FreeRTOS+TCP V2.0.11
|
||||||
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
@ -38,6 +38,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#include "FreeRTOS_IP.h"
|
#include "FreeRTOS_IP.h"
|
||||||
#include "FreeRTOS_Sockets.h"
|
#include "FreeRTOS_Sockets.h"
|
||||||
#include "FreeRTOS_IP_Private.h"
|
#include "FreeRTOS_IP_Private.h"
|
||||||
|
#include "FreeRTOS_ARP.h"
|
||||||
#include "NetworkBufferManagement.h"
|
#include "NetworkBufferManagement.h"
|
||||||
#include "NetworkInterface.h"
|
#include "NetworkInterface.h"
|
||||||
|
|
||||||
|
@ -50,10 +51,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
/* Provided memory configured as uncached. */
|
/* Provided memory configured as uncached. */
|
||||||
#include "uncached_memory.h"
|
#include "uncached_memory.h"
|
||||||
|
|
||||||
#ifndef BMSR_LINK_STATUS
|
#ifndef niEMAC_HANDLER_TASK_PRIORITY
|
||||||
#define BMSR_LINK_STATUS 0x0004UL
|
#define niEMAC_HANDLER_TASK_PRIORITY configMAX_PRIORITIES - 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define niBMSR_LINK_STATUS 0x0004UL
|
||||||
|
#define niBMSR_AN_COMPLETE 0x0020u /* Auto-Negotiation process completed */
|
||||||
|
|
||||||
#ifndef PHY_LS_HIGH_CHECK_TIME_MS
|
#ifndef PHY_LS_HIGH_CHECK_TIME_MS
|
||||||
/* Check if the LinkSStatus in the PHY is still high after 15 seconds of not
|
/* Check if the LinkSStatus in the PHY is still high after 15 seconds of not
|
||||||
receiving packets. */
|
receiving packets. */
|
||||||
|
@ -188,7 +192,7 @@ const TickType_t xWaitLinkDelay = pdMS_TO_TICKS( 7000UL ), xWaitRelinkDelay = pd
|
||||||
possible priority to ensure the interrupt handler can return directly
|
possible priority to ensure the interrupt handler can return directly
|
||||||
to it. The task's handle is stored in xEMACTaskHandle so interrupts can
|
to it. The task's handle is stored in xEMACTaskHandle so interrupts can
|
||||||
notify the task when there is something to process. */
|
notify the task when there is something to process. */
|
||||||
xTaskCreate( prvEMACHandlerTask, "EMAC", configEMAC_TASK_STACK_SIZE, NULL, configMAX_PRIORITIES - 1, &xEMACTaskHandle );
|
xTaskCreate( prvEMACHandlerTask, "EMAC", configEMAC_TASK_STACK_SIZE, NULL, niEMAC_HANDLER_TASK_PRIORITY, &xEMACTaskHandle );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -206,7 +210,34 @@ const TickType_t xWaitLinkDelay = pdMS_TO_TICKS( 7000UL ), xWaitRelinkDelay = pd
|
||||||
|
|
||||||
BaseType_t xNetworkInterfaceOutput( NetworkBufferDescriptor_t * const pxBuffer, BaseType_t bReleaseAfterSend )
|
BaseType_t xNetworkInterfaceOutput( NetworkBufferDescriptor_t * const pxBuffer, BaseType_t bReleaseAfterSend )
|
||||||
{
|
{
|
||||||
if( ( ulPHYLinkStatus & BMSR_LINK_STATUS ) != 0 )
|
if( xCheckLoopback( pxBuffer, bReleaseAfterSend ) != 0 )
|
||||||
|
{
|
||||||
|
/* The packet has been sent back to the IP-task.
|
||||||
|
The IP-task will further handle it.
|
||||||
|
Do not release the descriptor. */
|
||||||
|
return pdTRUE;
|
||||||
|
}
|
||||||
|
#if( ipconfigDRIVER_INCLUDED_TX_IP_CHECKSUM != 0 )
|
||||||
|
{
|
||||||
|
ProtocolPacket_t *pxPacket;
|
||||||
|
|
||||||
|
/* If the peripheral must calculate the checksum, it wants
|
||||||
|
the protocol checksum to have a value of zero. */
|
||||||
|
pxPacket = ( ProtocolPacket_t * ) ( pxBuffer->pucEthernetBuffer );
|
||||||
|
if( pxPacket->xICMPPacket.xIPHeader.ucProtocol == ipPROTOCOL_ICMP )
|
||||||
|
{
|
||||||
|
IPHeader_t *pxIPHeader = &( pxPacket->xUDPPacket.xIPHeader );
|
||||||
|
|
||||||
|
pxPacket->xICMPPacket.xICMPHeader.usChecksum = ( uint16_t )0u;
|
||||||
|
pxIPHeader->usHeaderChecksum = 0u;
|
||||||
|
pxIPHeader->usHeaderChecksum = usGenerateChecksum( 0UL, ( uint8_t * ) &( pxIPHeader->ucVersionHeaderLength ), ipSIZE_OF_IPv4_HEADER );
|
||||||
|
pxIPHeader->usHeaderChecksum = ~FreeRTOS_htons( pxIPHeader->usHeaderChecksum );
|
||||||
|
|
||||||
|
usGenerateProtocolChecksum( (uint8_t*)&( pxPacket->xUDPPacket ), pxBuffer->xDataLength, pdTRUE );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* ipconfigDRIVER_INCLUDED_TX_IP_CHECKSUM */
|
||||||
|
if( ( ulPHYLinkStatus & niBMSR_LINK_STATUS ) != 0 )
|
||||||
{
|
{
|
||||||
iptraceNETWORK_INTERFACE_TRANSMIT();
|
iptraceNETWORK_INTERFACE_TRANSMIT();
|
||||||
emacps_send_message( &xEMACpsif, pxBuffer, bReleaseAfterSend );
|
emacps_send_message( &xEMACpsif, pxBuffer, bReleaseAfterSend );
|
||||||
|
@ -249,7 +280,7 @@ BaseType_t xReturn;
|
||||||
}
|
}
|
||||||
ulPHYLinkStatus = ulReadMDIO( PHY_REG_01_BMSR );
|
ulPHYLinkStatus = ulReadMDIO( PHY_REG_01_BMSR );
|
||||||
|
|
||||||
if( ( ulPHYLinkStatus & BMSR_LINK_STATUS ) != 0 )
|
if( ( ulPHYLinkStatus & niBMSR_LINK_STATUS ) != 0 )
|
||||||
{
|
{
|
||||||
xReturn = pdTRUE;
|
xReturn = pdTRUE;
|
||||||
break;
|
break;
|
||||||
|
@ -281,7 +312,7 @@ BaseType_t xGetPhyLinkStatus( void )
|
||||||
{
|
{
|
||||||
BaseType_t xReturn;
|
BaseType_t xReturn;
|
||||||
|
|
||||||
if( ( ulPHYLinkStatus & BMSR_LINK_STATUS ) == 0 )
|
if( ( ulPHYLinkStatus & niBMSR_LINK_STATUS ) == 0 )
|
||||||
{
|
{
|
||||||
xReturn = pdFALSE;
|
xReturn = pdFALSE;
|
||||||
}
|
}
|
||||||
|
@ -298,11 +329,12 @@ static void prvEMACHandlerTask( void *pvParameters )
|
||||||
{
|
{
|
||||||
TimeOut_t xPhyTime;
|
TimeOut_t xPhyTime;
|
||||||
TickType_t xPhyRemTime;
|
TickType_t xPhyRemTime;
|
||||||
UBaseType_t uxLastMinBufferCount = 0;
|
|
||||||
UBaseType_t uxCurrentCount;
|
UBaseType_t uxCurrentCount;
|
||||||
BaseType_t xResult = 0;
|
BaseType_t xResult = 0;
|
||||||
uint32_t xStatus;
|
uint32_t xStatus;
|
||||||
const TickType_t ulMaxBlockTime = pdMS_TO_TICKS( 100UL );
|
const TickType_t ulMaxBlockTime = pdMS_TO_TICKS( 100UL );
|
||||||
|
UBaseType_t uxLastMinBufferCount = 0;
|
||||||
|
UBaseType_t uxCurrentBufferCount = 0;
|
||||||
|
|
||||||
/* Remove compiler warnings about unused parameters. */
|
/* Remove compiler warnings about unused parameters. */
|
||||||
( void ) pvParameters;
|
( void ) pvParameters;
|
||||||
|
@ -316,14 +348,14 @@ const TickType_t ulMaxBlockTime = pdMS_TO_TICKS( 100UL );
|
||||||
|
|
||||||
for( ;; )
|
for( ;; )
|
||||||
{
|
{
|
||||||
uxCurrentCount = uxGetMinimumFreeNetworkBuffers();
|
uxCurrentBufferCount = uxGetMinimumFreeNetworkBuffers();
|
||||||
if( uxLastMinBufferCount != uxCurrentCount )
|
if( uxLastMinBufferCount != uxCurrentBufferCount )
|
||||||
{
|
{
|
||||||
/* The logging produced below may be helpful
|
/* The logging produced below may be helpful
|
||||||
while tuning +TCP: see how many buffers are in use. */
|
while tuning +TCP: see how many buffers are in use. */
|
||||||
uxLastMinBufferCount = uxCurrentCount;
|
uxLastMinBufferCount = uxCurrentBufferCount;
|
||||||
FreeRTOS_printf( ( "Network buffers: %lu lowest %lu\n",
|
FreeRTOS_printf( ( "Network buffers: %lu lowest %lu\n",
|
||||||
uxGetNumberOfFreeNetworkBuffers(), uxCurrentCount ) );
|
uxGetNumberOfFreeNetworkBuffers(), uxCurrentBufferCount ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
#if( ipconfigCHECK_IP_QUEUE_SPACE != 0 )
|
#if( ipconfigCHECK_IP_QUEUE_SPACE != 0 )
|
||||||
|
@ -364,7 +396,6 @@ const TickType_t ulMaxBlockTime = pdMS_TO_TICKS( 100UL );
|
||||||
xEMACpsif.isr_events &= ~EMAC_IF_ERR_EVENT;
|
xEMACpsif.isr_events &= ~EMAC_IF_ERR_EVENT;
|
||||||
emacps_check_errors( &xEMACpsif );
|
emacps_check_errors( &xEMACpsif );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xResult > 0 )
|
if( xResult > 0 )
|
||||||
{
|
{
|
||||||
/* A packet was received. No need to check for the PHY status now,
|
/* A packet was received. No need to check for the PHY status now,
|
||||||
|
@ -372,19 +403,22 @@ const TickType_t ulMaxBlockTime = pdMS_TO_TICKS( 100UL );
|
||||||
vTaskSetTimeOutState( &xPhyTime );
|
vTaskSetTimeOutState( &xPhyTime );
|
||||||
xPhyRemTime = pdMS_TO_TICKS( PHY_LS_HIGH_CHECK_TIME_MS );
|
xPhyRemTime = pdMS_TO_TICKS( PHY_LS_HIGH_CHECK_TIME_MS );
|
||||||
xResult = 0;
|
xResult = 0;
|
||||||
|
/* Indicate that the Link Status is high, so that
|
||||||
|
xNetworkInterfaceOutput() can send packets. */
|
||||||
|
ulPHYLinkStatus |= niBMSR_LINK_STATUS;
|
||||||
}
|
}
|
||||||
else if( xTaskCheckForTimeOut( &xPhyTime, &xPhyRemTime ) != pdFALSE )
|
else if( xTaskCheckForTimeOut( &xPhyTime, &xPhyRemTime ) != pdFALSE )
|
||||||
{
|
{
|
||||||
xStatus = ulReadMDIO( PHY_REG_01_BMSR );
|
xStatus = ulReadMDIO( PHY_REG_01_BMSR );
|
||||||
|
|
||||||
if( ( ulPHYLinkStatus & BMSR_LINK_STATUS ) != ( xStatus & BMSR_LINK_STATUS ) )
|
if( ( ulPHYLinkStatus & niBMSR_LINK_STATUS ) != ( xStatus & niBMSR_LINK_STATUS ) )
|
||||||
{
|
{
|
||||||
ulPHYLinkStatus = xStatus;
|
ulPHYLinkStatus = xStatus;
|
||||||
FreeRTOS_printf( ( "prvEMACHandlerTask: PHY LS now %d\n", ( ulPHYLinkStatus & BMSR_LINK_STATUS ) != 0 ) );
|
FreeRTOS_printf( ( "prvEMACHandlerTask: PHY LS now %d\n", ( ulPHYLinkStatus & niBMSR_LINK_STATUS ) != 0 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
vTaskSetTimeOutState( &xPhyTime );
|
vTaskSetTimeOutState( &xPhyTime );
|
||||||
if( ( ulPHYLinkStatus & BMSR_LINK_STATUS ) != 0 )
|
if( ( ulPHYLinkStatus & niBMSR_LINK_STATUS ) != 0 )
|
||||||
{
|
{
|
||||||
xPhyRemTime = pdMS_TO_TICKS( PHY_LS_HIGH_CHECK_TIME_MS );
|
xPhyRemTime = pdMS_TO_TICKS( PHY_LS_HIGH_CHECK_TIME_MS );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#warning Temoporary file and a dependent on the Zynq network interface.
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* uncached_memory.c
|
* uncached_memory.c
|
||||||
*
|
*
|
||||||
|
@ -19,6 +17,21 @@
|
||||||
* uncached memory.
|
* uncached memory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* Standard includes. */
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
/* FreeRTOS includes. */
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "task.h"
|
||||||
|
#include "queue.h"
|
||||||
|
|
||||||
|
/* FreeRTOS+TCP includes. */
|
||||||
|
#include "FreeRTOS_IP.h"
|
||||||
|
#include "FreeRTOS_Sockets.h"
|
||||||
|
#include "FreeRTOS_IP_Private.h"
|
||||||
|
|
||||||
#include "Zynq/x_emacpsif.h"
|
#include "Zynq/x_emacpsif.h"
|
||||||
#include "Zynq/x_topology.h"
|
#include "Zynq/x_topology.h"
|
||||||
#include "xstatus.h"
|
#include "xstatus.h"
|
||||||
|
@ -28,12 +41,8 @@
|
||||||
#include "xil_exception.h"
|
#include "xil_exception.h"
|
||||||
#include "xil_mmu.h"
|
#include "xil_mmu.h"
|
||||||
|
|
||||||
#include "FreeRTOS.h"
|
|
||||||
|
|
||||||
#include "uncached_memory.h"
|
#include "uncached_memory.h"
|
||||||
|
|
||||||
#include "Demo_Logging.h"
|
|
||||||
|
|
||||||
#define UNCACHED_MEMORY_SIZE 0x100000ul
|
#define UNCACHED_MEMORY_SIZE 0x100000ul
|
||||||
|
|
||||||
#define DDR_MEMORY_END (XPAR_PS7_DDR_0_S_AXI_HIGHADDR+1)
|
#define DDR_MEMORY_END (XPAR_PS7_DDR_0_S_AXI_HIGHADDR+1)
|
||||||
|
@ -100,7 +109,7 @@ static void vInitialiseUncachedMemory( )
|
||||||
|
|
||||||
if( ( ( u32 )pucStartOfMemory ) + UNCACHED_MEMORY_SIZE > DDR_MEMORY_END )
|
if( ( ( u32 )pucStartOfMemory ) + UNCACHED_MEMORY_SIZE > DDR_MEMORY_END )
|
||||||
{
|
{
|
||||||
vLoggingPrintf("vInitialiseUncachedMemory: Can not allocate uncached memory\n" );
|
// vLoggingPrintf("vInitialiseUncachedMemory: Can not allocate uncached memory\n" );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -109,7 +118,11 @@ static void vInitialiseUncachedMemory( )
|
||||||
* address range that starts after "_end" is made uncached
|
* address range that starts after "_end" is made uncached
|
||||||
* by setting appropriate attributes in the translation table.
|
* by setting appropriate attributes in the translation table.
|
||||||
*/
|
*/
|
||||||
Xil_SetTlbAttributes( ( uint32_t )pucStartOfMemory, 0xc02 ); // addr, attr
|
/* FIXME claudio rossi. Modified to prevent data abort exception (misaligned access)
|
||||||
|
* when application is compiled with -O1 or more optimization flag.
|
||||||
|
*/
|
||||||
|
/* Xil_SetTlbAttributes( ( uint32_t )pucStartOfMemory, 0xc02 ); // addr, attr */
|
||||||
|
Xil_SetTlbAttributes( ( uint32_t )pucStartOfMemory, 0x1c02 ); // addr, attr
|
||||||
|
|
||||||
/* For experiments in the SDIO driver, make the remaining uncached memory public */
|
/* For experiments in the SDIO driver, make the remaining uncached memory public */
|
||||||
pucHeadOfMemory = pucStartOfMemory;
|
pucHeadOfMemory = pucStartOfMemory;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS+TCP V2.0.7
|
FreeRTOS+TCP V2.0.11
|
||||||
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
@ -23,15 +23,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
http://www.FreeRTOS.org
|
http://www.FreeRTOS.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Zynq/x_emacpsif.h"
|
|
||||||
#include "Zynq/x_topology.h"
|
|
||||||
#include "xstatus.h"
|
|
||||||
|
|
||||||
#include "xparameters.h"
|
|
||||||
#include "xparameters_ps.h"
|
|
||||||
#include "xil_exception.h"
|
|
||||||
#include "xil_mmu.h"
|
|
||||||
|
|
||||||
#include "FreeRTOS.h"
|
#include "FreeRTOS.h"
|
||||||
#include "task.h"
|
#include "task.h"
|
||||||
#include "timers.h"
|
#include "timers.h"
|
||||||
|
@ -43,6 +34,15 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#include "FreeRTOS_IP_Private.h"
|
#include "FreeRTOS_IP_Private.h"
|
||||||
#include "NetworkBufferManagement.h"
|
#include "NetworkBufferManagement.h"
|
||||||
|
|
||||||
|
#include "Zynq/x_emacpsif.h"
|
||||||
|
#include "Zynq/x_topology.h"
|
||||||
|
#include "xstatus.h"
|
||||||
|
|
||||||
|
#include "xparameters.h"
|
||||||
|
#include "xparameters_ps.h"
|
||||||
|
#include "xil_exception.h"
|
||||||
|
#include "xil_mmu.h"
|
||||||
|
|
||||||
#include "uncached_memory.h"
|
#include "uncached_memory.h"
|
||||||
|
|
||||||
/* Two defines used to set or clear the EMAC interrupt */
|
/* Two defines used to set or clear the EMAC interrupt */
|
||||||
|
@ -201,7 +201,7 @@ BaseType_t xReturn;
|
||||||
XStatus emacps_send_message(xemacpsif_s *xemacpsif, NetworkBufferDescriptor_t *pxBuffer, int iReleaseAfterSend )
|
XStatus emacps_send_message(xemacpsif_s *xemacpsif, NetworkBufferDescriptor_t *pxBuffer, int iReleaseAfterSend )
|
||||||
{
|
{
|
||||||
int head = xemacpsif->txHead;
|
int head = xemacpsif->txHead;
|
||||||
int tail = xemacpsif->txTail;
|
//int tail = xemacpsif->txTail;
|
||||||
int iHasSent = 0;
|
int iHasSent = 0;
|
||||||
uint32_t ulBaseAddress = xemacpsif->emacps.Config.BaseAddress;
|
uint32_t ulBaseAddress = xemacpsif->emacps.Config.BaseAddress;
|
||||||
TickType_t xBlockTimeTicks = pdMS_TO_TICKS( 5000u );
|
TickType_t xBlockTimeTicks = pdMS_TO_TICKS( 5000u );
|
||||||
|
@ -313,10 +313,7 @@ void emacps_recv_handler(void *arg)
|
||||||
portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
|
portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
|
||||||
}
|
}
|
||||||
|
|
||||||
static NetworkBufferDescriptor_t *ethMsg = NULL;
|
static void passEthMessages( NetworkBufferDescriptor_t *ethMsg )
|
||||||
static NetworkBufferDescriptor_t *ethLast = NULL;
|
|
||||||
|
|
||||||
static void passEthMessages( void )
|
|
||||||
{
|
{
|
||||||
IPStackEvent_t xRxEvent;
|
IPStackEvent_t xRxEvent;
|
||||||
|
|
||||||
|
@ -338,20 +335,50 @@ IPStackEvent_t xRxEvent;
|
||||||
iptraceETHERNET_RX_EVENT_LOST();
|
iptraceETHERNET_RX_EVENT_LOST();
|
||||||
FreeRTOS_printf( ( "passEthMessages: Can not queue return packet!\n" ) );
|
FreeRTOS_printf( ( "passEthMessages: Can not queue return packet!\n" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
ethMsg = ethLast = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TickType_t ack_reception_delay = 10;
|
||||||
|
|
||||||
int emacps_check_rx( xemacpsif_s *xemacpsif )
|
int emacps_check_rx( xemacpsif_s *xemacpsif )
|
||||||
{
|
{
|
||||||
NetworkBufferDescriptor_t *pxBuffer, *pxNewBuffer;
|
NetworkBufferDescriptor_t *pxBuffer, *pxNewBuffer;
|
||||||
int rx_bytes;
|
int rx_bytes;
|
||||||
volatile int msgCount = 0;
|
volatile int msgCount = 0;
|
||||||
int head = xemacpsif->rxHead;
|
int head = xemacpsif->rxHead;
|
||||||
|
BaseType_t bHasDataPacket = pdFALSE;
|
||||||
|
NetworkBufferDescriptor_t *ethMsg = NULL;
|
||||||
|
NetworkBufferDescriptor_t *ethLast = NULL;
|
||||||
|
|
||||||
/* There seems to be an issue (SI# 692601), see comments below. */
|
/* There seems to be an issue (SI# 692601), see comments below. */
|
||||||
resetrx_on_no_rxdata(xemacpsif);
|
resetrx_on_no_rxdata(xemacpsif);
|
||||||
|
|
||||||
|
{
|
||||||
|
static int maxcount = 0;
|
||||||
|
int count = 0;
|
||||||
|
for( ;; )
|
||||||
|
{
|
||||||
|
if( ( ( xemacpsif->rxSegments[ head ].address & XEMACPS_RXBUF_NEW_MASK ) == 0 ) ||
|
||||||
|
( pxDMA_rx_buffers[ head ] == NULL ) )
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
count++;
|
||||||
|
if( ++head == ipconfigNIC_N_RX_DESC )
|
||||||
|
{
|
||||||
|
head = 0;
|
||||||
|
}
|
||||||
|
if( head == xemacpsif->rxHead )
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (maxcount < count) {
|
||||||
|
maxcount = count;
|
||||||
|
FreeRTOS_printf( ( "emacps_check_rx: %d packets\n", maxcount ) );
|
||||||
|
}
|
||||||
|
head = xemacpsif->rxHead;
|
||||||
|
}
|
||||||
|
|
||||||
/* This FreeRTOS+TCP driver shall be compiled with the option
|
/* This FreeRTOS+TCP driver shall be compiled with the option
|
||||||
"ipconfigUSE_LINKED_RX_MESSAGES" enabled. It allows the driver to send a
|
"ipconfigUSE_LINKED_RX_MESSAGES" enabled. It allows the driver to send a
|
||||||
chain of RX messages within one message to the IP-task. */
|
chain of RX messages within one message to the IP-task. */
|
||||||
|
@ -384,7 +411,10 @@ int head = xemacpsif->rxHead;
|
||||||
rx_bytes = xemacpsif->rxSegments[ head ].flags & XEMACPS_RXBUF_LEN_MASK;
|
rx_bytes = xemacpsif->rxSegments[ head ].flags & XEMACPS_RXBUF_LEN_MASK;
|
||||||
|
|
||||||
pxBuffer->xDataLength = rx_bytes;
|
pxBuffer->xDataLength = rx_bytes;
|
||||||
|
if( rx_bytes > 60 )
|
||||||
|
{
|
||||||
|
bHasDataPacket = 1;
|
||||||
|
}
|
||||||
if( ucIsCachedMemory( pxBuffer->pucEthernetBuffer ) != 0 )
|
if( ucIsCachedMemory( pxBuffer->pucEthernetBuffer ) != 0 )
|
||||||
{
|
{
|
||||||
Xil_DCacheInvalidateRange( ( ( uint32_t )pxBuffer->pucEthernetBuffer ) - ipconfigPACKET_FILLER_SIZE, (unsigned)rx_bytes );
|
Xil_DCacheInvalidateRange( ( ( uint32_t )pxBuffer->pucEthernetBuffer ) - ipconfigPACKET_FILLER_SIZE, (unsigned)rx_bytes );
|
||||||
|
@ -421,8 +451,11 @@ int head = xemacpsif->rxHead;
|
||||||
addr |= XEMACPS_RXBUF_WRAP_MASK;
|
addr |= XEMACPS_RXBUF_WRAP_MASK;
|
||||||
}
|
}
|
||||||
/* Clearing 'XEMACPS_RXBUF_NEW_MASK' 0x00000001 *< Used bit.. */
|
/* Clearing 'XEMACPS_RXBUF_NEW_MASK' 0x00000001 *< Used bit.. */
|
||||||
xemacpsif->rxSegments[ head ].address = addr;
|
|
||||||
xemacpsif->rxSegments[ head ].flags = 0;
|
xemacpsif->rxSegments[ head ].flags = 0;
|
||||||
|
xemacpsif->rxSegments[ head ].address = addr;
|
||||||
|
if (xemacpsif->rxSegments[ head ].address) {
|
||||||
|
// Just to read it
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -435,7 +468,11 @@ int head = xemacpsif->rxHead;
|
||||||
|
|
||||||
if( ethMsg != NULL )
|
if( ethMsg != NULL )
|
||||||
{
|
{
|
||||||
passEthMessages( );
|
if( bHasDataPacket == pdFALSE )
|
||||||
|
{
|
||||||
|
// vTaskDelay( ack_reception_delay );
|
||||||
|
}
|
||||||
|
passEthMessages( ethMsg );
|
||||||
}
|
}
|
||||||
|
|
||||||
return msgCount;
|
return msgCount;
|
||||||
|
@ -455,9 +492,9 @@ unsigned char *ucTxBuffer;
|
||||||
xemacpsif->txSegments[ index ].address = ( uint32_t )ucTxBuffer;
|
xemacpsif->txSegments[ index ].address = ( uint32_t )ucTxBuffer;
|
||||||
xemacpsif->txSegments[ index ].flags = XEMACPS_TXBUF_USED_MASK;
|
xemacpsif->txSegments[ index ].flags = XEMACPS_TXBUF_USED_MASK;
|
||||||
#if( ipconfigZERO_COPY_TX_DRIVER != 0 )
|
#if( ipconfigZERO_COPY_TX_DRIVER != 0 )
|
||||||
pxDMA_tx_buffers[ index ] = ( void* )NULL;
|
pxDMA_tx_buffers[ index ] = ( unsigned char * )NULL;
|
||||||
#else
|
#else
|
||||||
pxDMA_tx_buffers[ index ] = ( void* )( ucTxBuffer + TX_OFFSET );
|
pxDMA_tx_buffers[ index ] = ( unsigned char * )( ucTxBuffer + TX_OFFSET );
|
||||||
#endif
|
#endif
|
||||||
ucTxBuffer += xemacpsif->uTxUnitSize;
|
ucTxBuffer += xemacpsif->uTxUnitSize;
|
||||||
}
|
}
|
||||||
|
@ -601,6 +638,7 @@ void resetrx_on_no_rxdata(xemacpsif_s *xemacpsif)
|
||||||
tempcntr = XEmacPs_ReadReg( xemacpsif->emacps.Config.BaseAddress, XEMACPS_RXCNT_OFFSET );
|
tempcntr = XEmacPs_ReadReg( xemacpsif->emacps.Config.BaseAddress, XEMACPS_RXCNT_OFFSET );
|
||||||
if ( ( tempcntr == 0 ) && ( xemacpsif->last_rx_frms_cntr == 0 ) )
|
if ( ( tempcntr == 0 ) && ( xemacpsif->last_rx_frms_cntr == 0 ) )
|
||||||
{
|
{
|
||||||
|
FreeRTOS_printf( ( "resetrx_on_no_rxdata: RESET~\n" ) );
|
||||||
regctrl = XEmacPs_ReadReg(xemacpsif->emacps.Config.BaseAddress,
|
regctrl = XEmacPs_ReadReg(xemacpsif->emacps.Config.BaseAddress,
|
||||||
XEMACPS_NWCTRL_OFFSET);
|
XEMACPS_NWCTRL_OFFSET);
|
||||||
regctrl &= (~XEMACPS_NWCTRL_RXEN_MASK);
|
regctrl &= (~XEMACPS_NWCTRL_RXEN_MASK);
|
||||||
|
|
|
@ -22,19 +22,19 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "Zynq/x_emacpsif.h"
|
|
||||||
|
|
||||||
/* FreeRTOS includes. */
|
/* FreeRTOS includes. */
|
||||||
#include "FreeRTOS.h"
|
#include "FreeRTOS.h"
|
||||||
#include "task.h"
|
#include "task.h"
|
||||||
#include "queue.h"
|
#include "queue.h"
|
||||||
|
|
||||||
///* FreeRTOS+TCP includes. */
|
|
||||||
/* FreeRTOS+TCP includes. */
|
/* FreeRTOS+TCP includes. */
|
||||||
#include "FreeRTOS_IP.h"
|
#include "FreeRTOS_IP.h"
|
||||||
#include "FreeRTOS_Sockets.h"
|
#include "FreeRTOS_Sockets.h"
|
||||||
#include "FreeRTOS_IP_Private.h"
|
#include "FreeRTOS_IP_Private.h"
|
||||||
#include "NetworkBufferManagement.h"
|
#include "NetworkBufferManagement.h"
|
||||||
|
#include "NetworkInterface.h"
|
||||||
|
|
||||||
|
#include "Zynq/x_emacpsif.h"
|
||||||
|
|
||||||
extern TaskHandle_t xEMACTaskHandle;
|
extern TaskHandle_t xEMACTaskHandle;
|
||||||
|
|
||||||
|
@ -42,8 +42,6 @@ extern TaskHandle_t xEMACTaskHandle;
|
||||||
*** to run it on a PEEP board
|
*** to run it on a PEEP board
|
||||||
***/
|
***/
|
||||||
|
|
||||||
unsigned int link_speed = 100;
|
|
||||||
|
|
||||||
void setup_isr( xemacpsif_s *xemacpsif )
|
void setup_isr( xemacpsif_s *xemacpsif )
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -141,8 +139,6 @@ int xResult;
|
||||||
return xResult;
|
return xResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseType_t xNetworkInterfaceInitialise( void );
|
|
||||||
|
|
||||||
static void emacps_handle_error(void *arg, u8 Direction, u32 ErrorWord)
|
static void emacps_handle_error(void *arg, u8 Direction, u32 ErrorWord)
|
||||||
{
|
{
|
||||||
xemacpsif_s *xemacpsif;
|
xemacpsif_s *xemacpsif;
|
||||||
|
|
|
@ -53,24 +53,23 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "Zynq/x_emacpsif.h"
|
|
||||||
//#include "lwipopts.h"
|
|
||||||
#include "xparameters_ps.h"
|
|
||||||
#include "xparameters.h"
|
|
||||||
|
|
||||||
/* FreeRTOS includes. */
|
/* FreeRTOS includes. */
|
||||||
#include "FreeRTOS.h"
|
#include "FreeRTOS.h"
|
||||||
#include "task.h"
|
#include "task.h"
|
||||||
#include "queue.h"
|
#include "queue.h"
|
||||||
#include "semphr.h"
|
#include "semphr.h"
|
||||||
|
|
||||||
///* FreeRTOS+TCP includes. */
|
|
||||||
/* FreeRTOS+TCP includes. */
|
/* FreeRTOS+TCP includes. */
|
||||||
#include "FreeRTOS_IP.h"
|
#include "FreeRTOS_IP.h"
|
||||||
#include "FreeRTOS_Sockets.h"
|
#include "FreeRTOS_Sockets.h"
|
||||||
#include "FreeRTOS_IP_Private.h"
|
#include "FreeRTOS_IP_Private.h"
|
||||||
#include "NetworkBufferManagement.h"
|
#include "NetworkBufferManagement.h"
|
||||||
|
|
||||||
|
#include "Zynq/x_emacpsif.h"
|
||||||
|
#include "xparameters_ps.h"
|
||||||
|
#include "xparameters.h"
|
||||||
|
|
||||||
|
|
||||||
int phy_detected = 0;
|
int phy_detected = 0;
|
||||||
|
|
||||||
/*** IMPORTANT: Define PEEP in xemacpsif.h and sys_arch_raw.c
|
/*** IMPORTANT: Define PEEP in xemacpsif.h and sys_arch_raw.c
|
||||||
|
@ -99,6 +98,8 @@ int phy_detected = 0;
|
||||||
|
|
||||||
#define IEEE_CONTROL_REG_OFFSET 0
|
#define IEEE_CONTROL_REG_OFFSET 0
|
||||||
#define IEEE_STATUS_REG_OFFSET 1
|
#define IEEE_STATUS_REG_OFFSET 1
|
||||||
|
#define IEEE_PHYSID1_OFFSET 2
|
||||||
|
#define IEEE_PHYSID2_OFFSET 3
|
||||||
#define IEEE_AUTONEGO_ADVERTISE_REG 4
|
#define IEEE_AUTONEGO_ADVERTISE_REG 4
|
||||||
#define IEEE_PARTNER_ABILITIES_1_REG_OFFSET 5
|
#define IEEE_PARTNER_ABILITIES_1_REG_OFFSET 5
|
||||||
#define IEEE_1000_ADVERTISE_REG_OFFSET 9
|
#define IEEE_1000_ADVERTISE_REG_OFFSET 9
|
||||||
|
@ -135,9 +136,6 @@ int phy_detected = 0;
|
||||||
#define IEEE_PAUSE_MASK 0x0400
|
#define IEEE_PAUSE_MASK 0x0400
|
||||||
#define IEEE_AUTONEG_ERROR_MASK 0x8000
|
#define IEEE_AUTONEG_ERROR_MASK 0x8000
|
||||||
|
|
||||||
#define PHY_DETECT_REG 1
|
|
||||||
#define PHY_DETECT_MASK 0x1808
|
|
||||||
|
|
||||||
#define XEMACPS_GMII2RGMII_SPEED1000_FD 0x140
|
#define XEMACPS_GMII2RGMII_SPEED1000_FD 0x140
|
||||||
#define XEMACPS_GMII2RGMII_SPEED100_FD 0x2100
|
#define XEMACPS_GMII2RGMII_SPEED100_FD 0x2100
|
||||||
#define XEMACPS_GMII2RGMII_SPEED10_FD 0x100
|
#define XEMACPS_GMII2RGMII_SPEED10_FD 0x100
|
||||||
|
@ -163,19 +161,17 @@ int phy_detected = 0;
|
||||||
|
|
||||||
static int detect_phy(XEmacPs *xemacpsp)
|
static int detect_phy(XEmacPs *xemacpsp)
|
||||||
{
|
{
|
||||||
u16 phy_reg;
|
u16 id_lower, id_upper;
|
||||||
u32 phy_addr;
|
u32 phy_addr, id;
|
||||||
|
|
||||||
for (phy_addr = 31; phy_addr > 0; phy_addr--) {
|
for (phy_addr = 0; phy_addr < 32; phy_addr++) {
|
||||||
XEmacPs_PhyRead(xemacpsp, phy_addr, PHY_DETECT_REG,
|
XEmacPs_PhyRead(xemacpsp, phy_addr, IEEE_PHYSID1_OFFSET, &id_lower);
|
||||||
&phy_reg);
|
|
||||||
|
|
||||||
if ((phy_reg != 0xFFFF) &&
|
if ((id_lower != ( u16 )0xFFFFu) && (id_lower != ( u16 )0x0u)) {
|
||||||
((phy_reg & PHY_DETECT_MASK) == PHY_DETECT_MASK)) {
|
|
||||||
/* Found a valid PHY address */
|
XEmacPs_PhyRead(xemacpsp, phy_addr, IEEE_PHYSID2_OFFSET, &id_upper);
|
||||||
FreeRTOS_printf( ("XEmacPs detect_phy: PHY detected at address %d.\r\n",
|
id = ( ( ( uint32_t ) id_upper ) << 16 ) | ( id_lower & 0xFFF0 );
|
||||||
phy_addr));
|
FreeRTOS_printf( ("XEmacPs detect_phy: %04lX at address %d.\n", id, phy_addr ) );
|
||||||
FreeRTOS_printf( ("XEmacPs detect_phy: PHY detected.\n" ) );
|
|
||||||
phy_detected = phy_addr;
|
phy_detected = phy_addr;
|
||||||
return phy_addr;
|
return phy_addr;
|
||||||
}
|
}
|
||||||
|
@ -238,7 +234,7 @@ unsigned get_IEEE_phy_speed(XEmacPs *xemacpsp)
|
||||||
if (partner_capabilities & IEEE_AN1_ABILITY_MASK_10MBPS)
|
if (partner_capabilities & IEEE_AN1_ABILITY_MASK_10MBPS)
|
||||||
return 10;
|
return 10;
|
||||||
|
|
||||||
xil_printf("%s: unknown PHY link speed, setting TEMAC speed to be 10 Mbps\r\n",
|
xil_printf("%s: unknown PHY link speed, setting TEMAC speed to be 10 Mbps\n",
|
||||||
__FUNCTION__);
|
__FUNCTION__);
|
||||||
return 10;
|
return 10;
|
||||||
|
|
||||||
|
@ -257,7 +253,7 @@ unsigned get_IEEE_phy_speed(XEmacPs *xemacpsp)
|
||||||
case (IEEE_CTRL_LINKSPEED_10M):
|
case (IEEE_CTRL_LINKSPEED_10M):
|
||||||
return 10;
|
return 10;
|
||||||
default:
|
default:
|
||||||
xil_printf("%s: unknown PHY link speed (%d), setting TEMAC speed to be 10 Mbps\r\n",
|
xil_printf("%s: unknown PHY link speed (%d), setting TEMAC speed to be 10 Mbps\n",
|
||||||
__FUNCTION__, phylinkspeed);
|
__FUNCTION__, phylinkspeed);
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
|
@ -282,7 +278,7 @@ unsigned get_IEEE_phy_speed(XEmacPs *xemacpsp)
|
||||||
#else
|
#else
|
||||||
u32 phy_addr = detect_phy(xemacpsp);
|
u32 phy_addr = detect_phy(xemacpsp);
|
||||||
#endif
|
#endif
|
||||||
xil_printf("Start PHY autonegotiation \r\n");
|
xil_printf("Start PHY autonegotiation \n");
|
||||||
|
|
||||||
#if XPAR_GIGE_PCS_PMA_CORE_PRESENT == 1
|
#if XPAR_GIGE_PCS_PMA_CORE_PRESENT == 1
|
||||||
#else
|
#else
|
||||||
|
@ -338,7 +334,7 @@ unsigned get_IEEE_phy_speed(XEmacPs *xemacpsp)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
xil_printf("Waiting for PHY to complete autonegotiation.\r\n");
|
xil_printf("Waiting for PHY to complete autonegotiation.\n");
|
||||||
|
|
||||||
XEmacPs_PhyRead(xemacpsp, phy_addr, IEEE_STATUS_REG_OFFSET, &status);
|
XEmacPs_PhyRead(xemacpsp, phy_addr, IEEE_STATUS_REG_OFFSET, &status);
|
||||||
while ( !(status & IEEE_STAT_AUTONEGOTIATE_COMPLETE) ) {
|
while ( !(status & IEEE_STAT_AUTONEGOTIATE_COMPLETE) ) {
|
||||||
|
@ -348,14 +344,14 @@ unsigned get_IEEE_phy_speed(XEmacPs *xemacpsp)
|
||||||
XEmacPs_PhyRead(xemacpsp, phy_addr, IEEE_COPPER_SPECIFIC_STATUS_REG_2,
|
XEmacPs_PhyRead(xemacpsp, phy_addr, IEEE_COPPER_SPECIFIC_STATUS_REG_2,
|
||||||
&temp);
|
&temp);
|
||||||
if (temp & IEEE_AUTONEG_ERROR_MASK) {
|
if (temp & IEEE_AUTONEG_ERROR_MASK) {
|
||||||
xil_printf("Auto negotiation error \r\n");
|
xil_printf("Auto negotiation error \n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
XEmacPs_PhyRead(xemacpsp, phy_addr, IEEE_STATUS_REG_OFFSET,
|
XEmacPs_PhyRead(xemacpsp, phy_addr, IEEE_STATUS_REG_OFFSET,
|
||||||
&status);
|
&status);
|
||||||
}
|
}
|
||||||
|
|
||||||
xil_printf("autonegotiation complete \r\n");
|
xil_printf("autonegotiation complete \n");
|
||||||
|
|
||||||
#if XPAR_GIGE_PCS_PMA_CORE_PRESENT == 1
|
#if XPAR_GIGE_PCS_PMA_CORE_PRESENT == 1
|
||||||
#else
|
#else
|
||||||
|
@ -363,7 +359,7 @@ unsigned get_IEEE_phy_speed(XEmacPs *xemacpsp)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if XPAR_GIGE_PCS_PMA_CORE_PRESENT == 1
|
#if XPAR_GIGE_PCS_PMA_CORE_PRESENT == 1
|
||||||
xil_printf("Waiting for Link to be up; Polling for SGMII core Reg \r\n");
|
xil_printf("Waiting for Link to be up; Polling for SGMII core Reg \n");
|
||||||
XEmacPs_PhyRead(xemacpsp, phy_addr, 5, &temp);
|
XEmacPs_PhyRead(xemacpsp, phy_addr, 5, &temp);
|
||||||
while(!(temp & 0x8000)) {
|
while(!(temp & 0x8000)) {
|
||||||
XEmacPs_PhyRead(xemacpsp, phy_addr, 5, &temp);
|
XEmacPs_PhyRead(xemacpsp, phy_addr, 5, &temp);
|
||||||
|
@ -380,7 +376,7 @@ unsigned get_IEEE_phy_speed(XEmacPs *xemacpsp)
|
||||||
XEmacPs_PhyRead(xemacpsp, phy_addr, 0, &temp);
|
XEmacPs_PhyRead(xemacpsp, phy_addr, 0, &temp);
|
||||||
return 10;
|
return 10;
|
||||||
} else {
|
} else {
|
||||||
xil_printf("get_IEEE_phy_speed(): Invalid speed bit value, Deafulting to Speed = 10 Mbps\r\n");
|
xil_printf("get_IEEE_phy_speed(): Invalid speed bit value, Deafulting to Speed = 10 Mbps\n");
|
||||||
XEmacPs_PhyRead(xemacpsp, phy_addr, 0, &temp);
|
XEmacPs_PhyRead(xemacpsp, phy_addr, 0, &temp);
|
||||||
XEmacPs_PhyWrite(xemacpsp, phy_addr, 0, 0x0100);
|
XEmacPs_PhyWrite(xemacpsp, phy_addr, 0, 0x0100);
|
||||||
return 10;
|
return 10;
|
||||||
|
@ -579,7 +575,7 @@ unsigned Phy_Setup (XEmacPs *xemacpsp)
|
||||||
XEMACPS_GMII2RGMII_REG_NUM, convspeeddupsetting);
|
XEMACPS_GMII2RGMII_REG_NUM, convspeeddupsetting);
|
||||||
}
|
}
|
||||||
|
|
||||||
xil_printf("link speed: %d\r\n", link_speed);
|
xil_printf("link speed: %d\n", link_speed);
|
||||||
return link_speed;
|
return link_speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS+TCP V2.0.7
|
FreeRTOS+TCP V2.0.11
|
||||||
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
|
Loading…
Reference in a new issue