コード例 #1
0
ファイル: can.c プロジェクト: ChibiOS/ChibiOS-gitmain
/**
 * @brief   Deactivates the CAN peripheral.
 *
 * @param[in] canp      pointer to the @p CANDriver object
 *
 * @api
 */
void canStop(CANDriver *canp) {

  osalDbgCheck(canp != NULL);

  osalSysLock();
  osalDbgAssert((canp->state == CAN_STOP) || (canp->state == CAN_READY),
                "invalid state");
  can_lld_stop(canp);
  canp->state  = CAN_STOP;
  osalThreadDequeueAllI(&canp->rxqueue, MSG_RESET);
  osalThreadDequeueAllI(&canp->txqueue, MSG_RESET);
  osalOsRescheduleS();
  osalSysUnlock();
}
コード例 #2
0
ファイル: can.c プロジェクト: Dionysios/STM_Library_2
/**
 * @brief   Deactivates the CAN peripheral.
 *
 * @param[in] canp      pointer to the @p CANDriver object
 *
 * @api
 */
void canStop(CANDriver *canp) {

  chDbgCheck(canp != NULL, "canStop");

  chSysLock();
  chDbgAssert((canp->state == CAN_STOP) || (canp->state == CAN_READY),
              "canStop(), #1", "invalid state");
  can_lld_stop(canp);
  chSemResetI(&canp->rxsem, 0);
  chSemResetI(&canp->txsem, 0);
  chSchRescheduleS();
  canp->state  = CAN_STOP;
  canp->status = 0;
  chSysUnlock();
}
コード例 #3
0
ファイル: can.c プロジェクト: SVentas/SmartMDC
/**
 * @brief   Deactivates the CAN peripheral.
 *
 * @param[in] canp      pointer to the @p CANDriver object
 *
 * @api
 */
void canStop(CANDriver *canp) {

  osalDbgCheck(canp != NULL);

  osalSysLock();
  osalDbgAssert((canp->state == CAN_STOP) || (canp->state == CAN_READY),
                "invalid state");

  /* The low level driver is stopped.*/
  can_lld_stop(canp);
  canp->state  = CAN_STOP;

  /* Threads waiting on CAN APIs are notified that the driver has been
     stopped in order to not have stuck threads.*/
  osalThreadDequeueAllI(&canp->rxqueue, MSG_RESET);
  osalThreadDequeueAllI(&canp->txqueue, MSG_RESET);
  osalOsRescheduleS();
  osalSysUnlock();
}