示例#1
0
文件: icu_lld.c 项目: 0x00f/ChibiOS
/**
 * @brief   Deactivates the ICU peripheral.
 *
 * @param[in] icup      pointer to the @p ICUDriver object
 *
 * @notapi
 */
void icu_lld_stop(ICUDriver *icup) {

  chDbgAssert(get_emios_active_channels() < SPC5_EMIOS_NUM_CHANNELS,
		  	  "icu_lld_stop(), #1", "too many channels");

  if (icup->state == ICU_READY) {

    /* Disables the peripheral.*/
#if SPC5_ICU_USE_EMIOS_CH0
    if (&ICUD1 == icup) {
      /* Reset UC Control Register.*/
      icup->emiosp->CH[icup->ch_number].CCR.R = 0;

      decrease_emios_active_channels();
    }
#endif /* SPC5_ICU_USE_EMIOS_CH0 */
#if SPC5_ICU_USE_EMIOS_CH1
    if (&ICUD2 == icup) {
      /* Reset UC Control Register.*/
      icup->emiosp->CH[icup->ch_number].CCR.R = 0;

      decrease_emios_active_channels();
    }
#endif /* SPC5_ICU_USE_EMIOS_CH1 */
#if SPC5_ICU_USE_EMIOS_CH2
    if (&ICUD3 == icup) {
      /* Reset UC Control Register.*/
      icup->emiosp->CH[icup->ch_number].CCR.R = 0;

      decrease_emios_active_channels();
    }
#endif /* SPC5_ICU_USE_EMIOS_CH2 */
#if SPC5_ICU_USE_EMIOS_CH3
    if (&ICUD4 == icup) {
      /* Reset UC Control Register.*/
      icup->emiosp->CH[icup->ch_number].CCR.R = 0;

      decrease_emios_active_channels();
    }
#endif /* SPC5_ICU_USE_EMIOS_CH3 */
#if SPC5_ICU_USE_EMIOS_CH4
    if (&ICUD5 == icup) {
      /* Reset UC Control Register.*/
      icup->emiosp->CH[icup->ch_number].CCR.R = 0;

      decrease_emios_active_channels();
    }
#endif /* SPC5_ICU_USE_EMIOS_CH4 */
#if SPC5_ICU_USE_EMIOS_CH5
    if (&ICUD6 == icup) {
      /* Reset UC Control Register.*/
      icup->emiosp->CH[icup->ch_number].CCR.R = 0;

      decrease_emios_active_channels();
    }
#endif /* SPC5_ICU_USE_EMIOS_CH5 */
#if SPC5_ICU_USE_EMIOS_CH6
    if (&ICUD7 == icup) {
      /* Reset UC Control Register.*/
      icup->emiosp->CH[icup->ch_number].CCR.R = 0;

      decrease_emios_active_channels();
    }
#endif /* SPC5_ICU_USE_EMIOS_CH6 */
#if SPC5_ICU_USE_EMIOS_CH8
    if (&ICUD8 == icup) {
      /* Reset UC Control Register.*/
      icup->emiosp->CH[icup->ch_number].CCR.R = 0;

      decrease_emios_active_channels();
    }
#endif /* SPC5_ICU_USE_EMIOS_CH8 */
#if SPC5_ICU_USE_EMIOS_CH7
    if (&ICUD9 == icup) {
      /* Reset UC Control Register.*/
      icup->emiosp->CH[icup->ch_number].CCR.R = 0;

      decrease_emios_active_channels();
    }
#endif /* SPC5_ICU_USE_EMIOS_CH7 */
#if SPC5_ICU_USE_EMIOS_CH16
    if (&ICUD10 == icup) {
      /* Reset UC Control Register.*/
      icup->emiosp->CH[icup->ch_number].CCR.R = 0;

      decrease_emios_active_channels();
    }
#endif /* SPC5_ICU_USE_EMIOS_CH16 */
#if SPC5_ICU_USE_EMIOS_CH17
    if (&ICUD11 == icup) {
      /* Reset UC Control Register.*/
      icup->emiosp->CH[icup->ch_number].CCR.R = 0;

      decrease_emios_active_channels();
    }
#endif /* SPC5_ICU_USE_EMIOS_CH17 */
#if SPC5_ICU_USE_EMIOS_CH18
    if (&ICUD12 == icup) {
      /* Reset UC Control Register.*/
      icup->emiosp->CH[icup->ch_number].CCR.R = 0;

      decrease_emios_active_channels();
    }
#endif /* SPC5_ICU_USE_EMIOS_CH18 */

    /* eMIOS clock deactivation.*/
#if SPC5_ICU_USE_EMIOS
    deactive_emios_clock();
#endif

  }
}
示例#2
0
/**
 * @brief   Deactivates the PWM peripheral.
 *
 * @param[in] pwmp      pointer to the @p PWMDriver object
 *
 * @notapi
 */
