From 794c092a2aa7dfe3ca93a9ac5f5714855854553f Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 2 May 2013 12:06:58 +0000 Subject: Fixed eTimer ICU driver. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5653 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/platforms/SPC5xx/eTimer_v1/icu_lld.c | 4 ++-- os/hal/platforms/SPC5xx/eTimer_v1/icu_lld.h | 21 ++++++++++----------- testhal/SPC56ELxx/PWM-ICU/chconf.h | 10 +++++----- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/os/hal/platforms/SPC5xx/eTimer_v1/icu_lld.c b/os/hal/platforms/SPC5xx/eTimer_v1/icu_lld.c index da762432e..609be3c2f 100644 --- a/os/hal/platforms/SPC5xx/eTimer_v1/icu_lld.c +++ b/os/hal/platforms/SPC5xx/eTimer_v1/icu_lld.c @@ -285,10 +285,10 @@ static void icu_lld_serve_interrupt(ICUDriver *icup) { * @param[in] config the architecture-dependent ICU driver configuration */ static void spc5_icu_smod_init(ICUDriver *icup) { - uint32_t psc = (icup->clock / icup->config->frequency); + uint32_t psc = (SPC5_ETIMER0_CLK / icup->config->frequency); chDbgAssert((psc <= 0xFFFF) && - ((psc * icup->config->frequency) == icup->clock) && + ((psc * icup->config->frequency) == SPC5_ETIMER0_CLK) && ((psc == 1) || (psc == 2) || (psc == 4) || (psc == 8) || (psc == 16) || (psc == 32) || (psc == 64) || (psc == 128)), diff --git a/os/hal/platforms/SPC5xx/eTimer_v1/icu_lld.h b/os/hal/platforms/SPC5xx/eTimer_v1/icu_lld.h index 9ec046b13..1e07e7918 100644 --- a/os/hal/platforms/SPC5xx/eTimer_v1/icu_lld.h +++ b/os/hal/platforms/SPC5xx/eTimer_v1/icu_lld.h @@ -458,20 +458,19 @@ struct ICUDriver { /** * @brief Driver state. */ - icustate_t state; - /** - * @brief eTimer submodule number. - */ - uint8_t smod_number; + icustate_t state; /** * @brief Current configuration data. */ - const ICUConfig *config; + const ICUConfig *config; +#if defined(ICU_DRIVER_EXT_FIELDS) + ICU_DRIVER_EXT_FIELDS +#endif + /* End of the mandatory fields.*/ /** - * @brief Timer base clock. + * @brief eTimer submodule number. */ - uint32_t clock; - /* End of the mandatory fields.*/ + uint32_t smod_number; /** * @brief Pointer to the eTimerx registers block. */ @@ -479,11 +478,11 @@ struct ICUDriver { /** * @brief CCR register used for width capture. */ - volatile vuint16_t *wccrp; + volatile vuint16_t *wccrp; /** * @brief CCR register used for period capture. */ - volatile vuint16_t *pccrp; + volatile vuint16_t *pccrp; }; /*===========================================================================*/ diff --git a/testhal/SPC56ELxx/PWM-ICU/chconf.h b/testhal/SPC56ELxx/PWM-ICU/chconf.h index c132ac014..50d8024a1 100644 --- a/testhal/SPC56ELxx/PWM-ICU/chconf.h +++ b/testhal/SPC56ELxx/PWM-ICU/chconf.h @@ -357,7 +357,7 @@ * @note The default is @p FALSE. */ #if !defined(CH_DBG_SYSTEM_STATE_CHECK) || defined(__DOXYGEN__) -#define CH_DBG_SYSTEM_STATE_CHECK FALSE +#define CH_DBG_SYSTEM_STATE_CHECK TRUE #endif /** @@ -368,7 +368,7 @@ * @note The default is @p FALSE. */ #if !defined(CH_DBG_ENABLE_CHECKS) || defined(__DOXYGEN__) -#define CH_DBG_ENABLE_CHECKS FALSE +#define CH_DBG_ENABLE_CHECKS TRUE #endif /** @@ -380,7 +380,7 @@ * @note The default is @p FALSE. */ #if !defined(CH_DBG_ENABLE_ASSERTS) || defined(__DOXYGEN__) -#define CH_DBG_ENABLE_ASSERTS FALSE +#define CH_DBG_ENABLE_ASSERTS TRUE #endif /** @@ -391,7 +391,7 @@ * @note The default is @p FALSE. */ #if !defined(CH_DBG_ENABLE_TRACE) || defined(__DOXYGEN__) -#define CH_DBG_ENABLE_TRACE FALSE +#define CH_DBG_ENABLE_TRACE TRUE #endif /** @@ -417,7 +417,7 @@ * @note The default is @p FALSE. */ #if !defined(CH_DBG_FILL_THREADS) || defined(__DOXYGEN__) -#define CH_DBG_FILL_THREADS FALSE +#define CH_DBG_FILL_THREADS TRUE #endif /** -- cgit v1.2.3