当前位置: 首页>>代码示例>>C++>>正文


C++ osalSysUnlock函数代码示例

本文整理汇总了C++中osalSysUnlock函数的典型用法代码示例。如果您正苦于以下问题:C++ osalSysUnlock函数的具体用法?C++ osalSysUnlock怎么用?C++ osalSysUnlock使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了osalSysUnlock函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: sdc_lld_wait_transaction_end

/**
 * @brief   Wait end of data transaction and performs finalizations.
 *
 * @param[in] sdcp      pointer to the @p SDCDriver object
 * @param[in] n         number of blocks in transaction
 * @param[in] resp      pointer to the response buffer
 *
 * @return              The operation status.
 * @retval HAL_SUCCESS  operation succeeded.
 * @retval HAL_FAILED   operation failed.
 */
static bool sdc_lld_wait_transaction_end(SDCDriver *sdcp, uint32_t n,
        uint32_t *resp) {

    /* Note the mask is checked before going to sleep because the interrupt
       may have occurred before reaching the critical zone.*/
    osalSysLock();
    if (sdcp->sdio->MASK != 0)
        osalThreadSuspendS(&sdcp->thread);
    if ((sdcp->sdio->STA & SDIO_STA_DATAEND) == 0) {
        osalSysUnlock();
        return HAL_FAILED;
    }

#if (defined(STM32F4XX) || defined(STM32F2XX))
    /* Wait until DMA channel enabled to be sure that all data transferred.*/
    while (sdcp->dma->stream->CR & STM32_DMA_CR_EN)
        ;

    /* DMA event flags must be manually cleared.*/
    dmaStreamClearInterrupt(sdcp->dma);

    sdcp->sdio->ICR = STM32_SDIO_ICR_ALL_FLAGS;
    sdcp->sdio->DCTRL = 0;
    osalSysUnlock();

    /* Wait until interrupt flags to be cleared.*/
    /*while (((DMA2->LISR) >> (sdcp->dma->ishift)) & STM32_DMA_ISR_TCIF)
      dmaStreamClearInterrupt(sdcp->dma);*/
#else
    /* Waits for transfer completion at DMA level, then the stream is
       disabled and cleared.*/
    dmaWaitCompletion(sdcp->dma);

    sdcp->sdio->ICR = STM32_SDIO_ICR_ALL_FLAGS;
    sdcp->sdio->DCTRL = 0;
    osalSysUnlock();
#endif

    /* Finalize transaction.*/
    if (n > 1)
        return sdc_lld_send_cmd_short_crc(sdcp, MMCSD_CMD_STOP_TRANSMISSION, 0, resp);

    return HAL_SUCCESS;
}
开发者ID:xobs,项目名称:chibi-chibios,代码行数:55,代码来源:sdc_lld.c

示例2: SetSystemNameType

/**
 * @brief           Sets the vehicle name and vehicle type in the system
 *                  information structure.
 *
 * @param[in] name  New name array.
 * @param[in] type  New type array.
 */
void SetSystemNameType(const char name[VEHICLE_NAME_SIZE],
                       const char type[VEHICLE_TYPE_SIZE])
{
  osalSysLock();

  strncpy(system_strings.vehicle_name, name, VEHICLE_NAME_SIZE);
  strncpy(system_strings.vehicle_type, type, VEHICLE_TYPE_SIZE);

  osalSysUnlock();
}
开发者ID:korken89,项目名称:KFly_ChibiOS,代码行数:17,代码来源:system_information.c

示例3: gptChangeInterval

/**
 * @brief   Changes the interval of GPT peripheral.
 * @details This function changes the interval of a running GPT unit.
 * @pre     The GPT unit must be running in continuous mode.
 * @post    The GPT unit interval is changed to the new value.
 *
 * @param[in] gptp      pointer to a @p GPTDriver object
 * @param[in] interval  new cycle time in timer ticks
 *
 * @api
 */
void gptChangeInterval(GPTDriver *gptp, gptcnt_t interval) {

  osalDbgCheck(gptp != NULL);

  osalSysLock();
  osalDbgAssert(gptp->state == GPT_CONTINUOUS,
                "invalid state");
  gptChangeIntervalI(gptp, interval);
  osalSysUnlock();
}
开发者ID:AlexShiLucky,项目名称:ChibiOS,代码行数:21,代码来源:hal_gpt.c

示例4: eicuEnable

/**
 * @brief   Enables the extended input capture.
 *
 * @param[in] eicup     Pointer to the @p EICUDriver object
 *
 * @api
 */
void eicuEnable(EICUDriver *eicup) {

  osalDbgCheck(eicup != NULL);

  osalSysLock();
  osalDbgAssert(eicup->state == EICU_READY, "invalid state");
  eicu_lld_enable(eicup);
  eicup->state = EICU_WAITING;
  osalSysUnlock();
}
开发者ID:TexZK,项目名称:ChibiOS-Contrib,代码行数:17,代码来源:eicu.c

示例5: icuDisableNotifications

