Fixed bug 3064204.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2175 35acf78f-673a-0410-8e92-d51de3d6d3f4
master
gdisirio 2010-09-11 10:57:11 +00:00
parent d51840a0c7
commit 781b0b129c
35 changed files with 318 additions and 11 deletions

View File

@ -62,6 +62,11 @@
#define CH_HAL_USE_ADC FALSE
#endif
/*
* Default ADC settings overrides (uncomment to override).
*/
/*#define ADC_USE_WAIT TRUE*/
/*===========================================================================*/
/* CAN driver related settings. */
/*===========================================================================*/
@ -73,6 +78,11 @@
#define CH_HAL_USE_CAN FALSE
#endif
/*
* Default CAN settings overrides (uncomment to override).
*/
/*#define CAN_USE_SLEEP_MODE TRUE*/
/*===========================================================================*/
/* MAC driver related settings. */
/*===========================================================================*/

View File

@ -62,6 +62,11 @@
#define CH_HAL_USE_ADC FALSE
#endif
/*
* Default ADC settings overrides (uncomment to override).
*/
/*#define ADC_USE_WAIT TRUE*/
/*===========================================================================*/
/* CAN driver related settings. */
/*===========================================================================*/
@ -73,6 +78,11 @@
#define CH_HAL_USE_CAN FALSE
#endif
/*
* Default CAN settings overrides (uncomment to override).
*/
/*#define CAN_USE_SLEEP_MODE TRUE*/
/*===========================================================================*/
/* MAC driver related settings. */
/*===========================================================================*/

View File

@ -62,6 +62,11 @@
#define CH_HAL_USE_ADC FALSE
#endif
/*
* Default ADC settings overrides (uncomment to override).
*/
/*#define ADC_USE_WAIT TRUE*/
/*===========================================================================*/
/* CAN driver related settings. */
/*===========================================================================*/
@ -73,6 +78,11 @@
#define CH_HAL_USE_CAN FALSE
#endif
/*
* Default CAN settings overrides (uncomment to override).
*/
/*#define CAN_USE_SLEEP_MODE TRUE*/
/*===========================================================================*/
/* MAC driver related settings. */
/*===========================================================================*/

View File

@ -62,6 +62,11 @@
#define CH_HAL_USE_ADC FALSE
#endif
/*
* Default ADC settings overrides (uncomment to override).
*/
/*#define ADC_USE_WAIT TRUE*/
/*===========================================================================*/
/* CAN driver related settings. */
/*===========================================================================*/
@ -73,6 +78,11 @@
#define CH_HAL_USE_CAN FALSE
#endif
/*
* Default CAN settings overrides (uncomment to override).
*/
/*#define CAN_USE_SLEEP_MODE TRUE*/
/*===========================================================================*/
/* MAC driver related settings. */
/*===========================================================================*/

View File

@ -62,6 +62,11 @@
#define CH_HAL_USE_ADC FALSE
#endif
/*
* Default ADC settings overrides (uncomment to override).
*/
/*#define ADC_USE_WAIT TRUE*/
/*===========================================================================*/
/* CAN driver related settings. */
/*===========================================================================*/
@ -73,6 +78,11 @@
#define CH_HAL_USE_CAN FALSE
#endif
/*
* Default CAN settings overrides (uncomment to override).
*/
/*#define CAN_USE_SLEEP_MODE TRUE*/
/*===========================================================================*/
/* MAC driver related settings. */
/*===========================================================================*/

View File

@ -62,6 +62,11 @@
#define CH_HAL_USE_ADC FALSE
#endif
/*
* Default ADC settings overrides (uncomment to override).
*/
/*#define ADC_USE_WAIT TRUE*/
/*===========================================================================*/
/* CAN driver related settings. */
/*===========================================================================*/
@ -73,6 +78,11 @@
#define CH_HAL_USE_CAN FALSE
#endif
/*
* Default CAN settings overrides (uncomment to override).
*/
/*#define CAN_USE_SLEEP_MODE TRUE*/
/*===========================================================================*/
/* MAC driver related settings. */
/*===========================================================================*/

