Skip to content

Commit

Permalink
Fix uninitialized variable in TM4C NetworkInterface.c (#1028)
Browse files Browse the repository at this point in the history
* Fix uninitialized variable in TM4C NetworkInterface.c

* Uncrustify: triggered by comment.

* Update macro

---------

Co-authored-by: GitHub Action <[email protected]>
Co-authored-by: Monika Singh <[email protected]>
  • Loading branch information
3 people authored Sep 26, 2023
1 parent c9e63fc commit ce11071
Showing 1 changed file with 6 additions and 3 deletions.
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

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

0 comments on commit ce11071

Please sign in to comment.