void pwm_lld_stop(PWMDriver *pwmp) {

  chDbgAssert(get_emios_active_channels() < SPC5_EMIOS_NUM_CHANNELS,
		  	  "pwm_lld_stop(), #1", "too many channels");

  if (pwmp->state == PWM_READY) {

    /* Disables the peripheral.*/
#if SPC5_PWM_USE_EMIOS_CH0
    if (&PWMD1 == pwmp) {
      /* Reset UC Control Register.*/
      pwmp->emiosp->CH[pwmp->ch_number].CCR.R = 0;

      decrease_emios_active_channels();
    }
#endif /* SPC5_PWM_USE_EMIOS_CH0 */

#if SPC5_PWM_USE_EMIOS_CH8
    if (&PWMD2 == pwmp) {
      /* Reset UC Control Register.*/
      pwmp->emiosp->CH[pwmp->ch_number].CCR.R = 0;

      decrease_emios_active_channels();
    }
#endif /* SPC5_PWM_USE_EMIOS_CH8 */

#if SPC5_PWM_USE_EMIOS_CH9
    if (&PWMD3 == pwmp) {
      /* Reset UC Control Register.*/
      pwmp->emiosp->CH[pwmp->ch_number].CCR.R = 0;

      decrease_emios_active_channels();
    }
#endif /* SPC5_PWM_USE_EMIOS_CH9 */

#if SPC5_PWM_USE_EMIOS_CH10
    if (&PWMD4 == pwmp) {
      /* Reset UC Control Register.*/
      pwmp->emiosp->CH[pwmp->ch_number].CCR.R = 0;

      decrease_emios_active_channels();
    }
#endif /* SPC5_PWM_USE_EMIOS_CH10 */

#if SPC5_PWM_USE_EMIOS_CH12
    if (&PWMD5 == pwmp) {
      /* Reset UC Control Register.*/
      pwmp->emiosp->CH[pwmp->ch_number].CCR.R = 0;

      decrease_emios_active_channels();
    }
#endif /* SPC5_PWM_USE_EMIOS_CH12 */

#if SPC5_PWM_USE_EMIOS_CH14
    if (&PWMD6 == pwmp) {
      /* Reset UC Control Register.*/
      pwmp->emiosp->CH[pwmp->ch_number].CCR.R = 0;

      decrease_emios_active_channels();
    }
#endif /* SPC5_PWM_USE_EMIOS_CH14 */

#if SPC5_PWM_USE_EMIOS_CH15
    if (&PWMD7 == pwmp) {
      /* Reset UC Control Register.*/
      pwmp->emiosp->CH[pwmp->ch_number].CCR.R = 0;

      decrease_emios_active_channels();
    }
#endif /* SPC5_PWM_USE_EMIOS_CH15 */

#if SPC5_PWM_USE_EMIOS_CH23
    if (&PWMD8 == pwmp) {
      /* Reset UC Control Register.*/
      pwmp->emiosp->CH[pwmp->ch_number].CCR.R = 0;

      decrease_emios_active_channels();
    }
#endif /* SPC5_PWM_USE_EMIOS_CH23 */

#if SPC5_EMIOS_NUM_CHANNELS == 24
#if SPC5_PWM_USE_EMIOS_CH19
    if (&PWMD9 == pwmp) {
      /* Reset UC Control Register.*/
      pwmp->emiosp->CH[pwmp->ch_number].CCR.R = 0;

      decrease_emios_active_channels();
    }
#endif /* SPC5_PWM_USE_EMIOS_CH19 */

#if SPC5_PWM_USE_EMIOS_CH20
    if (&PWMD10 == pwmp) {
      /* Reset UC Control Register.*/
      pwmp->emiosp->CH[pwmp->ch_number].CCR.R = 0;

      decrease_emios_active_channels();
    }
#endif /* SPC5_PWM_USE_EMIOS_CH20 */

#if SPC5_PWM_USE_EMIOS_CH21
    if (&PWMD11 == pwmp) {
      /* Reset UC Control Register.*/
      pwmp->emiosp->CH[pwmp->ch_number].CCR.R = 0;

      decrease_emios_active_channels();
    }
#endif /* SPC5_PWM_USE_EMIOS_CH21 */

#if SPC5_PWM_USE_EMIOS_CH22
    if (&PWMD12 == pwmp) {
      /* Reset UC Control Register.*/
      pwmp->emiosp->CH[pwmp->ch_number].CCR.R = 0;

      decrease_emios_active_channels();
    }
#endif /* SPC5_PWM_USE_EMIOS_CH22 */
#endif

    /* eMIOS clock deactivation.*/
#if SPC5_PWM_USE_EMIOS
    deactive_emios_clock();
#endif

  }
}