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 +- os/hal/include/can.h | 2 +- os/hal/include/hal.h | 59 ++++++++++++++++++++++++++++++++++++ os/hal/include/mac.h | 2 +- os/hal/include/mmc_spi.h | 2 +- os/hal/include/pal.h | 2 +- os/hal/include/serial.h | 2 +- os/hal/include/spi.h | 2 +- os/hal/platforms/STM32/adc_lld.c | 2 +- os/hal/platforms/STM32/adc_lld.h | 2 +- os/hal/platforms/STM32/can_lld.c | 2 +- os/hal/platforms/STM32/can_lld.h | 2 +- os/hal/platforms/STM32/pal_lld.c | 2 +- os/hal/platforms/STM32/pal_lld.h | 2 +- os/hal/platforms/STM32/serial_lld.c | 2 +- os/hal/platforms/STM32/serial_lld.h | 2 +- os/hal/platforms/STM32/spi_lld.c | 2 +- os/hal/platforms/STM32/spi_lld.h | 2 +- os/hal/src/adc.c | 2 +- os/hal/src/can.c | 2 +- os/hal/src/hal.c | 60 +++++++++++++++++++++++++++++++++++++ os/hal/src/mac.c | 2 +- os/hal/src/mmc_spi.c | 2 +- os/hal/src/pal.c | 2 +- os/hal/src/serial.c | 2 +- os/hal/src/spi.c | 2 +- os/hal/templates/adc_lld.c | 2 +- os/hal/templates/adc_lld.h | 2 +- os/hal/templates/can_lld.c | 2 +- os/hal/templates/can_lld.h | 2 +- os/hal/templates/mac_lld.c | 2 +- os/hal/templates/mac_lld.h | 2 +- os/hal/templates/pal_lld.c | 2 +- os/hal/templates/pal_lld.h | 2 +- os/hal/templates/serial_lld.c | 2 +- os/hal/templates/serial_lld.h | 2 +- os/hal/templates/spi_lld.c | 2 +- os/hal/templates/spi_lld.h | 2 +- 38 files changed, 155 insertions(+), 36 deletions(-) create mode 100644 os/hal/include/hal.h create mode 100644 os/hal/src/hal.c (limited to 'os') 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" diff --git a/os/hal/include/can.h b/os/hal/include/can.h index 2a8ffc7e0..3d43e1c51 100644 --- a/os/hal/include/can.h +++ b/os/hal/include/can.h @@ -27,7 +27,7 @@ #ifndef _CAN_H_ #define _CAN_H_ -#if CH_HAL_USE_CAN +#if CH_HAL_USE_CAN || defined(__DOXYGEN__) /** * @brief Driver state machine possible states. diff --git a/os/hal/include/hal.h b/os/hal/include/hal.h new file mode 100644 index 000000000..34ed2f08c --- /dev/null +++ b/os/hal/include/hal.h @@ -0,0 +1,59 @@ +/* + 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 hal.h + * @brief HAL subsystem header. + * @addtogroup HAL + * @{ + */ + +#ifndef _HAL_H_ +#define _HAL_H_ + +#include "halconf.h" +#include "board.h" + +#include "hal_lld.h" + +#include "pal.h" +#include "adc.h" +#include "can.h" +#include "mac.h" +#include "serial.h" +#include "spi.h" +#include "mmc_spi.h" + +/*===========================================================================*/ +/* External declarations. */ +/*===========================================================================*/ + +extern const STM32GPIOConfig pal_default_config; + +#ifdef __cplusplus +extern "C" { +#endif + void halInit(void); +#ifdef __cplusplus +} +#endif + +#endif /* _HAL_H_ */ + +/** @} */ diff --git a/os/hal/include/mac.h b/os/hal/include/mac.h index ae2d3a42e..c07d6029d 100644 --- a/os/hal/include/mac.h +++ b/os/hal/include/mac.h @@ -27,7 +27,7 @@ #ifndef _MAC_H_ #define _MAC_H_ -#if CH_HAL_USE_MAC +#if CH_HAL_USE_MAC || defined(__DOXYGEN__) #include "mac_lld.h" diff --git a/os/hal/include/mmc_spi.h b/os/hal/include/mmc_spi.h index e77dbe7dc..4a6886933 100644 --- a/os/hal/include/mmc_spi.h +++ b/os/hal/include/mmc_spi.h @@ -27,7 +27,7 @@ #ifndef _MMC_SPI_H_ #define _MMC_SPI_H_ -#if CH_HAL_USE_MMC_SPI +#if CH_HAL_USE_MMC_SPI || defined(__DOXYGEN__) /*===========================================================================*/ /* Driver pre-compile time settings. */ diff --git a/os/hal/include/pal.h b/os/hal/include/pal.h index 2ea625d5e..7f2e53344 100644 --- a/os/hal/include/pal.h +++ b/os/hal/include/pal.h @@ -27,7 +27,7 @@ #ifndef _PAL_H_ #define _PAL_H_ -#if CH_HAL_USE_PAL +#if CH_HAL_USE_PAL || defined(__DOXYGEN__) /** * @brief Bits in a mode word dedicated as mode selector. diff --git a/os/hal/include/serial.h b/os/hal/include/serial.h index 54e8b33a9..3623fa7e5 100644 --- a/os/hal/include/serial.h +++ b/os/hal/include/serial.h @@ -27,7 +27,7 @@ #ifndef _SERIAL_H_ #define _SERIAL_H_ -#if CH_HAL_USE_SERIAL +#if CH_HAL_USE_SERIAL || defined(__DOXYGEN__) /** No pending conditions.*/ #define SD_NO_ERROR 0 diff --git a/os/hal/include/spi.h b/os/hal/include/spi.h index 6f17f69c2..5d1355106 100644 --- a/os/hal/include/spi.h +++ b/os/hal/include/spi.h @@ -27,7 +27,7 @@ #ifndef _SPI_H_ #define _SPI_H_ -#if CH_HAL_USE_SPI +#if CH_HAL_USE_SPI || defined(__DOXYGEN__) /** * @brief Enables the mutual exclusion APIs on the SPI bus. diff --git a/os/hal/platforms/STM32/adc_lld.c b/os/hal/platforms/STM32/adc_lld.c index a48f7e9af..e90448fa3 100644 --- a/os/hal/platforms/STM32/adc_lld.c +++ b/os/hal/platforms/STM32/adc_lld.c @@ -27,7 +27,7 @@ #include "ch.h" #include "hal.h" -#if CH_HAL_USE_ADC +#if CH_HAL_USE_ADC || defined(__DOXYGEN__) /*===========================================================================*/ /* Low Level Driver exported variables. */ diff --git a/os/hal/platforms/STM32/adc_lld.h b/os/hal/platforms/STM32/adc_lld.h index c9b282685..2b254d7af 100644 --- a/os/hal/platforms/STM32/adc_lld.h +++ b/os/hal/platforms/STM32/adc_lld.h @@ -27,7 +27,7 @@ #ifndef _ADC_LLD_H_ #define _ADC_LLD_H_ -#if CH_HAL_USE_ADC +#if CH_HAL_USE_ADC || defined(__DOXYGEN__) /*===========================================================================*/ /* Driver pre-compile time settings. */ diff --git a/os/hal/platforms/STM32/can_lld.c b/os/hal/platforms/STM32/can_lld.c index 40450a071..91831cff1 100644 --- a/os/hal/platforms/STM32/can_lld.c +++ b/os/hal/platforms/STM32/can_lld.c @@ -27,7 +27,7 @@ #include "ch.h" #include "hal.h" -#if CH_HAL_USE_CAN +#if CH_HAL_USE_CAN || defined(__DOXYGEN__) /*===========================================================================*/ /* Low Level Driver exported variables. */ diff --git a/os/hal/platforms/STM32/can_lld.h b/os/hal/platforms/STM32/can_lld.h index 54572ba64..6b7cf3b6c 100644 --- a/os/hal/platforms/STM32/can_lld.h +++ b/os/hal/platforms/STM32/can_lld.h @@ -27,7 +27,7 @@ #ifndef _CAN_LLD_H_ #define _CAN_LLD_H_ -#if CH_HAL_USE_CAN +#if CH_HAL_USE_CAN || defined(__DOXYGEN__) /** * @brief This switch defines whether the driver implementation supports diff --git a/os/hal/platforms/STM32/pal_lld.c b/os/hal/platforms/STM32/pal_lld.c index 16050e6e2..7e4dd74e0 100644 --- a/os/hal/platforms/STM32/pal_lld.c +++ b/os/hal/platforms/STM32/pal_lld.c @@ -27,7 +27,7 @@ #include "ch.h" #include "hal.h" -#if CH_HAL_USE_PAL +#if CH_HAL_USE_PAL || defined(__DOXYGEN__) #if defined(STM32F10X_LD) #define APB2_RST_MASK (RCC_APB2RSTR_IOPARST | RCC_APB2RSTR_IOPBRST | \ diff --git a/os/hal/platforms/STM32/pal_lld.h b/os/hal/platforms/STM32/pal_lld.h index 74116a7a1..a9cb04a81 100644 --- a/os/hal/platforms/STM32/pal_lld.h +++ b/os/hal/platforms/STM32/pal_lld.h @@ -27,7 +27,7 @@ #ifndef _PAL_LLD_H_ #define _PAL_LLD_H_ -#if CH_HAL_USE_PAL +#if CH_HAL_USE_PAL || defined(__DOXYGEN__) /*===========================================================================*/ /* I/O Ports Types and constants. */ diff --git a/os/hal/platforms/STM32/serial_lld.c b/os/hal/platforms/STM32/serial_lld.c index 5337c4dfa..01646a75a 100644 --- a/os/hal/platforms/STM32/serial_lld.c +++ b/os/hal/platforms/STM32/serial_lld.c @@ -27,7 +27,7 @@ #include "ch.h" #include "hal.h" -#if CH_HAL_USE_SERIAL +#if CH_HAL_USE_SERIAL || defined(__DOXYGEN__) #if USE_STM32_USART1 || defined(__DOXYGEN__) /** @brief USART1 serial driver identifier.*/ diff --git a/os/hal/platforms/STM32/serial_lld.h b/os/hal/platforms/STM32/serial_lld.h index 983ae406d..c1118d8ca 100644 --- a/os/hal/platforms/STM32/serial_lld.h +++ b/os/hal/platforms/STM32/serial_lld.h @@ -27,7 +27,7 @@ #ifndef _SERIAL_LLD_H_ #define _SERIAL_LLD_H_ -#if CH_HAL_USE_SERIAL +#if CH_HAL_USE_SERIAL || defined(__DOXYGEN__) /*===========================================================================*/ /* Driver pre-compile time settings. */ diff --git a/os/hal/platforms/STM32/spi_lld.c b/os/hal/platforms/STM32/spi_lld.c index 0adbe4d8a..cf7916cf3 100644 --- a/os/hal/platforms/STM32/spi_lld.c +++ b/os/hal/platforms/STM32/spi_lld.c @@ -27,7 +27,7 @@ #include "ch.h" #include "hal.h" -#if CH_HAL_USE_SPI +#if CH_HAL_USE_SPI || defined(__DOXYGEN__) /*===========================================================================*/ /* Low Level Driver exported variables. */ diff --git a/os/hal/platforms/STM32/spi_lld.h b/os/hal/platforms/STM32/spi_lld.h index e065ed2d4..f8c00f136 100644 --- a/os/hal/platforms/STM32/spi_lld.h +++ b/os/hal/platforms/STM32/spi_lld.h @@ -27,7 +27,7 @@ #ifndef _SPI_LLD_H_ #define _SPI_LLD_H_ -#if CH_HAL_USE_SPI +#if CH_HAL_USE_SPI || defined(__DOXYGEN__) /*===========================================================================*/ /* Driver pre-compile time settings. */ diff --git a/os/hal/src/adc.c b/os/hal/src/adc.c index c074c0224..afa464212 100644 --- a/os/hal/src/adc.c +++ b/os/hal/src/adc.c @@ -27,7 +27,7 @@ #include "ch.h" #include "hal.h" -#if CH_HAL_USE_ADC +#if CH_HAL_USE_ADC || defined(__DOXYGEN__) /** * @brief ADC Driver initialization. diff --git a/os/hal/src/can.c b/os/hal/src/can.c index bb3e0d1a5..387581d8c 100644 --- a/os/hal/src/can.c +++ b/os/hal/src/can.c @@ -27,7 +27,7 @@ #include "ch.h" #include "hal.h" -#if CH_HAL_USE_CAN +#if CH_HAL_USE_CAN || defined(__DOXYGEN__) /** * @brief CAN Driver initialization. diff --git a/os/hal/src/hal.c b/os/hal/src/hal.c new file mode 100644 index 000000000..864789858 --- /dev/null +++ b/os/hal/src/hal.c @@ -0,0 +1,60 @@ +/* + 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 hal.c + * @brief HAL subsystem code. + * @addtogroup HAL + * @{ + */ + +#include "ch.h" +#include "hal.h" + +/** + * @brief HAL initialization. + */ +void halInit(void) { + + hal_lld_init(); + +#if CH_HAL_USE_PAL + palInit(&pal_default_config); +#endif +#if CH_HAL_USE_ADC + adcInit(); +#endif +#if CH_HAL_USE_CAN + canInit(); +#endif +#if CH_HAL_USE_MAC + macInit(); +#endif +#if CH_HAL_USE_SERIAL + sdInit(); +#endif +#if CH_HAL_USE_SPI + spiInit(); +#endif +#if CH_HAL_USE_MMC_SPI + mmcInit(); +#endif +} + +/** @} */ diff --git a/os/hal/src/mac.c b/os/hal/src/mac.c index 8dfb400aa..a18d3e4df 100644 --- a/os/hal/src/mac.c +++ b/os/hal/src/mac.c @@ -27,7 +27,7 @@ #include "ch.h" #include "hal.h" -#if CH_HAL_USE_MAC +#if CH_HAL_USE_MAC || defined(__DOXYGEN__) /** * @brief MAC Driver initialization. diff --git a/os/hal/src/mmc_spi.c b/os/hal/src/mmc_spi.c index 7846da353..24abf2a2b 100644 --- a/os/hal/src/mmc_spi.c +++ b/os/hal/src/mmc_spi.c @@ -27,7 +27,7 @@ #include "ch.h" #include "hal.h" -#if CH_HAL_USE_MMC_SPI +#if CH_HAL_USE_MMC_SPI || defined(__DOXYGEN__) /*===========================================================================*/ /* Driver local functions. */ diff --git a/os/hal/src/pal.c b/os/hal/src/pal.c index 1f9d058d5..53cfeb1f0 100644 --- a/os/hal/src/pal.c +++ b/os/hal/src/pal.c @@ -27,7 +27,7 @@ #include "ch.h" #include "hal.h" -#if CH_HAL_USE_PAL +#if CH_HAL_USE_PAL || defined(__DOXYGEN__) /** * @brief Read from an I/O bus. diff --git a/os/hal/src/serial.c b/os/hal/src/serial.c index 2944a98ab..d2cb17c77 100644 --- a/os/hal/src/serial.c +++ b/os/hal/src/serial.c @@ -27,7 +27,7 @@ #include "ch.h" #include "hal.h" -#if CH_HAL_USE_SERIAL +#if CH_HAL_USE_SERIAL || defined(__DOXYGEN__) /* * Interface implementation, the following functions just invoke the equivalent diff --git a/os/hal/src/spi.c b/os/hal/src/spi.c index 8b8ea6f32..08113a000 100644 --- a/os/hal/src/spi.c +++ b/os/hal/src/spi.c @@ -27,7 +27,7 @@ #include "ch.h" #include "hal.h" -#if CH_HAL_USE_SPI +#if CH_HAL_USE_SPI || defined(__DOXYGEN__) /** * @brief SPI Driver initialization. diff --git a/os/hal/templates/adc_lld.c b/os/hal/templates/adc_lld.c index 9aabc4bcd..dc68ef64a 100644 --- a/os/hal/templates/adc_lld.c +++ b/os/hal/templates/adc_lld.c @@ -27,7 +27,7 @@ #include "ch.h" #include "hal.h" -#if CH_HAL_USE_ADC +#if CH_HAL_USE_ADC || defined(__DOXYGEN__) /*===========================================================================*/ /* Low Level Driver exported variables. */ diff --git a/os/hal/templates/adc_lld.h b/os/hal/templates/adc_lld.h index ca14577f0..1cacf2ac9 100644 --- a/os/hal/templates/adc_lld.h +++ b/os/hal/templates/adc_lld.h @@ -27,7 +27,7 @@ #ifndef _ADC_LLD_H_ #define _ADC_LLD_H_ -#if CH_HAL_USE_ADC +#if CH_HAL_USE_ADC || defined(__DOXYGEN__) /*===========================================================================*/ /* Driver pre-compile time settings. */ diff --git a/os/hal/templates/can_lld.c b/os/hal/templates/can_lld.c index 7c56acad1..f2f54e66d 100644 --- a/os/hal/templates/can_lld.c +++ b/os/hal/templates/can_lld.c @@ -27,7 +27,7 @@ #include "ch.h" #include "hal.h" -#if CH_HAL_USE_CAN +#if CH_HAL_USE_CAN || defined(__DOXYGEN__) /*===========================================================================*/ /* Low Level Driver exported variables. */ diff --git a/os/hal/templates/can_lld.h b/os/hal/templates/can_lld.h index c899055c6..202f7e044 100644 --- a/os/hal/templates/can_lld.h +++ b/os/hal/templates/can_lld.h @@ -27,7 +27,7 @@ #ifndef _CAN_LLD_H_ #define _CAN_LLD_H_ -#if CH_HAL_USE_CAN +#if CH_HAL_USE_CAN || defined(__DOXYGEN__) /** * @brief This switch defines whether the driver implementation supports diff --git a/os/hal/templates/mac_lld.c b/os/hal/templates/mac_lld.c index fa6ef7a9e..cd859fff4 100644 --- a/os/hal/templates/mac_lld.c +++ b/os/hal/templates/mac_lld.c @@ -27,7 +27,7 @@ #include "ch.h" #include "hal.h" -#if CH_HAL_USE_MAC +#if CH_HAL_USE_MAC || defined(__DOXYGEN__) /** * @brief Low level MAC initialization. diff --git a/os/hal/templates/mac_lld.h b/os/hal/templates/mac_lld.h index 07a199f7e..82e88280d 100644 --- a/os/hal/templates/mac_lld.h +++ b/os/hal/templates/mac_lld.h @@ -27,7 +27,7 @@ #ifndef _MAC_LLD_H_ #define _MAC_LLD_H_ -#if CH_HAL_USE_MAC +#if CH_HAL_USE_MAC || defined(__DOXYGEN__) /*===========================================================================*/ /* Driver pre-compile time settings. */ diff --git a/os/hal/templates/pal_lld.c b/os/hal/templates/pal_lld.c index 598832d09..69417b24c 100644 --- a/os/hal/templates/pal_lld.c +++ b/os/hal/templates/pal_lld.c @@ -27,7 +27,7 @@ #include "ch.h" #include "hal.h" -#if CH_HAL_USE_PAL +#if CH_HAL_USE_PAL || defined(__DOXYGEN__) /*===========================================================================*/ /* Low Level Driver exported variables. */ diff --git a/os/hal/templates/pal_lld.h b/os/hal/templates/pal_lld.h index a8caf089b..2412ee294 100644 --- a/os/hal/templates/pal_lld.h +++ b/os/hal/templates/pal_lld.h @@ -27,7 +27,7 @@ #ifndef _PAL_LLD_H_ #define _PAL_LLD_H_ -#if CH_HAL_USE_PAL +#if CH_HAL_USE_PAL || defined(__DOXYGEN__) /*===========================================================================*/ /* Unsupported modes and specific modes */ diff --git a/os/hal/templates/serial_lld.c b/os/hal/templates/serial_lld.c index c4d63ed76..4b6164c2e 100644 --- a/os/hal/templates/serial_lld.c +++ b/os/hal/templates/serial_lld.c @@ -27,7 +27,7 @@ #include "ch.h" #include "hal.h" -#if CH_HAL_USE_SERIAL +#if CH_HAL_USE_SERIAL || defined(__DOXYGEN__) /** @brief Driver default configuration.*/ static const SerialDriverConfig default_config = { diff --git a/os/hal/templates/serial_lld.h b/os/hal/templates/serial_lld.h index 53cf2ce25..a0874c5e7 100644 --- a/os/hal/templates/serial_lld.h +++ b/os/hal/templates/serial_lld.h @@ -27,7 +27,7 @@ #ifndef _SERIAL_LLD_H_ #define _SERIAL_LLD_H_ -#if CH_HAL_USE_SERIAL +#if CH_HAL_USE_SERIAL || defined(__DOXYGEN__) /*===========================================================================*/ /* Driver pre-compile time settings. */ diff --git a/os/hal/templates/spi_lld.c b/os/hal/templates/spi_lld.c index 5fd6295d2..67e337f9f 100644 --- a/os/hal/templates/spi_lld.c +++ b/os/hal/templates/spi_lld.c @@ -27,7 +27,7 @@ #include "ch.h" #include "hal.h" -#if CH_HAL_USE_SPI +#if CH_HAL_USE_SPI || defined(__DOXYGEN__) /*===========================================================================*/ /* Low Level Driver exported variables. */ diff --git a/os/hal/templates/spi_lld.h b/os/hal/templates/spi_lld.h index 907bad859..b66d6cd70 100644 --- a/os/hal/templates/spi_lld.h +++ b/os/hal/templates/spi_lld.h @@ -27,7 +27,7 @@ #ifndef _SPI_LLD_H_ #define _SPI_LLD_H_ -#if CH_HAL_USE_SPI +#if CH_HAL_USE_SPI || defined(__DOXYGEN__) /*===========================================================================*/ /* Driver pre-compile time settings. */ -- cgit v1.2.3