mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
Merge pull request #18108 from benpicco/drivers/dose-rxbuf
drivers/dose: make RX buffer size configurable
This commit is contained in:
commit
e1e99c3bf1
@ -632,6 +632,15 @@ static int _get(netdev_t *dev, netopt_t opt, void *value, size_t max_len)
|
||||
*((netopt_enable_t *)value) = NETOPT_DISABLE;
|
||||
}
|
||||
return sizeof(netopt_enable_t);
|
||||
case NETOPT_MAX_PDU_SIZE:
|
||||
if (CONFIG_DOSE_RX_BUF_LEN < (ETHERNET_FRAME_LEN + DOSE_FRAME_CRC_LEN)) {
|
||||
if (max_len < sizeof(uint16_t)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
*((uint16_t *)value) = CONFIG_DOSE_RX_BUF_LEN - DOSE_FRAME_CRC_LEN;
|
||||
return sizeof(uint16_t);
|
||||
}
|
||||
/* fall-through */
|
||||
default:
|
||||
return netdev_eth_get(dev, opt, value, max_len);
|
||||
}
|
||||
|
@ -160,7 +160,14 @@ typedef enum {
|
||||
/** @} */
|
||||
|
||||
#define DOSE_FRAME_CRC_LEN (2) /**< CRC16 is used */
|
||||
#define DOSE_FRAME_LEN (ETHERNET_FRAME_LEN + DOSE_FRAME_CRC_LEN) /**< dose frame length */
|
||||
|
||||
/**
|
||||
* @brief DOSE RX buffer length
|
||||
* Should be large enough to fit at least one Ethernet frame
|
||||
*/
|
||||
#ifndef CONFIG_DOSE_RX_BUF_LEN
|
||||
#define CONFIG_DOSE_RX_BUF_LEN (ETHERNET_FRAME_LEN + DOSE_FRAME_CRC_LEN)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Hardware timer to use with the `dose_watchdog` module.
|
||||
@ -182,7 +189,7 @@ typedef struct {
|
||||
uint8_t opts; /**< Driver options */
|
||||
dose_state_t state; /**< Current state of the driver's state machine */
|
||||
mutex_t state_mtx; /**< Is unlocked every time a state is (re)entered */
|
||||
uint8_t recv_buf[DOSE_FRAME_LEN]; /**< Receive buffer for incoming frames */
|
||||
uint8_t recv_buf[CONFIG_DOSE_RX_BUF_LEN]; /**< Receive buffer for incoming frames */
|
||||
chunk_ringbuf_t rb; /**< Ringbuffer to store received frames. */
|
||||
/* Written to from interrupts (with irq_disable */
|
||||
/* to prevent any simultaneous writes), */
|
||||
|
Loading…
Reference in New Issue
Block a user