diff options
| author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2014-03-08 10:19:32 +0000 | 
|---|---|---|
| committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2014-03-08 10:19:32 +0000 | 
| commit | 6bc9f636b5488434375da0296a3d90285dc1cec4 (patch) | |
| tree | b48404ced7251d3ec32dd816e7d4f96df8357d57 | |
| parent | f40d33139e0bd179b766d1576dfd7b494734ff67 (diff) | |
| download | ChibiOS-6bc9f636b5488434375da0296a3d90285dc1cec4.tar.gz ChibiOS-6bc9f636b5488434375da0296a3d90285dc1cec4.tar.bz2 ChibiOS-6bc9f636b5488434375da0296a3d90285dc1cec4.zip  | |
More enhancements to the GPT driver.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6759 35acf78f-673a-0410-8e92-d51de3d6d3f4
| -rw-r--r-- | os/hal/include/gpt.h | 32 | ||||
| -rw-r--r-- | os/hal/ports/STM32/LLD/TIMv1/gpt_lld.h | 29 | ||||
| -rw-r--r-- | os/hal/src/gpt.c | 4 | 
3 files changed, 54 insertions, 11 deletions
diff --git a/os/hal/include/gpt.h b/os/hal/include/gpt.h index 3b474cb14..a900243ba 100644 --- a/os/hal/include/gpt.h +++ b/os/hal/include/gpt.h @@ -79,9 +79,7 @@ typedef void (*gptcallback_t)(GPTDriver *gptp);  /**
   * @brief   Changes the interval of GPT peripheral.
   * @details This function changes the interval of a running GPT unit.
 - * @pre     The GPT unit must have been activated using @p gptStart().
 - * @pre     The GPT unit must have been running in continuous mode using
 - *          @p gptStartContinuous().
 + * @pre     The GPT unit must be running in continuous mode.
   * @post    The GPT unit interval is changed to the new value.
   *
   * @param[in] gptp      pointer to a @p GPTDriver object
 @@ -89,10 +87,34 @@ typedef void (*gptcallback_t)(GPTDriver *gptp);   *
   * @iclass
   */
 -#define gptChangeIntervalI(gptp, interval) {                                  \
 -  gpt_lld_change_interval(gptp, interval);                                    \
 +#define gptChangeIntervalI(gptp, interval) {                                \
 +  gpt_lld_change_interval(gptp, interval);                                  \
  }
 +/**
 + * @brief   Returns the interval of GPT peripheral.
 + * @pre     The GPT unit must be running in continuous mode.
 + *
 + * @param[in] gptp      pointer to a @p GPTDriver object
 + * @return              The current interval.
 + *
 + * @xclass
 + */
 +#define gptGetIntervalX(gptp) gpt_lld_get_interval(gptp)
 +
 +/**
 + * @brief   Returns the counter value of GPT peripheral.
 + * @pre     The GPT unit must be running in continuous mode.
 + * @note    The nature of the counter is not defined, it may count upward
 + *          or downward, it could be continuously running or not.
 + *
 + * @param[in] gptp      pointer to a @p GPTDriver object
 + * @return              The current counter value.
 + *
 + * @xclass
 + */
 +#define gptGetCounterX(gptp) gpt_lld_get_counter(gptp)
 +
  /*===========================================================================*/
  /* External declarations.                                                    */
  /*===========================================================================*/
 diff --git a/os/hal/ports/STM32/LLD/TIMv1/gpt_lld.h b/os/hal/ports/STM32/LLD/TIMv1/gpt_lld.h index 4a914133e..9f0b16980 100644 --- a/os/hal/ports/STM32/LLD/TIMv1/gpt_lld.h +++ b/os/hal/ports/STM32/LLD/TIMv1/gpt_lld.h @@ -432,19 +432,42 @@ struct GPTDriver {  /**
   * @brief   Changes the interval of GPT peripheral.
   * @details This function changes the interval of a running GPT unit.
 - * @pre     The GPT unit must have been activated using @p gptStart().
 - * @pre     The GPT unit must have been running in continuous mode using
 - *          @p gptStartContinuous().
 + * @pre     The GPT unit must be running in continuous mode.
   * @post    The GPT unit interval is changed to the new value.
   * @note    The function has effect at the next cycle start.
   *
   * @param[in] gptp      pointer to a @p GPTDriver object
   * @param[in] interval  new cycle time in timer ticks
 + *
   * @notapi
   */
  #define gpt_lld_change_interval(gptp, interval)                               \
    ((gptp)->tim->ARR = (uint32_t)((interval) - 1))
 +/**
 + * @brief   Returns the interval of GPT peripheral.
 + * @pre     The GPT unit must be running in continuous mode.
 + *
 + * @param[in] gptp      pointer to a @p GPTDriver object
 + * @return              The current interval.
 + *
 + * @notapi
 + */
 +#define gpt_lld_get_interval(gptp) ((gptcnt_t)(gptp)->tim->ARR + 1)
 +
 +/**
 + * @brief   Returns the counter value of GPT peripheral.
 + * @pre     The GPT unit must be running in continuous mode.
 + * @note    The nature of the counter is not defined, it may count upward
 + *          or downward, it could be continuously running or not.
 + *
 + * @param[in] gptp      pointer to a @p GPTDriver object
 + * @return              The current counter value.
 + *
 + * @notapi
 + */
 +#define gpt_lld_get_counter(gptp) ((gptcnt_t)(gptp)->tim->CNT)
 +
  /*===========================================================================*/
  /* External declarations.                                                    */
  /*===========================================================================*/
 diff --git a/os/hal/src/gpt.c b/os/hal/src/gpt.c index 780ac407e..d654a3c4a 100644 --- a/os/hal/src/gpt.c +++ b/os/hal/src/gpt.c @@ -118,9 +118,7 @@ void gptStop(GPTDriver *gptp) {  /**
   * @brief   Changes the interval of GPT peripheral.
   * @details This function changes the interval of a running GPT unit.
 - * @pre     The GPT unit must have been activated using @p gptStart().
 - * @pre     The GPT unit must have been running in continuous mode using
 - *          @p gptStartContinuous().
 + * @pre     The GPT unit must be running in continuous mode.
   * @post    The GPT unit interval is changed to the new value.
   *
   * @param[in] gptp      pointer to a @p GPTDriver object
  | 
