From 8ed6a8d9e3b4613a0d586d409f4c5706f21b5857 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 1 May 2012 16:53:58 +0000 Subject: [PATCH] Fixed bug 3522808, fixed problem with STM32 MAC driver checksum offload. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4156 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/platforms/AT91SAM7/mac_lld.c | 4 ++-- os/hal/platforms/AT91SAM7/mac_lld.h | 4 ++-- os/hal/platforms/STM32/mac_lld.c | 12 ++++++------ os/hal/platforms/STM32/mac_lld.h | 4 ++-- os/hal/src/mac.c | 4 ++-- os/hal/templates/mac_lld.c | 4 ++-- os/hal/templates/mac_lld.h | 4 ++-- readme.txt | 2 ++ testhal/STM32F4xx/USB_CDC/main.c | 3 +++ 9 files changed, 23 insertions(+), 18 deletions(-) diff --git a/os/hal/platforms/AT91SAM7/mac_lld.c b/os/hal/platforms/AT91SAM7/mac_lld.c index dd1d6c6bd..83f8d6ef1 100644 --- a/os/hal/platforms/AT91SAM7/mac_lld.c +++ b/os/hal/platforms/AT91SAM7/mac_lld.c @@ -288,7 +288,7 @@ void mac_lld_stop(MACDriver *macp) { * * @notapi */ -msg_t max_lld_get_transmit_descriptor(MACDriver *macp, +msg_t mac_lld_get_transmit_descriptor(MACDriver *macp, MACTransmitDescriptor *tdp) { EMACDescriptor *edp; @@ -378,7 +378,7 @@ void mac_lld_release_transmit_descriptor(MACTransmitDescriptor *tdp) { * * @notapi */ -msg_t max_lld_get_receive_descriptor(MACDriver *macp, +msg_t mac_lld_get_receive_descriptor(MACDriver *macp, MACReceiveDescriptor *rdp) { unsigned n; EMACDescriptor *edp; diff --git a/os/hal/platforms/AT91SAM7/mac_lld.h b/os/hal/platforms/AT91SAM7/mac_lld.h index c89464ffa..33613b45d 100644 --- a/os/hal/platforms/AT91SAM7/mac_lld.h +++ b/os/hal/platforms/AT91SAM7/mac_lld.h @@ -227,13 +227,13 @@ extern "C" { void mac_lld_init(void); void mac_lld_start(MACDriver *macp); void mac_lld_stop(MACDriver *macp); - msg_t max_lld_get_transmit_descriptor(MACDriver *macp, + msg_t mac_lld_get_transmit_descriptor(MACDriver *macp, MACTransmitDescriptor *tdp); size_t mac_lld_write_transmit_descriptor(MACTransmitDescriptor *tdp, uint8_t *buf, size_t size); void mac_lld_release_transmit_descriptor(MACTransmitDescriptor *tdp); - msg_t max_lld_get_receive_descriptor(MACDriver *macp, + msg_t mac_lld_get_receive_descriptor(MACDriver *macp, MACReceiveDescriptor *rdp); size_t mac_lld_read_receive_descriptor(MACReceiveDescriptor *rdp, uint8_t *buf, diff --git a/os/hal/platforms/STM32/mac_lld.c b/os/hal/platforms/STM32/mac_lld.c index 15f9cd13c..aff58342e 100644 --- a/os/hal/platforms/STM32/mac_lld.c +++ b/os/hal/platforms/STM32/mac_lld.c @@ -384,7 +384,7 @@ void mac_lld_stop(MACDriver *macp) { * * @notapi */ -msg_t max_lld_get_transmit_descriptor(MACDriver *macp, +msg_t mac_lld_get_transmit_descriptor(MACDriver *macp, MACTransmitDescriptor *tdp) { stm32_eth_tx_descriptor_t *tdes; @@ -493,7 +493,7 @@ void mac_lld_release_transmit_descriptor(MACTransmitDescriptor *tdp) { * * @notapi */ -msg_t max_lld_get_receive_descriptor(MACDriver *macp, +msg_t mac_lld_get_receive_descriptor(MACDriver *macp, MACReceiveDescriptor *rdp) { stm32_eth_rx_descriptor_t *rdes; @@ -505,12 +505,12 @@ msg_t max_lld_get_receive_descriptor(MACDriver *macp, /* Iterates through received frames until a valid one is found, invalid frames are discarded.*/ while (!(rdes->rdes0 & STM32_RDES0_OWN)) { - if (!(rdes->rdes0 & (STM32_RDES0_AFM | STM32_RDES0_ES + if (!(rdes->rdes0 & (STM32_RDES0_AFM | STM32_RDES0_ES)) #if STM32_IP_CHECKSUM_OFFLOAD - | STM32_RDES0_IPHCE | STM32_RDES0_PCE + && !(rdes->rdes0 & STM32_RDES0_FT & (STM32_RDES0_IPHCE | + STM32_RDES0_PCE)) #endif - )) && (rdes->rdes0 & STM32_RDES0_FS) && - (rdes->rdes0 & STM32_RDES0_LS)) { + && (rdes->rdes0 & STM32_RDES0_FS) && (rdes->rdes0 & STM32_RDES0_LS)) { /* Found a valid one.*/ rdp->offset = 0; rdp->size = ((rdes->rdes0 & STM32_RDES0_FL_MASK) >> 16) - 4; diff --git a/os/hal/platforms/STM32/mac_lld.h b/os/hal/platforms/STM32/mac_lld.h index 3bedc38a2..75675787a 100644 --- a/os/hal/platforms/STM32/mac_lld.h +++ b/os/hal/platforms/STM32/mac_lld.h @@ -323,13 +323,13 @@ extern "C" { void mac_lld_init(void); void mac_lld_start(MACDriver *macp); void mac_lld_stop(MACDriver *macp); - msg_t max_lld_get_transmit_descriptor(MACDriver *macp, + msg_t mac_lld_get_transmit_descriptor(MACDriver *macp, MACTransmitDescriptor *tdp); size_t mac_lld_write_transmit_descriptor(MACTransmitDescriptor *tdp, uint8_t *buf, size_t size); void mac_lld_release_transmit_descriptor(MACTransmitDescriptor *tdp); - msg_t max_lld_get_receive_descriptor(MACDriver *macp, + msg_t mac_lld_get_receive_descriptor(MACDriver *macp, MACReceiveDescriptor *rdp); size_t mac_lld_read_receive_descriptor(MACReceiveDescriptor *rdp, uint8_t *buf, diff --git a/os/hal/src/mac.c b/os/hal/src/mac.c index 5ffb42b8d..553613438 100644 --- a/os/hal/src/mac.c +++ b/os/hal/src/mac.c @@ -153,7 +153,7 @@ msg_t macWaitTransmitDescriptor(MACDriver *macp, chDbgAssert(macp->state == MAC_ACTIVE, "macWaitTransmitDescriptor(), #1", "not active"); - while (((msg = max_lld_get_transmit_descriptor(macp, tdp)) != RDY_OK) && + while (((msg = mac_lld_get_transmit_descriptor(macp, tdp)) != RDY_OK) && (time > 0)) { chSysLock(); systime_t now = chTimeNow(); @@ -211,7 +211,7 @@ msg_t macWaitReceiveDescriptor(MACDriver *macp, chDbgAssert(macp->state == MAC_ACTIVE, "macWaitReceiveDescriptor(), #1", "not active"); - while (((msg = max_lld_get_receive_descriptor(macp, rdp)) != RDY_OK) && + while (((msg = mac_lld_get_receive_descriptor(macp, rdp)) != RDY_OK) && (time > 0)) { chSysLock(); systime_t now = chTimeNow(); diff --git a/os/hal/templates/mac_lld.c b/os/hal/templates/mac_lld.c index 41c8f331a..167b2673f 100644 --- a/os/hal/templates/mac_lld.c +++ b/os/hal/templates/mac_lld.c @@ -104,7 +104,7 @@ void mac_lld_stop(MACDriver *macp) { * * @notapi */ -msg_t max_lld_get_transmit_descriptor(MACDriver *macp, +msg_t mac_lld_get_transmit_descriptor(MACDriver *macp, MACTransmitDescriptor *tdp) { return RDY_OK; @@ -154,7 +154,7 @@ void mac_lld_release_transmit_descriptor(MACTransmitDescriptor *tdp) { * * @notapi */ -msg_t max_lld_get_receive_descriptor(MACDriver *macp, +msg_t mac_lld_get_receive_descriptor(MACDriver *macp, MACReceiveDescriptor *rdp) { return RDY_TIMEOUT; diff --git a/os/hal/templates/mac_lld.h b/os/hal/templates/mac_lld.h index 2f7e10c8d..ac415c126 100644 --- a/os/hal/templates/mac_lld.h +++ b/os/hal/templates/mac_lld.h @@ -135,13 +135,13 @@ extern "C" { void mac_lld_init(void); void mac_lld_start(MACDriver *macp); void mac_lld_stop(MACDriver *macp); - msg_t max_lld_get_transmit_descriptor(MACDriver *macp, + msg_t mac_lld_get_transmit_descriptor(MACDriver *macp, MACTransmitDescriptor *tdp); size_t mac_lld_write_transmit_descriptor(MACTransmitDescriptor *tdp, uint8_t *buf, size_t size); void mac_lld_release_transmit_descriptor(MACTransmitDescriptor *tdp); - msg_t max_lld_get_receive_descriptor(MACDriver *macp, + msg_t mac_lld_get_receive_descriptor(MACDriver *macp, MACReceiveDescriptor *rdp); size_t mac_lld_read_receive_descriptor(MACReceiveDescriptor *rdp, uint8_t *buf, diff --git a/readme.txt b/readme.txt index 2b2cf1a58..1bfe7fcdb 100644 --- a/readme.txt +++ b/readme.txt @@ -79,6 +79,8 @@ ***************************************************************************** *** 2.5.0 *** +- FIX: Fixed MAC driver functions with invalid name (bug 3522808)(backported + to 2.2.10 and 2.4.1). - FIX: Fixed code coverage crashes with Linux/gcc-4.4.5 (bug 3522301) (backported to 2.4.1). - FIX: Fixed macro dmaWaitCompletion() fails to compile in STM32 HAL (bug diff --git a/testhal/STM32F4xx/USB_CDC/main.c b/testhal/STM32F4xx/USB_CDC/main.c index ff6b2e15b..6e4f3b7a8 100644 --- a/testhal/STM32F4xx/USB_CDC/main.c +++ b/testhal/STM32F4xx/USB_CDC/main.c @@ -236,6 +236,7 @@ static const USBEndpointConfig ep1config = { 0x0040, 0x0000, NULL, + NULL, NULL }; @@ -250,6 +251,7 @@ static const USBEndpointConfig ep2config = { 0x0010, 0x0000, NULL, + NULL, NULL }; @@ -264,6 +266,7 @@ static const USBEndpointConfig ep3config = { 0x0000, 0x0040, NULL, + NULL, NULL };