diff options
| author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2013-08-06 09:19:19 +0000 | 
|---|---|---|
| committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2013-08-06 09:19:19 +0000 | 
| commit | 04601b760b4d72a400237c5469a0962a66251507 (patch) | |
| tree | 9761c4f0f7fa3303e3c120652a6d3acbe7bcf1b8 /os/kernel | |
| parent | d7d1667ccd6032d570e9d53ec4988c4b1761a71f (diff) | |
| download | ChibiOS-04601b760b4d72a400237c5469a0962a66251507.tar.gz ChibiOS-04601b760b4d72a400237c5469a0962a66251507.tar.bz2 ChibiOS-04601b760b4d72a400237c5469a0962a66251507.zip | |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6084 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/kernel')
| -rw-r--r-- | os/kernel/include/chsys.h | 20 | ||||
| -rw-r--r-- | os/kernel/include/chvt.h | 16 | 
2 files changed, 16 insertions, 20 deletions
| diff --git a/os/kernel/include/chsys.h b/os/kernel/include/chsys.h index 9eaf5d8e6..2d7cfa430 100644 --- a/os/kernel/include/chsys.h +++ b/os/kernel/include/chsys.h @@ -109,75 +109,71 @@   * @details Converts from seconds to realtime counter cycles.
   * @note    The result is rounded upward to the next tick boundary.
   *
 - * @param[in] freq      realtime counter operating frequency
   * @param[in] sec       number of seconds
   * @return              The number of cycles.
   *
   * @api
   */
 -#define S2RTV(freq, sec) ((freq) * (sec))
 +#define S2RTV(sec) (CH_CFG_RTC_FREQUENCY * (sec))
  /**
   * @brief   Milliseconds to realtime counter.
   * @details Converts from milliseconds to realtime counter cycles.
   * @note    The result is rounded upward to the next tick boundary.
   *
 - * @param[in] freq      realtime counter operating frequency
   * @param[in] msec      number of milliseconds
   * @return              The number of cycles.
   *
   * @api
   */
 -#define MS2RTC(freq, msec) (rtcnt_t)((((freq) + 999UL) / 1000UL) * (msec))
 +#define MS2RTC(msec) (rtcnt_t)(((CH_CFG_RTC_FREQUENCY + 999UL) /            \
 +                                1000UL) * (msec))
  /**
   * @brief   Microseconds to realtime counter.
   * @details Converts from microseconds to realtime counter cycles.
   * @note    The result is rounded upward to the next tick boundary.
   *
 - * @param[in] freq      realtime counter operating frequency
   * @param[in] usec      number of microseconds
   * @return              The number of cycles.
   *
   * @api
   */
 -#define US2RTC(freq, usec) (rtcnt_t)((((freq) + 999999UL) / 1000000UL) * (usec))
 +#define US2RTC(usec) (rtcnt_t)(((CH_CFG_RTC_FREQUENCY + 999999UL) /         \
 +                                1000000UL) * (usec))
  /**
   * @brief   Realtime counter cycles to seconds.
   * @details Converts from realtime counter cycles number to seconds.
   *
 - * @param[in] freq      realtime counter operating frequency
   * @param[in] n         number of cycles
   * @return              The number of seconds.
   *
   * @api
   */
 -#define RTC2S(freq, n) (rtcnt_t)((n) / (freq))
 +#define RTC2S(n) (rtcnt_t)(CH_CFG_RTC_FREQUENCY / (freq))
  /**
   * @brief   Realtime counter cycles to milliseconds.
   * @details Converts from realtime counter cycles number to milliseconds.
   *
 - * @param[in] freq      realtime counter operating frequency
   * @param[in] n         number of cycles
   * @return              The number of milliseconds.
   *
   * @api
   */
 -#define RTC2MS(freq, n) ((n) / ((freq) / 1000UL))
 +#define RTC2MS(n) ((n) / (CH_CFG_RTC_FREQUENCY / 1000UL))
  /**
   * @brief   Realtime counter cycles to microseconds.
   * @details Converts from realtime counter cycles number to microseconds.
   *
 - * @param[in] freq      realtime counter operating frequency
   * @param[in] n         number of cycles
   * @return              The number of microseconds.
   *
   * @api
   */
 -#define RTC2US(freq, n) ((n) / ((freq) / 1000000UL))
 +#define RTC2US(n) ((n) / (CH_CFG_RTC_FREQUENCY / 1000000UL))
  /** @} */
  /**
 diff --git a/os/kernel/include/chvt.h b/os/kernel/include/chvt.h index 10168a66e..75823f954 100644 --- a/os/kernel/include/chvt.h +++ b/os/kernel/include/chvt.h @@ -41,12 +41,12 @@  /* Derived constants and error checks.                                       */
  /*===========================================================================*/
 -#if CH_CFG_FREQUENCY <= 0
 -#error "invalid CH_CFG_FREQUENCY specified"
 +#if CH_CFG_ST_FREQUENCY <= 0
 +#error "invalid CH_CFG_ST_FREQUENCY specified"
  #endif
  #if (CH_CFG_TIMEDELTA < 0) || (CH_CFG_TIMEDELTA == 1)
 -#error "invalid NIL_CFG_TIMEDELTA specified"
 +#error "invalid CH_CFG_TIMEDELTA specified"
  #endif
  #if (CH_CFG_TIMEDELTA > 0) && (CH_CFG_TIME_QUANTUM > 0)
 @@ -125,7 +125,7 @@ struct virtual_timer {   * @api
   */
  #define S2ST(sec)                                                           \
 -  ((systime_t)((uint32_t)(sec) * (uint32_t)CH_CFG_FREQUENCY))
 +  ((systime_t)((uint32_t)(sec) * (uint32_t)CH_CFG_ST_FREQUENCY))
  /**
   * @brief   Milliseconds to system ticks.
 @@ -138,8 +138,8 @@ struct virtual_timer {   * @api
   */
  #define MS2ST(msec)                                                         \
 -  ((systime_t)(((((uint32_t)(msec)) * ((uint32_t)CH_CFG_FREQUENCY) - 1UL) /     \
 -                1000UL) + 1UL))
 +  ((systime_t)(((((uint32_t)(msec)) *                                       \
 +                 ((uint32_t)CH_CFG_ST_FREQUENCY) - 1UL) / 1000UL) + 1UL))
  /**
   * @brief   Microseconds to system ticks.
 @@ -152,8 +152,8 @@ struct virtual_timer {   * @api
   */
  #define US2ST(usec)                                                         \
 -  ((systime_t)(((((uint32_t)(usec)) * ((uint32_t)CH_CFG_FREQUENCY) - 1UL) /     \
 -                1000000UL) + 1UL))
 +  ((systime_t)(((((uint32_t)(usec)) *                                       \
 +                 ((uint32_t)CH_CFG_ST_FREQUENCY) - 1UL) / 1000000UL) + 1UL))
  /** @} */
  /*===========================================================================*/
 | 
