Fixed bugs 3534767, 3534819, 3535887 and 3535938.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4293 35acf78f-673a-0410-8e92-d51de3d6d3f4
master
gdisirio 2012-06-18 08:52:26 +00:00
parent fa2cedd0d0
commit 3626647d7b
11 changed files with 52 additions and 34 deletions

View File

@ -259,7 +259,7 @@
PIN_PUDR_PULLUP(14) | \ PIN_PUDR_PULLUP(14) | \
PIN_PUDR_PULLUP(15)) PIN_PUDR_PULLUP(15))
#define VAL_GPIOC_ODR 0xFFFFFFFF #define VAL_GPIOC_ODR 0xFFFFFFFF
#define VAL_GPIOC_AFRL PIN_AFIO_AF(GPIOC_MCLK, 6)) #define VAL_GPIOC_AFRL (PIN_AFIO_AF(GPIOC_MCLK, 6))
#define VAL_GPIOC_AFRH (PIN_AFIO_AF(GPIOC_SCLK, 6) | \ #define VAL_GPIOC_AFRH (PIN_AFIO_AF(GPIOC_SCLK, 6) | \
PIN_AFIO_AF(GPIOC_SDIN, 6)) PIN_AFIO_AF(GPIOC_SDIN, 6))

View File

@ -210,7 +210,8 @@ typedef enum {
if ((adcp)->depth > 1) { \ if ((adcp)->depth > 1) { \
/* Invokes the callback passing the 2nd half of the buffer.*/ \ /* Invokes the callback passing the 2nd half of the buffer.*/ \
size_t half = (adcp)->depth / 2; \ size_t half = (adcp)->depth / 2; \
(adcp)->grpp->end_cb(adcp, (adcp)->samples + half, half); \ size_t half_index = half * (adcp)->grpp->num_channels; \
(adcp)->grpp->end_cb(adcp, (adcp)->samples + half_index, half); \
} \ } \
else { \ else { \
/* Invokes the callback passing the whole buffer.*/ \ /* Invokes the callback passing the whole buffer.*/ \
@ -226,7 +227,8 @@ typedef enum {
if ((adcp)->depth > 1) { \ if ((adcp)->depth > 1) { \
/* Invokes the callback passing the 2nd half of the buffer.*/ \ /* Invokes the callback passing the 2nd half of the buffer.*/ \
size_t half = (adcp)->depth / 2; \ size_t half = (adcp)->depth / 2; \
(adcp)->grpp->end_cb(adcp, (adcp)->samples + half, half); \ size_t half_index = half * (adcp)->grpp->num_channels; \
(adcp)->grpp->end_cb(adcp, (adcp)->samples + half_index, half); \
} \ } \
else { \ else { \
/* Invokes the callback passing the whole buffer.*/ \ /* Invokes the callback passing the whole buffer.*/ \

View File

@ -265,6 +265,9 @@ void mac_lld_init(void) {
#else #else
/* PHY soft reset procedure.*/ /* PHY soft reset procedure.*/
mii_write(&ETHD1, MII_BMCR, BMCR_RESET); mii_write(&ETHD1, MII_BMCR, BMCR_RESET);
#if defined(BOARD_PHY_RESET_DELAY)
halPolledDelay(BOARD_PHY_RESET_DELAY);
#endif
while (mii_read(&ETHD1, MII_BMCR) & BMCR_RESET) while (mii_read(&ETHD1, MII_BMCR) & BMCR_RESET)
; ;
#endif #endif

View File

@ -372,11 +372,14 @@ void spi_lld_ignore(SPIDriver *spip, size_t n) {
dmaStreamSetMemory0(spip->dmarx, &dummyrx); dmaStreamSetMemory0(spip->dmarx, &dummyrx);
dmaStreamSetTransactionSize(spip->dmarx, n); dmaStreamSetTransactionSize(spip->dmarx, n);
dmaStreamSetMode(spip->dmarx, spip->rxdmamode | STM32_DMA_CR_EN); dmaStreamSetMode(spip->dmarx, spip->rxdmamode);
dmaStreamSetMemory0(spip->dmatx, &dummytx); dmaStreamSetMemory0(spip->dmatx, &dummytx);
dmaStreamSetTransactionSize(spip->dmatx, n); dmaStreamSetTransactionSize(spip->dmatx, n);
dmaStreamSetMode(spip->dmatx, spip->txdmamode | STM32_DMA_CR_EN); dmaStreamSetMode(spip->dmatx, spip->txdmamode);
dmaStreamEnable(spip->dmarx);
dmaStreamEnable(spip->dmatx);
} }
/** /**
@ -399,12 +402,14 @@ void spi_lld_exchange(SPIDriver *spip, size_t n,
dmaStreamSetMemory0(spip->dmarx, rxbuf); dmaStreamSetMemory0(spip->dmarx, rxbuf);
dmaStreamSetTransactionSize(spip->dmarx, n); dmaStreamSetTransactionSize(spip->dmarx, n);
dmaStreamSetMode(spip->dmarx, spip->rxdmamode| STM32_DMA_CR_MINC | dmaStreamSetMode(spip->dmarx, spip->rxdmamode| STM32_DMA_CR_MINC);
STM32_DMA_CR_EN);
dmaStreamSetMemory0(spip->dmatx, txbuf); dmaStreamSetMemory0(spip->dmatx, txbuf);
dmaStreamSetTransactionSize(spip->dmatx, n); dmaStreamSetTransactionSize(spip->dmatx, n);
dmaStreamSetMode(spip->dmatx, spip->txdmamode | STM32_DMA_CR_MINC | dmaStreamSetMode(spip->dmatx, spip->txdmamode | STM32_DMA_CR_MINC);
STM32_DMA_CR_EN);
dmaStreamEnable(spip->dmarx);
dmaStreamEnable(spip->dmatx);
} }
/** /**
@ -424,12 +429,14 @@ void spi_lld_send(SPIDriver *spip, size_t n, const void *txbuf) {
dmaStreamSetMemory0(spip->dmarx, &dummyrx); dmaStreamSetMemory0(spip->dmarx, &dummyrx);
dmaStreamSetTransactionSize(spip->dmarx, n); dmaStreamSetTransactionSize(spip->dmarx, n);
dmaStreamSetMode(spip->dmarx, spip->rxdmamode | STM32_DMA_CR_EN); dmaStreamSetMode(spip->dmarx, spip->rxdmamode);
dmaStreamSetMemory0(spip->dmatx, txbuf); dmaStreamSetMemory0(spip->dmatx, txbuf);
dmaStreamSetTransactionSize(spip->dmatx, n); dmaStreamSetTransactionSize(spip->dmatx, n);
dmaStreamSetMode(spip->dmatx, spip->txdmamode | STM32_DMA_CR_MINC | dmaStreamSetMode(spip->dmatx, spip->txdmamode | STM32_DMA_CR_MINC);
STM32_DMA_CR_EN);
dmaStreamEnable(spip->dmarx);
dmaStreamEnable(spip->dmatx);
} }
/** /**
@ -449,11 +456,14 @@ void spi_lld_receive(SPIDriver *spip, size_t n, void *rxbuf) {
dmaStreamSetMemory0(spip->dmarx, rxbuf); dmaStreamSetMemory0(spip->dmarx, rxbuf);
dmaStreamSetTransactionSize(spip->dmarx, n); dmaStreamSetTransactionSize(spip->dmarx, n);
dmaStreamSetMode(spip->dmarx, spip->rxdmamode | STM32_DMA_CR_MINC | dmaStreamSetMode(spip->dmarx, spip->rxdmamode | STM32_DMA_CR_MINC);
STM32_DMA_CR_EN);
dmaStreamSetMemory0(spip->dmatx, &dummytx); dmaStreamSetMemory0(spip->dmatx, &dummytx);
dmaStreamSetTransactionSize(spip->dmatx, n); dmaStreamSetTransactionSize(spip->dmatx, n);
dmaStreamSetMode(spip->dmatx, spip->txdmamode | STM32_DMA_CR_EN); dmaStreamSetMode(spip->dmatx, spip->txdmamode);
dmaStreamEnable(spip->dmarx);
dmaStreamEnable(spip->dmatx);
} }
/** /**

View File

@ -151,8 +151,7 @@ void adc_lld_init(void) {
STM32_DMA_CR_DIR_P2M | STM32_DMA_CR_DIR_P2M |
STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_PSIZE_HWORD |
STM32_DMA_CR_MINC | STM32_DMA_CR_TCIE | STM32_DMA_CR_MINC | STM32_DMA_CR_TCIE |
STM32_DMA_CR_DMEIE | STM32_DMA_CR_TEIE | STM32_DMA_CR_DMEIE | STM32_DMA_CR_TEIE;
STM32_DMA_CR_EN;
#endif #endif
/* The shared vector is initialized on driver initialization and never /* The shared vector is initialized on driver initialization and never
@ -265,6 +264,7 @@ void adc_lld_start_conversion(ADCDriver *adcp) {
dmaStreamSetTransactionSize(adcp->dmastp, (uint32_t)grpp->num_channels * dmaStreamSetTransactionSize(adcp->dmastp, (uint32_t)grpp->num_channels *
(uint32_t)adcp->depth); (uint32_t)adcp->depth);
dmaStreamSetMode(adcp->dmastp, mode); dmaStreamSetMode(adcp->dmastp, mode);
dmaStreamEnable(adcp->dmastp);
/* ADC setup, if it is defined a callback for the analog watch dog then it /* ADC setup, if it is defined a callback for the analog watch dog then it
is enabled.*/ is enabled.*/

View File

@ -97,7 +97,7 @@ void adc_lld_init(void) {
ADCD1.dmamode = STM32_DMA_CR_PL(STM32_ADC_ADC1_DMA_PRIORITY) | ADCD1.dmamode = STM32_DMA_CR_PL(STM32_ADC_ADC1_DMA_PRIORITY) |
STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_PSIZE_HWORD |
STM32_DMA_CR_MINC | STM32_DMA_CR_TCIE | STM32_DMA_CR_MINC | STM32_DMA_CR_TCIE |
STM32_DMA_CR_TEIE | STM32_DMA_CR_EN; STM32_DMA_CR_TEIE;
/* Temporary activation.*/ /* Temporary activation.*/
rccEnableADC1(FALSE); rccEnableADC1(FALSE);
@ -199,6 +199,7 @@ void adc_lld_start_conversion(ADCDriver *adcp) {
dmaStreamSetMemory0(adcp->dmastp, adcp->samples); dmaStreamSetMemory0(adcp->dmastp, adcp->samples);
dmaStreamSetTransactionSize(adcp->dmastp, n); dmaStreamSetTransactionSize(adcp->dmastp, n);
dmaStreamSetMode(adcp->dmastp, mode); dmaStreamSetMode(adcp->dmastp, mode);
dmaStreamEnable(adcp->dmastp);
/* ADC setup.*/ /* ADC setup.*/
adcp->adc->CR1 = grpp->cr1 | ADC_CR1_SCAN; adcp->adc->CR1 = grpp->cr1 | ADC_CR1_SCAN;

View File

@ -186,8 +186,7 @@ void adc_lld_init(void) {
STM32_DMA_CR_DIR_P2M | STM32_DMA_CR_DIR_P2M |
STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_PSIZE_HWORD |
STM32_DMA_CR_MINC | STM32_DMA_CR_TCIE | STM32_DMA_CR_MINC | STM32_DMA_CR_TCIE |
STM32_DMA_CR_DMEIE | STM32_DMA_CR_TEIE | STM32_DMA_CR_DMEIE | STM32_DMA_CR_TEIE;
STM32_DMA_CR_EN;
#endif #endif
#if STM32_ADC_USE_ADC2 #if STM32_ADC_USE_ADC2
@ -200,8 +199,7 @@ void adc_lld_init(void) {
STM32_DMA_CR_DIR_P2M | STM32_DMA_CR_DIR_P2M |
STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_PSIZE_HWORD |
STM32_DMA_CR_MINC | STM32_DMA_CR_TCIE | STM32_DMA_CR_MINC | STM32_DMA_CR_TCIE |
STM32_DMA_CR_DMEIE | STM32_DMA_CR_TEIE | STM32_DMA_CR_DMEIE | STM32_DMA_CR_TEIE;
STM32_DMA_CR_EN;
#endif #endif
#if STM32_ADC_USE_ADC3 #if STM32_ADC_USE_ADC3
@ -214,8 +212,7 @@ void adc_lld_init(void) {
STM32_DMA_CR_DIR_P2M | STM32_DMA_CR_DIR_P2M |
STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_PSIZE_HWORD |
STM32_DMA_CR_MINC | STM32_DMA_CR_TCIE | STM32_DMA_CR_MINC | STM32_DMA_CR_TCIE |
STM32_DMA_CR_DMEIE | STM32_DMA_CR_TEIE | STM32_DMA_CR_DMEIE | STM32_DMA_CR_TEIE;
STM32_DMA_CR_EN;
#endif #endif
/* The shared vector is initialized on driver initialization and never /* The shared vector is initialized on driver initialization and never
@ -338,6 +335,7 @@ void adc_lld_start_conversion(ADCDriver *adcp) {
dmaStreamSetTransactionSize(adcp->dmastp, (uint32_t)grpp->num_channels * dmaStreamSetTransactionSize(adcp->dmastp, (uint32_t)grpp->num_channels *
(uint32_t)adcp->depth); (uint32_t)adcp->depth);
dmaStreamSetMode(adcp->dmastp, mode); dmaStreamSetMode(adcp->dmastp, mode);
dmaStreamEnable(adcp->dmastp);
/* ADC setup.*/ /* ADC setup.*/
adcp->adc->SR = 0; adcp->adc->SR = 0;

View File

@ -186,8 +186,7 @@ void adc_lld_init(void) {
STM32_DMA_CR_DIR_P2M | STM32_DMA_CR_DIR_P2M |
STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_PSIZE_HWORD |
STM32_DMA_CR_MINC | STM32_DMA_CR_TCIE | STM32_DMA_CR_MINC | STM32_DMA_CR_TCIE |
STM32_DMA_CR_DMEIE | STM32_DMA_CR_TEIE | STM32_DMA_CR_DMEIE | STM32_DMA_CR_TEIE;
STM32_DMA_CR_EN;
#endif #endif
#if STM32_ADC_USE_ADC2 #if STM32_ADC_USE_ADC2
@ -200,8 +199,7 @@ void adc_lld_init(void) {
STM32_DMA_CR_DIR_P2M | STM32_DMA_CR_DIR_P2M |
STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_PSIZE_HWORD |
STM32_DMA_CR_MINC | STM32_DMA_CR_TCIE | STM32_DMA_CR_MINC | STM32_DMA_CR_TCIE |
STM32_DMA_CR_DMEIE | STM32_DMA_CR_TEIE | STM32_DMA_CR_DMEIE | STM32_DMA_CR_TEIE;
STM32_DMA_CR_EN;
#endif #endif
#if STM32_ADC_USE_ADC3 #if STM32_ADC_USE_ADC3
@ -214,8 +212,7 @@ void adc_lld_init(void) {
STM32_DMA_CR_DIR_P2M | STM32_DMA_CR_DIR_P2M |
STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_PSIZE_HWORD |
STM32_DMA_CR_MINC | STM32_DMA_CR_TCIE | STM32_DMA_CR_MINC | STM32_DMA_CR_TCIE |
STM32_DMA_CR_DMEIE | STM32_DMA_CR_TEIE | STM32_DMA_CR_DMEIE | STM32_DMA_CR_TEIE;
STM32_DMA_CR_EN;
#endif #endif
/* The shared vector is initialized on driver initialization and never /* The shared vector is initialized on driver initialization and never
@ -338,6 +335,7 @@ void adc_lld_start_conversion(ADCDriver *adcp) {
dmaStreamSetTransactionSize(adcp->dmastp, (uint32_t)grpp->num_channels * dmaStreamSetTransactionSize(adcp->dmastp, (uint32_t)grpp->num_channels *
(uint32_t)adcp->depth); (uint32_t)adcp->depth);
dmaStreamSetMode(adcp->dmastp, mode); dmaStreamSetMode(adcp->dmastp, mode);
dmaStreamEnable(adcp->dmastp);
/* ADC setup.*/ /* ADC setup.*/
adcp->adc->SR = 0; adcp->adc->SR = 0;

View File

@ -129,8 +129,7 @@ void adc_lld_init(void) {
STM32_DMA_CR_DIR_P2M | STM32_DMA_CR_DIR_P2M |
STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_PSIZE_HWORD |
STM32_DMA_CR_MINC | STM32_DMA_CR_TCIE | STM32_DMA_CR_MINC | STM32_DMA_CR_TCIE |
STM32_DMA_CR_DMEIE | STM32_DMA_CR_TEIE | STM32_DMA_CR_DMEIE | STM32_DMA_CR_TEIE;
STM32_DMA_CR_EN;
#endif #endif
/* The shared vector is initialized on driver initialization and never /* The shared vector is initialized on driver initialization and never
@ -217,6 +216,7 @@ void adc_lld_start_conversion(ADCDriver *adcp) {
dmaStreamSetTransactionSize(adcp->dmastp, (uint32_t)grpp->num_channels * dmaStreamSetTransactionSize(adcp->dmastp, (uint32_t)grpp->num_channels *
(uint32_t)adcp->depth); (uint32_t)adcp->depth);
dmaStreamSetMode(adcp->dmastp, mode); dmaStreamSetMode(adcp->dmastp, mode);
dmaStreamEnable(adcp->dmastp);
/* ADC setup.*/ /* ADC setup.*/
adcp->adc->SR = 0; adcp->adc->SR = 0;

View File

@ -423,13 +423,13 @@ void mmcObjectInit(MMCDriver *mmcp) {
* @brief Configures and activates the MMC peripheral. * @brief Configures and activates the MMC peripheral.
* *
* @param[in] mmcp pointer to the @p MMCDriver object * @param[in] mmcp pointer to the @p MMCDriver object
* @param[in] config pointer to the @p MMCConfig object. Must be @p NULL. * @param[in] config pointer to the @p MMCConfig object.
* *
* @api * @api
*/ */
void mmcStart(MMCDriver *mmcp, const MMCConfig *config) { void mmcStart(MMCDriver *mmcp, const MMCConfig *config) {
chDbgCheck((mmcp != NULL) && (config == NULL), "mmcStart"); chDbgCheck((mmcp != NULL) && (config != NULL), "mmcStart");
chSysLock(); chSysLock();
chDbgAssert(mmcp->state == MMC_STOP, "mmcStart(), #1", "invalid state"); chDbgAssert(mmcp->state == MMC_STOP, "mmcStart(), #1", "invalid state");

View File

@ -81,6 +81,12 @@
***************************************************************************** *****************************************************************************
*** 2.5.0 *** *** 2.5.0 ***
- FIX: Fixed issue with DMA channel init in STM32 ADC and SPI drivers (bug
3535938)(backported to 2.2.10 and 2.4.2).
- FIX: Fixed issue debugging mmc_spi (bug 3535887)(trunk only).
- FIX: Fixed unreliable PHY initialization (bug 3534819)(backported to 2.4.2).
- FIX: Fixed wrong ADC callback buffer pointer in ADC driver (bug 3534767)
(backported to 2.2.10 and 2.4.2).
- FIX: Fixed STM32F2 RTC subseconds (bug 3533414)(trunk only). - FIX: Fixed STM32F2 RTC subseconds (bug 3533414)(trunk only).
- FIX: Fixed problem with arm-v6m and state checker (bug 3532591)(backported - FIX: Fixed problem with arm-v6m and state checker (bug 3532591)(backported
to 2.4.2). to 2.4.2).