]> git.sur5r.net Git - freertos/blobdiff - Demo/CORTEX_A2F200_IAR_and_Keil/MicroSemi_Code/drivers/mss_ethernet_mac/mss_ethernet_mac.c
Update the IO page served by the A2F web server to use the correct LED for the A2F...
[freertos] / Demo / CORTEX_A2F200_IAR_and_Keil / MicroSemi_Code / drivers / mss_ethernet_mac / mss_ethernet_mac.c
index a138492498785078779473f6effe9a89b857d98d..891cb888c812d742e5603d5b1dcef6c6cf863b94 100644 (file)
  ******************************************************************************/\r
 \r
 /*\r
- * NOTE:  This driver has been roughly modified specifically for use with the\r
- * uIP stack.  It is no longer a generic driver.\r
+ *\r
+ *\r
+ * NOTE:  This driver has been modified specifically for use with the* uIP stack.\r
+ * It is no longer a generic driver.\r
+ *\r
+ *\r
  */\r
 \r
 #ifdef __cplusplus\r
@@ -59,7 +63,7 @@ extern "C" {
 /* Allocating this many buffers will always ensure there is one free as, even\r
 though TX_RING_SIZE is set to two, the two Tx descriptors will only ever point\r
 to the same buffer. */\r
-#define macNUM_BUFFERS RX_RING_SIZE + TX_RING_SIZE + 2\r
+#define macNUM_BUFFERS RX_RING_SIZE + TX_RING_SIZE + 1\r
 #define macBUFFER_SIZE 1488\r
 \r
 /***************************************************************/\r
@@ -207,13 +211,14 @@ MSS_MAC_init
     /* Start general-purpose */\r
     MAC->CSR11 =  (MAC->CSR11 & ~CSR11_TIM_MASK) | (0x0000FFFFuL << CSR11_TIM_SHIFT);\r
 \r
-       /* Disable transmit interrupt mitigation. */\r
-       MAC->CSR11 = ( MAC->CSR11 & ~CSR11_TT_MASK );\r
-       MAC->CSR11 = ( MAC->CSR11 & ~CSR11_NTP_MASK );\r
-\r
-       /* Automatic Tx descriptor polling. */\r
-       MAC->CSR0 = ( MAC->CSR0 & ~CSR0_TAP_MASK );\r
-       MAC->CSR0 = ( MAC->CSR0 | ( 0x01 << CSR0_TAP_SHIFT ) );\r
+       /* Ensure promiscous mode is off (it should be by default anyway). */\r
+       MAC_BITBAND->CSR6_PR = 0;\r
+       \r
+       /* Perfect filter. */\r
+       MAC_BITBAND->CSR6_HP = 1;\r
+       \r
+       /* Pass multcast. */\r
+       MAC_BITBAND->CSR6_PM = 1;\r
        \r
     /* Set descriptors */\r
     MAC->CSR3 = (uint32_t)&(g_mss_mac.rx_descriptors[0].descriptor_0);\r
@@ -420,10 +425,6 @@ MSS_MAC_tx_packet
        if( ( ( (g_mss_mac.tx_descriptors[ 0 ].descriptor_0) & TDES0_OWN) == TDES0_OWN ) || ( ( (g_mss_mac.tx_descriptors[ 1 ].descriptor_0) & TDES0_OWN) == TDES0_OWN ) )\r
        {\r
                error = MAC_BUFFER_IS_FULL;\r
-               \r
-               /* Check the buffers pointed to by the Tx descriptors, just in case a Tx\r
-               interrupt has been missed and a free buffer remains marked as in use. */\r
-               MSS_MAC_CheckTxBufferStatus();\r
        }\r
 \r
        \r
@@ -1424,30 +1425,16 @@ static void MAC_memcpy(uint8_t *dest, const uint8_t *src, uint32_t n)
 }\r
 \r
 /***************************************************************************//**\r
- * Check the buffers assigned to the Tx descriptors to ensure that none remain\r
- * marked as in use even though the Tx has completed.  This could happen if a\r
- * Tx interrupt was missed.\r
+ * Tx has completed, mark the buffers that were assigned to the Tx descriptors\r
+ * as free again.\r
  *\r
  */\r
-void MSS_MAC_CheckTxBufferStatus( void )\r
+void MSS_MAC_FreeTxBuffers( void )\r
 {\r
-unsigned char *pxTransmittedBuffer;\r
-long lDescriptor, lIndex;\r
-\r
-       for( lDescriptor = 1; lDescriptor < TX_RING_SIZE; lDescriptor++ )\r
+       if( ( ( (g_mss_mac.tx_descriptors[ 0 ].descriptor_0) & TDES0_OWN) == 0 ) && ( ( (g_mss_mac.tx_descriptors[ 1 ].descriptor_0) & TDES0_OWN) == 0 ) )\r
        {\r
-               if( ( g_mss_mac.tx_descriptors[ lDescriptor ].descriptor_0 & TDES0_OWN ) == 0UL )\r
-               {\r
-                       pxTransmittedBuffer = ( unsigned char * ) g_mss_mac.tx_descriptors[ lDescriptor ].buffer_1;\r
-\r
-                       for( lIndex = 0; lIndex < macNUM_BUFFERS; lIndex++ )\r
-                       {\r
-                               if( pxTransmittedBuffer == &( xMACBuffers.ucBuffer[ lIndex ][ 0 ] ) )\r
-                               {\r
-                                       ucMACBufferInUse[ lIndex ] = pdFALSE;\r
-                               }\r
-                       }                       \r
-               }\r
+               MAC_release_buffer( ( unsigned char * ) g_mss_mac.tx_descriptors[ 0 ].buffer_1 );\r
+               MAC_release_buffer( ( unsigned char * ) g_mss_mac.tx_descriptors[ 1 ].buffer_1 );\r
        }\r
 }\r
 \r
@@ -1499,10 +1486,6 @@ long lIndex;
                }\r
        }\r
        \r
-       /* Check the buffers pointed to by the Tx descriptors, just in case a Tx\r
-       interrupt has been missed and a free buffer remains marked as in use. */\r
-       MSS_MAC_CheckTxBufferStatus();\r
-       \r
        configASSERT( lIndex < macNUM_BUFFERS );\r
 }\r
 \r