aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/include/adc.h
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-11-25 18:32:45 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-11-25 18:32:45 +0000
commitc852dcb3c960198f49c5fdd8619a6d5d581d9136 (patch)
tree18da29976692bb47392618d38484c7cebbabdffb /os/hal/include/adc.h
parentd973c3f25a6ab56e12b9f858b0692ec4297d84c9 (diff)
downloadChibiOS-c852dcb3c960198f49c5fdd8619a6d5d581d9136.tar.gz
ChibiOS-c852dcb3c960198f49c5fdd8619a6d5d581d9136.tar.bz2
ChibiOS-c852dcb3c960198f49c5fdd8619a6d5d581d9136.zip
Improved ADC and SPI driver models.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2426 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/include/adc.h')
-rw-r--r--os/hal/include/adc.h16
1 files changed, 6 insertions, 10 deletions
diff --git a/os/hal/include/adc.h b/os/hal/include/adc.h
index 48f9d9ff6..0b55d0d15 100644
--- a/os/hal/include/adc.h
+++ b/os/hal/include/adc.h
@@ -122,22 +122,21 @@ typedef enum {
*
* @notapi
*/
-#define _adc_wakeup_i(adcp) { \
- chSysLockFromIsr(); \
- (adcp)->ad_grpp = NULL; \
+#define _adc_wakeup_isr(adcp) { \
if ((adcp)->ad_thread != NULL) { \
Thread *tp = (adcp)->ad_thread; \
(adcp)->ad_thread = NULL; \
+ chSysLockFromIsr(); \
tp->p_u.rdymsg = RDY_OK; \
chSchReadyI(tp); \
+ chSysUnlockFromIsr(); \
} \
- chSysUnlockFromIsr(); \
}
#else /* !ADC_USE_WAIT */
#define _adc_reset_i(adcp)
#define _adc_reset_s(adcp)
-#define _adc_wakeup(adcp)
+#define _adc_wakeup_isr(adcp)
#endif /* !ADC_USE_WAIT */
/**
@@ -192,11 +191,7 @@ typedef enum {
else { \
/* End conversion.*/ \
adc_lld_stop_conversion(adcp); \
- if ((adcp)->ad_grpp->acg_endcb == NULL) { \
- (adcp)->ad_state = ADC_READY; \
- _adc_wakeup_i(adcp); \
- } \
- else { \
+ if ((adcp)->ad_grpp->acg_endcb != NULL) { \
(adcp)->ad_state = ADC_COMPLETE; \
if ((adcp)->ad_depth > 1) { \
/* Invokes the callback passing the 2nd half of the buffer.*/ \
@@ -212,6 +207,7 @@ typedef enum {
(adcp)->ad_state = ADC_READY; \
} \
(adcp)->ad_grpp = NULL; \
+ _adc_wakeup_isr(adcp); \
} \
}