示例#1
0
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);
}
示例#2
0
/**
 * @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);
}
示例#3
0
/**
 * @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);
}
示例#4
0
/**
 * @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);
}
示例#5
0
/**
 * @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);
}
示例#6
0
文件: hal_adc.c 项目: rusefi/ChibiOS
/**
 * @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);
}
示例#7
0
文件: hal_i2c.c 项目: rusefi/ChibiOS
/**
 * @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);
}