static void otg_core_reset(USBDriver *usbp) { stm32_otg_t *otgp = usbp->otg; halPolledDelay(32); /* Core reset and delay of at least 3 PHY cycles.*/ otgp->GRSTCTL = GRSTCTL_CSRST; while ((otgp->GRSTCTL & GRSTCTL_CSRST) != 0) ; halPolledDelay(12); /* Wait AHB idle condition.*/ while ((otgp->GRSTCTL & GRSTCTL_AHBIDL) == 0) ; }
static void otg_txfifo_flush(USBDriver *usbp, uint32_t fifo) { stm32_otg_t *otgp = usbp->otg; otgp->GRSTCTL = GRSTCTL_TXFNUM(fifo) | GRSTCTL_TXFFLSH; while ((otgp->GRSTCTL & GRSTCTL_TXFFLSH) != 0) ; /* Wait for 3 PHY Clocks.*/ halPolledDelay(12); }
/** * @brief Enables the ADC voltage regulator. * * @param[in] adcp pointer to the @p ADCDriver object */ static void adc_lld_vreg_on(ADCDriver *adcp) { adcp->adcm->CR = 0; /* RM 12.4.3.*/ adcp->adcm->CR = ADC_CR_ADVREGEN_0; #if STM32_ADC_DUAL_MODE adcp->adcs->CR = ADC_CR_ADVREGEN_0; #endif halPolledDelay(US2RTT(10)); }
void mac_phy_reset(void){ palSetPad(GPIOD, GPIOD_EPHY_NRST); halPolledDelay(BOARD_PHY_HARD_RESET_DELAY); /* PHY soft reset procedure.*/ mii_write(ÐD1, MII_BMCR, BMCR_RESET); while (mii_read(ÐD1, MII_BMCR) & BMCR_RESET) ; mii_write(ÐD1, PHYCTRL2, mii_read(ÐD1, PHYCTRL2) | RMII_RCLKSEL); }
static void otg_core_reset(USBDriver *usbp) { stm32_otg_t *otgp = usbp->otg; //FIXME: Makes things work for me, otherwise hangs on following loop. chThdSleepMilliseconds(1); /* Core reset and delay of at least 3 PHY cycles.*/ otgp->GRSTCTL = GRSTCTL_CSRST; while ((otgp->GRSTCTL & GRSTCTL_CSRST) != 0) ; halPolledDelay(12); /* Wait AHB idle condition.*/ while ((otgp->GRSTCTL & GRSTCTL_AHBIDL) == 0) ; }
void codec_hw_reset(void) { palClearPad(GPIOD, GPIOD_RESET); halPolledDelay(MS2RTT(10)); palSetPad(GPIOD, GPIOD_RESET); }