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

This commit is contained in:
gdisirio 2013-11-29 13:24:08 +00:00
parent fc91e8bea1
commit 83fa155385
3 changed files with 45 additions and 5 deletions

View File

@ -57,7 +57,7 @@
* @note This number does not include the 16 system vectors and must be * @note This number does not include the 16 system vectors and must be
* rounded to a multiple of 8. * rounded to a multiple of 8.
*/ */
#define CORTEX_NUM_VECTORS 88 #define CORTEX_NUM_VECTORS 96
/* The following code is not processed when the file is included from an /* The following code is not processed when the file is included from an
asm module.*/ asm module.*/
@ -66,7 +66,8 @@
/* If the device type is not externally defined, for example from the Makefile, /* If the device type is not externally defined, for example from the Makefile,
then a file named board.h is included. This file must contain a device then a file named board.h is included. This file must contain a device
definition compatible with the vendor include file.*/ definition compatible with the vendor include file.*/
#if !defined(STM32F40XX) && !defined(STM32F427X) #if !defined(STM32F40_41xxx) && !defined(STM32F427_437xx) && \
!defined(STM32F429_439xx) && !defined(STM32F401xx)
#include "board.h" #include "board.h"
#endif #endif

View File

@ -145,35 +145,38 @@
/** /**
* @brief Realtime counter cycles to seconds. * @brief Realtime counter cycles to seconds.
* @details Converts from realtime counter cycles number to seconds. * @details Converts from realtime counter cycles number to seconds.
* @note The result is rounded up to the next second boundary.
* *
* @param[in] n number of cycles * @param[in] n number of cycles
* @return The number of seconds. * @return The number of seconds.
* *
* @api * @api
*/ */
#define RTC2S(n) (rtcnt_t)(CH_CFG_RTC_FREQUENCY / (freq)) #define RTC2S(n) ((((n) - 1UL) / CH_CFG_RTC_FREQUENCY) + 1UL)
/** /**
* @brief Realtime counter cycles to milliseconds. * @brief Realtime counter cycles to milliseconds.
* @details Converts from realtime counter cycles number to milliseconds. * @details Converts from realtime counter cycles number to milliseconds.
* @note The result is rounded up to the next millisecond boundary.
* *
* @param[in] n number of cycles * @param[in] n number of cycles
* @return The number of milliseconds. * @return The number of milliseconds.
* *
* @api * @api
*/ */
#define RTC2MS(n) ((n) / (CH_CFG_RTC_FREQUENCY / 1000UL)) #define RTC2MS(n) ((((n) - 1UL) / (CH_CFG_RTC_FREQUENCY / 1000UL)) + 1UL)
/** /**
* @brief Realtime counter cycles to microseconds. * @brief Realtime counter cycles to microseconds.
* @details Converts from realtime counter cycles number to microseconds. * @details Converts from realtime counter cycles number to microseconds.
* @note The result is rounded up to the next microsecond boundary.
* *
* @param[in] n number of cycles * @param[in] n number of cycles
* @return The number of microseconds. * @return The number of microseconds.
* *
* @api * @api
*/ */
#define RTC2US(n) ((n) / (CH_CFG_RTC_FREQUENCY / 1000000UL)) #define RTC2US(n) ((((n) - 1UL) / (CH_CFG_RTC_FREQUENCY / 1000000UL)) + 1UL)
/** @} */ /** @} */
/** /**

View File

@ -160,6 +160,42 @@ struct virtual_timer {
#define US2ST(usec) \ #define US2ST(usec) \
((systime_t)(((((uint32_t)(usec)) * \ ((systime_t)(((((uint32_t)(usec)) * \
((uint32_t)CH_CFG_ST_FREQUENCY) - 1UL) / 1000000UL) + 1UL)) ((uint32_t)CH_CFG_ST_FREQUENCY) - 1UL) / 1000000UL) + 1UL))
/**
* @brief System ticks to seconds.
* @details Converts from system ticks number to seconds.
* @note The result is rounded up to the next second boundary.
*
* @param[in] n number of system ticks
* @return The number of seconds.
*
* @api
*/
#define ST2S(n) ((((n) - 1UL) / CH_CFG_ST_FREQUENCY) + 1UL)
/**
* @brief System ticks to milliseconds.
* @details Converts from system ticks number to milliseconds.
* @note The result is rounded up to the next millisecond boundary.
*
* @param[in] n number of system ticks
* @return The number of milliseconds.
*
* @api
*/
#define ST2MS(n) ((((n) - 1UL) / (CH_CFG_ST_FREQUENCY / 1000UL)) + 1UL)
/**
* @brief System ticks to microseconds.
* @details Converts from system ticks number to microseconds.
* @note The result is rounded up to the next microsecond boundary.
*
* @param[in] n number of system ticks
* @return The number of microseconds.
*
* @api
*/
#define ST2US(n) ((((n) - 1UL) / (CH_CFG_ST_FREQUENCY / 1000000UL)) + 1UL)
/** @} */ /** @} */
/*===========================================================================*/ /*===========================================================================*/