2009-11-29 08:50:13 +00:00
|
|
|
/*
|
2010-02-21 07:24:53 +00:00
|
|
|
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
|
2009-11-29 08:50:13 +00:00
|
|
|
|
|
|
|
This file is part of ChibiOS/RT.
|
|
|
|
|
|
|
|
ChibiOS/RT is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
ChibiOS/RT is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2010-02-07 11:11:45 +00:00
|
|
|
* @file templates/can_lld.c
|
|
|
|
* @brief CAN Driver subsystem low level driver source template.
|
|
|
|
*
|
2009-11-29 08:50:13 +00:00
|
|
|
* @addtogroup CAN_LLD
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ch.h"
|
|
|
|
#include "hal.h"
|
|
|
|
|
2009-11-29 10:37:31 +00:00
|
|
|
#if CH_HAL_USE_CAN || defined(__DOXYGEN__)
|
2009-11-29 08:50:13 +00:00
|
|
|
|
|
|
|
/*===========================================================================*/
|
2009-12-29 11:12:05 +00:00
|
|
|
/* Driver exported variables. */
|
2009-11-29 08:50:13 +00:00
|
|
|
/*===========================================================================*/
|
|
|
|
|
|
|
|
/*===========================================================================*/
|
2009-12-29 11:12:05 +00:00
|
|
|
/* Driver local variables. */
|
2009-11-29 08:50:13 +00:00
|
|
|
/*===========================================================================*/
|
|
|
|
|
|
|
|
/*===========================================================================*/
|
2009-12-29 11:12:05 +00:00
|
|
|
/* Driver local functions. */
|
2009-11-29 08:50:13 +00:00
|
|
|
/*===========================================================================*/
|
|
|
|
|
|
|
|
/*===========================================================================*/
|
2009-12-29 11:12:05 +00:00
|
|
|
/* Driver interrupt handlers. */
|
2009-11-29 08:50:13 +00:00
|
|
|
/*===========================================================================*/
|
|
|
|
|
|
|
|
/*===========================================================================*/
|
2009-12-29 11:12:05 +00:00
|
|
|
/* Driver exported functions. */
|
2009-11-29 08:50:13 +00:00
|
|
|
/*===========================================================================*/
|
|
|
|
|
|
|
|
/**
|
2010-02-07 11:11:45 +00:00
|
|
|
* @brief Low level CAN driver initialization.
|
2009-11-29 08:50:13 +00:00
|
|
|
*/
|
|
|
|
void can_lld_init(void) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2010-02-07 11:11:45 +00:00
|
|
|
* @brief Configures and activates the CAN peripheral.
|
2009-11-29 08:50:13 +00:00
|
|
|
*
|
2010-02-07 11:11:45 +00:00
|
|
|
* @param[in] canp pointer to the @p CANDriver object
|
2009-11-29 08:50:13 +00:00
|
|
|
*/
|
|
|
|
void can_lld_start(CANDriver *canp) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2010-02-07 11:11:45 +00:00
|
|
|
* @brief Deactivates the CAN peripheral.
|
2009-11-29 08:50:13 +00:00
|
|
|
*
|
2010-02-07 11:11:45 +00:00
|
|
|
* @param[in] canp pointer to the @p CANDriver object
|
2009-11-29 08:50:13 +00:00
|
|
|
*/
|
|
|
|
void can_lld_stop(CANDriver *canp) {
|
|
|
|
|
2009-12-04 20:56:51 +00:00
|
|
|
/* If in ready state then disables the CAN peripheral.*/
|
|
|
|
if (canp->cd_state == CAN_READY) {
|
|
|
|
|
|
|
|
}
|
2009-11-29 08:50:13 +00:00
|
|
|
}
|
|
|
|
|
2009-12-04 20:56:51 +00:00
|
|
|
|
2009-11-29 08:50:13 +00:00
|
|
|
/**
|
2010-02-07 11:11:45 +00:00
|
|
|
* @brief Determines whether a frame can be transmitted.
|
2010-02-21 07:24:53 +00:00
|
|
|
*
|
2010-02-07 11:11:45 +00:00
|
|
|
* @param[in] canp pointer to the @p CANDriver object
|
|
|
|
* @return The queue space availability.
|
|
|
|
* @retval FALSE no space in the transmit queue.
|
2010-02-21 07:24:53 +00:00
|
|
|
* @retval TRUE transmit slot available.
|
2009-11-29 08:50:13 +00:00
|
|
|
*/
|
|
|
|
bool_t can_lld_can_transmit(CANDriver *canp) {
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2010-02-07 11:11:45 +00:00
|
|
|
* @brief Inserts a frame into the transmit queue.
|
2009-11-29 08:50:13 +00:00
|
|
|
*
|
2009-12-04 20:56:51 +00:00
|
|
|
* @param[in] canp pointer to the @p CANDriver object
|
|
|
|
* @param[in] ctfp pointer to the CAN frame to be transmitted
|
2009-11-29 08:50:13 +00:00
|
|
|
*/
|
2009-12-04 20:56:51 +00:00
|
|
|
void can_lld_transmit(CANDriver *canp, const CANTxFrame *ctfp) {
|
2009-11-29 08:50:13 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2010-02-07 11:11:45 +00:00
|
|
|
* @brief Determines whether a frame has been received.
|
2009-11-29 08:50:13 +00:00
|
|
|
*
|
2010-02-07 11:11:45 +00:00
|
|
|
* @param[in] canp pointer to the @p CANDriver object
|
|
|
|
* @return The queue space availability.
|
|
|
|
* @retval FALSE no space in the transmit queue.
|
|
|
|
* @retval TRUE transmit slot available.
|
2009-11-29 08:50:13 +00:00
|
|
|
*/
|
|
|
|
bool_t can_lld_can_receive(CANDriver *canp) {
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2010-02-07 11:11:45 +00:00
|
|
|
* @brief Receives a frame from the input queue.
|
2009-11-29 08:50:13 +00:00
|
|
|
*
|
2009-12-04 20:56:51 +00:00
|
|
|
* @param[in] canp pointer to the @p CANDriver object
|
|
|
|
* @param[out] crfp pointer to the buffer where the CAN frame is copied
|
2009-11-29 08:50:13 +00:00
|
|
|
*/
|
2009-12-04 20:56:51 +00:00
|
|
|
void can_lld_receive(CANDriver *canp, CANRxFrame *crfp) {
|
2009-11-29 08:50:13 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#if CAN_USE_SLEEP_MODE || defined(__DOXYGEN__)
|
|
|
|
/**
|
2010-02-07 11:11:45 +00:00
|
|
|
* @brief Enters the sleep mode.
|
2009-11-29 08:50:13 +00:00
|
|
|
*
|
|
|
|
* @param[in] canp pointer to the @p CANDriver object
|
|
|
|
*/
|
|
|
|
void can_lld_sleep(CANDriver *canp) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2010-02-07 11:11:45 +00:00
|
|
|
* @brief Enforces leaving the sleep mode.
|
2009-11-29 08:50:13 +00:00
|
|
|
*
|
|
|
|
* @param[in] canp pointer to the @p CANDriver object
|
|
|
|
*/
|
|
|
|
void can_lld_wakeup(CANDriver *canp) {
|
|
|
|
|
|
|
|
}
|
|
|
|
#endif /* CAN_USE_SLEEP_MODE */
|
|
|
|
|
|
|
|
#endif /* CH_HAL_USE_CAN */
|
|
|
|
|
|
|
|
/** @} */
|