git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6298 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
8261c67442
commit
a86b48c578
|
@ -51,6 +51,12 @@
|
|||
*/
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief System time counter resolution.
|
||||
* @note Allowed values are 16 or 32 bits.
|
||||
*/
|
||||
#define NIL_CFG_ST_RESOLUTION 32
|
||||
|
||||
/**
|
||||
* @brief System tick frequency.
|
||||
*/
|
||||
|
|
|
@ -51,6 +51,12 @@
|
|||
*/
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief System time counter resolution.
|
||||
* @note Allowed values are 16 or 32 bits.
|
||||
*/
|
||||
#define NIL_CFG_ST_RESOLUTION 32
|
||||
|
||||
/**
|
||||
* @brief System tick frequency.
|
||||
*/
|
||||
|
|
|
@ -51,6 +51,12 @@
|
|||
*/
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief System time counter resolution.
|
||||
* @note Allowed values are 16 or 32 bits.
|
||||
*/
|
||||
#define NIL_CFG_ST_RESOLUTION 16
|
||||
|
||||
/**
|
||||
* @brief System tick frequency.
|
||||
*/
|
||||
|
@ -64,7 +70,7 @@
|
|||
* The value one is not valid, timeouts are rounded up to
|
||||
* this value.
|
||||
*/
|
||||
#define NIL_CFG_ST_TIMEDELTA 0
|
||||
#define NIL_CFG_ST_TIMEDELTA 2
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
@ -83,11 +83,11 @@
|
|||
#error "STM32_ST_USE_TIMER specifies an unsupported timer"
|
||||
#endif
|
||||
|
||||
#if ST_CLOCK_SRC % OSAL_SYSTICK_FREQUENCY != 0
|
||||
#if ST_CLOCK_SRC % OSAL_ST_FREQUENCY != 0
|
||||
#error "the selected ST frequency is not obtainable because integer rounding"
|
||||
#endif
|
||||
|
||||
#if (ST_CLOCK_SRC / OSAL_SYSTICK_FREQUENCY) - 1 > 0xFFFF
|
||||
#if (ST_CLOCK_SRC / OSAL_ST_FREQUENCY) - 1 > 0xFFFF
|
||||
#error "the selected ST frequency is not obtainable because TIM timer prescaler limits"
|
||||
#endif
|
||||
|
||||
|
@ -95,11 +95,11 @@
|
|||
|
||||
#if OSAL_ST_MODE == OSAL_ST_MODE_PERIODIC
|
||||
|
||||
#if STM32_HCLK % OSAL_SYSTICK_FREQUENCY != 0
|
||||
#if STM32_HCLK % OSAL_ST_FREQUENCY != 0
|
||||
#error "the selected ST frequency is not obtainable because integer rounding"
|
||||
#endif
|
||||
|
||||
#if (STM32_HCLK / OSAL_SYSTICK_FREQUENCY) - 1 > 0xFFFFFF
|
||||
#if (STM32_HCLK / OSAL_ST_FREQUENCY) - 1 > 0xFFFFFF
|
||||
#error "the selected ST frequency is not obtainable because SysTick timer counter limits"
|
||||
#endif
|
||||
|
||||
|
@ -183,7 +183,7 @@ void st_lld_init(void) {
|
|||
ST_ENABLE_CLOCK();
|
||||
|
||||
/* Initializing the counter in free running mode.*/
|
||||
STM32_ST_TIM->PSC = (ST_CLOCK_SRC / OSAL_SYSTICK_FREQUENCY) - 1;
|
||||
STM32_ST_TIM->PSC = (ST_CLOCK_SRC / OSAL_ST_FREQUENCY) - 1;
|
||||
STM32_ST_TIM->ARR = ST_ARR_INIT;
|
||||
STM32_ST_TIM->CCMR1 = 0;
|
||||
STM32_ST_TIM->CCR[0] = 0;
|
||||
|
@ -199,7 +199,7 @@ void st_lld_init(void) {
|
|||
#if OSAL_ST_MODE == OSAL_ST_MODE_PERIODIC
|
||||
/* Periodic systick mode, the Cortex-Mx internal systick timer is used
|
||||
in this mode.*/
|
||||
SysTick->LOAD = (STM32_HCLK / OSAL_SYSTICK_FREQUENCY) - 1;
|
||||
SysTick->LOAD = (STM32_HCLK / OSAL_ST_FREQUENCY) - 1;
|
||||
SysTick->VAL = 0;
|
||||
SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
|
||||
SysTick_CTRL_ENABLE_Msk |
|
||||
|
|
|
@ -85,6 +85,20 @@
|
|||
#define OSAL_ST_MODE_FREERUNNING 2
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Systick parameters.
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief Size in bits of the @p systick_t type.
|
||||
*/
|
||||
#define OSAL_ST_RESOLUTION NIL_CFG_ST_RESOLUTION
|
||||
|
||||
/**
|
||||
* @brief Required systick frequency or resolution.
|
||||
*/
|
||||
#define OSAL_ST_FREQUENCY NIL_CFG_ST_FREQUENCY
|
||||
|
||||
/**
|
||||
* @brief Systick mode required by the underlying OS.
|
||||
*/
|
||||
|
@ -93,11 +107,7 @@
|
|||
#else
|
||||
#define OSAL_ST_MODE OSAL_ST_MODE_FREERUNNING
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Required systick frequency or resolution.
|
||||
*/
|
||||
#define OSAL_SYSTICK_FREQUENCY NIL_CFG_ST_FREQUENCY
|
||||
/** @} */
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Module pre-compile time settings. */
|
||||
|
@ -117,6 +127,10 @@
|
|||
#error "invalid OSAL_ST_MODE setting in osal.h"
|
||||
#endif
|
||||
|
||||
#if (OSAL_ST_RESOLUTION != 16) && (OSAL_ST_RESOLUTION != 32)
|
||||
#error "invalid OSAL_ST_RESOLUTION, must be 16 or 32"
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Module data structures and types. */
|
||||
/*===========================================================================*/
|
||||
|
|
|
@ -86,11 +86,18 @@
|
|||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Systick resolution.
|
||||
* @name Systick parameters.
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief Size in bits of the @p systick_t type.
|
||||
*/
|
||||
#define OSAL_ST_RESOLUTION CH_CFG_ST_RESOLUTION
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief Required systick frequency or resolution.
|
||||
*/
|
||||
#define OSAL_ST_FREQUENCY CH_CFG_ST_FREQUENCY
|
||||
|
||||
/**
|
||||
* @brief Systick mode required by the underlying OS.
|
||||
|
@ -100,11 +107,7 @@
|
|||
#else
|
||||
#define OSAL_ST_MODE OSAL_ST_MODE_FREERUNNING
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Required systick frequency or resolution.
|
||||
*/
|
||||
#define OSAL_SYSTICK_FREQUENCY CH_CFG_ST_FREQUENCY
|
||||
/** @} */
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Module pre-compile time settings. */
|
||||
|
|
Loading…
Reference in New Issue