From 59b90e189777793cde5f156ed1a1b831f4fc29e0 Mon Sep 17 00:00:00 2001 From: richardbarry Date: Tue, 25 Jul 2006 19:44:40 +0000 Subject: [PATCH] Corrected the Rx frame length mask when obtaining the length from the rx descriptor. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@20 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- Demo/lwIP_Demo_Rowley_ARM7/EMAC/SAM7_EMAC.c | 10 +++++++++- Demo/uIP_Demo_IAR_ARM7/EMAC/SAM7_EMAC.c | 11 ++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Demo/lwIP_Demo_Rowley_ARM7/EMAC/SAM7_EMAC.c b/Demo/lwIP_Demo_Rowley_ARM7/EMAC/SAM7_EMAC.c index 81dacf5a6..dc72d52e9 100644 --- a/Demo/lwIP_Demo_Rowley_ARM7/EMAC/SAM7_EMAC.c +++ b/Demo/lwIP_Demo_Rowley_ARM7/EMAC/SAM7_EMAC.c @@ -54,6 +54,11 @@ Changes from V4.0.1 + Made the function vClearEMACTxBuffer() more robust by moving the index manipulation into the if() statement. This allows the tx interrupt to execute even when there is no data to handle. + +Changes from V4.0.4 + + + Corrected the Rx frame length mask when obtaining the length from the + rx descriptor. */ @@ -128,6 +133,9 @@ one not be immediately available when trying to transmit a frame. */ #define emacRESET_KEY ( ( unsigned portLONG ) 0xA5000000 ) #define emacRESET_LENGTH ( ( unsigned portLONG ) ( 0x01 << 8 ) ) +/* The Atmel header file only defines the TX frame length mask. */ +#define emacRX_LENGTH_FRAME ( 0xfff ) + /*-----------------------------------------------------------*/ /* Buffer written to by the EMAC DMA. Must be aligned as described by the @@ -323,7 +331,7 @@ register unsigned portLONG ulIndex, ulLength = 0; frame. The last buffer will give us the length of the entire frame. */ while( ( xRxDescriptors[ ulIndex ].addr & AT91C_OWNERSHIP_BIT ) && !ulLength ) { - ulLength = xRxDescriptors[ ulIndex ].U_Status.status & AT91C_LENGTH_FRAME; + ulLength = xRxDescriptors[ ulIndex ].U_Status.status & emacRX_LENGTH_FRAME; /* Increment to the next buffer, wrapping if necessary. */ ulIndex++; diff --git a/Demo/uIP_Demo_IAR_ARM7/EMAC/SAM7_EMAC.c b/Demo/uIP_Demo_IAR_ARM7/EMAC/SAM7_EMAC.c index a8d69b1fc..51832e0d7 100644 --- a/Demo/uIP_Demo_IAR_ARM7/EMAC/SAM7_EMAC.c +++ b/Demo/uIP_Demo_IAR_ARM7/EMAC/SAM7_EMAC.c @@ -57,6 +57,12 @@ Changes from V3.2.4 + Also read the EMAC_RSR register in the EMAC ISR as a work around the the EMAC bug that can reset the RX bit in EMAC_ISR register before the bit has been read. + +Changes from V4.0.4 + + + Corrected the Rx frame length mask when obtaining the length from the + rx descriptor. + */ /* Standard includes. */ @@ -105,6 +111,9 @@ one not be immediately available when trying to transmit a frame. */ #define emacRESET_KEY ( ( unsigned portLONG ) 0xA5000000 ) #define emacRESET_LENGTH ( ( unsigned portLONG ) ( 0x01 << 8 ) ) +/* The Atmel header file only defines the TX frame length mask. */ +#define emacRX_LENGTH_FRAME ( 0xfff ) + /*-----------------------------------------------------------*/ /* @@ -344,7 +353,7 @@ portCHAR *pcSource; while( ( xRxDescriptors[ ulNextRxBuffer ].addr & AT91C_OWNERSHIP_BIT ) && !ulSectionLength ) { pcSource = ( portCHAR * )( xRxDescriptors[ ulNextRxBuffer ].addr & emacADDRESS_MASK ); - ulSectionLength = xRxDescriptors[ ulNextRxBuffer ].U_Status.status & AT91C_LENGTH_FRAME; + ulSectionLength = xRxDescriptors[ ulNextRxBuffer ].U_Status.status & emacRX_LENGTH_FRAME; if( ulSectionLength == 0 ) { -- 2.39.5