Skip to content
Snippets Groups Projects
Commit 838b18e8 authored by Peter Kietzmann's avatar Peter Kietzmann
Browse files

drivers/cc2420: add netopt NETOPT_MAX_PACKET_SIZE

parent 7f6fe21b
No related branches found
No related tags found
No related merge requests found
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#define ENABLE_DEBUG (0) #define ENABLE_DEBUG (0)
#include "debug.h" #include "debug.h"
#define _MAX_MHR_OVERHEAD (25)
static int _send(netdev_t *netdev, const iolist_t *iolist); static int _send(netdev_t *netdev, const iolist_t *iolist);
static int _recv(netdev_t *netdev, void *buf, size_t len, void *info); 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) ...@@ -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); cc2420_get_addr_long(dev, val);
return 8; 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: case NETOPT_NID:
assert(max_len >= sizeof(uint16_t)); assert(max_len >= sizeof(uint16_t));
return w_u16(val, cc2420_get_pan(dev)); return w_u16(val, cc2420_get_pan(dev));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment