git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@6423 35acf78f-673a-0410-8e92-d51de3d6d3f4
parent
2c53a8e16d
commit
d61a5d8920
|
@ -51,22 +51,15 @@ static uint32_t emios1_active_channels;
|
|||
/* Driver local functions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
#if SPC5_HAS_EMIOS0
|
||||
void reset_emios0_active_channels() {
|
||||
emios0_active_channels = 0;
|
||||
}
|
||||
|
||||
void reset_emios1_active_channels() {
|
||||
emios1_active_channels = 0;
|
||||
}
|
||||
|
||||
uint32_t get_emios0_active_channels() {
|
||||
return emios0_active_channels;
|
||||
}
|
||||
|
||||
uint32_t get_emios1_active_channels() {
|
||||
return emios1_active_channels;
|
||||
}
|
||||
|
||||
void increase_emios0_active_channels() {
|
||||
emios0_active_channels++;
|
||||
}
|
||||
|
@ -75,14 +68,6 @@ void decrease_emios0_active_channels() {
|
|||
emios0_active_channels--;
|
||||
}
|
||||
|
||||
void increase_emios1_active_channels() {
|
||||
emios1_active_channels++;
|
||||
}
|
||||
|
||||
void decrease_emios1_active_channels() {
|
||||
emios1_active_channels--;
|
||||
}
|
||||
|
||||
#if HAL_USE_ICU
|
||||
void icu_active_emios0_clock(ICUDriver *icup) {
|
||||
/* If this is the first Channel activated then the eMIOS0 is enabled.*/
|
||||
|
@ -101,6 +86,16 @@ void icu_active_emios0_clock(ICUDriver *icup) {
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
void icu_deactive_emios0_clock(ICUDriver *icup) {
|
||||
/* If it is the last active channels then the eMIOS0 is disabled.*/
|
||||
if (emios0_active_channels == 0) {
|
||||
if (icup->emiosp->UCDIS.R == 0) {
|
||||
halSPCSetPeripheralClockMode(SPC5_EMIOS0_PCTL,
|
||||
SPC5_EMIOS0_STOP_PCTL);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAL_USE_PWM
|
||||
|
@ -121,7 +116,35 @@ void pwm_active_emios0_clock(PWMDriver *pwmp) {
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
void pwm_deactive_emios0_clock(PWMDriver *pwmp) {
|
||||
/* If it is the last active channels then the eMIOS0 is disabled.*/
|
||||
if (emios0_active_channels == 0) {
|
||||
if (pwmp->emiosp->UCDIS.R == 0) {
|
||||
halSPCSetPeripheralClockMode(SPC5_EMIOS0_PCTL,
|
||||
SPC5_EMIOS0_STOP_PCTL);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if SPC5_HAS_EMIOS1
|
||||
void reset_emios1_active_channels() {
|
||||
emios1_active_channels = 0;
|
||||
}
|
||||
|
||||
uint32_t get_emios1_active_channels() {
|
||||
return emios1_active_channels;
|
||||
}
|
||||
|
||||
void increase_emios1_active_channels() {
|
||||
emios1_active_channels++;
|
||||
}
|
||||
|
||||
void decrease_emios1_active_channels() {
|
||||
emios1_active_channels--;
|
||||
}
|
||||
|
||||
#if HAL_USE_ICU
|
||||
void icu_active_emios1_clock(ICUDriver *icup) {
|
||||
|
@ -141,6 +164,16 @@ void icu_active_emios1_clock(ICUDriver *icup) {
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
void icu_deactive_emios1_clock(ICUDriver *icup) {
|
||||
/* If it is the last active channels then the eMIOS1 is disabled.*/
|
||||
if (emios1_active_channels == 0) {
|
||||
if (icup->emiosp->UCDIS.R == 0) {
|
||||
halSPCSetPeripheralClockMode(SPC5_EMIOS1_PCTL,
|
||||
SPC5_EMIOS1_STOP_PCTL);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAL_USE_PWM
|
||||
|
@ -161,45 +194,7 @@ void pwm_active_emios1_clock(PWMDriver *pwmp) {
|
|||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAL_USE_ICU
|
||||
void icu_deactive_emios0_clock(ICUDriver *icup) {
|
||||
/* If it is the last active channels then the eMIOS0 is disabled.*/
|
||||
if (emios0_active_channels == 0) {
|
||||
if (icup->emiosp->UCDIS.R == 0) {
|
||||
halSPCSetPeripheralClockMode(SPC5_EMIOS0_PCTL,
|
||||
SPC5_EMIOS0_STOP_PCTL);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAL_USE_PWM
|
||||
void pwm_deactive_emios0_clock(PWMDriver *pwmp) {
|
||||
/* If it is the last active channels then the eMIOS0 is disabled.*/
|
||||
if (emios0_active_channels == 0) {
|
||||
if (pwmp->emiosp->UCDIS.R == 0) {
|
||||
halSPCSetPeripheralClockMode(SPC5_EMIOS0_PCTL,
|
||||
SPC5_EMIOS0_STOP_PCTL);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAL_USE_ICU
|
||||
void icu_deactive_emios1_clock(ICUDriver *icup) {
|
||||
/* If it is the last active channels then the eMIOS1 is disabled.*/
|
||||
if (emios1_active_channels == 0) {
|
||||
if (icup->emiosp->UCDIS.R == 0) {
|
||||
halSPCSetPeripheralClockMode(SPC5_EMIOS1_PCTL,
|
||||
SPC5_EMIOS1_STOP_PCTL);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAL_USE_PWM
|
||||
void pwm_deactive_emios1_clock(PWMDriver *pwmp) {
|
||||
/* If it is the last active channels then the eMIOS1 is disabled.*/
|
||||
if (emios1_active_channels == 0) {
|
||||
|
@ -210,6 +205,7 @@ void pwm_deactive_emios1_clock(PWMDriver *pwmp) {
|
|||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver interrupt handlers. */
|
||||
|
|
|
@ -149,30 +149,36 @@
|
|||
/* External declarations. */
|
||||
/*===========================================================================*/
|
||||
|
||||
#if SPC5_HAS_EMIOS0
|
||||
void reset_emios0_active_channels(void);
|
||||
void reset_emios1_active_channels(void);
|
||||
uint32_t get_emios0_active_channels(void);
|
||||
uint32_t get_emios1_active_channels(void);
|
||||
void increase_emios0_active_channels(void);
|
||||
void decrease_emios0_active_channels(void);
|
||||
void increase_emios1_active_channels(void);
|
||||
void decrease_emios1_active_channels(void);
|
||||
void active_emios0_clock(ICUDriver *icup, PWMDriver *pwmp);
|
||||
void deactive_emios0_clock(ICUDriver *icup, PWMDriver *pwmp);
|
||||
#if HAL_USE_ICU
|
||||
void icu_active_emios0_clock(ICUDriver *icup);
|
||||
void icu_active_emios1_clock(ICUDriver *icup);
|
||||
void icu_deactive_emios0_clock(ICUDriver *icup);
|
||||
#endif
|
||||
#if HAL_USE_PWM
|
||||
void pwm_active_emios0_clock(PWMDriver *pwmp);
|
||||
void pwm_active_emios1_clock(PWMDriver *pwmp);
|
||||
void pwm_deactive_emios0_clock(PWMDriver *pwmp);
|
||||
#endif
|
||||
#endif
|
||||
#if SPC5_HAS_EMIOS1
|
||||
void reset_emios1_active_channels(void);
|
||||
uint32_t get_emios1_active_channels(void);
|
||||
void increase_emios1_active_channels(void);
|
||||
void decrease_emios1_active_channels(void);
|
||||
#if HAL_USE_ICU
|
||||
void icu_deactive_emios0_clock(ICUDriver *icup);
|
||||
void icu_active_emios1_clock(ICUDriver *icup);
|
||||
void icu_deactive_emios1_clock(ICUDriver *icup);
|
||||
#endif
|
||||
#if HAL_USE_PWM
|
||||
void pwm_deactive_emios0_clock(PWMDriver *pwmp);
|
||||
void pwm_active_emios1_clock(PWMDriver *pwmp);
|
||||
void pwm_deactive_emios1_clock(PWMDriver *pwmp);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* HAL_USE_ICU || HAL_USE_PWM */
|
||||
|
||||
|
|
Loading…
Reference in New Issue