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 + os/hal/platforms/STM32F1xx/platform.dox | 20 +++++++++++++++-- os/hal/platforms/STM32L1xx/adc_lld.c | 5 ++++- os/hal/platforms/STM32L1xx/platform.dox | 40 +++++++++++++++++++++++++++++++-- os/hal/templates/ext_lld.c | 7 ++++++ os/hal/templates/ext_lld.h | 19 +++++++++++++--- 6 files changed, 84 insertions(+), 8 deletions(-) (limited to 'os/hal') 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 */ diff --git a/os/hal/platforms/STM32F1xx/platform.dox b/os/hal/platforms/STM32F1xx/platform.dox index 83c33a868..de8d9a5d9 100644 --- a/os/hal/platforms/STM32F1xx/platform.dox +++ b/os/hal/platforms/STM32F1xx/platform.dox @@ -62,7 +62,7 @@ * - Programmable ADC interrupt priority level. * - Programmable DMA bus priority for each DMA channel. * - Programmable DMA interrupt priority for each DMA channel. - * - Programmable DMA error hook. + * - DMA errors detection. * . * @ingroup STM32F1xx_DRIVERS */ @@ -93,9 +93,25 @@ * - DMA2 (where present). * . * @section stm32f1xx_dma_2 STM32F1xx DMA driver implementation features - * - Automatic DMA clock stop when not in use by other drivers. * - Exports helper functions/macros to the other drivers that share the * DMA resource. + * - Automatic DMA clock stop when not in use by any driver. + * - DMA streams and interrupt vectors sharing among multiple drivers. + * . + * @ingroup STM32F1xx_DRIVERS + */ + +/** + * @defgroup STM32F1xx_EXT STM32F1xx EXT Support + * @details The STM32F1xx EXT driver uses the EXTI peripheral. + * + * @section stm32f1xx_ext_1 Supported HW resources + * - EXTI. + * . + * @section stm32f1xx_ext_2 STM32F1xx EXT driver implementation features + * - Each EXTI channel can be independently enabled and programmed. + * - Programmable EXTI interrupts priority level. + * - Capability to work as event sources (WFE) rather than interrupt sources. * . * @ingroup STM32F1xx_DRIVERS */ diff --git a/os/hal/platforms/STM32L1xx/adc_lld.c b/os/hal/platforms/STM32L1xx/adc_lld.c index a2149b6ae..74c9a6ee3 100644 --- a/os/hal/platforms/STM32L1xx/adc_lld.c +++ b/os/hal/platforms/STM32L1xx/adc_lld.c @@ -84,7 +84,7 @@ static void adc_lld_serve_rx_interrupt(ADCDriver *adcp, uint32_t flags) { * * @isr */ -CH_IRQ_HANDLER(UART5_IRQHandler) { +CH_IRQ_HANDLER(ADC1_IRQHandler) { uint32_t sr; CH_IRQ_PROLOGUE(); @@ -96,6 +96,7 @@ CH_IRQ_HANDLER(UART5_IRQHandler) { to read data fast enough.*/ _adc_isr_error_code(&ADCD1, ADC_ERR_OVERFLOW); } + /* TODO: Add here analog watchdog handling.*/ CH_IRQ_EPILOGUE(); } @@ -146,6 +147,8 @@ void adc_lld_start(ADCDriver *adcp) { chDbgAssert(!b, "adc_lld_start(), #1", "stream already allocated"); dmaStreamSetPeripheral(adcp->dmastp, &ADC1->DR); rccEnableADC1(FALSE); + NVICEnableVector(ADC1_IRQn, + CORTEX_PRIORITY_MASK(STM32_ADC_ADC1_IRQ_PRIORITY)); } #endif diff --git a/os/hal/platforms/STM32L1xx/platform.dox b/os/hal/platforms/STM32L1xx/platform.dox index 7abe18e5e..910fdf7bd 100644 --- a/os/hal/platforms/STM32L1xx/platform.dox +++ b/os/hal/platforms/STM32L1xx/platform.dox @@ -20,7 +20,7 @@ /** * @defgroup STM32L1xx_DRIVERS STM32L1xx Drivers - * @details This section describes all the supported drivers on the STM32F1xx + * @details This section describes all the supported drivers on the STM32L1xx * platform and the implementation details of the single drivers. * * @ingroup platforms @@ -46,6 +46,26 @@ * @ingroup STM32L1xx_DRIVERS */ +/** + * @defgroup STM32L1xx_ADC STM32L1xx ADC Support + * @details The STM32L1xx ADC driver supports the ADC peripherals using DMA + * channels for maximum performance. + * + * @section stm32l1xx_adc_1 Supported HW resources + * - ADC1. + * - DMA1. + * . + * @section stm32l1xx_adc_2 STM32L1xx ADC driver implementation features + * - Clock stop for reduced power usage when the driver is in stop state. + * - Streaming conversion using DMA for maximum performance. + * - Programmable ADC interrupt priority level. + * - Programmable DMA bus priority for each DMA channel. + * - Programmable DMA interrupt priority for each DMA channel. + * - DMA and ADC errors detection. + * . + * @ingroup STM32L1xx_DRIVERS + */ + /** * @defgroup STM32L1xx_DMA STM32L1xx DMA Support * @details This DMA helper driver is used by the other drivers in order to @@ -56,9 +76,25 @@ * - DMA1. * . * @section stm32l1xx_dma_2 STM32L1xx DMA driver implementation features - * - Automatic DMA clock stop when not in use by other drivers. * - Exports helper functions/macros to the other drivers that share the * DMA resource. + * - Automatic DMA clock stop when not in use by any driver. + * - DMA streams and interrupt vectors sharing among multiple drivers. + * . + * @ingroup STM32L1xx_DRIVERS + */ + +/** + * @defgroup STM32L1xx_EXT STM32L1xx EXT Support + * @details The STM32L1xx EXT driver uses the EXTI peripheral. + * + * @section stm32l1xx_ext_1 Supported HW resources + * - EXTI. + * . + * @section stm32l1xx_ext_2 STM32L1xx EXT driver implementation features + * - Each EXTI channel can be independently enabled and programmed. + * - Programmable EXTI interrupts priority level. + * - Capability to work as event sources (WFE) rather than interrupt sources. * . * @ingroup STM32L1xx_DRIVERS */ diff --git a/os/hal/templates/ext_lld.c b/os/hal/templates/ext_lld.c index 45bc1c3dc..fc9c2181d 100644 --- a/os/hal/templates/ext_lld.c +++ b/os/hal/templates/ext_lld.c @@ -39,6 +39,11 @@ /* Driver exported variables. */ /*===========================================================================*/ +/** + * @brief EXTD1 driver identifier. + */ +EXTDriver EXTD1; + /*===========================================================================*/ /* Driver local variables. */ /*===========================================================================*/ @@ -62,6 +67,8 @@ */ void ext_lld_init(void) { + /* Driver initialization.*/ + extObjectInit(&EXTD1); } /** diff --git a/os/hal/templates/ext_lld.h b/os/hal/templates/ext_lld.h index 494cef1b9..f299a8914 100644 --- a/os/hal/templates/ext_lld.h +++ b/os/hal/templates/ext_lld.h @@ -63,14 +63,23 @@ typedef uint32_t expchannel_t; * @param[in] extp pointer to the @p EXPDriver object triggering the * callback */ -typedef void (*extcallback_t)(EXTDriver *extp); +typedef void (*extcallback_t)(EXTDriver *extp, expchannel_t channel); /** * @brief Channel configuration structure. */ typedef struct { - uint32_t mode; /**< @brief Channel mode. */ - extcallback_t cb; /**< @brief Channel callback. */ + /** + * @brief Channel mode. + */ + uint32_t mode; + /** + * @brief Channel callback. + * @details In the STM32 implementation a @p NULL callback pointer is + * valid and configures the channel as an event sources instead + * of an interrupt source. + */ + extcallback_t cb; } EXTChannelConfig; /** @@ -108,6 +117,10 @@ struct EXTDriver { /* External declarations. */ /*===========================================================================*/ +#if !defined(__DOXYGEN__) +extern EXTDriver EXTD1; +#endif + #ifdef __cplusplus extern "C" { #endif -- cgit v1.2.3