From d7d1667ccd6032d570e9d53ec4988c4b1761a71f Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 6 Aug 2013 08:37:40 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6083 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/halnew/hal.mk | 15 +++++++++++++ os/halnew/include/hal.h | 3 ++- os/halnew/osal/chibios/osal.h | 35 +++++++++++++++++++++++++++++++ os/halnew/platforms/STM32/st_lld.c | 2 +- os/halnew/platforms/STM32F30x/hal_lld.h | 33 ----------------------------- os/halnew/platforms/STM32F30x/platform.mk | 1 + 6 files changed, 54 insertions(+), 35 deletions(-) create mode 100644 os/halnew/hal.mk (limited to 'os/halnew') 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. */ /*===========================================================================*/ @@ -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 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 \ -- cgit v1.2.3