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-d51de3d6d3f4master
parent
17d265e3ba
commit
22dcca914b
|
@ -124,14 +124,55 @@ typedef struct MACDriver MACDriver;
|
|||
* @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
|
||||
* @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 */
|
||||
/** @} */
|
||||
|
||||
/*===========================================================================*/
|
||||
|
|
|
@ -536,9 +536,12 @@ msg_t mac_lld_get_receive_descriptor(MACDriver *macp,
|
|||
}
|
||||
/* Invalid frame found, purging.*/
|
||||
rdes->rdes0 = STM32_RDES0_OWN;
|
||||
rdes = macp->rxptr = (stm32_eth_rx_descriptor_t *)rdes->rdes3;
|
||||
rdes = (stm32_eth_rx_descriptor_t *)rdes->rdes3;
|
||||
}
|
||||
|
||||
/* Next descriptor to check.*/
|
||||
macp->rxptr = rdes;
|
||||
|
||||
chSysUnlock();
|
||||
return RDY_TIMEOUT;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue