Skip to content

Commit

Permalink
add timestamping
Browse files Browse the repository at this point in the history
  • Loading branch information
tony-josi-aws committed Aug 30, 2023
1 parent 828eb1a commit ba87c2d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
3 changes: 2 additions & 1 deletion source/FreeRTOS_IP.c
Original file line number Diff line number Diff line change
Expand Up @@ -418,8 +418,9 @@ static void prvProcessIPEventsAndTimers( void )
/* The network stack has generated a packet to send. A
* pointer to the generated buffer is located in the pvData
* member of the received event structure. */
LOG_SYSCLK_COUNT; //
vProcessGeneratedUDPPacket( ( NetworkBufferDescriptor_t * ) xReceivedEvent.pvData );

LOG_SYSCLK_COUNT;
if( request_stat == 1 )
{
vGetTxLatency( uiMeasureCycleCountStop( &TxCycleCountData ) );
Expand Down
16 changes: 16 additions & 0 deletions source/FreeRTOS_Sockets.c
Original file line number Diff line number Diff line change
Expand Up @@ -1443,12 +1443,16 @@ static int32_t prvSendUDPPacket( const FreeRTOS_Socket_t * pxSocket,
xStackTxEvent.pvData = pxNetworkBuffer;

/* Ask the IP-task to send this packet */
LOG_SYSCLK_COUNT; // 2

#if ( ipconfigRAW_PACKETS == 1 )
if( ( ( UBaseType_t ) xFlags & ( UBaseType_t ) FREERTOS_AF_RAW ) != 0U )
{
/* The packet was successfully sent to the IP task. */
lReturn = ( int32_t ) uxTotalDataLength;
LOG_SYSCLK_COUNT; // 1
vProcessGeneratedUDPPacket( pxNetworkBuffer );
LOG_SYSCLK_COUNT; // 2
}
else
#endif
Expand Down Expand Up @@ -1596,6 +1600,10 @@ int32_t FreeRTOS_sendto( Socket_t xSocket,
size_t uxMaxPayloadLength = 0;
size_t uxPayloadOffset = 0;

LOG_SYSCLK_COUNT_RESET;

LOG_SYSCLK_COUNT; // 0

#if ( ipconfigIPv4_BACKWARD_COMPATIBLE == 1 )
struct freertos_sockaddr xTempDestinationAddress;

Expand Down Expand Up @@ -1663,6 +1671,14 @@ int32_t FreeRTOS_sendto( Socket_t xSocket,
}
}

LOG_SYSCLK_COUNT; // 3

extern uint32_t time_logger[], time_logg_cntr;
for(int i = 0; i < time_logg_cntr; ++i)
{
FreeRTOS_debug_printf(("ID: %d Timestamp: %u Delta: %u \r\n", i , time_logger[i], i == 0 ? 0 : time_logger[i] - time_logger[i-1]));
}

return lReturn;
} /* Tested */
/*-----------------------------------------------------------*/
Expand Down
4 changes: 2 additions & 2 deletions source/portable/NetworkInterface/STM32Fxx/NetworkInterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ static BaseType_t xSTM32F_NetworkInterfaceOutput( NetworkInterface_t * pxInterfa
/* As there is only a single instance of the EMAC, there is only one pxInterface object. */
( void ) pxInterface;

xSemaphoreTake(xTXNetworkInterfaceOutSem, portMAX_DELAY);
//xSemaphoreTake(xTXNetworkInterfaceOutSem, portMAX_DELAY);

/* Open a do {} while ( 0 ) loop to be able to call break. */
do
Expand Down Expand Up @@ -944,7 +944,7 @@ static BaseType_t xSTM32F_NetworkInterfaceOutput( NetworkInterface_t * pxInterfa
vReleaseNetworkBufferAndDescriptor( pxDescriptor );
}

xSemaphoreGive(xTXNetworkInterfaceOutSem);
//xSemaphoreGive(xTXNetworkInterfaceOutSem);

return xReturn;
}
Expand Down

0 comments on commit ba87c2d

Please sign in to comment.