View File

@ -62,6 +62,11 @@
#define CH_HAL_USE_ADC FALSE
#endif
/*
* Default ADC settings overrides (uncomment to override).
*/
/*#define ADC_USE_WAIT TRUE*/
/*===========================================================================*/
/* CAN driver related settings. */
/*===========================================================================*/
@ -73,6 +78,11 @@
#define CH_HAL_USE_CAN FALSE
#endif
/*
* Default CAN settings overrides (uncomment to override).
*/
/*#define CAN_USE_SLEEP_MODE TRUE*/
/*===========================================================================*/
/* MAC driver related settings. */
/*===========================================================================*/

View File

@ -62,6 +62,11 @@
#define CH_HAL_USE_ADC FALSE
#endif
/*
* Default ADC settings overrides (uncomment to override).
*/
/*#define ADC_USE_WAIT TRUE*/
/*===========================================================================*/
/* CAN driver related settings. */
/*===========================================================================*/
@ -73,6 +78,11 @@
#define CH_HAL_USE_CAN FALSE
#endif
/*
* Default CAN settings overrides (uncomment to override).
*/
/*#define CAN_USE_SLEEP_MODE TRUE*/
/*===========================================================================*/
/* MAC driver related settings. */
/*===========================================================================*/

View File

@ -62,6 +62,11 @@
#define CH_HAL_USE_ADC FALSE
#endif
/*
* Default ADC settings overrides (uncomment to override).
*/
/*#define ADC_USE_WAIT TRUE*/
/*===========================================================================*/
/* CAN driver related settings. */
/*===========================================================================*/
@ -73,6 +78,11 @@
#define CH_HAL_USE_CAN FALSE
#endif
/*
* Default CAN settings overrides (uncomment to override).
*/
/*#define CAN_USE_SLEEP_MODE TRUE*/
/*===========================================================================*/
/* MAC driver related settings. */
/*===========================================================================*/

View File

@ -62,6 +62,11 @@
#define CH_HAL_USE_ADC FALSE
#endif
/*
* Default ADC settings overrides (uncomment to override).
*/
/*#define ADC_USE_WAIT TRUE*/
/*===========================================================================*/
/* CAN driver related settings. */
/*===========================================================================*/
@ -73,6 +78,11 @@
#define CH_HAL_USE_CAN FALSE
#endif
/*
* Default CAN settings overrides (uncomment to override).
*/
/*#define CAN_USE_SLEEP_MODE TRUE*/
/*===========================================================================*/
/* MAC driver related settings. */
/*===========================================================================*/

View File

@ -62,6 +62,11 @@
#define CH_HAL_USE_ADC FALSE
#endif
/*
* Default ADC settings overrides (uncomment to override).
*/
/*#define ADC_USE_WAIT TRUE*/
/*===========================================================================*/
/* CAN driver related settings. */
/*===========================================================================*/
@ -73,6 +78,11 @@
#define CH_HAL_USE_CAN FALSE
#endif
/*
* Default CAN settings overrides (uncomment to override).
*/
/*#define CAN_USE_SLEEP_MODE TRUE*/
/*===========================================================================*/
/* MAC driver related settings. */
/*===========================================================================*/

View File

@ -62,6 +62,11 @@
#define CH_HAL_USE_ADC FALSE
#endif
/*
* Default ADC settings overrides (uncomment to override).
*/
/*#define ADC_USE_WAIT TRUE*/
/*===========================================================================*/
/* CAN driver related settings. */
/*===========================================================================*/
@ -73,6 +78,11 @@
#define CH_HAL_USE_CAN FALSE
#endif
/*
* Default CAN settings overrides (uncomment to override).
*/
/*#define CAN_USE_SLEEP_MODE TRUE*/
/*===========================================================================*/
/* MAC driver related settings. */
/*===========================================================================*/

