aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-11-29 13:24:08 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-11-29 13:24:08 +0000
commit83fa155385e88ac06d6834604ab57c1132c5b0af (patch)
tree9e1624ee855a39cfbd313fdf01b34cab0226c9f1
parentfc91e8bea11e9e24684f39d69cceda6c2e2dd2d0 (diff)
downloadChibiOS-83fa155385e88ac06d6834604ab57c1132c5b0af.tar.gz
ChibiOS-83fa155385e88ac06d6834604ab57c1132c5b0af.tar.bz2
ChibiOS-83fa155385e88ac06d6834604ab57c1132c5b0af.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6513 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r--os/common/ports/ARMCMx/devices/STM32F4xx/cmparams.h5
-rw-r--r--os/rt/include/chsys.h9
-rw-r--r--os/rt/include/chvt.h36
3 files changed, 45 insertions, 5 deletions
diff --git a/os/common/ports/ARMCMx/devices/STM32F4xx/cmparams.h b/os/common/ports/ARMCMx/devices/STM32F4xx/cmparams.h
index 43277ee96..e742a7e66 100644
--- a/os/common/ports/ARMCMx/devices/STM32F4xx/cmparams.h
+++ b/os/common/ports/ARMCMx/devices/STM32F4xx/cmparams.h
@@ -57,7 +57,7 @@
* @note This number does not include the 16 system vectors and must be
* 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
asm module.*/
@@ -66,7 +66,8 @@
/* 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
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"
#endif
diff --git a/os/rt/include/chsys.h b/os/rt/include/chsys.h
index 9a74788ae..1b80bba65 100644
--- a/os/rt/include/chsys.h
+++ b/os/rt/include/chsys.h
@@ -145,35 +145,38 @@
/**
* @brief Realtime counter cycles 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
* @return The number of seconds.
*
* @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.
* @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
* @return The number of milliseconds.
*
* @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.
* @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
* @return The number of microseconds.
*
* @api
*/
-#define RTC2US(n) ((n) / (CH_CFG_RTC_FREQUENCY / 1000000UL))
+#define RTC2US(n) ((((n) - 1UL) / (CH_CFG_RTC_FREQUENCY / 1000000UL)) + 1UL)
/** @} */
/**
diff --git a/os/rt/include/chvt.h b/os/rt/include/chvt.h
index ea84df9fd..35d9986c0 100644
--- a/os/rt/include/chvt.h
+++ b/os/rt/include/chvt.h
@@ -160,6 +160,42 @@ struct virtual_timer {
#define US2ST(usec) \
((systime_t)(((((uint32_t)(usec)) * \
((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)
/** @} */
/*===========================================================================*/