1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

drivers/cc2420: add netopt NETOPT_MAX_PACKET_SIZE

This commit is contained in:
PeterKietzmann 2018-07-17 11:50:25 +02:00
parent 7f6fe21b93
commit 838b18e8f9

View File

@ -38,6 +38,7 @@
#define ENABLE_DEBUG (0)
#include "debug.h"
#define _MAX_MHR_OVERHEAD (25)
static int _send(netdev_t *netdev, const iolist_t *iolist);
static int _recv(netdev_t *netdev, void *buf, size_t len, void *info);
@ -187,6 +188,11 @@ static int _get(netdev_t *netdev, netopt_t opt, void *val, size_t max_len)
cc2420_get_addr_long(dev, val);
return 8;
case NETOPT_MAX_PACKET_SIZE:
assert(max_len >= sizeof(int16_t));
*((uint16_t *)val) = CC2420_PKT_MAXLEN - _MAX_MHR_OVERHEAD;
return sizeof(int16_t);
case NETOPT_NID:
assert(max_len >= sizeof(uint16_t));
return w_u16(val, cc2420_get_pan(dev));