View File

@ -62,6 +62,11 @@
#define CH_HAL_USE_ADC FALSE
#endif
/*
* Default ADC settings overrides (uncomment to override).
*/
/*#define ADC_USE_WAIT TRUE*/
/*===========================================================================*/
/* CAN driver related settings. */
/*===========================================================================*/
@ -73,6 +78,11 @@
#define CH_HAL_USE_CAN FALSE
#endif
/*
* Default CAN settings overrides (uncomment to override).
*/
/*#define CAN_USE_SLEEP_MODE TRUE*/
/*===========================================================================*/
/* MAC driver related settings. */
/*===========================================================================*/

View File

@ -62,6 +62,11 @@
#define CH_HAL_USE_ADC FALSE
#endif
/*
* Default ADC settings overrides (uncomment to override).
*/
/*#define ADC_USE_WAIT TRUE*/
/*===========================================================================*/
/* CAN driver related settings. */
/*===========================================================================*/
@ -73,6 +78,11 @@
#define CH_HAL_USE_CAN FALSE
#endif
/*
* Default CAN settings overrides (uncomment to override).
*/
/*#define CAN_USE_SLEEP_MODE TRUE*/
/*===========================================================================*/
/* MAC driver related settings. */
/*===========================================================================*/

View File

@ -62,6 +62,11 @@
#define CH_HAL_USE_ADC FALSE
#endif
/*
* Default ADC settings overrides (uncomment to override).
*/
/*#define ADC_USE_WAIT TRUE*/
/*===========================================================================*/
/* CAN driver related settings. */
/*===========================================================================*/
@ -73,6 +78,11 @@
#define CH_HAL_USE_CAN FALSE
#endif
/*
* Default CAN settings overrides (uncomment to override).
*/
/*#define CAN_USE_SLEEP_MODE TRUE*/
/*===========================================================================*/
/* MAC driver related settings. */
/*===========================================================================*/

View File

@ -62,6 +62,11 @@
#define CH_HAL_USE_ADC FALSE
#endif
/*
* Default ADC settings overrides (uncomment to override).
*/
/*#define ADC_USE_WAIT TRUE*/
/*===========================================================================*/
/* CAN driver related settings. */
/*===========================================================================*/
@ -73,6 +78,11 @@
#define CH_HAL_USE_CAN FALSE
#endif
/*
* Default CAN settings overrides (uncomment to override).
*/
/*#define CAN_USE_SLEEP_MODE TRUE*/
/*===========================================================================*/
/* MAC driver related settings. */
/*===========================================================================*/

View File

@ -62,6 +62,11 @@
#define CH_HAL_USE_ADC FALSE
#endif
/*
* Default ADC settings overrides (uncomment to override).
*/
/*#define ADC_USE_WAIT TRUE*/
/*===========================================================================*/
/* CAN driver related settings. */
/*===========================================================================*/
@ -73,6 +78,11 @@
#define CH_HAL_USE_CAN FALSE
#endif
/*
* Default CAN settings overrides (uncomment to override).
*/
/*#define CAN_USE_SLEEP_MODE TRUE*/
/*===========================================================================*/
/* MAC driver related settings. */
/*===========================================================================*/

View File

@ -62,6 +62,11 @@
#define CH_HAL_USE_ADC FALSE
#endif
/*
* Default ADC settings overrides (uncomment to override).
*/
/*#define ADC_USE_WAIT TRUE*/
/*===========================================================================*/
/* CAN driver related settings. */
/*===========================================================================*/
@ -73,6 +78,11 @@
#define CH_HAL_USE_CAN FALSE
#endif
/*
* Default CAN settings overrides (uncomment to override).
*/
/*#define CAN_USE_SLEEP_MODE TRUE*/
/*===========================================================================*/
/* MAC driver related settings. */
/*===========================================================================*/

View File

