+ Made the function vClearEMACTxBuffer() more robust by moving the index\r
manipulation into the if() statement. This allows the tx interrupt to\r
execute even when there is no data to handle.\r
+\r
+Changes from V4.0.4\r
+\r
+ + Corrected the Rx frame length mask when obtaining the length from the\r
+ rx descriptor.\r
*/\r
\r
\r
#define emacRESET_KEY ( ( unsigned portLONG ) 0xA5000000 )\r
#define emacRESET_LENGTH ( ( unsigned portLONG ) ( 0x01 << 8 ) )\r
\r
+/* The Atmel header file only defines the TX frame length mask. */\r
+#define emacRX_LENGTH_FRAME ( 0xfff )\r
+\r
/*-----------------------------------------------------------*/\r
\r
/* Buffer written to by the EMAC DMA. Must be aligned as described by the\r
frame. The last buffer will give us the length of the entire frame. */\r
while( ( xRxDescriptors[ ulIndex ].addr & AT91C_OWNERSHIP_BIT ) && !ulLength )\r
{\r
- ulLength = xRxDescriptors[ ulIndex ].U_Status.status & AT91C_LENGTH_FRAME;\r
+ ulLength = xRxDescriptors[ ulIndex ].U_Status.status & emacRX_LENGTH_FRAME;\r
\r
/* Increment to the next buffer, wrapping if necessary. */\r
ulIndex++;\r
+ Also read the EMAC_RSR register in the EMAC ISR as a work around the \r
the EMAC bug that can reset the RX bit in EMAC_ISR register before the\r
bit has been read.\r
+\r
+Changes from V4.0.4\r
+\r
+ + Corrected the Rx frame length mask when obtaining the length from the\r
+ rx descriptor.\r
+\r
*/\r
\r
/* Standard includes. */\r
#define emacRESET_KEY ( ( unsigned portLONG ) 0xA5000000 )\r
#define emacRESET_LENGTH ( ( unsigned portLONG ) ( 0x01 << 8 ) )\r
\r
+/* The Atmel header file only defines the TX frame length mask. */\r
+#define emacRX_LENGTH_FRAME ( 0xfff )\r
+\r
/*-----------------------------------------------------------*/\r
\r
/*\r
while( ( xRxDescriptors[ ulNextRxBuffer ].addr & AT91C_OWNERSHIP_BIT ) && !ulSectionLength )\r
{\r
pcSource = ( portCHAR * )( xRxDescriptors[ ulNextRxBuffer ].addr & emacADDRESS_MASK );\r
- ulSectionLength = xRxDescriptors[ ulNextRxBuffer ].U_Status.status & AT91C_LENGTH_FRAME;\r
+ ulSectionLength = xRxDescriptors[ ulNextRxBuffer ].U_Status.status & emacRX_LENGTH_FRAME;\r
\r
if( ulSectionLength == 0 )\r
{\r