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/mac_lld.c 00029 * @brief MAC Driver subsystem low level driver source template. 00030 * 00031 * @addtogroup MAC_LLD 00032 * @{ 00033 */ 00034 00035 #include "ch.h" 00036 #include "hal.h" 00037 00038 #if CH_HAL_USE_MAC || 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 MAC initialization. 00062 */ 00063 void mac_lld_init(void) { 00064 00065 } 00066 00067 /** 00068 * @brief Low level MAC address setup. 00069 * 00070 * @param[in] macp pointer to the @p MACDriver object 00071 * @param[in] p pointer to a six bytes buffer containing the MAC 00072 * address. If this parameter is set to @p NULL then 00073 * a system default MAC is used. 00074 */ 00075 void mac_lld_set_address(MACDriver *macp, const uint8_t *p) { 00076 00077 } 00078 00079 /** 00080 * @brief Returns a transmission descriptor. 00081 * @details One of the available transmission descriptors is locked and 00082 * returned. 00083 * 00084 * @param[in] macp pointer to the @p MACDriver object 00085 * @param[out] tdp pointer to a @p MACTransmitDescriptor structure 00086 * @return The operation status. 00087 * @retval RDY_OK a descriptor was obtained. 00088 * @retval RDY_TIMEOUT descriptor not available. 00089 */ 00090 msg_t max_lld_get_transmit_descriptor(MACDriver *macp, 00091 MACTransmitDescriptor *tdp) { 00092 00093 return RDY_OK; 00094 } 00095 00096 /** 00097 * @brief Writes to a transmit descriptor's stream. 00098 * 00099 * @param[in] tdp pointer to a @p MACTransmitDescriptor structure 00100 * @param[in] buf pointer to the buffer containing the data to be 00101 * written 00102 * @param[in] size number of bytes to be written 00103 * @return The number of bytes written into the descriptor's 00104 * stream, this value can be less than the amount 00105 * specified in the parameter @p size if the maximum 00106 * frame size is reached. 00107 */ 00108 size_t mac_lld_write_transmit_descriptor(MACTransmitDescriptor *tdp, 00109 uint8_t *buf, 00110 size_t size) { 00111 00112 return 0; 00113 } 00114 00115 /** 00116 * @brief Releases a transmit descriptor and starts the transmission of the 00117 * enqueued data as a single frame. 00118 * 00119 * @param[in] tdp pointer to a @p MACTransmitDescriptor structure 00120 */ 00121 void mac_lld_release_transmit_descriptor(MACTransmitDescriptor *tdp) { 00122 00123 } 00124 00125 /** 00126 * @brief Returns a receive descriptor. 00127 * 00128 * @param[in] macp pointer to a @p MACDriver object 00129 * @param[out] rdp pointer to a @p MACReceiveDescriptor structure 00130 * @return The operation status. 00131 * @retval RDY_OK a descriptor was obtained. 00132 * @retval RDY_TIMEOUT descriptor not available. 00133 */ 00134 msg_t max_lld_get_receive_descriptor(MACDriver *macp, 00135 MACReceiveDescriptor *rdp) { 00136 00137 return RDY_OK; 00138 } 00139 00140 /** 00141 * @brief Reads from a receive descriptor's stream. 00142 * 00143 * @param[in] rdp pointer to a @p MACReceiveDescriptor structure 00144 * @param[in] buf pointer to a buffer that will receive the read data 00145 * @param[in] size number of bytes to be read 00146 * @return The number of bytes read from the descriptor's stream, 00147 * this value can be less than the amount specified in 00148 * the parameter @p size if there are no more bytes to read. 00149 */ 00150 size_t mac_lld_read_receive_descriptor(MACReceiveDescriptor *rdp, 00151 uint8_t *buf, 00152 size_t size) { 00153 00154 return 0; 00155 } 00156 00157 /** 00158 * @brief Releases a receive descriptor. 00159 * @details The descriptor and its buffer are made available for more incoming 00160 * frames. 00161 * 00162 * @param[in] rdp pointer to a @p MACReceiveDescriptor structure 00163 */ 00164 void mac_lld_release_receive_descriptor(MACReceiveDescriptor *rdp) { 00165 00166 } 00167 00168 /** 00169 * @brief Updates and returns the link status. 00170 * 00171 * @param[in] macp pointer to a @p MACDriver object 00172 * @return The link status. 00173 * @retval TRUE if the link is active. 00174 * @retval FALSE if the link is down. 00175 */ 00176 bool_t mac_lld_poll_link_status(MACDriver *macp) { 00177 00178 return FALSE; 00179 } 00180 00181 #endif /* CH_HAL_USE_MAC */ 00182 00183 /** @} */