/**
 * @brief   Disables notifications.
 * @pre     The ICU unit must have been activated using @p icuStart().
 * @note    If the notification is already disabled then the call has no effect.
 *
 * @param[in] icup      pointer to the @p ICUDriver object
 *
 * @api
 */
void icuDisableNotifications(ICUDriver *icup) {

  osalDbgCheck(icup != NULL);

  osalSysLock();
  osalDbgAssert((icup->state == ICU_WAITING) || (icup->state == ICU_ACTIVE),
                "invalid state");
  icuDisableNotificationsI(icup);
  osalSysUnlock();
}
开发者ID:SVentas,项目名称:SmartMDC,代码行数:19,代码来源:icu.c

示例6: rtcGetAlarm

/**
 * @brief   Get current alarm.
 * @note    If an alarm has not been set then the returned alarm specification
 *          is not meaningful.
 *
 * @param[in] rtcp      pointer to RTC driver structure
 * @param[in] alarm     alarm identifier
 * @param[out] alarmspec pointer to a @p RTCAlarm structure
 *
 * @api
 */
void rtcGetAlarm(RTCDriver *rtcp,
                 rtcalarm_t alarm,
                 RTCAlarm *alarmspec) {

  osalDbgCheck((rtcp != NULL) && (alarm < RTC_ALARMS) && (alarmspec != NULL));

  osalSysLock();
  rtcGetAlarmI(rtcp, alarm, alarmspec);
  osalSysUnlock();
}
开发者ID:GuzTech,项目名称:senoko-chibios-3,代码行数:21,代码来源:rtc.c

示例7: opampEnable

/**
 * @brief   Activates the opamp.
 *
 * @param[in] opampp      pointer to the @p OPAMPDriver object
 *
 * @api
 */
void opampEnable(OPAMPDriver *opampp) {

  osalDbgCheck(opampp != NULL);

  osalSysLock();
  osalDbgAssert(opampp->state == OPAMP_ACTIVE, "invalid state");
  opamp_lld_enable(opampp);
  opampp->state = OPAMP_ACTIVE;
  osalSysUnlock();
}
开发者ID:ChibiOS,项目名称:ChibiOS-Contrib,代码行数:17,代码来源:hal_opamp.c

示例8: onewireWrite

/**
 * @brief     Read some bites from slave device.
 *
 * @param[in] owp           pointer to the @p onewireDriver object
 * @param[in] txbuf         pointer to the buffer with data to be written
 * @param[in] txbytes       amount of data to be written
 * @param[in] pullup_time   how long strong pull up must be activated. Set
 *                          it to 0 if not needed.
 */
void onewireWrite(onewireDriver *owp, uint8_t *txbuf,
                  size_t txbytes, systime_t pullup_time) {
  PWMDriver *pwmd;
  PWMConfig *pwmcfg;
  size_t mch, sch;

  osalDbgCheck((NULL != owp) && (NULL != txbuf));
  osalDbgCheck((txbytes > 0) && (txbytes <= ONEWIRE_MAX_TRANSACTION_LEN));
  osalDbgAssert(owp->reg.state == ONEWIRE_READY, "Invalid state");
#if !ONEWIRE_USE_STRONG_PULLUP
  osalDbgAssert(0 == pullup_time,
      "Non zero time is valid only when strong pull enabled");
#endif

  pwmd = owp->config->pwmd;
  pwmcfg = owp->config->pwmcfg;
  mch = owp->config->master_channel;
  sch = owp->config->sample_channel;

  owp->buf = txbuf;
  owp->reg.bit = 0;
  owp->reg.final_timeslot = false;
  owp->reg.bytes = txbytes;

  pwmcfg->period = ONEWIRE_ZERO_WIDTH + ONEWIRE_RECOVERY_WIDTH;
  pwmcfg->callback = pwm_write_bit_cb;
  pwmcfg->channels[mch].callback = NULL;
  pwmcfg->channels[mch].mode = owp->config->pwmmode;
  pwmcfg->channels[sch].callback = NULL;
  pwmcfg->channels[sch].mode = PWM_OUTPUT_DISABLED;

#if ONEWIRE_USE_STRONG_PULLUP
  if (pullup_time > 0) {
    owp->reg.state = ONEWIRE_PULL_UP;
    owp->reg.need_pullup = true;
  }
#endif

  ow_bus_active(owp);
  osalSysLock();
  pwmEnablePeriodicNotificationI(pwmd);
  osalThreadSuspendS(&owp->thread);
  osalSysUnlock();

  pwmDisablePeriodicNotification(pwmd);
  ow_bus_idle(owp);

#if ONEWIRE_USE_STRONG_PULLUP
  if (pullup_time > 0) {
    osalThreadSleep(pullup_time);
    owp->config->pullup_release();
    owp->reg.state = ONEWIRE_READY;
  }
#endif
}
开发者ID:awygle,项目名称:ChibiOS-Contrib,代码行数:64,代码来源:hal_onewire.c

示例9: pwmEnableChannel