@ -62,6 +62,11 @@
#define CH_HAL_USE_ADC FALSE
#endif
/*
* Default ADC settings overrides (uncomment to override).
*/
/*#define ADC_USE_WAIT TRUE*/
/*===========================================================================*/
/* CAN driver related settings. */
/*===========================================================================*/
@ -73,6 +78,11 @@
#define CH_HAL_USE_CAN FALSE
#endif
/*
* Default CAN settings overrides (uncomment to override).
*/
/*#define CAN_USE_SLEEP_MODE TRUE*/
/*===========================================================================*/
/* MAC driver related settings. */
/*===========================================================================*/

View File

@ -62,6 +62,11 @@
#define CH_HAL_USE_ADC FALSE
#endif
/*
* Default ADC settings overrides (uncomment to override).
*/
/*#define ADC_USE_WAIT TRUE*/
/*===========================================================================*/
/* CAN driver related settings. */
/*===========================================================================*/
@ -73,6 +78,11 @@
#define CH_HAL_USE_CAN FALSE
#endif
/*
* Default CAN settings overrides (uncomment to override).
*/
/*#define CAN_USE_SLEEP_MODE TRUE*/
/*===========================================================================*/
/* MAC driver related settings. */
/*===========================================================================*/

View File

@ -62,6 +62,11 @@
#define CH_HAL_USE_ADC FALSE
#endif
/*
* Default ADC settings overrides (uncomment to override).
*/
/*#define ADC_USE_WAIT TRUE*/
/*===========================================================================*/
/* CAN driver related settings. */
/*===========================================================================*/
@ -73,6 +78,11 @@
#define CH_HAL_USE_CAN FALSE
#endif
/*
* Default CAN settings overrides (uncomment to override).
*/
/*#define CAN_USE_SLEEP_MODE TRUE*/
/*===========================================================================*/
/* MAC driver related settings. */
/*===========================================================================*/

View File

@ -38,12 +38,19 @@
/* Driver pre-compile time settings. */
/*===========================================================================*/
/**
* @brief Inclusion of the @p adcWaitConversion() function.
*/
#if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__)
#define ADC_USE_WAIT TRUE
#endif
/*===========================================================================*/
/* Derived constants and error checks. */
/*===========================================================================*/
#if !CH_USE_SEMAPHORES
#error "ADC driver requires CH_USE_SEMAPHORES"
#if ADC_USE_WAIT && !CH_USE_SEMAPHORES
#error "ADC driver requires CH_USE_SEMAPHORES when ADC_USE_WAIT is enabled"
#endif
/*===========================================================================*/
@ -90,7 +97,9 @@ extern "C" {
adccallback_t callback);
void adcStopConversion(ADCDriver *adcp);
void adcStopConversionI(ADCDriver *adcp);
#if ADC_USE_WAIT
msg_t adcWaitConversion(ADCDriver *adcp, systime_t timeout);
#endif
#ifdef __cplusplus
}
#endif

View File

@ -62,7 +62,9 @@
/**
* @brief Sleep mode related APIs inclusion switch.
*/
#if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__)
#define CAN_USE_SLEEP_MODE TRUE
#endif
/*===========================================================================*/
/* Derived constants and error checks. */

View File

