diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2013-08-06 08:37:40 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2013-08-06 08:37:40 +0000 |
commit | d7d1667ccd6032d570e9d53ec4988c4b1761a71f (patch) | |
tree | 7d3996904887aed46fbff7eeae541ffae8aaf4bd | |
parent | 8a4a66b32d8290b2cd13e1fcda6d72a1654b8ab7 (diff) | |
download | ChibiOS-d7d1667ccd6032d570e9d53ec4988c4b1761a71f.tar.gz ChibiOS-d7d1667ccd6032d570e9d53ec4988c4b1761a71f.tar.bz2 ChibiOS-d7d1667ccd6032d570e9d53ec4988c4b1761a71f.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6083 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r-- | os/halnew/hal.mk | 15 | ||||
-rw-r--r-- | os/halnew/include/hal.h | 3 | ||||
-rw-r--r-- | os/halnew/osal/chibios/osal.h | 35 | ||||
-rw-r--r-- | os/halnew/platforms/STM32/st_lld.c | 2 | ||||
-rw-r--r-- | os/halnew/platforms/STM32F30x/hal_lld.h | 33 | ||||
-rw-r--r-- | os/halnew/platforms/STM32F30x/platform.mk | 1 | ||||
-rw-r--r-- | os/ports/GCC/ARMCMx/STM32F3xx/chtimer.c | 75 | ||||
-rw-r--r-- | os/ports/GCC/ARMCMx/STM32F3xx/port.mk | 1 | ||||
-rw-r--r-- | os/ports/GCC/ARMCMx/STM32F3xx/systick.h (renamed from os/ports/GCC/ARMCMx/STM32F3xx/chtimer.h) | 0 | ||||
-rw-r--r-- | os/ports/GCC/ARMCMx/chcore_v7m.h | 2 |
10 files changed, 55 insertions, 112 deletions
diff --git a/os/halnew/hal.mk b/os/halnew/hal.mk new file mode 100644 index 000000000..7f93a6263 --- /dev/null +++ b/os/halnew/hal.mk @@ -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
diff --git a/os/halnew/include/hal.h b/os/halnew/include/hal.h index 9251afacb..bafdb5419 100644 --- a/os/halnew/include/hal.h +++ b/os/halnew/include/hal.h @@ -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"
diff --git a/os/halnew/osal/chibios/osal.h b/os/halnew/osal/chibios/osal.h index 52509e8c8..9c6170d4b 100644 --- a/os/halnew/osal/chibios/osal.h +++ b/os/halnew/osal/chibios/osal.h @@ -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. */
/*===========================================================================*/
@@ -287,6 +310,18 @@ static inline void osalSysUnlockFromISR(void) { }
/**
+ * @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
* by themselves, an explicit reschedule using this function is
diff --git a/os/halnew/platforms/STM32/st_lld.c b/os/halnew/platforms/STM32/st_lld.c index ed1c03c56..2c637042f 100644 --- a/os/halnew/platforms/STM32/st_lld.c +++ b/os/halnew/platforms/STM32/st_lld.c @@ -83,7 +83,7 @@ OSAL_IRQ_HANDLER(STM32_TIM2_HANDLER) { STM32_TIM2->SR = 0;
osalSysLockFromISR();
- osalTimerHandlerI();
+ osalOsTimerHandlerI();
osalSysUnlockFromISR();
OSAL_IRQ_EPILOGUE();
diff --git a/os/halnew/platforms/STM32F30x/hal_lld.h b/os/halnew/platforms/STM32F30x/hal_lld.h index 625700ab5..eab83a194 100644 --- a/os/halnew/platforms/STM32F30x/hal_lld.h +++ b/os/halnew/platforms/STM32F30x/hal_lld.h @@ -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. */
/*===========================================================================*/
diff --git a/os/halnew/platforms/STM32F30x/platform.mk b/os/halnew/platforms/STM32F30x/platform.mk index da5921b5b..5fd4ced5d 100644 --- a/os/halnew/platforms/STM32F30x/platform.mk +++ b/os/halnew/platforms/STM32F30x/platform.mk @@ -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 \
diff --git a/os/ports/GCC/ARMCMx/STM32F3xx/chtimer.c b/os/ports/GCC/ARMCMx/STM32F3xx/chtimer.c deleted file mode 100644 index 9eba072c5..000000000 --- a/os/ports/GCC/ARMCMx/STM32F3xx/chtimer.c +++ /dev/null @@ -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 */
-
-/** @} */
diff --git a/os/ports/GCC/ARMCMx/STM32F3xx/port.mk b/os/ports/GCC/ARMCMx/STM32F3xx/port.mk index e4da1ad11..09cc8dfd6 100644 --- a/os/ports/GCC/ARMCMx/STM32F3xx/port.mk +++ b/os/ports/GCC/ARMCMx/STM32F3xx/port.mk @@ -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
diff --git a/os/ports/GCC/ARMCMx/STM32F3xx/chtimer.h b/os/ports/GCC/ARMCMx/STM32F3xx/systick.h index 4f42a1fb3..4f42a1fb3 100644 --- a/os/ports/GCC/ARMCMx/STM32F3xx/chtimer.h +++ b/os/ports/GCC/ARMCMx/STM32F3xx/systick.h diff --git a/os/ports/GCC/ARMCMx/chcore_v7m.h b/os/ports/GCC/ARMCMx/chcore_v7m.h index b9b30dad2..e3a6c627c 100644 --- a/os/ports/GCC/ARMCMx/chcore_v7m.h +++ b/os/ports/GCC/ARMCMx/chcore_v7m.h @@ -405,7 +405,7 @@ extern "C" { #endif
#if CH_CFG_TIMEDELTA > 0
-#include "chtimer.h"
+#include "systick.h"
#endif
/*===========================================================================*/
|