mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-24 14:03:55 +01:00
drivers: Use size_t print format specifier
Co-authored-by: Marian Buschsieweke <marian.buschsieweke@posteo.net>
This commit is contained in:
parent
64ba553d1f
commit
ec7fe8d598
@ -158,8 +158,8 @@ static int _send(netdev_t *netdev, const iolist_t *iolist)
|
||||
|
||||
/* current packet data + FCS too long */
|
||||
if ((len + iol->iol_len + IEEE802154_FCS_LEN) > AT86RF215_MAX_PKT_LENGTH) {
|
||||
DEBUG("[at86rf215] error: packet too large (%u byte) to be send\n",
|
||||
(unsigned)len + IEEE802154_FCS_LEN);
|
||||
DEBUG("[at86rf215] error: packet too large (%" PRIuSIZE
|
||||
" byte) to be send\n", len + IEEE802154_FCS_LEN);
|
||||
at86rf215_tx_abort(dev);
|
||||
return -EOVERFLOW;
|
||||
}
|
||||
|
||||
@ -30,6 +30,7 @@
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "architecture.h"
|
||||
#include "iolist.h"
|
||||
|
||||
#include "net/eui64.h"
|
||||
@ -216,8 +217,8 @@ static int _send(netdev_t *netdev, const iolist_t *iolist)
|
||||
for (const iolist_t *iol = iolist; iol; iol = iol->iol_next) {
|
||||
/* current packet data + FCS too long */
|
||||
if ((len + iol->iol_len + 2) > AT86RF2XX_MAX_PKT_LENGTH) {
|
||||
DEBUG("[at86rf2xx] error: packet too large (%u byte) to be send\n",
|
||||
(unsigned)len + 2);
|
||||
DEBUG("[at86rf2xx] error: packet too large (%" PRIuSIZE
|
||||
" byte) to be send\n", len + 2);
|
||||
return -EOVERFLOW;
|
||||
}
|
||||
if (iol->iol_len) {
|
||||
|
||||
@ -425,10 +425,9 @@ static int cc110x_send(netdev_t *netdev, const iolist_t *iolist)
|
||||
if (iol->iol_len) {
|
||||
if (size + iol->iol_len > CC110X_MAX_FRAME_SIZE) {
|
||||
cc110x_release(dev);
|
||||
DEBUG("[cc110x] netdev_driver_t::send(): Frame size of %uB "
|
||||
"exceeds maximum supported size of %uB\n",
|
||||
(unsigned)(size + iol->iol_len),
|
||||
(unsigned)CC110X_MAX_FRAME_SIZE);
|
||||
DEBUG("[cc110x] netdev_driver_t::send(): Frame size of %"
|
||||
PRIuSIZE "B exceeds maximum supported size of %uB\n",
|
||||
size + iol->iol_len, (unsigned)CC110X_MAX_FRAME_SIZE);
|
||||
return -1;
|
||||
}
|
||||
memcpy(dev->buf.data + size, iol->iol_base, iol->iol_len);
|
||||
|
||||
@ -120,7 +120,7 @@ static int cc1xxx_adpt_send(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt)
|
||||
|
||||
/* get the payload size and the dst address details */
|
||||
size = gnrc_pkt_len(pkt->next);
|
||||
DEBUG("[cc1xxx-gnrc] send: payload of packet is %i\n", (int)size);
|
||||
DEBUG("[cc1xxx-gnrc] send: payload of packet is %" PRIuSIZE "\n", size);
|
||||
netif_hdr = (gnrc_netif_hdr_t *)pkt->data;
|
||||
|
||||
l2hdr.src_addr = cc1xxx_dev->addr;
|
||||
|
||||
@ -133,7 +133,7 @@ size_t cc2420_tx_prepare(cc2420_t *dev, const iolist_t *iolist)
|
||||
cc2420_fifo_write(dev, iol->iol_base, iol->iol_len);
|
||||
}
|
||||
}
|
||||
DEBUG("cc2420: tx_prep: loaded %i byte into the TX FIFO\n", (int)pkt_len);
|
||||
DEBUG("cc2420: tx_prep: loaded %" PRIuSIZE " byte into the TX FIFO\n", pkt_len);
|
||||
|
||||
return pkt_len;
|
||||
}
|
||||
|
||||
@ -443,7 +443,7 @@ static int _recv(netdev_t *dev, void *buf, size_t len, void *info)
|
||||
|
||||
size_t dummy;
|
||||
if (crb_get_chunk_size(&ctx->rb, &dummy)) {
|
||||
DEBUG("dose: %u byte pkt in rx queue\n", (unsigned)dummy);
|
||||
DEBUG("dose: %" PRIuSIZE " byte pkt in rx queue\n", dummy);
|
||||
netdev_trigger_event_isr(&ctx->netdev);
|
||||
}
|
||||
|
||||
|
||||
@ -330,8 +330,8 @@ static int nd_recv(netdev_t *netdev, void *buf, size_t max_len, void *info)
|
||||
next = (uint16_t)((head[1] << 8) | head[0]);
|
||||
size = (uint16_t)((head[3] << 8) | head[2]) - 4; /* discard CRC */
|
||||
|
||||
DEBUG("[enc28j60] recv: size=%i next=%i buf=%p len=%d\n",
|
||||
(int)size, (int)next, buf, max_len);
|
||||
DEBUG("[enc28j60] recv: size=%u next=%u buf=%p len=%" PRIuSIZE "\n",
|
||||
size, next, buf, max_len);
|
||||
|
||||
if (buf != NULL) {
|
||||
/* read packet content into the supplied buffer */
|
||||
|
||||
@ -243,14 +243,14 @@ static int kw41zrf_netdev_send(netdev_t *netdev, const iolist_t *iolist)
|
||||
for (const iolist_t *iol = iolist; iol; iol = iol->iol_next) {
|
||||
/* current packet data + FCS too long */
|
||||
if ((len + iol->iol_len) > (KW41ZRF_MAX_PKT_LENGTH - IEEE802154_FCS_LEN)) {
|
||||
LOG_ERROR("[kw41zrf] packet too large (%u byte) to fit\n",
|
||||
(unsigned)len + IEEE802154_FCS_LEN);
|
||||
LOG_ERROR("[kw41zrf] packet too large (%" PRIuSIZE " byte) to fit\n",
|
||||
len + IEEE802154_FCS_LEN);
|
||||
return -EOVERFLOW;
|
||||
}
|
||||
len = kw41zrf_tx_load(iol->iol_base, iol->iol_len, len);
|
||||
}
|
||||
|
||||
DEBUG("[kw41zrf] TX %u bytes\n", len);
|
||||
DEBUG("[kw41zrf] TX %" PRIuSIZE " bytes\n", len);
|
||||
|
||||
/*
|
||||
* First octet in the TX buffer contains the frame length.
|
||||
|
||||
@ -428,8 +428,8 @@ void lcd_pixmap(lcd_t *dev, uint16_t x1, uint16_t x2,
|
||||
size_t num_pix = (x2 - x1 + 1) * (y2 - y1 + 1);
|
||||
|
||||
DEBUG("[lcd]: Write x1: %" PRIu16 ", x2: %" PRIu16 ", "
|
||||
"y1: %" PRIu16 ", y2: %" PRIu16 ". Num pixels: %lu\n",
|
||||
x1, x2, y1, y2, (unsigned long)num_pix);
|
||||
"y1: %" PRIu16 ", y2: %" PRIu16 ". Num pixels: %" PRIuSIZE "\n",
|
||||
x1, x2, y1, y2, num_pix);
|
||||
|
||||
lcd_ll_acquire(dev);
|
||||
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "architecture.h"
|
||||
#include "periph/usbdev.h"
|
||||
#include "test_utils/expect.h"
|
||||
#include "usbdev_mock.h"
|
||||
@ -200,8 +201,8 @@ void _ep_esr(usbdev_ep_t *ep)
|
||||
|
||||
int _xmit(usbdev_ep_t *ep, uint8_t *buf, size_t len)
|
||||
{
|
||||
DEBUG("[mock]: Readying EP %u, dir %s, len %u\n",
|
||||
ep->num, ep->dir == USB_EP_DIR_OUT ? "out" : "in", (unsigned)len);
|
||||
DEBUG("[mock]: Readying EP %u, dir %s, len %" PRIuSIZE "\n",
|
||||
ep->num, ep->dir == USB_EP_DIR_OUT ? "out" : "in", len);
|
||||
if (ep->num == 0) {
|
||||
usbdev_mock_t *usbdev_mock = _ep2dev(ep);
|
||||
usbdev_mock_ep_t *mock_ep = (usbdev_mock_ep_t *)ep;
|
||||
|
||||
@ -111,7 +111,7 @@ static int xbee_adpt_send(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt)
|
||||
|
||||
/* get the payload size and the dst address details */
|
||||
size = gnrc_pkt_len(pkt->next);
|
||||
DEBUG("[xbee-gnrc] send: payload of packet is %i\n", (int)size);
|
||||
DEBUG("[xbee-gnrc] send: payload of packet is %" PRIuSIZE "\n", size);
|
||||
hdr = (gnrc_netif_hdr_t *)pkt->data;
|
||||
if (hdr->flags & BCAST) {
|
||||
uint16_t addr = 0xffff;
|
||||
|
||||
@ -673,7 +673,7 @@ static int xbee_send(netdev_t *dev, const iolist_t *iolist)
|
||||
}
|
||||
|
||||
/* send the actual data packet */
|
||||
DEBUG("[xbee] send: now sending out %i byte\n", (int)size);
|
||||
DEBUG("[xbee] send: now sending out %" PRIuSIZE " byte\n", size);
|
||||
mutex_lock(&(xbee->tx_lock));
|
||||
for (const iolist_t *iol = iolist; iol; iol = iol->iol_next) {
|
||||
if (iol->iol_len > 0) {
|
||||
@ -705,16 +705,16 @@ static int xbee_recv(netdev_t *dev, void *buf, size_t len, void *info)
|
||||
size = (size_t)(xbee->rx_limit - 1);
|
||||
if (buf == NULL) {
|
||||
if (len > 0) {
|
||||
DEBUG("[xbee] recv: reading size and dropping: %u\n", (unsigned)size);
|
||||
DEBUG("[xbee] recv: reading size and dropping: %" PRIuSIZE "\n", size);
|
||||
xbee->rx_count = 0;
|
||||
}
|
||||
else {
|
||||
DEBUG("[xbee] recv: reading size without dropping: %u\n", (unsigned)size);
|
||||
DEBUG("[xbee] recv: reading size without dropping: %" PRIuSIZE "\n", size);
|
||||
}
|
||||
}
|
||||
else {
|
||||
size = (size > len) ? len : size;
|
||||
DEBUG("[xbee] recv: consuming packet: reading %u byte\n", (unsigned)size);
|
||||
DEBUG("[xbee] recv: consuming packet: reading %" PRIuSIZE " byte\n", size);
|
||||
memcpy(buf, xbee->rx_buf, size);
|
||||
xbee->rx_count = 0;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user