git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5580 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
76b3f122ac
commit
2114bc97d1
|
@ -111,7 +111,6 @@
|
||||||
* @name Configuration options
|
* @name Configuration options
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#if SPC5_HAS_FLEXPWM0 || defined(__DOXYGEN__)
|
|
||||||
/**
|
/**
|
||||||
* @brief PWMD1 driver enable switch.
|
* @brief PWMD1 driver enable switch.
|
||||||
* @details If set to @p TRUE the support for PWMD1 is included.
|
* @details If set to @p TRUE the support for PWMD1 is included.
|
||||||
|
@ -197,9 +196,7 @@
|
||||||
#define SPC5_PWM_FLEXPWM0_STOP_PCTL (SPC5_ME_PCTL_RUN(0) | \
|
#define SPC5_PWM_FLEXPWM0_STOP_PCTL (SPC5_ME_PCTL_RUN(0) | \
|
||||||
SPC5_ME_PCTL_LP(0))
|
SPC5_ME_PCTL_LP(0))
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#if SPC5_HAS_FLEXPWM1 || defined(__DOXYGEN__)
|
|
||||||
/**
|
/**
|
||||||
* @brief PWMD5 driver enable switch.
|
* @brief PWMD5 driver enable switch.
|
||||||
* @details If set to @p TRUE the support for PWMD5 is included.
|
* @details If set to @p TRUE the support for PWMD5 is included.
|
||||||
|
@ -285,18 +282,10 @@
|
||||||
#define SPC5_PWM_FLEXPWM1_STOP_PCTL (SPC5_ME_PCTL_RUN(0) | \
|
#define SPC5_PWM_FLEXPWM1_STOP_PCTL (SPC5_ME_PCTL_RUN(0) | \
|
||||||
SPC5_ME_PCTL_LP(0))
|
SPC5_ME_PCTL_LP(0))
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* Configuration checks. */
|
/* Configuration checks. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
#if !SPC5_HAS_FLEXPWM0
|
|
||||||
#error "FlexPWM0 not present in the selected device"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !SPC5_HAS_FLEXPWM1
|
|
||||||
#error "FlexPWM1 not present in the selected device"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define SPC5_PWM_USE_FLEXPWM0 (SPC5_PWM_USE_SMOD0 || \
|
#define SPC5_PWM_USE_FLEXPWM0 (SPC5_PWM_USE_SMOD0 || \
|
||||||
SPC5_PWM_USE_SMOD1 || \
|
SPC5_PWM_USE_SMOD1 || \
|
||||||
|
@ -308,6 +297,14 @@
|
||||||
SPC5_PWM_USE_SMOD6 || \
|
SPC5_PWM_USE_SMOD6 || \
|
||||||
SPC5_PWM_USE_SMOD7)
|
SPC5_PWM_USE_SMOD7)
|
||||||
|
|
||||||
|
#if !SPC5_HAS_FLEXPWM0 && SPC5_PWM_USE_FLEXPWM0
|
||||||
|
#error "FlexPWM0 not present in the selected device"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !SPC5_HAS_FLEXPWM1 && SPC5_PWM_USE_FLEXPWM1
|
||||||
|
#error "FlexPWM1 not present in the selected device"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !SPC5_PWM_USE_FLEXPWM0 && !SPC5_PWM_USE_FLEXPWM1
|
#if !SPC5_PWM_USE_FLEXPWM0 && !SPC5_PWM_USE_FLEXPWM1
|
||||||
#error "PWM driver activated but no PWM peripheral assigned"
|
#error "PWM driver activated but no PWM peripheral assigned"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -223,10 +223,10 @@ static void icu_lld_serve_interrupt(ICUDriver *icup) {
|
||||||
else {
|
else {
|
||||||
icup->etimerp->CHANNEL[icup->smod_number].STS.B.ICF1 = 1U;
|
icup->etimerp->CHANNEL[icup->smod_number].STS.B.ICF1 = 1U;
|
||||||
if (icup->etimerp->CHANNEL[icup->smod_number].CTRL3.B.C1FCNT == 2) {
|
if (icup->etimerp->CHANNEL[icup->smod_number].CTRL3.B.C1FCNT == 2) {
|
||||||
period = icup->etimer->CHANNEL[icup->smod_number].CAPT1.R;
|
period = icup->etimerp->CHANNEL[icup->smod_number].CAPT1.R;
|
||||||
period = icup->etimer->CHANNEL[icup->smod_number].CAPT1.R;
|
period = icup->etimerp->CHANNEL[icup->smod_number].CAPT1.R;
|
||||||
} else {
|
} else {
|
||||||
period = icup->etimer->CHANNEL[icup->smod_number].CAPT1.R;
|
period = icup->etimerp->CHANNEL[icup->smod_number].CAPT1.R;
|
||||||
}
|
}
|
||||||
_icu_isr_invoke_period_cb(icup);
|
_icu_isr_invoke_period_cb(icup);
|
||||||
}
|
}
|
||||||
|
@ -240,10 +240,10 @@ static void icu_lld_serve_interrupt(ICUDriver *icup) {
|
||||||
else {
|
else {
|
||||||
icup->etimerp->CHANNEL[icup->smod_number].STS.B.ICF2 = 1U;
|
icup->etimerp->CHANNEL[icup->smod_number].STS.B.ICF2 = 1U;
|
||||||
if (icup->etimerp->CHANNEL[icup->smod_number].CTRL3.B.C2FCNT == 2) {
|
if (icup->etimerp->CHANNEL[icup->smod_number].CTRL3.B.C2FCNT == 2) {
|
||||||
width = icup->etimer->CHANNEL[icup->smod_number].CAPT2.R;
|
width = icup->etimerp->CHANNEL[icup->smod_number].CAPT2.R;
|
||||||
width = icup->etimer->CHANNEL[icup->smod_number].CAPT2.R;
|
width = icup->etimerp->CHANNEL[icup->smod_number].CAPT2.R;
|
||||||
} else {
|
} else {
|
||||||
width = icup->etimer->CHANNEL[icup->smod_number].CAPT2.R;
|
width = icup->etimerp->CHANNEL[icup->smod_number].CAPT2.R;
|
||||||
}
|
}
|
||||||
_icu_isr_invoke_width_cb(icup);
|
_icu_isr_invoke_width_cb(icup);
|
||||||
}
|
}
|
||||||
|
@ -256,20 +256,20 @@ static void icu_lld_serve_interrupt(ICUDriver *icup) {
|
||||||
if ((sr & 0x0040) != 0) { /* ICF1 */
|
if ((sr & 0x0040) != 0) { /* ICF1 */
|
||||||
icup->etimerp->CHANNEL[icup->smod_number].STS.B.ICF1 = 1U;
|
icup->etimerp->CHANNEL[icup->smod_number].STS.B.ICF1 = 1U;
|
||||||
if (icup->etimerp->CHANNEL[icup->smod_number].CTRL3.B.C1FCNT == 2) {
|
if (icup->etimerp->CHANNEL[icup->smod_number].CTRL3.B.C1FCNT == 2) {
|
||||||
period = icup->etimer->CHANNEL[icup->smod_number].CAPT1.R;
|
period = icup->etimerp->CHANNEL[icup->smod_number].CAPT1.R;
|
||||||
period = icup->etimer->CHANNEL[icup->smod_number].CAPT1.R;
|
period = icup->etimerp->CHANNEL[icup->smod_number].CAPT1.R;
|
||||||
} else {
|
} else {
|
||||||
period = icup->etimer->CHANNEL[icup->smod_number].CAPT1.R;
|
period = icup->etimerp->CHANNEL[icup->smod_number].CAPT1.R;
|
||||||
}
|
}
|
||||||
_icu_isr_invoke_period_cb(icup);
|
_icu_isr_invoke_period_cb(icup);
|
||||||
}
|
}
|
||||||
else if ((sr & 0x0080) != 0) { /* ICF2 */
|
else if ((sr & 0x0080) != 0) { /* ICF2 */
|
||||||
icup->etimerp->CHANNEL[icup->smod_number].STS.B.ICF2 = 1U;
|
icup->etimerp->CHANNEL[icup->smod_number].STS.B.ICF2 = 1U;
|
||||||
if (icup->etimerp->CHANNEL[icup->smod_number].CTRL3.B.C2FCNT == 2) {
|
if (icup->etimerp->CHANNEL[icup->smod_number].CTRL3.B.C2FCNT == 2) {
|
||||||
width = icup->etimer->CHANNEL[icup->smod_number].CAPT2.R;
|
width = icup->etimerp->CHANNEL[icup->smod_number].CAPT2.R;
|
||||||
width = icup->etimer->CHANNEL[icup->smod_number].CAPT2.R;
|
width = icup->etimerp->CHANNEL[icup->smod_number].CAPT2.R;
|
||||||
} else {
|
} else {
|
||||||
width = icup->etimer->CHANNEL[icup->smod_number].CAPT2.R;
|
width = icup->etimerp->CHANNEL[icup->smod_number].CAPT2.R;
|
||||||
}
|
}
|
||||||
_icu_isr_invoke_width_cb(icup);
|
_icu_isr_invoke_width_cb(icup);
|
||||||
}
|
}
|
||||||
|
@ -970,20 +970,12 @@ void icu_lld_init(void) {
|
||||||
*/
|
*/
|
||||||
void icu_lld_start(ICUDriver *icup) {
|
void icu_lld_start(ICUDriver *icup) {
|
||||||
|
|
||||||
chDbgAssert((icup->config->channel == ICU_CHANNEL_1) ||
|
|
||||||
(icup->config->channel == ICU_CHANNEL_2) ||
|
|
||||||
(icup->config->channel == ICU_CHANNEL_3) ||
|
|
||||||
(icup->config->channel == ICU_CHANNEL_4) ||
|
|
||||||
(icup->config->channel == ICU_CHANNEL_5) ||
|
|
||||||
(icup->config->channel == ICU_CHANNEL_6),
|
|
||||||
"icu_lld_start(), #1", "invalid input");
|
|
||||||
|
|
||||||
chDbgAssert(icu_active_submodules0 < 6, "icu_lld_start(), #1",
|
chDbgAssert(icu_active_submodules0 < 6, "icu_lld_start(), #1",
|
||||||
"too many submodules");
|
"too many submodules");
|
||||||
chDbgAssert(icu_active_submodules1 < 6, "icu_lld_start(), #1",
|
chDbgAssert(icu_active_submodules1 < 6, "icu_lld_start(), #1",
|
||||||
"too many submodules");
|
"too many submodules");
|
||||||
chDbgAssert(icu_active_submodules2 < 6, "icu_lld_start(), #1",
|
chDbgAssert(icu_active_submodules2 < 6, "icu_lld_start(), #1",
|
||||||
"too many submodules");
|
"too many submodules");
|
||||||
|
|
||||||
if (icup->state == ICU_STOP) {
|
if (icup->state == ICU_STOP) {
|
||||||
#if SPC5_ICU_USE_SMOD0
|
#if SPC5_ICU_USE_SMOD0
|
||||||
|
|
|
@ -94,7 +94,6 @@
|
||||||
* @name Configuration options
|
* @name Configuration options
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#if SPC5_HAS_ETIMER0 || defined(__DOXYGEN__)
|
|
||||||
/**
|
/**
|
||||||
* @brief ICUD1 driver enable switch.
|
* @brief ICUD1 driver enable switch.
|
||||||
* @details If set to @p TRUE the support for ICUD1 is included.
|
* @details If set to @p TRUE the support for ICUD1 is included.
|
||||||
|
@ -177,9 +176,7 @@
|
||||||
#define SPC5_ICU_ETIMER0_STOP_PCTL (SPC5_ME_PCTL_RUN(0) | \
|
#define SPC5_ICU_ETIMER0_STOP_PCTL (SPC5_ME_PCTL_RUN(0) | \
|
||||||
SPC5_ME_PCTL_LP(0))
|
SPC5_ME_PCTL_LP(0))
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#if SPC5_HAS_ETIMER1 || defined(__DOXYGEN__)
|
|
||||||
/**
|
/**
|
||||||
* @brief ICUD6 driver enable switch.
|
* @brief ICUD6 driver enable switch.
|
||||||
* @details If set to @p TRUE the support for ICUD6 is included.
|
* @details If set to @p TRUE the support for ICUD6 is included.
|
||||||
|
@ -262,9 +259,7 @@
|
||||||
#define SPC5_ICU_ETIMER1_STOP_PCTL (SPC5_ME_PCTL_RUN(0) | \
|
#define SPC5_ICU_ETIMER1_STOP_PCTL (SPC5_ME_PCTL_RUN(0) | \
|
||||||
SPC5_ME_PCTL_LP(0))
|
SPC5_ME_PCTL_LP(0))
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#if SPC5_HAS_ETIMER2 || defined(__DOXYGEN__)
|
|
||||||
/**
|
/**
|
||||||
* @brief ICUD13 driver enable switch.
|
* @brief ICUD13 driver enable switch.
|
||||||
* @details If set to @p TRUE the support for ICUD13 is included.
|
* @details If set to @p TRUE the support for ICUD13 is included.
|
||||||
|
@ -347,25 +342,12 @@
|
||||||
#define SPC5_ICU_ETIMER2_STOP_PCTL (SPC5_ME_PCTL_RUN(0) | \
|
#define SPC5_ICU_ETIMER2_STOP_PCTL (SPC5_ME_PCTL_RUN(0) | \
|
||||||
SPC5_ME_PCTL_LP(0))
|
SPC5_ME_PCTL_LP(0))
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* Derived constants and error checks. */
|
/* Derived constants and error checks. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
||||||
#if !SPC5_HAS_ETIMER0
|
|
||||||
#error "ETIMER0 not present in the selected device"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !SPC5_HAS_ETIMER1
|
|
||||||
#error "ETIMER1 not present in the selected device"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !SPC5_HAS_ETIMER2
|
|
||||||
#error "ETIMER2 not present in the selected device"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define SPC5_ICU_USE_ETIMER0 (SPC5_ICU_USE_SMOD0 || \
|
#define SPC5_ICU_USE_ETIMER0 (SPC5_ICU_USE_SMOD0 || \
|
||||||
SPC5_ICU_USE_SMOD1 || \
|
SPC5_ICU_USE_SMOD1 || \
|
||||||
SPC5_ICU_USE_SMOD2 || \
|
SPC5_ICU_USE_SMOD2 || \
|
||||||
|
@ -387,6 +369,18 @@
|
||||||
SPC5_ICU_USE_SMOD16 || \
|
SPC5_ICU_USE_SMOD16 || \
|
||||||
SPC5_ICU_USE_SMOD17)
|
SPC5_ICU_USE_SMOD17)
|
||||||
|
|
||||||
|
#if !SPC5_HAS_ETIMER0 && SPC5_ICU_USE_ETIMER0
|
||||||
|
#error "ETIMER0 not present in the selected device"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !SPC5_HAS_ETIMER1 && SPC5_ICU_USE_ETIMER1
|
||||||
|
#error "ETIMER1 not present in the selected device"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !SPC5_HAS_ETIMER2 && SPC5_ICU_USE_ETIMER2
|
||||||
|
#error "ETIMER2 not present in the selected device"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !SPC5_ICU_USE_ETIMER0 && !SPC5_ICU_USE_ETIMER1 && !SPC5_ICU_USE_ETIMER2
|
#if !SPC5_ICU_USE_ETIMER0 && !SPC5_ICU_USE_ETIMER1 && !SPC5_ICU_USE_ETIMER2
|
||||||
#error "ICU driver activated but no SMOD peripheral assigned"
|
#error "ICU driver activated but no SMOD peripheral assigned"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -59,8 +59,7 @@ static ICUConfig icucfg = {
|
||||||
250000, /* 250kHz ICU clock frequency.*/
|
250000, /* 250kHz ICU clock frequency.*/
|
||||||
icuwidthcb,
|
icuwidthcb,
|
||||||
icuperiodcb,
|
icuperiodcb,
|
||||||
NULL,
|
NULL
|
||||||
ICU_CHANNEL_1
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue