git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1354 35acf78f-673a-0410-8e92-d51de3d6d3f4

master
gdisirio 2009-11-29 10:37:31 +00:00
parent d477d161e3
commit f90ae4d17d
38 changed files with 155 additions and 36 deletions

View File

@ -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"

View File

@ -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.

59
os/hal/include/hal.h Normal file
View File

@ -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 <http://www.gnu.org/licenses/>.
*/
/**
* @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_ */
/** @} */

View File

@ -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"

View File

@ -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. */

View File

@ -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.

View File

@ -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

View File

@ -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.

View File

@ -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. */

View File

@ -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. */

View File

@ -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. */

View File

@ -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

View File

@ -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 | \

View File

@ -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. */

View File

@ -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.*/

View File

@ -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. */

View File

@ -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. */

View File

@ -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. */

View File

@ -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.

View File

@ -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.

60
os/hal/src/hal.c Normal file
View File

@ -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 <http://www.gnu.org/licenses/>.
*/
/**
* @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
}
/** @} */

View File

@ -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.

View File

@ -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. */

View File

@ -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.

View File

@ -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

View File

@ -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.

View File

@ -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. */

View File

@ -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. */

View File

@ -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. */

View File

@ -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

View File

@ -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.

View File

@ -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. */

View File

@ -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. */

View File

@ -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 */

View File

@ -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 = {

View File

@ -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. */

View File

@ -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. */

View File

@ -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. */