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/templates/adc_lld.h | 19 ++++++++++++++++--- os/hal/templates/spi_lld.h | 11 +++++++---- 2 files changed, 23 insertions(+), 7 deletions(-) (limited to 'os/hal/templates') diff --git a/os/hal/templates/adc_lld.h b/os/hal/templates/adc_lld.h index 2b2e8dd58..9f436ffbc 100644 --- a/os/hal/templates/adc_lld.h +++ b/os/hal/templates/adc_lld.h @@ -93,8 +93,11 @@ typedef struct { adc_channels_num_t acg_num_channels; /** * @brief Callback function associated to the group or @p NULL. + * @note In order to use synchronous functions this field must be set to + * @p NULL, callbacks and synchronous operations are mutually + * exclusive. */ - adccallback_t acg_callback; + adccallback_t acg_endcb; /* End of the mandatory fields.*/ } ADCConversionGroup; @@ -136,10 +139,20 @@ struct ADCDriver { const ADCConversionGroup *ad_grpp; #if ADC_USE_WAIT || defined(__DOXYGEN__) /** - * @brief Synchronization semaphore. + * @brief Waiting thread. */ - Semaphore ad_sem; + Thread *ad_thread; +#endif /* SPI_USE_WAIT */ +#if ADC_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__) +#if CH_USE_MUTEXES || defined(__DOXYGEN__) + /** + * @brief Mutex protecting the peripheral. + */ + Mutex ad_mutex; +#elif CH_USE_SEMAPHORES + Semaphore ad_semaphore; #endif +#endif /* ADC_USE_MUTUAL_EXCLUSION */ #if defined(ADC_DRIVER_EXT_FIELDS) ADC_DRIVER_EXT_FIELDS #endif diff --git a/os/hal/templates/spi_lld.h b/os/hal/templates/spi_lld.h index 582b56678..a9aeca56f 100644 --- a/os/hal/templates/spi_lld.h +++ b/os/hal/templates/spi_lld.h @@ -67,6 +67,9 @@ typedef void (*spicallback_t)(SPIDriver *spip); typedef struct { /** * @brief Operation complete callback. + * @note In order to use synchronous functions this field must be set to + * @p NULL, callbacks and synchronous operations are mutually + * exclusive. */ spicallback_t spc_endcb; /* End of the mandatory fields.*/ @@ -82,6 +85,10 @@ struct SPIDriver { * @brief Driver state. */ spistate_t spd_state; + /** + * @brief Current configuration data. + */ + const SPIConfig *spd_config; #if SPI_USE_WAIT || defined(__DOXYGEN__) /** * @brief Waiting thread. @@ -98,10 +105,6 @@ struct SPIDriver { Semaphore spd_semaphore; #endif #endif /* SPI_USE_MUTUAL_EXCLUSION */ - /** - * @brief Current configuration data. - */ - const SPIConfig *spd_config; #if defined(SPI_DRIVER_EXT_FIELDS) SPI_DRIVER_EXT_FIELDS #endif -- cgit v1.2.3