static void _ftdi_unload(usbh_baseclassdriver_t *drv) { osalDbgCheck(drv != NULL); USBHFTDIDriver *const ftdip = (USBHFTDIDriver *)drv; USBHFTDIPortDriver *ftdipp = ftdip->ports; osalMutexLock(&ftdip->mtx); while (ftdipp) { _stop(ftdipp); ftdipp = ftdipp->next; } ftdipp = ftdip->ports; osalSysLock(); while (ftdipp) { USBHFTDIPortDriver *next = ftdipp->next; usbhftdipObjectInit(ftdipp); ftdipp = next; } osalSysUnlock(); osalMutexUnlock(&ftdip->mtx); }
/** * @brief Gains exclusive access to the SPI bus. * @details This function tries to gain ownership to the SPI bus, if the bus * is already being used then the invoking thread is queued. * @pre In order to use this function the option @p SPI_USE_MUTUAL_EXCLUSION * must be enabled. * * @param[in] spip pointer to the @p SPIDriver object * * @api */ void spiAcquireBus(SPIDriver *spip) { osalDbgCheck(spip != NULL); osalMutexLock(&spip->mutex); }
/** * @brief Gains exclusive access to the UART bus. * @details This function tries to gain ownership to the UART bus, if the bus * is already being used then the invoking thread is queued. * @pre In order to use this function the option @p UART_USE_MUTUAL_EXCLUSION * must be enabled. * * @param[in] uartp pointer to the @p UARTDriver object * * @api */ void uartAcquireBus(UARTDriver *uartp) { osalDbgCheck(uartp != NULL); osalMutexLock(&uartp->mutex); }
/** * @brief Gains exclusive access to the QSPI bus. * @details This function tries to gain ownership to the QSPI bus, if the bus * is already being used then the invoking thread is queued. * @pre In order to use this function the option @p QSPI_USE_MUTUAL_EXCLUSION * must be enabled. * * @param[in] qspip pointer to the @p QSPIDriver object * * @api */ void qspiAcquireBus(QSPIDriver *qspip) { osalDbgCheck(qspip != NULL); osalMutexLock(&qspip->mutex); }
/** * @brief Gains exclusive access to the DAC bus. * @details This function tries to gain ownership to the DAC bus, if the bus * is already being used then the invoking thread is queued. * @pre In order to use this function the option @p DAC_USE_MUTUAL_EXCLUSION * must be enabled. * * @param[in] dacp pointer to the @p DACDriver object * * @api */ void dacAcquireBus(DACDriver *dacp) { osalDbgCheck(dacp != NULL); osalMutexLock(&dacp->mutex); }
/** * @brief Gains exclusive access to the ADC peripheral. * @details This function tries to gain ownership to the ADC bus, if the bus * is already being used then the invoking thread is queued. * @pre In order to use this function the option * @p ADC_USE_MUTUAL_EXCLUSION must be enabled. * * @param[in] adcp pointer to the @p ADCDriver object * * @api */ void adcAcquireBus(ADCDriver *adcp) { osalDbgCheck(adcp != NULL); osalMutexLock(&adcp->mutex); }
/** * @brief Gains exclusive access to the I2C bus. * @details This function tries to gain ownership to the I2C bus, if the bus * is already being used then the invoking thread is queued. * @pre In order to use this function the option @p I2C_USE_MUTUAL_EXCLUSION * must be enabled. * * @param[in] i2cp pointer to the @p I2CDriver object * * @api */ void i2cAcquireBus(I2CDriver *i2cp) { osalDbgCheck(i2cp != NULL); osalMutexLock(&i2cp->mutex); }