aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/include/adc.h
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal/include/adc.h')
-rw-r--r--os/hal/include/adc.h47
1 files changed, 10 insertions, 37 deletions
diff --git a/os/hal/include/adc.h b/os/hal/include/adc.h
index 32b4c65a2..626840c5e 100644
--- a/os/hal/include/adc.h
+++ b/os/hal/include/adc.h
@@ -64,10 +64,6 @@
/* Derived constants and error checks. */
/*===========================================================================*/
-#if ADC_USE_MUTUAL_EXCLUSION && !CH_USE_MUTEXES && !CH_USE_SEMAPHORES
-#error "ADC_USE_MUTUAL_EXCLUSION requires CH_USE_MUTEXES and/or CH_USE_SEMAPHORES"
-#endif
-
/*===========================================================================*/
/* Driver data structures and types. */
/*===========================================================================*/
@@ -102,14 +98,8 @@ typedef enum {
*
* @notapi
*/
-#define _adc_reset_i(adcp) { \
- if ((adcp)->thread != NULL) { \
- Thread *tp = (adcp)->thread; \
- (adcp)->thread = NULL; \
- tp->p_u.rdymsg = RDY_RESET; \
- chSchReadyI(tp); \
- } \
-}
+#define _adc_reset_i(adcp) \
+ osalThreadResumeI(&(adcp)->thread, MSG_RESET)
/**
* @brief Resumes a thread waiting for a conversion completion.
@@ -118,13 +108,8 @@ typedef enum {
*
* @notapi
*/
-#define _adc_reset_s(adcp) { \
- if ((adcp)->thread != NULL) { \
- Thread *tp = (adcp)->thread; \
- (adcp)->thread = NULL; \
- chSchWakeupS(tp, RDY_RESET); \
- } \
-}
+#define _adc_reset_s(adcp) \
+ osalThreadResumeS(&(adcp)->thread, MSG_RESET)
/**
* @brief Wakes up the waiting thread.
@@ -134,15 +119,9 @@ typedef enum {
* @notapi
*/
#define _adc_wakeup_isr(adcp) { \
- chSysLockFromIsr(); \
- if ((adcp)->thread != NULL) { \
- Thread *tp; \
- tp = (adcp)->thread; \
- (adcp)->thread = NULL; \
- tp->p_u.rdymsg = RDY_OK; \
- chSchReadyI(tp); \
- } \
- chSysUnlockFromIsr(); \
+ osalSysLockFromISR(); \
+ osalThreadResumeI(&(adcp)->thread, MSG_OK); \
+ osalSysUnlockFromISR(); \
}
/**
@@ -153,15 +132,9 @@ typedef enum {
* @notapi
*/
#define _adc_timeout_isr(adcp) { \
- chSysLockFromIsr(); \
- if ((adcp)->thread != NULL) { \
- Thread *tp; \
- tp = (adcp)->thread; \
- (adcp)->thread = NULL; \
- tp->p_u.rdymsg = RDY_TIMEOUT; \
- chSchReadyI(tp); \
- } \
- chSysUnlockFromIsr(); \
+ osalSysLockFromISR(); \
+ osalThreadResumeI(&(adcp)->thread, MSG_TIMEOUT); \
+ osalSysUnlockFromISR(); \
}
#else /* !ADC_USE_WAIT */