From 16178e1c45a76544d34ce63db37932838353637c Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 28 Nov 2009 12:25:35 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1333 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/include/adc.h | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 os/hal/include/adc.h (limited to 'os/hal/include/adc.h') diff --git a/os/hal/include/adc.h b/os/hal/include/adc.h new file mode 100644 index 000000000..af08502a8 --- /dev/null +++ b/os/hal/include/adc.h @@ -0,0 +1,70 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +/** + * @file adc.h + * @brief ADC Driver macros and structures. + * @addtogroup ADC + * @{ + */ + +#ifndef _ADC_H_ +#define _ADC_H_ + +#if CH_HAL_USE_ADC + +#if !CH_USE_SEMAPHORES +#error "ADC driver requires CH_USE_SEMAPHORES" +#endif + +/** + * @brief Driver state machine possible states. + */ +typedef enum { + ADC_UNINIT = 0, /**< @brief Not initialized. */ + ADC_STOP = 1, /**< @brief Stopped. */ + ADC_READY = 2, /**< @brief Ready. */ + ADC_RUNNING = 3 /**< @brief Conversion running. */ +} adcstate_t; + +#include "adc_lld.h" + +#ifdef __cplusplus +extern "C" { +#endif + void adcInit(void); + void adcObjectInit(ADCDriver *adcp); + void adcStart(ADCDriver *adcp, const ADCConfig *config); + void adcStop(ADCDriver *adcp); + bool_t adcStartConversion(ADCDriver *adcp, + const ADCConversionGroup *grpp, + adcsample_t *samples, + size_t depth, + adccallback_t callback); + void adcStopConversion(ADCDriver *adcp); + msg_t adcWaitConversion(ADCDriver *adcp, systime_t timeout); +#ifdef __cplusplus +} +#endif + +#endif /* CH_HAL_USE_ADC */ + +#endif /* _ADC_H_ */ + +/** @} */ -- cgit v1.2.3 From 2f43c85736e70a59c0b3675d01d4ddc521223263 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 28 Nov 2009 20:09:14 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1339 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/include/adc.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'os/hal/include/adc.h') diff --git a/os/hal/include/adc.h b/os/hal/include/adc.h index af08502a8..67ebf5ca2 100644 --- a/os/hal/include/adc.h +++ b/os/hal/include/adc.h @@ -40,7 +40,8 @@ typedef enum { ADC_UNINIT = 0, /**< @brief Not initialized. */ ADC_STOP = 1, /**< @brief Stopped. */ ADC_READY = 2, /**< @brief Ready. */ - ADC_RUNNING = 3 /**< @brief Conversion running. */ + ADC_RUNNING = 3, /**< @brief Conversion running. */ + ADC_COMPLETE = 4 /**< @brief Conversion complete.*/ } adcstate_t; #include "adc_lld.h" -- cgit v1.2.3 From 0d0e4d619185ad86270ca5c0212c314f7f4529d5 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 29 Nov 2009 08:25:31 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1342 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/include/adc.h | 71 ---------------------------------------------------- 1 file changed, 71 deletions(-) delete mode 100644 os/hal/include/adc.h (limited to 'os/hal/include/adc.h') diff --git a/os/hal/include/adc.h b/os/hal/include/adc.h deleted file mode 100644 index 67ebf5ca2..000000000 --- a/os/hal/include/adc.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. - - This file is part of ChibiOS/RT. - - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file adc.h - * @brief ADC Driver macros and structures. - * @addtogroup ADC - * @{ - */ - -#ifndef _ADC_H_ -#define _ADC_H_ - -#if CH_HAL_USE_ADC - -#if !CH_USE_SEMAPHORES -#error "ADC driver requires CH_USE_SEMAPHORES" -#endif - -/** - * @brief Driver state machine possible states. - */ -typedef enum { - ADC_UNINIT = 0, /**< @brief Not initialized. */ - ADC_STOP = 1, /**< @brief Stopped. */ - ADC_READY = 2, /**< @brief Ready. */ - ADC_RUNNING = 3, /**< @brief Conversion running. */ - ADC_COMPLETE = 4 /**< @brief Conversion complete.*/ -} adcstate_t; - -#include "adc_lld.h" - -#ifdef __cplusplus -extern "C" { -#endif - void adcInit(void); - void adcObjectInit(ADCDriver *adcp); - void adcStart(ADCDriver *adcp, const ADCConfig *config); - void adcStop(ADCDriver *adcp); - bool_t adcStartConversion(ADCDriver *adcp, - const ADCConversionGroup *grpp, - adcsample_t *samples, - size_t depth, - adccallback_t callback); - void adcStopConversion(ADCDriver *adcp); - msg_t adcWaitConversion(ADCDriver *adcp, systime_t timeout); -#ifdef __cplusplus -} -#endif - -#endif /* CH_HAL_USE_ADC */ - -#endif /* _ADC_H_ */ - -/** @} */ -- cgit v1.2.3 From d4c616e6eeb0587ca450c75b1086efa77ac690e5 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 29 Nov 2009 08:50:13 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1351 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/include/adc.h | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 os/hal/include/adc.h (limited to 'os/hal/include/adc.h') diff --git a/os/hal/include/adc.h b/os/hal/include/adc.h new file mode 100644 index 000000000..67ebf5ca2 --- /dev/null +++ b/os/hal/include/adc.h @@ -0,0 +1,71 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +/** + * @file adc.h + * @brief ADC Driver macros and structures. + * @addtogroup ADC + * @{ + */ + +#ifndef _ADC_H_ +#define _ADC_H_ + +#if CH_HAL_USE_ADC + +#if !CH_USE_SEMAPHORES +#error "ADC driver requires CH_USE_SEMAPHORES" +#endif + +/** + * @brief Driver state machine possible states. + */ +typedef enum { + ADC_UNINIT = 0, /**< @brief Not initialized. */ + ADC_STOP = 1, /**< @brief Stopped. */ + ADC_READY = 2, /**< @brief Ready. */ + ADC_RUNNING = 3, /**< @brief Conversion running. */ + ADC_COMPLETE = 4 /**< @brief Conversion complete.*/ +} adcstate_t; + +#include "adc_lld.h" + +#ifdef __cplusplus +extern "C" { +#endif + void adcInit(void); + void adcObjectInit(ADCDriver *adcp); + void adcStart(ADCDriver *adcp, const ADCConfig *config); + void adcStop(ADCDriver *adcp); + bool_t adcStartConversion(ADCDriver *adcp, + const ADCConversionGroup *grpp, + adcsample_t *samples, + size_t depth, + adccallback_t callback); + void adcStopConversion(ADCDriver *adcp); + msg_t adcWaitConversion(ADCDriver *adcp, systime_t timeout); +#ifdef __cplusplus +} +#endif + +#endif /* CH_HAL_USE_ADC */ + +#endif /* _ADC_H_ */ + +/** @} */ -- cgit v1.2.3 From f90ae4d17df24cd6477f2557bc86ef9433e93414 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 29 Nov 2009 10:37:31 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1354 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/include/adc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'os/hal/include/adc.h') diff --git a/os/hal/include/adc.h b/os/hal/include/adc.h index 67ebf5ca2..685c4049f 100644 --- a/os/hal/include/adc.h +++ b/os/hal/include/adc.h @@ -27,7 +27,7 @@ #ifndef _ADC_H_ #define _ADC_H_ -#if CH_HAL_USE_ADC +#if CH_HAL_USE_ADC || defined(__DOXYGEN__) #if !CH_USE_SEMAPHORES #error "ADC driver requires CH_USE_SEMAPHORES" -- cgit v1.2.3 From fe24da9fcca4967e58b25a2698c46717995de0ad Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 29 Dec 2009 11:12:05 +0000 Subject: Reorganized sections in HAL files. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1473 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/include/adc.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'os/hal/include/adc.h') diff --git a/os/hal/include/adc.h b/os/hal/include/adc.h index 685c4049f..2aa0c41c5 100644 --- a/os/hal/include/adc.h +++ b/os/hal/include/adc.h @@ -29,10 +29,26 @@ #if CH_HAL_USE_ADC || defined(__DOXYGEN__) +/*===========================================================================*/ +/* Driver constants. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Driver pre-compile time settings. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Derived constants and error checks. */ +/*===========================================================================*/ + #if !CH_USE_SEMAPHORES #error "ADC driver requires CH_USE_SEMAPHORES" #endif +/*===========================================================================*/ +/* Driver data structures and types. */ +/*===========================================================================*/ + /** * @brief Driver state machine possible states. */ @@ -46,6 +62,14 @@ typedef enum { #include "adc_lld.h" +/*===========================================================================*/ +/* Driver macros. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* External declarations. */ +/*===========================================================================*/ + #ifdef __cplusplus extern "C" { #endif -- cgit v1.2.3 From e3c7dc319ff582f9eb4a593950ac7bedb1d38b77 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 6 Feb 2010 16:17:30 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1571 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/include/adc.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'os/hal/include/adc.h') diff --git a/os/hal/include/adc.h b/os/hal/include/adc.h index 2aa0c41c5..76e83a51a 100644 --- a/os/hal/include/adc.h +++ b/os/hal/include/adc.h @@ -18,8 +18,9 @@ */ /** - * @file adc.h - * @brief ADC Driver macros and structures. + * @file adc.h + * @brief ADC Driver macros and structures. + * * @addtogroup ADC * @{ */ @@ -50,7 +51,7 @@ /*===========================================================================*/ /** - * @brief Driver state machine possible states. + * @brief Driver state machine possible states. */ typedef enum { ADC_UNINIT = 0, /**< @brief Not initialized. */ -- cgit v1.2.3 From 157b6f9695e7f72f2d54b231c19cb4045710ed01 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 21 Feb 2010 07:24:53 +0000 Subject: Updated license dates. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1646 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/include/adc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'os/hal/include/adc.h') diff --git a/os/hal/include/adc.h b/os/hal/include/adc.h index 76e83a51a..983fe0f78 100644 --- a/os/hal/include/adc.h +++ b/os/hal/include/adc.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. -- cgit v1.2.3 From f9fd465da5bd86e2c650fe7f8f6f54b528c46aff Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 11 Sep 2010 10:14:05 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2173 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/include/adc.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'os/hal/include/adc.h') diff --git a/os/hal/include/adc.h b/os/hal/include/adc.h index 983fe0f78..8b1bfd47b 100644 --- a/os/hal/include/adc.h +++ b/os/hal/include/adc.h @@ -83,7 +83,13 @@ extern "C" { adcsample_t *samples, size_t depth, adccallback_t callback); + bool_t adcStartConversionI(ADCDriver *adcp, + const ADCConversionGroup *grpp, + adcsample_t *samples, + size_t depth, + adccallback_t callback); void adcStopConversion(ADCDriver *adcp); + void adcStopConversionI(ADCDriver *adcp); msg_t adcWaitConversion(ADCDriver *adcp, systime_t timeout); #ifdef __cplusplus } -- cgit v1.2.3 From 781b0b129cccbecba160effce8c4ddd68295b8b9 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 11 Sep 2010 10:57:11 +0000 Subject: Fixed bug 3064204. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2175 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/include/adc.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'os/hal/include/adc.h') diff --git a/os/hal/include/adc.h b/os/hal/include/adc.h index 8b1bfd47b..8a2af908e 100644 --- a/os/hal/include/adc.h +++ b/os/hal/include/adc.h @@ -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 -- cgit v1.2.3 From f407e4a84fcf2cf3bb003ed36f80ec136f8683c2 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 8 Oct 2010 18:16:38 +0000 Subject: HAL improvements, mailboxes macro name changed. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2238 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/include/adc.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'os/hal/include/adc.h') diff --git a/os/hal/include/adc.h b/os/hal/include/adc.h index 8a2af908e..7549ea515 100644 --- a/os/hal/include/adc.h +++ b/os/hal/include/adc.h @@ -88,13 +88,11 @@ extern "C" { bool_t adcStartConversion(ADCDriver *adcp, const ADCConversionGroup *grpp, adcsample_t *samples, - size_t depth, - adccallback_t callback); + size_t depth); bool_t adcStartConversionI(ADCDriver *adcp, const ADCConversionGroup *grpp, adcsample_t *samples, - size_t depth, - adccallback_t callback); + size_t depth); void adcStopConversion(ADCDriver *adcp); void adcStopConversionI(ADCDriver *adcp); #if ADC_USE_WAIT -- cgit v1.2.3 From 935e2fb27f56a3b81d4161d65e116e9da4fe441c Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 12 Oct 2010 15:19:15 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2250 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/include/adc.h | 83 ++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 71 insertions(+), 12 deletions(-) (limited to 'os/hal/include/adc.h') diff --git a/os/hal/include/adc.h b/os/hal/include/adc.h index 7549ea515..dab90b477 100644 --- a/os/hal/include/adc.h +++ b/os/hal/include/adc.h @@ -39,12 +39,21 @@ /*===========================================================================*/ /** - * @brief Inclusion of the @p adcWaitConversion() function. + * @brief Enables synchronous APIs. + * @note Disabling this option saves both code and data space. */ #if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__) #define ADC_USE_WAIT TRUE #endif +/** + * @brief Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define ADC_USE_MUTUAL_EXCLUSION TRUE +#endif + /*===========================================================================*/ /* Derived constants and error checks. */ /*===========================================================================*/ @@ -61,11 +70,11 @@ * @brief Driver state machine possible states. */ typedef enum { - ADC_UNINIT = 0, /**< @brief Not initialized. */ - ADC_STOP = 1, /**< @brief Stopped. */ - ADC_READY = 2, /**< @brief Ready. */ - ADC_RUNNING = 3, /**< @brief Conversion running. */ - ADC_COMPLETE = 4 /**< @brief Conversion complete.*/ + ADC_UNINIT = 0, /**< Not initialized. */ + ADC_STOP = 1, /**< Stopped. */ + ADC_READY = 2, /**< Ready. */ + ADC_ACTIVE = 3, /**< Converting. */ + ADC_COMPLETE = 4 /**< Conversion complete. */ } adcstate_t; #include "adc_lld.h" @@ -74,6 +83,49 @@ typedef enum { /* Driver macros. */ /*===========================================================================*/ +#if ADC_USE_WAIT || defined(__DOXYGEN__) +/** + * @brief Resumes a thread waiting for a conversion completion. + * + * @param[in] adcp pointer to the @p ADCDriver object + * + * @notapi + */ +#define _adc_reset_i(adcp) { \ + if ((adcp)->ad_thread != NULL) { \ + Thread *tp = (adcp)->ad_thread; \ + (adcp)->ad_thread = NULL; \ + tp->p_u.rdymsg = RDY_RESET; \ + chSchReadyI(tp); \ + } \ +} + +/** + * @brief Resumes a thread waiting for a conversion completion. + * + * @param[in] adcp pointer to the @p ADCDriver object + * + * @notapi + */ +#define _adc_reset_s(adcp) { \ + if ((adcp)->ad_thread != NULL) { \ + Thread *tp = (adcp)->ad_thread; \ + (adcp)->ad_thread = NULL; \ + chSchWakeupS(tp, RDY_RESET); \ + } \ +} + +#else /* !ADC_USE_WAIT */ + +#define _adc_reset_i(adcp) + +#define _adc_reset_s(adcp) + +#define _adc_isr_code(adcp) { \ +} + +#endif /* !ADC_USE_WAIT */ + /*===========================================================================*/ /* External declarations. */ /*===========================================================================*/ @@ -85,19 +137,26 @@ extern "C" { void adcObjectInit(ADCDriver *adcp); void adcStart(ADCDriver *adcp, const ADCConfig *config); void adcStop(ADCDriver *adcp); - bool_t adcStartConversion(ADCDriver *adcp, + void adcStartConversion(ADCDriver *adcp, + const ADCConversionGroup *grpp, + adcsample_t *samples, + size_t depth); + void adcStartConversionI(ADCDriver *adcp, const ADCConversionGroup *grpp, adcsample_t *samples, size_t depth); - bool_t adcStartConversionI(ADCDriver *adcp, - const ADCConversionGroup *grpp, - adcsample_t *samples, - size_t depth); void adcStopConversion(ADCDriver *adcp); void adcStopConversionI(ADCDriver *adcp); #if ADC_USE_WAIT - msg_t adcWaitConversion(ADCDriver *adcp, systime_t timeout); + msg_t adcConvert(ADCDriver *adcp, + const ADCConversionGroup *grpp, + adcsample_t *samples, + size_t depth); #endif +#if ADC_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__) + void adcAcquireBus(ADCDriver *adcp); + void adcReleaseBus(ADCDriver *adcp); +#endif /* ADC_USE_MUTUAL_EXCLUSION */ #ifdef __cplusplus } #endif -- cgit v1.2.3 From ec7455babe131ee0b8a4c228ed00a02396619a7d Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 12 Oct 2010 20:47:30 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2253 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/include/adc.h | 97 +++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 93 insertions(+), 4 deletions(-) (limited to 'os/hal/include/adc.h') diff --git a/os/hal/include/adc.h b/os/hal/include/adc.h index dab90b477..3a4a08de0 100644 --- a/os/hal/include/adc.h +++ b/os/hal/include/adc.h @@ -115,16 +115,105 @@ typedef enum { } \ } -#else /* !ADC_USE_WAIT */ +/** + * @brief Wakes up the waiting thread. + * + * @param[in] adcp pointer to the @p ADCDriver object + * + * @notapi + */ +#define _adc_wakeup_i(adcp) { \ + chSysLockFromIsr(); \ + (adcp)->ad_grpp = NULL; \ + if ((adcp)->ad_thread != NULL) { \ + Thread *tp = (adcp)->ad_thread; \ + (adcp)->ad_thread = NULL; \ + tp->p_u.rdymsg = RDY_OK; \ + chSchReadyI(tp); \ + } \ + chSysUnlockFromIsr(); \ +} +#else /* !ADC_USE_WAIT */ #define _adc_reset_i(adcp) - #define _adc_reset_s(adcp) +#define _adc_wakeup(adcp) +#endif /* !ADC_USE_WAIT */ -#define _adc_isr_code(adcp) { \ +/** + * @brief Common ISR code, half buffer full. + * @details This code handles the portable part of the ISR code: + * - Callback invocation. + * . + * @note This macro is meant to be used in the low level drivers + * implementation only. + * + * @param[in] adcp pointer to the @p ADCDriver object + * + * @notapi + */ +#define _adc_isr_half_code(adcp) { \ + if ((adcp)->ad_grpp->acg_endcb != NULL) { \ + (adcp)->ad_grpp->acg_endcb(adcp, (adcp)->ad_samples, \ + (adcp)->ad_depth / 2); \ + } \ } -#endif /* !ADC_USE_WAIT */ +/** + * @brief Common ISR code, full buffer full. + * @details This code handles the portable part of the ISR code: + * - Callback invocation. + * - Waiting thread wakeup, if any. + * - Driver state transitions. + * . + * @note This macro is meant to be used in the low level drivers + * implementation only. + * + * @param[in] adcp pointer to the @p ADCDriver object + * + * @notapi + */ +#define _adc_isr_full_code(adcp) { \ + if ((adcp)->ad_grpp->acg_circular) { \ + /* Callback handling.*/ \ + if ((adcp)->ad_grpp->acg_endcb != NULL) { \ + if ((adcp)->ad_depth > 1) { \ + /* Invokes the callback passing the 2nd half of the buffer.*/ \ + size_t half = (adcp)->ad_depth / 2; \ + (adcp)->ad_grpp->acg_endcb(adcp, (adcp)->ad_samples + half, half); \ + } \ + else { \ + /* Invokes the callback passing the whole buffer.*/ \ + (adcp)->ad_grpp->acg_endcb(adcp, (adcp)->ad_samples, \ + (adcp)->ad_depth); \ + } \ + } \ + } \ + else { \ + (adcp)->ad_grpp = NULL; \ + /* End conversion.*/ \ + adc_lld_stop_conversion(adcp); \ + if ((adcp)->ad_grpp->acg_endcb == NULL) { \ + (adcp)->ad_state = ADC_READY; \ + _adc_wakeup_i(adcp); \ + } \ + else { \ + (adcp)->ad_state = ADC_COMPLETE; \ + if ((adcp)->ad_depth > 1) { \ + /* Invokes the callback passing the 2nd half of the buffer.*/ \ + size_t half = (adcp)->ad_depth / 2; \ + (adcp)->ad_grpp->acg_endcb(adcp, (adcp)->ad_samples + half, half); \ + } \ + else { \ + /* Invokes the callback passing the whole buffer.*/ \ + (adcp)->ad_grpp->acg_endcb(adcp, (adcp)->ad_samples, \ + (adcp)->ad_depth); \ + } \ + if ((adcp)->ad_state == ADC_COMPLETE) \ + (adcp)->ad_state = ADC_READY; \ + } \ + } \ +} /*===========================================================================*/ /* External declarations. */ -- cgit v1.2.3 From d8be44136c1e6d02ee105ac0791f9e6732551fec Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 1 Nov 2010 17:29:56 +0000 Subject: Fixed bug 3100946, renamed HAL switches removing the CH_ part. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2326 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/include/adc.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'os/hal/include/adc.h') diff --git a/os/hal/include/adc.h b/os/hal/include/adc.h index 3a4a08de0..df019fd27 100644 --- a/os/hal/include/adc.h +++ b/os/hal/include/adc.h @@ -28,7 +28,7 @@ #ifndef _ADC_H_ #define _ADC_H_ -#if CH_HAL_USE_ADC || defined(__DOXYGEN__) +#if HAL_USE_ADC || defined(__DOXYGEN__) /*===========================================================================*/ /* Driver constants. */ @@ -250,7 +250,7 @@ extern "C" { } #endif -#endif /* CH_HAL_USE_ADC */ +#endif /* HAL_USE_ADC */ #endif /* _ADC_H_ */ -- cgit v1.2.3 From feba444df5aacdb50c02f731e45fe5bdb0ac64f9 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 21 Nov 2010 15:46:17 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2411 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/include/adc.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'os/hal/include/adc.h') diff --git a/os/hal/include/adc.h b/os/hal/include/adc.h index df019fd27..aee876978 100644 --- a/os/hal/include/adc.h +++ b/os/hal/include/adc.h @@ -141,7 +141,7 @@ typedef enum { #endif /* !ADC_USE_WAIT */ /** - * @brief Common ISR code, half buffer full. + * @brief Common ISR code, half buffer event. * @details This code handles the portable part of the ISR code: * - Callback invocation. * . @@ -160,7 +160,7 @@ typedef enum { } /** - * @brief Common ISR code, full buffer full. + * @brief Common ISR code, full buffer event. * @details This code handles the portable part of the ISR code: * - Callback invocation. * - Waiting thread wakeup, if any. -- cgit v1.2.3 From 1de70ad9c8dc8eb91837dbb1ae81fb0817a5159b Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 21 Nov 2010 18:41:12 +0000 Subject: Fixed bug 3114696. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2412 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/include/adc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'os/hal/include/adc.h') diff --git a/os/hal/include/adc.h b/os/hal/include/adc.h index aee876978..48f9d9ff6 100644 --- a/os/hal/include/adc.h +++ b/os/hal/include/adc.h @@ -190,7 +190,6 @@ typedef enum { } \ } \ else { \ - (adcp)->ad_grpp = NULL; \ /* End conversion.*/ \ adc_lld_stop_conversion(adcp); \ if ((adcp)->ad_grpp->acg_endcb == NULL) { \ @@ -212,6 +211,7 @@ typedef enum { if ((adcp)->ad_state == ADC_COMPLETE) \ (adcp)->ad_state = ADC_READY; \ } \ + (adcp)->ad_grpp = NULL; \ } \ } -- cgit v1.2.3 From c852dcb3c960198f49c5fdd8619a6d5d581d9136 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 25 Nov 2010 18:32:45 +0000 Subject: Improved ADC and SPI driver models. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2426 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/include/adc.h | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'os/hal/include/adc.h') 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); \ } \ } -- cgit v1.2.3 From 1b12d62bd78a14c8cf4bf55e342aae5a2c7361f1 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 12 Dec 2010 14:51:21 +0000 Subject: White space fixes. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2476 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/include/adc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'os/hal/include/adc.h') diff --git a/os/hal/include/adc.h b/os/hal/include/adc.h index 0b55d0d15..d94d99aa3 100644 --- a/os/hal/include/adc.h +++ b/os/hal/include/adc.h @@ -86,7 +86,7 @@ typedef enum { #if ADC_USE_WAIT || defined(__DOXYGEN__) /** * @brief Resumes a thread waiting for a conversion completion. - * + * * @param[in] adcp pointer to the @p ADCDriver object * * @notapi -- cgit v1.2.3 From 18fb8f676f0f650d83f69bc29ab45b04b73e86c1 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 8 Mar 2011 10:09:57 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2808 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/include/adc.h | 55 +++++++++++++++++++++++++--------------------------- 1 file changed, 26 insertions(+), 29 deletions(-) (limited to 'os/hal/include/adc.h') diff --git a/os/hal/include/adc.h b/os/hal/include/adc.h index d94d99aa3..8bc013b38 100644 --- a/os/hal/include/adc.h +++ b/os/hal/include/adc.h @@ -92,9 +92,9 @@ typedef enum { * @notapi */ #define _adc_reset_i(adcp) { \ - if ((adcp)->ad_thread != NULL) { \ - Thread *tp = (adcp)->ad_thread; \ - (adcp)->ad_thread = NULL; \ + if ((adcp)->thread != NULL) { \ + Thread *tp = (adcp)->thread; \ + (adcp)->thread = NULL; \ tp->p_u.rdymsg = RDY_RESET; \ chSchReadyI(tp); \ } \ @@ -108,9 +108,9 @@ typedef enum { * @notapi */ #define _adc_reset_s(adcp) { \ - if ((adcp)->ad_thread != NULL) { \ - Thread *tp = (adcp)->ad_thread; \ - (adcp)->ad_thread = NULL; \ + if ((adcp)->thread != NULL) { \ + Thread *tp = (adcp)->thread; \ + (adcp)->thread = NULL; \ chSchWakeupS(tp, RDY_RESET); \ } \ } @@ -123,9 +123,9 @@ typedef enum { * @notapi */ #define _adc_wakeup_isr(adcp) { \ - if ((adcp)->ad_thread != NULL) { \ - Thread *tp = (adcp)->ad_thread; \ - (adcp)->ad_thread = NULL; \ + if ((adcp)->thread != NULL) { \ + Thread *tp = (adcp)->thread; \ + (adcp)->thread = NULL; \ chSysLockFromIsr(); \ tp->p_u.rdymsg = RDY_OK; \ chSchReadyI(tp); \ @@ -152,9 +152,8 @@ typedef enum { * @notapi */ #define _adc_isr_half_code(adcp) { \ - if ((adcp)->ad_grpp->acg_endcb != NULL) { \ - (adcp)->ad_grpp->acg_endcb(adcp, (adcp)->ad_samples, \ - (adcp)->ad_depth / 2); \ + if ((adcp)->grpp->end_cb != NULL) { \ + (adcp)->grpp->end_cb(adcp, (adcp)->samples, (adcp)->depth / 2); \ } \ } @@ -173,40 +172,38 @@ typedef enum { * @notapi */ #define _adc_isr_full_code(adcp) { \ - if ((adcp)->ad_grpp->acg_circular) { \ + if ((adcp)->grpp->circular) { \ /* Callback handling.*/ \ - if ((adcp)->ad_grpp->acg_endcb != NULL) { \ - if ((adcp)->ad_depth > 1) { \ + if ((adcp)->grpp->end_cb != NULL) { \ + if ((adcp)->depth > 1) { \ /* Invokes the callback passing the 2nd half of the buffer.*/ \ - size_t half = (adcp)->ad_depth / 2; \ - (adcp)->ad_grpp->acg_endcb(adcp, (adcp)->ad_samples + half, half); \ + size_t half = (adcp)->depth / 2; \ + (adcp)->grpp->end_cb(adcp, (adcp)->samples + half, half); \ } \ else { \ /* Invokes the callback passing the whole buffer.*/ \ - (adcp)->ad_grpp->acg_endcb(adcp, (adcp)->ad_samples, \ - (adcp)->ad_depth); \ + (adcp)->grpp->end_cb(adcp, (adcp)->samples, (adcp)->depth); \ } \ } \ } \ else { \ /* End conversion.*/ \ adc_lld_stop_conversion(adcp); \ - if ((adcp)->ad_grpp->acg_endcb != NULL) { \ - (adcp)->ad_state = ADC_COMPLETE; \ - if ((adcp)->ad_depth > 1) { \ + if ((adcp)->grpp->end_cb != NULL) { \ + (adcp)->state = ADC_COMPLETE; \ + if ((adcp)->depth > 1) { \ /* Invokes the callback passing the 2nd half of the buffer.*/ \ - size_t half = (adcp)->ad_depth / 2; \ - (adcp)->ad_grpp->acg_endcb(adcp, (adcp)->ad_samples + half, half); \ + size_t half = (adcp)->depth / 2; \ + (adcp)->grpp->end_cb(adcp, (adcp)->samples + half, half); \ } \ else { \ /* Invokes the callback passing the whole buffer.*/ \ - (adcp)->ad_grpp->acg_endcb(adcp, (adcp)->ad_samples, \ - (adcp)->ad_depth); \ + (adcp)->grpp->end_cb(adcp, (adcp)->samples, (adcp)->depth); \ } \ - if ((adcp)->ad_state == ADC_COMPLETE) \ - (adcp)->ad_state = ADC_READY; \ + if ((adcp)->state == ADC_COMPLETE) \ + (adcp)->state = ADC_READY; \ } \ - (adcp)->ad_grpp = NULL; \ + (adcp)->grpp = NULL; \ _adc_wakeup_isr(adcp); \ } \ } -- cgit v1.2.3 From a849378300019b9d6c030ab7af46bfda646e619e Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 10 Mar 2011 13:00:39 +0000 Subject: Fixed bug 3205410. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2813 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/include/adc.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'os/hal/include/adc.h') diff --git a/os/hal/include/adc.h b/os/hal/include/adc.h index 8bc013b38..b0d6d0938 100644 --- a/os/hal/include/adc.h +++ b/os/hal/include/adc.h @@ -124,9 +124,10 @@ typedef enum { */ #define _adc_wakeup_isr(adcp) { \ if ((adcp)->thread != NULL) { \ - Thread *tp = (adcp)->thread; \ - (adcp)->thread = NULL; \ + Thread *tp; \ chSysLockFromIsr(); \ + tp = (adcp)->thread; \ + (adcp)->thread = NULL; \ tp->p_u.rdymsg = RDY_OK; \ chSchReadyI(tp); \ chSysUnlockFromIsr(); \ -- cgit v1.2.3 From e7e79a6ccb4f3e320b2b8b7bad1b14d65218641d Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 18 Mar 2011 18:38:08 +0000 Subject: License updated. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2827 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/include/adc.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'os/hal/include/adc.h') diff --git a/os/hal/include/adc.h b/os/hal/include/adc.h index b0d6d0938..1e3f6edc7 100644 --- a/os/hal/include/adc.h +++ b/os/hal/include/adc.h @@ -1,5 +1,6 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011 Giovanni Di Sirio. This file is part of ChibiOS/RT. -- cgit v1.2.3 From aeed6d78c11a287f010a55b58bb640f5b54d6254 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 16 Apr 2011 09:27:46 +0000 Subject: Fixed bug 3288149. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2881 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/include/adc.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'os/hal/include/adc.h') diff --git a/os/hal/include/adc.h b/os/hal/include/adc.h index 1e3f6edc7..a236a040a 100644 --- a/os/hal/include/adc.h +++ b/os/hal/include/adc.h @@ -205,6 +205,8 @@ typedef enum { if ((adcp)->state == ADC_COMPLETE) \ (adcp)->state = ADC_READY; \ } \ + else \ + (adcp)->state = ADC_READY; \ (adcp)->grpp = NULL; \ _adc_wakeup_isr(adcp); \ } \ -- cgit v1.2.3 From 718dc5084f7719f91eaacfc99e8c7de654eb2ad8 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 23 Aug 2011 13:36:25 +0000 Subject: HAL documentation improvements. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3252 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/include/adc.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'os/hal/include/adc.h') diff --git a/os/hal/include/adc.h b/os/hal/include/adc.h index a236a040a..53c7c199a 100644 --- a/os/hal/include/adc.h +++ b/os/hal/include/adc.h @@ -39,6 +39,10 @@ /* Driver pre-compile time settings. */ /*===========================================================================*/ +/** + * @name ADC configuration options + * @{ + */ /** * @brief Enables synchronous APIs. * @note Disabling this option saves both code and data space. @@ -54,6 +58,7 @@ #if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) #define ADC_USE_MUTUAL_EXCLUSION TRUE #endif +/** @} */ /*===========================================================================*/ /* Derived constants and error checks. */ @@ -84,6 +89,10 @@ typedef enum { /* Driver macros. */ /*===========================================================================*/ +/** + * @name Low Level driver helper macros + * @{ + */ #if ADC_USE_WAIT || defined(__DOXYGEN__) /** * @brief Resumes a thread waiting for a conversion completion. @@ -211,6 +220,7 @@ typedef enum { _adc_wakeup_isr(adcp); \ } \ } +/** @} */ /*===========================================================================*/ /* External declarations. */ -- cgit v1.2.3 From 4a3e3fc01ec6dfb4a710db771bee262d5dc9327e Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 22 Sep 2011 14:53:42 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3381 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/include/adc.h | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) (limited to 'os/hal/include/adc.h') diff --git a/os/hal/include/adc.h b/os/hal/include/adc.h index 53c7c199a..cb392f4e2 100644 --- a/os/hal/include/adc.h +++ b/os/hal/include/adc.h @@ -80,7 +80,8 @@ typedef enum { ADC_STOP = 1, /**< Stopped. */ ADC_READY = 2, /**< Ready. */ ADC_ACTIVE = 3, /**< Converting. */ - ADC_COMPLETE = 4 /**< Conversion complete. */ + ADC_COMPLETE = 4, /**< Conversion complete. */ + ADC_ERROR = 5 /**< Conversion complete. */ } adcstate_t; #include "adc_lld.h" @@ -144,10 +145,30 @@ typedef enum { } \ } +/** + * @brief Wakes up the waiting thread with a timeout message. + * + * @param[in] adcp pointer to the @p ADCDriver object + * + * @notapi + */ +#define _adc_timeout_isr(adcp) { \ + if ((adcp)->thread != NULL) { \ + Thread *tp; \ + chSysLockFromIsr(); \ + tp = (adcp)->thread; \ + (adcp)->thread = NULL; \ + tp->p_u.rdymsg = RDY_TIMEOUT; \ + chSchReadyI(tp); \ + chSysUnlockFromIsr(); \ + } \ +} + #else /* !ADC_USE_WAIT */ #define _adc_reset_i(adcp) #define _adc_reset_s(adcp) #define _adc_wakeup_isr(adcp) +#define _adc_timeout_isr(adcp) #endif /* !ADC_USE_WAIT */ /** @@ -220,6 +241,32 @@ typedef enum { _adc_wakeup_isr(adcp); \ } \ } + +/** + * @brief Common ISR code, error event. + * @details This code handles the portable part of the ISR code: + * - Callback invocation. + * - Waiting thread timeout signaling, if any. + * - Driver state transitions. + * . + * @note This macro is meant to be used in the low level drivers + * implementation only. + * + * @param[in] adcp pointer to the @p ADCDriver object + * + * @notapi + */ +#define _adc_isr_error_code(adcp, err) { \ + adc_lld_stop_conversion(adcp); \ + if ((adcp)->grpp->error_cb != NULL) { \ + (adcp)->state = ADC_ERROR; \ + (adcp)->grpp->error_cb(adcp, err); \ + if ((adcp)->state == ADC_ERROR) \ + (adcp)->state = ADC_READY; \ + } \ + (adcp)->grpp = NULL; \ + _adc_timeout_isr(adcp); \ +} /** @} */ /*===========================================================================*/ -- cgit v1.2.3 From c39d08fc2ae9c43f73114e24292520306bddde19 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 23 Sep 2011 15:48:55 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3384 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/include/adc.h | 1 + 1 file changed, 1 insertion(+) (limited to 'os/hal/include/adc.h') diff --git a/os/hal/include/adc.h b/os/hal/include/adc.h index cb392f4e2..ff9e6b18f 100644 --- a/os/hal/include/adc.h +++ b/os/hal/include/adc.h @@ -253,6 +253,7 @@ typedef enum { * implementation only. * * @param[in] adcp pointer to the @p ADCDriver object + * @param[in] err platform dependent error code * * @notapi */ -- cgit v1.2.3 From 83d562f6b2842c4ec03ff08662ddc629ccc4e424 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 16 Nov 2011 21:21:28 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3504 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/include/adc.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'os/hal/include/adc.h') diff --git a/os/hal/include/adc.h b/os/hal/include/adc.h index ff9e6b18f..9ebe3754c 100644 --- a/os/hal/include/adc.h +++ b/os/hal/include/adc.h @@ -134,15 +134,15 @@ typedef enum { * @notapi */ #define _adc_wakeup_isr(adcp) { \ + chSysLockFromIsr(); \ if ((adcp)->thread != NULL) { \ Thread *tp; \ - chSysLockFromIsr(); \ tp = (adcp)->thread; \ (adcp)->thread = NULL; \ tp->p_u.rdymsg = RDY_OK; \ chSchReadyI(tp); \ - chSysUnlockFromIsr(); \ } \ + chSysUnlockFromIsr(); \ } /** @@ -153,15 +153,15 @@ typedef enum { * @notapi */ #define _adc_timeout_isr(adcp) { \ + chSysLockFromIsr(); \ if ((adcp)->thread != NULL) { \ Thread *tp; \ - chSysLockFromIsr(); \ tp = (adcp)->thread; \ (adcp)->thread = NULL; \ tp->p_u.rdymsg = RDY_TIMEOUT; \ chSchReadyI(tp); \ - chSysUnlockFromIsr(); \ } \ + chSysUnlockFromIsr(); \ } #else /* !ADC_USE_WAIT */ -- cgit v1.2.3 From de5dcbba856524599a8f06d3a9bdbf1b01db44c2 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 21 Jan 2012 14:29:42 +0000 Subject: License text updated with new year. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3846 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/include/adc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'os/hal/include/adc.h') diff --git a/os/hal/include/adc.h b/os/hal/include/adc.h index 9ebe3754c..137096609 100644 --- a/os/hal/include/adc.h +++ b/os/hal/include/adc.h @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011 Giovanni Di Sirio. + 2011,2012 Giovanni Di Sirio. This file is part of ChibiOS/RT. -- cgit v1.2.3 From 82984e1b5543228cfc3bd8bb40aa69046bc613e8 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 13 Mar 2012 15:41:46 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4038 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/include/adc.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'os/hal/include/adc.h') diff --git a/os/hal/include/adc.h b/os/hal/include/adc.h index 137096609..8f829d386 100644 --- a/os/hal/include/adc.h +++ b/os/hal/include/adc.h @@ -282,13 +282,13 @@ extern "C" { void adcStart(ADCDriver *adcp, const ADCConfig *config); void adcStop(ADCDriver *adcp); void adcStartConversion(ADCDriver *adcp, + const ADCConversionGroup *grpp, + adcsample_t *samples, + size_t depth); + void adcStartConversionI(ADCDriver *adcp, const ADCConversionGroup *grpp, adcsample_t *samples, size_t depth); - void adcStartConversionI(ADCDriver *adcp, - const ADCConversionGroup *grpp, - adcsample_t *samples, - size_t depth); void adcStopConversion(ADCDriver *adcp); void adcStopConversionI(ADCDriver *adcp); #if ADC_USE_WAIT -- cgit v1.2.3 From 3626647d7b924ca07df4197f9cde4a7965b8cbdf Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 18 Jun 2012 08:52:26 +0000 Subject: 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 --- os/hal/include/adc.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'os/hal/include/adc.h') diff --git a/os/hal/include/adc.h b/os/hal/include/adc.h index 8f829d386..86209a89f 100644 --- a/os/hal/include/adc.h +++ b/os/hal/include/adc.h @@ -210,7 +210,8 @@ typedef enum { if ((adcp)->depth > 1) { \ /* Invokes the callback passing the 2nd half of the buffer.*/ \ 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 { \ /* Invokes the callback passing the whole buffer.*/ \ @@ -226,7 +227,8 @@ typedef enum { if ((adcp)->depth > 1) { \ /* Invokes the callback passing the 2nd half of the buffer.*/ \ 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 { \ /* Invokes the callback passing the whole buffer.*/ \ -- cgit v1.2.3 From 184a71345c6a36a9a8664eda8fbcc3ea728267a8 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 2 Feb 2013 10:58:09 +0000 Subject: Updated license years. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5102 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/include/adc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'os/hal/include/adc.h') diff --git a/os/hal/include/adc.h b/os/hal/include/adc.h index 86209a89f..7c67e20d1 100644 --- a/os/hal/include/adc.h +++ b/os/hal/include/adc.h @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012 Giovanni Di Sirio. + 2011,2012,2013 Giovanni Di Sirio. This file is part of ChibiOS/RT. -- cgit v1.2.3 From 0b9f09be24512c7d9c0af453ebadc3307ca90f25 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 17 Feb 2013 14:00:57 +0000 Subject: Fixed bug 3605053. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5224 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/include/adc.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'os/hal/include/adc.h') diff --git a/os/hal/include/adc.h b/os/hal/include/adc.h index 7c67e20d1..d7f918da3 100644 --- a/os/hal/include/adc.h +++ b/os/hal/include/adc.h @@ -228,18 +228,21 @@ typedef enum { /* Invokes the callback passing the 2nd half of the buffer.*/ \ size_t half = (adcp)->depth / 2; \ size_t half_index = half * (adcp)->grpp->num_channels; \ - (adcp)->grpp->end_cb(adcp, (adcp)->samples + half_index, half); \ + (adcp)->grpp->end_cb(adcp, (adcp)->samples + half_index, (adcp)->depth - half); \ } \ else { \ /* Invokes the callback passing the whole buffer.*/ \ (adcp)->grpp->end_cb(adcp, (adcp)->samples, (adcp)->depth); \ } \ - if ((adcp)->state == ADC_COMPLETE) \ + if ((adcp)->state == ADC_COMPLETE) { \ (adcp)->state = ADC_READY; \ + (adcp)->grpp = NULL; \ + } \ } \ - else \ + else { \ (adcp)->state = ADC_READY; \ - (adcp)->grpp = NULL; \ + (adcp)->grpp = NULL; \ + } \ _adc_wakeup_isr(adcp); \ } \ } -- cgit v1.2.3 From df2a9909241e09bed7e1028d1e27030073182649 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 17 Feb 2013 14:04:11 +0000 Subject: Fixed bug 3605053. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5226 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/include/adc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'os/hal/include/adc.h') diff --git a/os/hal/include/adc.h b/os/hal/include/adc.h index d7f918da3..7db0f7641 100644 --- a/os/hal/include/adc.h +++ b/os/hal/include/adc.h @@ -228,7 +228,7 @@ typedef enum { /* Invokes the callback passing the 2nd half of the buffer.*/ \ size_t half = (adcp)->depth / 2; \ size_t half_index = half * (adcp)->grpp->num_channels; \ - (adcp)->grpp->end_cb(adcp, (adcp)->samples + half_index, (adcp)->depth - half); \ + (adcp)->grpp->end_cb(adcp, (adcp)->samples + half_index, half); \ } \ else { \ /* Invokes the callback passing the whole buffer.*/ \ -- cgit v1.2.3 From a7b208821aa9faa999d2ffdb370bbf92b208bb69 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 26 Feb 2013 13:28:47 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5329 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/include/adc.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'os/hal/include/adc.h') diff --git a/os/hal/include/adc.h b/os/hal/include/adc.h index 7db0f7641..91ab638e1 100644 --- a/os/hal/include/adc.h +++ b/os/hal/include/adc.h @@ -64,8 +64,8 @@ /* Derived constants and error checks. */ /*===========================================================================*/ -#if ADC_USE_WAIT && !CH_USE_SEMAPHORES -#error "ADC driver requires CH_USE_SEMAPHORES when ADC_USE_WAIT is enabled" +#if ADC_USE_WAIT && !CH_USE_MUTEXES && !CH_USE_SEMAPHORES +#error "ADC_USE_WAIT requires CH_USE_MUTEXES and/or CH_USE_SEMAPHORES" #endif /*===========================================================================*/ -- cgit v1.2.3 From 27cef0f6e1b6b23ab0b2e53722576a4c4f22e80a Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 26 Feb 2013 13:29:15 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5330 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/include/adc.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'os/hal/include/adc.h') diff --git a/os/hal/include/adc.h b/os/hal/include/adc.h index 91ab638e1..c41435452 100644 --- a/os/hal/include/adc.h +++ b/os/hal/include/adc.h @@ -64,8 +64,8 @@ /* Derived constants and error checks. */ /*===========================================================================*/ -#if ADC_USE_WAIT && !CH_USE_MUTEXES && !CH_USE_SEMAPHORES -#error "ADC_USE_WAIT requires CH_USE_MUTEXES and/or CH_USE_SEMAPHORES" +#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 /*===========================================================================*/ -- cgit v1.2.3