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

Merge pull request #9584 from PeterKietzmann/pr_cc2420_max_pkt_size

drivers/cc2420: add netopt NETOPT_MAX_PACKET_SIZE
This commit is contained in:
Koen Zandberg 2018-07-17 14:12:10 +02:00 committed by GitHub
commit 1dd4a46c90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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));