/**
 * @brief   Enables a PWM channel.
 * @pre     The PWM unit must have been activated using @p pwmStart().
 * @post    The channel is active using the specified configuration.
 * @note    Depending on the hardware implementation this function has
 *          effect starting on the next cycle (recommended implementation)
 *          or immediately (fallback implementation).
 *
 * @param[in] pwmp      pointer to a @p PWMDriver object
 * @param[in] channel   PWM channel identifier (0...PWM_CHANNELS-1)
 * @param[in] width     PWM pulse width as clock pulses number
 *
 * @api
 */
void pwmEnableChannel(PWMDriver *pwmp,
                      pwmchannel_t channel,
                      pwmcnt_t width) {

  osalDbgCheck((pwmp != NULL) && (channel < PWM_CHANNELS));

  osalSysLock();
  osalDbgAssert(pwmp->state == PWM_READY, "not ready");
  pwm_lld_enable_channel(pwmp, channel, width);
  osalSysUnlock();
}
开发者ID:TheShed,项目名称:ChibiOS,代码行数:25,代码来源:pwm.c

示例10: wdgStop

/**
 * @brief   Deactivates the WDG peripheral.
 *
 * @param[in] wdgp      pointer to the @p WDGDriver object
 *
 * @api
 */
void wdgStop(WDGDriver *wdgp) {

  osalDbgCheck(wdgp != NULL);

  osalSysLock();
  osalDbgAssert((wdgp->state == WDG_STOP) || (wdgp->state == WDG_READY),
                "invalid state");
  wdg_lld_stop(wdgp);
  wdgp->state = WDG_STOP;
  osalSysUnlock();
}
开发者ID:akerlund,项目名称:DSP_system,代码行数:18,代码来源:wdg.c

示例11: adcStop

/**
 * @brief   Deactivates the ADC peripheral.
 *
 * @param[in] adcp      pointer to the @p ADCDriver object
 *
 * @api
 */
void adcStop(ADCDriver *adcp) {

  osalDbgCheck(adcp != NULL);

  osalSysLock();
  osalDbgAssert((adcp->state == ADC_STOP) || (adcp->state == ADC_READY),
                "invalid state");
  adc_lld_stop(adcp);
  adcp->state = ADC_STOP;
  osalSysUnlock();
}
开发者ID:TheShed,项目名称:ChibiOS,代码行数:18,代码来源:adc.c

示例12: sdStart

/**
 * @brief   Configures and starts the driver.
 *
 * @param[in] sdp       pointer to a @p SerialDriver object
 * @param[in] config    the architecture-dependent serial driver configuration.
 *                      If this parameter is set to @p NULL then a default
 *                      configuration is used.
 *
 * @api
 */
void sdStart(SerialDriver *sdp, const SerialConfig *config) {

  osalDbgCheck(sdp != NULL);

  osalSysLock();
  osalDbgAssert((sdp->state == SD_STOP) || (sdp->state == SD_READY),
                "invalid state");
  sd_lld_start(sdp, config);
  sdp->state = SD_READY;
  osalSysUnlock();
}
开发者ID:KTannenberg,项目名称:ChibiOS,代码行数:21,代码来源:hal_serial.c

示例13: i2cStop

/**
 * @brief   Deactivates the I2C peripheral.
 *
 * @param[in] i2cp      pointer to the @p I2CDriver object
 *
 * @api
 */
void i2cStop(I2CDriver *i2cp) {

  osalDbgCheck(i2cp != NULL);
  osalDbgAssert((i2cp->state == I2C_STOP) || (i2cp->state == I2C_READY) ||
                (i2cp->state == I2C_LOCKED), "invalid state");

  osalSysLock();
  i2c_lld_stop(i2cp);
  i2cp->state = I2C_STOP;
  osalSysUnlock();
}
开发者ID:hmchen1,项目名称:ChibiOS,代码行数:18,代码来源:i2c.c

示例14: icuStopCapture

/**
 * @brief   Stops the input capture.
 *
 * @param[in] icup      pointer to the @p ICUDriver object
 *
 * @api
 */
void icuStopCapture(ICUDriver *icup) {

  osalDbgCheck(icup != NULL);

  osalSysLock();
  osalDbgAssert((icup->state == ICU_READY) || (icup->state == ICU_WAITING) ||
                (icup->state == ICU_ACTIVE),
                "invalid state");
  icuStopCaptureI(icup);
  osalSysUnlock();
}
开发者ID:SVentas,项目名称:SmartMDC,代码行数:18,代码来源:icu.c

示例15: icuStop

/**
 * @brief   Deactivates the ICU peripheral.
 *
 * @param[in] icup      pointer to the @p ICUDriver object
 *
 * @api
 */
void icuStop(ICUDriver *icup) {

  osalDbgCheck(icup != NULL);

  osalSysLock();
  osalDbgAssert((icup->state == ICU_STOP) || (icup->state == ICU_READY),
                "invalid state");
  icu_lld_stop(icup);
  icup->state = ICU_STOP;
  osalSysUnlock();
}
开发者ID:SVentas,项目名称:SmartMDC,代码行数:18,代码来源:icu.c


注:本文中的osalSysUnlock函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。