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

This commit is contained in:
gdisirio 2013-08-06 08:37:40 +00:00
parent 8a4a66b32d
commit d7d1667ccd
10 changed files with 55 additions and 112 deletions

15
os/halnew/hal.mk Normal file
View File

@ -0,0 +1,15 @@
# List of all the ChibiOS/RT HAL files, there is no need to remove the files
# from this list, you can disable parts of the kernel by editing halconf.h.
HALSRC = ${CHIBIOS}/os/halnew/src/hal.c \
${CHIBIOS}/os/halnew/src/hal_queues.c \
${CHIBIOS}/os/halnew/src/adc.c \
${CHIBIOS}/os/halnew/src/can.c \
${CHIBIOS}/os/halnew/src/icu.c \
${CHIBIOS}/os/halnew/src/pal.c \
${CHIBIOS}/os/halnew/src/pwm.c \
${CHIBIOS}/os/halnew/src/serial.c \
${CHIBIOS}/os/halnew/src/spi.c \
${CHIBIOS}/os/halnew/src/st.c \
# Required include directories
HALINC = ${CHIBIOS}/os/halnew/include

View File

@ -30,12 +30,12 @@
#define _HAL_H_
#include "osal.h"
#include "st.h"
#include "board.h"
#include "halconf.h"
#include "hal_lld.h"
/* Abstract interfaces.*/
#include "hal_streams.h"
#include "hal_channels.h"
@ -59,6 +59,7 @@
#include "serial.h"
//#include "sdc.h"
#include "spi.h"
#include "st.h"
//#include "uart.h"
//#include "usb.h"

View File

@ -74,6 +74,29 @@
/** @} */
#endif
/**
* @name Systick modes.
* @{
*/
#define OSAL_ST_MODE_NONE 0
#define OSAL_ST_MODE_PERIODIC 1
#define OSAL_ST_MODE_FREERUNNING 2
/** @} */
/**
* @brief Systick mode required by the underlying OS.
*/
#if (CH_CFG_TIMEDELTA == 0) || defined(__DOXYGEN__)
#define OSAL_ST_MODE OSAL_ST_MODE_PERIODIC
#else
#define OSAL_ST_MODE OSAL_ST_MODE_FREERUNNING
#endif
/**
* @brief Required systick frequency or resolution.
*/
#define OSAL_SYSTICK_FREQUENCY CH_CFG_FREQUENCY
/*===========================================================================*/
/* Module pre-compile time settings. */
/*===========================================================================*/
@ -286,6 +309,18 @@ static inline void osalSysUnlockFromISR(void) {
chSysUnlockFromISR();
}
/**
* @brief Systick callback for the underlying OS.
* @note This callback is only defined if the OSAL requires such a
* service from the HAL.
*/
#if (OSAL_ST_MODE != OSAL_ST_MODE_NONE) || defined(__DOXYGEN__)
static inline void osalOsTimerHandlerI(void) {
chSysTimerHandlerI();
}
#endif
/**
* @brief Checks if a reschedule is required and performs it.
* @note I-Class functions invoked from thread context must not reschedule

View File

@ -83,7 +83,7 @@ OSAL_IRQ_HANDLER(STM32_TIM2_HANDLER) {
STM32_TIM2->SR = 0;
osalSysLockFromISR();
osalTimerHandlerI();
osalOsTimerHandlerI();
osalSysUnlockFromISR();
OSAL_IRQ_EPILOGUE();

View File

@ -1077,43 +1077,10 @@
/* Driver data structures and types. */
/*===========================================================================*/
/**
* @brief Type representing a system clock frequency.
*/
typedef uint32_t halclock_t;
/**
* @brief Type of the realtime free counter value.
*/
typedef uint32_t halrtcnt_t;
/*===========================================================================*/
/* Driver macros. */
/*===========================================================================*/
/**
* @brief Returns the current value of the system free running counter.
* @note This service is implemented by returning the content of the
* DWT_CYCCNT register.
*
* @return The value of the system free running counter of
* type halrtcnt_t.
*
* @notapi
*/
#define hal_lld_get_counter_value() DWT_CYCCNT
/**
* @brief Realtime counter frequency.
* @note The DWT_CYCCNT register is incremented directly by the system
* clock so this function returns STM32_HCLK.
*
* @return The realtime counter frequency of type halclock_t.
*
* @notapi
*/
#define hal_lld_get_counter_frequency() STM32_HCLK
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/

View File

@ -8,6 +8,7 @@ PLATFORMSRC = ${CHIBIOS}/os/halnew/platforms/STM32F30x/stm32_dma.c \
${CHIBIOS}/os/halnew/platforms/STM32/gpt_lld.c \
${CHIBIOS}/os/halnew/platforms/STM32/icu_lld.c \
${CHIBIOS}/os/halnew/platforms/STM32/pwm_lld.c \
${CHIBIOS}/os/halnew/platforms/STM32/st_lld.c \
${CHIBIOS}/os/halnew/platforms/STM32/GPIOv2/pal_lld.c \
${CHIBIOS}/os/halnew/platforms/STM32/I2Cv2/i2c_lld.c \
${CHIBIOS}/os/halnew/platforms/STM32/RTCv2/rtc_lld.c \

View File

@ -1,75 +0,0 @@
/*
Nil RTOS - Copyright (C) 2012 Giovanni Di Sirio.
This file is part of Nil RTOS.
Nil RTOS 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.
Nil RTOS 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 STM32F3xx/chtimer.c
* @brief System timer code.
*
* @addtogroup STM32F3_TIMER
*/
#include "ch.h"
#if CH_CFG_TIMEDELTA > 0
/*===========================================================================*/
/* Module local definitions. */
/*===========================================================================*/
/*===========================================================================*/
/* Module exported variables. */
/*===========================================================================*/
/*===========================================================================*/
/* Module local variables. */
/*===========================================================================*/
/*===========================================================================*/
/* Module local functions. */
/*===========================================================================*/
/*===========================================================================*/
/* Module interrupt handlers. */
/*===========================================================================*/
/**
* @brief TIM2 interrupt handler.
*
* @isr
*/
CH_IRQ_HANDLER(VectorB0) {
CH_IRQ_PROLOGUE();
STM32F3_TIM2->SR = 0;
chSysLockFromISR();
chSysTimerHandlerI();
chSysUnlockFromISR();
CH_IRQ_EPILOGUE();
}
/*===========================================================================*/
/* Module exported functions. */
/*===========================================================================*/
#endif /* CH_CFG_TIMEDELTA > 0 */
/** @} */

View File

@ -1,7 +1,6 @@
# List of the ChibiOS/RT Cortex-M4 STM32 port files.
PORTSRC = $(CHIBIOS)/os/ports/GCC/ARMCMx/crt0.c \
$(CHIBIOS)/os/ports/GCC/ARMCMx/STM32F3xx/vectors.c \
$(CHIBIOS)/os/ports/GCC/ARMCMx/STM32F3xx/chtimer.c \
${CHIBIOS}/os/ports/GCC/ARMCMx/chcore.c \
${CHIBIOS}/os/ports/GCC/ARMCMx/chcore_v7m.c \
${CHIBIOS}/os/ports/common/ARMCMx/nvic.c

View File

@ -405,7 +405,7 @@ extern "C" {
#endif
#if CH_CFG_TIMEDELTA > 0
#include "chtimer.h"
#include "systick.h"
#endif
/*===========================================================================*/