diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2014-05-07 08:11:03 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2014-05-07 08:11:03 +0000 |
commit | bec915e05274a94f2b1a5e2443f04de826dd1f6e (patch) | |
tree | cec2044911766f5dc5a7bd8b8c9ffe0fe81734f8 /os/hal/include/adc.h | |
parent | 4afa0b98dff9eac6a94c104acf900e15147d2da3 (diff) | |
parent | b43c71424d201583822b26d13d11f7e3634cb515 (diff) | |
download | ChibiOS-bec915e05274a94f2b1a5e2443f04de826dd1f6e.tar.gz ChibiOS-bec915e05274a94f2b1a5e2443f04de826dd1f6e.tar.bz2 ChibiOS-bec915e05274a94f2b1a5e2443f04de826dd1f6e.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@6916 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/include/adc.h')
-rw-r--r-- | os/hal/include/adc.h | 47 |
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 */
|