1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-25 06:23:53 +01:00

cc2538: add netstat_l2

This commit is contained in:
smlng 2016-10-21 21:56:04 +02:00
parent 3d23724802
commit 89978ab8e5

View File

@ -277,7 +277,9 @@ static int _send(netdev2_t *netdev, const struct iovec *vector, unsigned count)
rfcore_write_fifo(vector[i].iov_base, vector[i].iov_len);
}
#ifdef MODULE_NETSTATS_L2
netdev->stats.tx_bytes += pkt_len;
#endif
/* Set first byte of TX FIFO to the packet length */
rfcore_poke_tx_fifo(0, pkt_len + CC2538_AUTOCRC_LEN);
@ -323,7 +325,10 @@ static int _recv(netdev2_t *netdev, void *buf, size_t len, void *info)
/* GNRC is expecting len bytes of data */
pkt_len = len;
}
#ifdef MODULE_NETSTATS_L2
netdev->stats.rx_count++;
netdev->stats.rx_bytes += pkt_len;
#endif
rfcore_read_fifo(buf, pkt_len);
if (info != NULL && RFCORE->XREG_RSSISTATbits.RSSI_VALID) {
@ -389,6 +394,9 @@ static int _init(netdev2_t *netdev)
#elif MODULE_GNRC
dev->netdev.proto = GNRC_NETTYPE_UNDEF;
#endif
#ifdef MODULE_NETSTATS_L2
memset(&netdev->stats, 0, sizeof(netstats_t));
#endif
return 0;
}