@ -76,9 +76,11 @@ CH_IRQ_HANDLER(DMA1_Ch1_IRQHandler) {
adc_lld_stop_conversion(&ADCD1);
ADCD1.ad_grpp = NULL;
ADCD1.ad_state = ADC_COMPLETE;
#if ADC_USE_WAIT
chSysLockFromIsr();
chSemResetI(&ADCD1.ad_sem, 0);
chSysUnlockFromIsr();
#endif
}
/* Callback handling.*/
if (ADCD1.ad_callback != NULL) {

View File

@ -194,10 +194,6 @@ typedef struct {
* @brief Current configuration data.
*/
const ADCConfig *ad_config;
/**
* @brief Synchronization semaphore.
*/
Semaphore ad_sem;
/**
* @brief Current callback function or @p NULL.
*/
@ -214,6 +210,12 @@ typedef struct {
* @brief Current conversion group pointer or @p NULL.
*/
const ADCConversionGroup *ad_grpp;
#if ADC_USE_WAIT
/**
* @brief Synchronization semaphore.
*/
Semaphore ad_sem;
#endif
/* End of the mandatory fields.*/
/**
* @brief Pointer to the ADCx registers block.

View File

@ -67,7 +67,9 @@ void adcObjectInit(ADCDriver *adcp) {
adcp->ad_samples = NULL;
adcp->ad_depth = 0;
adcp->ad_grpp = NULL;
#if ADC_USE_WAIT
chSemInit(&adcp->ad_sem, 0);
#endif
}
/**
@ -229,8 +231,10 @@ void adcStopConversion(ADCDriver *adcp) {
adc_lld_stop_conversion(adcp);
adcp->ad_grpp = NULL;
adcp->ad_state = ADC_READY;
#if ADC_USE_WAIT
chSemResetI(&adcp->ad_sem, 0);
chSchRescheduleS();
#endif
}
else
adcp->ad_state = ADC_READY;
@ -258,12 +262,15 @@ void adcStopConversionI(ADCDriver *adcp) {
adc_lld_stop_conversion(adcp);
adcp->ad_grpp = NULL;
adcp->ad_state = ADC_READY;
#if ADC_USE_WAIT
chSemResetI(&adcp->ad_sem, 0);
#endif
}
else
adcp->ad_state = ADC_READY;
}
#if ADC_USE_WAIT || defined(__DOXYGEN__)
/**
* @brief Waits for completion.
* @details If the conversion is not completed or not yet started then the
@ -296,6 +303,7 @@ msg_t adcWaitConversion(ADCDriver *adcp, systime_t timeout) {
chSysUnlock();
return RDY_OK;
}
#endif /* ADC_USE_WAIT */
#endif /* CH_HAL_USE_ADC */

View File

@ -111,10 +111,6 @@ typedef struct {
* @brief Current configuration data.
*/
const ADCConfig *ad_config;
/**
* @brief Synchronization semaphore.
*/
Semaphore ad_sem;
/**
* @brief Current callback function or @p NULL.
*/
@ -131,6 +127,12 @@ typedef struct {
* @brief Current conversion group pointer or @p NULL.
*/
const ADCConversionGroup *ad_grpp;
#if ADC_USE_WAIT
/**
* @brief Synchronization semaphore.
*/
Semaphore ad_sem;
#endif
/* End of the mandatory fields.*/
} ADCDriver;

View File

@ -62,6 +62,7 @@
*****************************************************************************
*** 2.1.2 ***
- FIX: Fixed CAN_USE_SLEEP_MODE setting (bug 3064204)(backported to 2.0.5).
- FIX: Fixed potential issue with GCC reorganizing instructions around "asm
volatile" statements (bug 3058731)(backported in 2.0.4).
- FIX: Fixed reduced ARM7 performance with GCC 4.5.x (bug 3056866)(backported
@ -96,7 +97,8 @@
is no footprint overhead.
- NEW: Added adcStartConversionI() and adcStopConversionI() APIs to the ADC
driver in order to allow the driver control from within callbacks or other
interrupt handlers.
interrupt handlers. Made the adcWaitConversion() API optional, this allows
to save some space in Flash/RAM if it is not required.
- NEW: Added a generic BaseFileStream interface for future File System
implementations or integrations (untested and not sure if it will stay or
change).

View File

@ -62,6 +62,11 @@
#define CH_HAL_USE_ADC FALSE
#endif
/*
* Default ADC settings overrides (uncomment to override).
*/
/*#define ADC_USE_WAIT TRUE*/
/*===========================================================================*/
/* CAN driver related settings. */
/*===========================================================================*/
@ -73,6 +78,11 @@
#define CH_HAL_USE_CAN FALSE
#endif
/*
* Default CAN settings overrides (uncomment to override).
*/
/*#define CAN_USE_SLEEP_MODE TRUE*/
/*===========================================================================*/
/* MAC driver related settings. */
/*===========================================================================*/

View File

@ -62,6 +62,11 @@
#define CH_HAL_USE_ADC TRUE
#endif
/*
* Default ADC settings overrides (uncomment to override).
*/
/*#define ADC_USE_WAIT TRUE*/
/*===========================================================================*/
/* CAN driver related settings. */
/*===========================================================================*/
@ -73,6 +78,11 @@
#define CH_HAL_USE_CAN FALSE
#endif
/*
* Default CAN settings overrides (uncomment to override).
*/
/*#define CAN_USE_SLEEP_MODE TRUE*/
/*===========================================================================*/
/* MAC driver related settings. */
/*===========================================================================*/

View File

@ -62,6 +62,11 @@
#define CH_HAL_USE_ADC FALSE
#endif
/*
* Default ADC settings overrides (uncomment to override).
*/
/*#define ADC_USE_WAIT TRUE*/
/*===========================================================================*/
/* CAN driver related settings. */
/*===========================================================================*/
@ -73,6 +78,11 @@
#define CH_HAL_USE_CAN TRUE
#endif
/*
* Default CAN settings overrides (uncomment to override).
*/
/*#define CAN_USE_SLEEP_MODE TRUE*/
/*===========================================================================*/
/* MAC driver related settings. */
/*===========================================================================*/

View File

@ -62,6 +62,11 @@
#define CH_HAL_USE_ADC FALSE
#endif
/*
* Default ADC settings overrides (uncomment to override).
*/
/*#define ADC_USE_WAIT TRUE*/
/*===========================================================================*/
/* CAN driver related settings. */
/*===========================================================================*/
@ -73,6 +78,11 @@
#define CH_HAL_USE_CAN FALSE
#endif
/*
* Default CAN settings overrides (uncomment to override).
*/
/*#define CAN_USE_SLEEP_MODE TRUE*/
/*===========================================================================*/
/* MAC driver related settings. */
/*===========================================================================*/

View File

@ -62,6 +62,11 @@
#define CH_HAL_USE_ADC FALSE
#endif
/*
* Default ADC settings overrides (uncomment to override).
*/
/*#define ADC_USE_WAIT TRUE*/
/*===========================================================================*/
/* CAN driver related settings. */
/*===========================================================================*/
@ -73,6 +78,11 @@
#define CH_HAL_USE_CAN FALSE
#endif
/*
* Default CAN settings overrides (uncomment to override).
*/
/*#define CAN_USE_SLEEP_MODE TRUE*/
/*===========================================================================*/
/* MAC driver related settings. */
/*===========================================================================*/

View File

@ -62,6 +62,11 @@
#define CH_HAL_USE_ADC FALSE
#endif
/*
* Default ADC settings overrides (uncomment to override).
*/
/*#define ADC_USE_WAIT TRUE*/
/*===========================================================================*/
/* CAN driver related settings. */
/*===========================================================================*/
@ -73,6 +78,11 @@
#define CH_HAL_USE_CAN FALSE
#endif
/*
* Default CAN settings overrides (uncomment to override).
*/
/*#define CAN_USE_SLEEP_MODE TRUE*/
/*===========================================================================*/
/* MAC driver related settings. */
/*===========================================================================*/

View File

@ -62,6 +62,11 @@
#define CH_HAL_USE_ADC TRUE
#endif
/*
* Default ADC settings overrides (uncomment to override).
*/
/*#define ADC_USE_WAIT TRUE*/
/*===========================================================================*/
/* CAN driver related settings. */
/*===========================================================================*/
@ -73,6 +78,11 @@
#define CH_HAL_USE_CAN TRUE
#endif
/*
* Default CAN settings overrides (uncomment to override).
*/
/*#define CAN_USE_SLEEP_MODE TRUE*/
/*===========================================================================*/
/* MAC driver related settings. */
/*===========================================================================*/