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

Fix uninitialized variable in TM4C NetworkInterface.c #1028

Merged
merged 3 commits into from
Sep 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions source/portable/NetworkInterface/TM4C/NetworkInterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@
#include "NetworkInterface.h"
#include "phyHandling.h"

#define BUFFER_SIZE ( ipTOTAL_ETHERNET_FRAME_SIZE + ipBUFFER_PADDING )
#define BUFFER_SIZE_WO_PADDING ( ipconfigNETWORK_MTU + ipSIZE_OF_ETH_HEADER )
#define BUFFER_SIZE ( BUFFER_SIZE_WO_PADDING + ipBUFFER_PADDING )
#define BUFFER_SIZE_ROUNDED_UP ( ( BUFFER_SIZE + 7 ) & ~0x7UL )
#define PHY_PHYS_ADDR 0

moninom1 marked this conversation as resolved.
Show resolved Hide resolved
Expand Down Expand Up @@ -446,7 +447,7 @@ static BaseType_t _ethernet_mac_get( uint8_t * mac_address_bytes )
static void _dma_descriptors_init( void )
{
uint32_t i;
size_t buffer_size_requested;
const size_t buffer_size_requested = BUFFER_SIZE_WO_PADDING;
NetworkBufferDescriptor_t * stack_descriptor;

/* Initialize the TX DMA descriptors */
Expand Down Expand Up @@ -592,6 +593,7 @@ static BaseType_t _process_received_packet( void )
IPStackEvent_t event;
BaseType_t result = pdTRUE;
const TickType_t max_block_time = pdMS_TO_MIN_TICKS( 50 );
const size_t buffer_size_requested = BUFFER_SIZE_WO_PADDING;

/* Go through the list of RX DMA descriptors */
for( i = 0; i < niEMAC_RX_DMA_DESC_COUNT; i++ )
Expand Down Expand Up @@ -665,7 +667,8 @@ static BaseType_t _process_received_packet( void )
} /* end if frame had error. In this case, give the buffer back to the DMA for the next RX */

/* Set up the DMA descriptor for the next receive transaction */
dma_descriptor->ui32Count = DES1_RX_CTRL_CHAINED | ipTOTAL_ETHERNET_FRAME_SIZE;
dma_descriptor->ui32Count = DES1_RX_CTRL_CHAINED | ( ( buffer_size_requested << DES1_RX_CTRL_BUFF1_SIZE_S ) & DES1_RX_CTRL_BUFF1_SIZE_M );

dma_descriptor->ui32CtrlStatus = DES0_RX_CTRL_OWN;

_rx_descriptor_list.write++;
Expand Down