aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/include
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-12-28 15:15:09 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-12-28 15:15:09 +0000
commit22dcca914b67892038958a03b527ca9df25ac916 (patch)
tree92bbb71680bed5bb61da242e1b325d1479fca679 /os/hal/include
parent17d265e3bac954e0e934bc528afa8de1ba1f1b60 (diff)
downloadChibiOS-22dcca914b67892038958a03b527ca9df25ac916.tar.gz
ChibiOS-22dcca914b67892038958a03b527ca9df25ac916.tar.bz2
ChibiOS-22dcca914b67892038958a03b527ca9df25ac916.zip
MAC API tentative extension, small improvement to STM32 MAC driver.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4983 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/include')
-rw-r--r--os/hal/include/mac.h53
1 files changed, 47 insertions, 6 deletions
diff --git a/os/hal/include/mac.h b/os/hal/include/mac.h
index 6f70aff44..2903bd07c 100644
--- a/os/hal/include/mac.h
+++ b/os/hal/include/mac.h
@@ -121,17 +121,58 @@ typedef struct MACDriver MACDriver;
/**
* @brief Reads from a receive descriptor's stream.
*
- * @param[in] rdp pointer to a @p MACReceiveDescriptor structure
- * @param[in] buf pointer to the buffer that will receive the read data
- * @param[in] size number of bytes to be read
- * @return The number of bytes read from the descriptor's stream, this
- * value can be less than the amount specified in the
- * parameter @p size if there are no more bytes to read.
+ * @param[in] rdp pointer to a @p MACReceiveDescriptor structure
+ * @param[in] buf pointer to the buffer that will receive the read data
+ * @param[in] size number of bytes to be read
+ * @return The number of bytes read from the descriptor's stream,
+ * this value can be less than the amount specified in the
+ * parameter @p size if there are no more bytes to read.
*
* @api
*/
#define macReadReceiveDescriptor(rdp, buf, size) \
mac_lld_read_receive_descriptor(rdp, buf, size)
+
+#if MAC_SUPPORTS_ZERO_COPY || defined(__DOXYGEN__)
+/**
+ * @brief Returns a pointer to the next transmit buffer in the descriptor
+ * chain.
+ * @note The API guarantees that enough buffers can be requested to fill
+ * a whole frame.
+ *
+ * @param[in] tdp pointer to a @p MACTransmitDescriptor structure
+ * @param[in] size size of the requested buffer. Specify the frame size
+ * on the first call then scale the value down subtracting
+ * the amount of data already copied into the previous
+ * buffers.
+ * @param[out] sizep pointer to variable receiving the real buffer size.
+ * The returned value can be less than the amount
+ * requested, this means that more buffers must be
+ * requested in order to fill the frame data entirely.
+ * @return Pointer to the returned buffer.
+ *
+ * @api
+ */
+#define macGetNextTransmitBuffer(tdp, size, sizep) \
+ mac_lld_get_next_transmit_buffer(tdp, bufp)
+
+/**
+ * @brief Returns a pointer to the next receive buffer in the descriptor
+ * chain.
+ * @note The API guarantees that the descriptor chain contains a whole
+ * frame.
+ *
+ * @param[in] rdp pointer to a @p MACReceiveDescriptor structure
+ * @param[out] sizep pointer to variable receiving the buffer size, it is
+ * zero when the last buffer has already been returned.
+ * @return Pointer to the returned buffer.
+ * @retval NULL if the buffer chain has been entirely scanned.
+ *
+ * @api
+ */
+#define magGetNextReceiveBuffer(rdp, sizep) \
+ mac_lld_get_next_receive_buffer(rdp, sizep)
+#endif /* MAC_SUPPORTS_ZERO_COPY */
/** @} */
/*===========================================================================*/