ChibiOS/RT Architecture - Reference Manual - Guides |
00001 /* 00002 ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. 00003 00004 This file is part of ChibiOS/RT. 00005 00006 ChibiOS/RT is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 3 of the License, or 00009 (at your option) any later version. 00010 00011 ChibiOS/RT is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program. If not, see <http://www.gnu.org/licenses/>. 00018 00019 --- 00020 00021 A special exception to the GPL can be applied should you wish to distribute 00022 a combined work that includes ChibiOS/RT, without being obliged to provide 00023 the source code for any proprietary components. See the file exception.txt 00024 for full details of how and when the exception can be applied. 00025 */ 00026 00027 /** 00028 * @file templates/can_lld.c 00029 * @brief CAN Driver subsystem low level driver source template. 00030 * 00031 * @addtogroup CAN_LLD 00032 * @{ 00033 */ 00034 00035 #include "ch.h" 00036 #include "hal.h" 00037 00038 #if CH_HAL_USE_CAN || defined(__DOXYGEN__) 00039 00040 /*===========================================================================*/ 00041 /* Driver exported variables. */ 00042 /*===========================================================================*/ 00043 00044 /*===========================================================================*/ 00045 /* Driver local variables. */ 00046 /*===========================================================================*/ 00047 00048 /*===========================================================================*/ 00049 /* Driver local functions. */ 00050 /*===========================================================================*/ 00051 00052 /*===========================================================================*/ 00053 /* Driver interrupt handlers. */ 00054 /*===========================================================================*/ 00055 00056 /*===========================================================================*/ 00057 /* Driver exported functions. */ 00058 /*===========================================================================*/ 00059 00060 /** 00061 * @brief Low level CAN driver initialization. 00062 */ 00063 void can_lld_init(void) { 00064 00065 } 00066 00067 /** 00068 * @brief Configures and activates the CAN peripheral. 00069 * 00070 * @param[in] canp pointer to the @p CANDriver object 00071 */ 00072 void can_lld_start(CANDriver *canp) { 00073 00074 } 00075 00076 /** 00077 * @brief Deactivates the CAN peripheral. 00078 * 00079 * @param[in] canp pointer to the @p CANDriver object 00080 */ 00081 void can_lld_stop(CANDriver *canp) { 00082 00083 /* If in ready state then disables the CAN peripheral.*/ 00084 if (canp->cd_state == CAN_READY) { 00085 00086 } 00087 } 00088 00089 00090 /** 00091 * @brief Determines whether a frame can be transmitted. 00092 * 00093 * @param[in] canp pointer to the @p CANDriver object 00094 * @return The queue space availability. 00095 * @retval FALSE no space in the transmit queue. 00096 * @retval TRUE transmit slot available. 00097 */ 00098 bool_t can_lld_can_transmit(CANDriver *canp) { 00099 00100 return FALSE; 00101 } 00102 00103 /** 00104 * @brief Inserts a frame into the transmit queue. 00105 * 00106 * @param[in] canp pointer to the @p CANDriver object 00107 * @param[in] ctfp pointer to the CAN frame to be transmitted 00108 */ 00109 void can_lld_transmit(CANDriver *canp, const CANTxFrame *ctfp) { 00110 00111 } 00112 00113 /** 00114 * @brief Determines whether a frame has been received. 00115 * 00116 * @param[in] canp pointer to the @p CANDriver object 00117 * @return The queue space availability. 00118 * @retval FALSE no space in the transmit queue. 00119 * @retval TRUE transmit slot available. 00120 */ 00121 bool_t can_lld_can_receive(CANDriver *canp) { 00122 00123 return FALSE; 00124 } 00125 00126 /** 00127 * @brief Receives a frame from the input queue. 00128 * 00129 * @param[in] canp pointer to the @p CANDriver object 00130 * @param[out] crfp pointer to the buffer where the CAN frame is copied 00131 */ 00132 void can_lld_receive(CANDriver *canp, CANRxFrame *crfp) { 00133 00134 } 00135 00136 #if CAN_USE_SLEEP_MODE || defined(__DOXYGEN__) 00137 /** 00138 * @brief Enters the sleep mode. 00139 * 00140 * @param[in] canp pointer to the @p CANDriver object 00141 */ 00142 void can_lld_sleep(CANDriver *canp) { 00143 00144 } 00145 00146 /** 00147 * @brief Enforces leaving the sleep mode. 00148 * 00149 * @param[in] canp pointer to the @p CANDriver object 00150 */ 00151 void can_lld_wakeup(CANDriver *canp) { 00152 00153 } 00154 #endif /* CAN_USE_SLEEP_MODE */ 00155 00156 #endif /* CH_HAL_USE_CAN */ 00157 00158 /** @} */