Skip to content

Commit

Permalink
cpu: drivers: adapt devices for netdev2 parameter type change
Browse files Browse the repository at this point in the history
  • Loading branch information
miri64 committed Aug 3, 2016
1 parent b7e45ff commit d2eebd6
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 28 deletions.
10 changes: 5 additions & 5 deletions cpu/native/netdev2_tap/netdev2_tap.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ netdev2_tap_t netdev2_tap;

/* netdev2 interface */
static int _init(netdev2_t *netdev);
static int _send(netdev2_t *netdev, const struct iovec *vector, int n);
static int _recv(netdev2_t *netdev, char* buf, int n, void *info);
static int _send(netdev2_t *netdev, const struct iovec *vector, unsigned n);
static int _recv(netdev2_t *netdev, void *buf, size_t n, void *info);

static inline void _get_mac_addr(netdev2_t *netdev, uint8_t *dst)
{
Expand Down Expand Up @@ -211,7 +211,7 @@ static void _continue_reading(netdev2_tap_t *dev)
_native_in_syscall--;
}

static int _recv(netdev2_t *netdev2, char *buf, int len, void *info)
static int _recv(netdev2_t *netdev2, void *buf, size_t len, void *info)
{
netdev2_tap_t *dev = (netdev2_tap_t*)netdev2;
(void)info;
Expand Down Expand Up @@ -284,13 +284,13 @@ static int _recv(netdev2_t *netdev2, char *buf, int len, void *info)
return -1;
}

static int _send(netdev2_t *netdev, const struct iovec *vector, int n)
static int _send(netdev2_t *netdev, const struct iovec *vector, unsigned n)
{
netdev2_tap_t *dev = (netdev2_tap_t*)netdev;
int res = _native_writev(dev->tap_fd, vector, n);
#ifdef MODULE_NETSTATS_L2
size_t bytes = 0;
for (int i = 0; i < n; i++) {
for (unsigned i = 0; i < n; i++) {
bytes += vector->iov_len;
vector++;
}
Expand Down
10 changes: 5 additions & 5 deletions drivers/at86rf2xx/at86rf2xx_netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@

#define _MAX_MHR_OVERHEAD (25)

static int _send(netdev2_t *netdev, const struct iovec *vector, int count);
static int _recv(netdev2_t *netdev, char *buf, int len, void *info);
static int _send(netdev2_t *netdev, const struct iovec *vector, unsigned count);
static int _recv(netdev2_t *netdev, void *buf, size_t len, void *info);
static int _init(netdev2_t *netdev);
static void _isr(netdev2_t *netdev);
static int _get(netdev2_t *netdev, netopt_t opt, void *val, size_t max_len);
Expand Down Expand Up @@ -97,7 +97,7 @@ static int _init(netdev2_t *netdev)
return 0;
}

static int _send(netdev2_t *netdev, const struct iovec *vector, int count)
static int _send(netdev2_t *netdev, const struct iovec *vector, unsigned count)
{
at86rf2xx_t *dev = (at86rf2xx_t *)netdev;
const struct iovec *ptr = vector;
Expand All @@ -106,7 +106,7 @@ static int _send(netdev2_t *netdev, const struct iovec *vector, int count)
at86rf2xx_tx_prepare(dev);

/* load packet data into FIFO */
for (int i = 0; i < count; i++, ptr++) {
for (unsigned i = 0; i < count; i++, ptr++) {
/* current packet data + FCS too long */
if ((len + ptr->iov_len + 2) > AT86RF2XX_MAX_PKT_LENGTH) {
DEBUG("[at86rf2xx] error: packet too large (%u byte) to be send\n",
Expand All @@ -127,7 +127,7 @@ static int _send(netdev2_t *netdev, const struct iovec *vector, int count)
return (int)len;
}

static int _recv(netdev2_t *netdev, char *buf, int len, void *info)
static int _recv(netdev2_t *netdev, void *buf, size_t len, void *info)
{
at86rf2xx_t *dev = (at86rf2xx_t *)netdev;
uint8_t phr;
Expand Down
4 changes: 2 additions & 2 deletions drivers/cc110x/cc110x-netdev2.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#define ENABLE_DEBUG (0)
#include "debug.h"

static int _send(netdev2_t *dev, const struct iovec *vector, int count)
static int _send(netdev2_t *dev, const struct iovec *vector, unsigned count)
{
DEBUG("%s:%u\n", __func__, __LINE__);

Expand All @@ -47,7 +47,7 @@ static int _send(netdev2_t *dev, const struct iovec *vector, int count)
return cc110x_send(&netdev2_cc110x->cc110x, cc110x_pkt);
}

static int _recv(netdev2_t *dev, char* buf, int len, void *info)
static int _recv(netdev2_t *dev, void *buf, size_t len, void *info)
{
DEBUG("%s:%u\n", __func__, __LINE__);

Expand Down
4 changes: 2 additions & 2 deletions drivers/enc28j60/enc28j60.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ static void on_int(void *arg)
netdev->event_callback(arg, NETDEV2_EVENT_ISR, netdev->isr_arg);
}

static int nd_send(netdev2_t *netdev, const struct iovec *data, int count)
static int nd_send(netdev2_t *netdev, const struct iovec *data, unsigned count)
{
enc28j60_t *dev = (enc28j60_t *)netdev;
uint8_t ctrl = 0;
Expand Down Expand Up @@ -248,7 +248,7 @@ static int nd_send(netdev2_t *netdev, const struct iovec *data, int count)
return c;
}

static int nd_recv(netdev2_t *netdev, char *buf, int max_len, void *info)
static int nd_recv(netdev2_t *netdev, void *buf, size_t max_len, void *info)
{
enc28j60_t *dev = (enc28j60_t *)netdev;
uint8_t head[6];
Expand Down
8 changes: 4 additions & 4 deletions drivers/encx24j600/encx24j600.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ static inline int _packets_available(encx24j600_t *dev);
static void _get_mac_addr(netdev2_t *dev, uint8_t* buf);

/* netdev2 interface */
static int _send(netdev2_t *netdev, const struct iovec *vector, int count);
static int _recv(netdev2_t *netdev, char* buf, int len, void *info);
static int _send(netdev2_t *netdev, const struct iovec *vector, unsigned count);
static int _recv(netdev2_t *netdev, void *buf, size_t len, void *info);
static int _init(netdev2_t *dev);
static void _isr(netdev2_t *dev);
int _get(netdev2_t *dev, netopt_t opt, void *value, size_t max_len);
Expand Down Expand Up @@ -305,7 +305,7 @@ static int _init(netdev2_t *encdev)
return 0;
}

static int _send(netdev2_t *netdev, const struct iovec *vector, int count) {
static int _send(netdev2_t *netdev, const struct iovec *vector, unsigned count) {
encx24j600_t * dev = (encx24j600_t *) netdev;
lock(dev);

Expand Down Expand Up @@ -360,7 +360,7 @@ static void _get_mac_addr(netdev2_t *encdev, uint8_t* buf)
unlock(dev);
}

static int _recv(netdev2_t *netdev, char* buf, int len, void *info)
static int _recv(netdev2_t *netdev, void *buf, size_t len, void *info)
{
encx24j600_t * dev = (encx24j600_t *) netdev;
encx24j600_frame_hdr_t hdr;
Expand Down
8 changes: 4 additions & 4 deletions drivers/ethos/ethos.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ void ethos_send_frame(ethos_t *dev, const uint8_t *data, size_t len, unsigned fr
}
}

static int _send(netdev2_t *netdev, const struct iovec *vector, int count)
static int _send(netdev2_t *netdev, const struct iovec *vector, unsigned count)
{
ethos_t * dev = (ethos_t *) netdev;
(void)dev;
Expand Down Expand Up @@ -292,7 +292,7 @@ static void _get_mac_addr(netdev2_t *encdev, uint8_t* buf)
memcpy(buf, dev->mac_addr, 6);
}

static int _recv(netdev2_t *netdev, char* buf, int len, void* info)
static int _recv(netdev2_t *netdev, void *buf, size_t len, void* info)
{
(void) info;
ethos_t * dev = (ethos_t *) netdev;
Expand All @@ -303,15 +303,15 @@ static int _recv(netdev2_t *netdev, char* buf, int len, void* info)
return -1;
}

len = (int)dev->last_framesize;
len = dev->last_framesize;
dev->last_framesize = 0;

if ((tsrb_get(&dev->inbuf, buf, len) != len)) {
DEBUG("ethos _recv(): inbuf doesn't contain enough bytes.");
return -1;
}

return len;
return (int)len;
}
else {
return dev->last_framesize;
Expand Down
10 changes: 5 additions & 5 deletions sys/net/netdev2_test/netdev2_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

#include "net/netdev2_test.h"

static int _send(netdev2_t *netdev, const struct iovec *vector, int count);
static int _recv(netdev2_t *netdev, char *buf, int len, void *info);
static int _send(netdev2_t *netdev, const struct iovec *vector, unsigned count);
static int _recv(netdev2_t *netdev, void *buf, size_t len, void *info);
static int _init(netdev2_t *dev);
static void _isr(netdev2_t *dev);
static int _get(netdev2_t *dev, netopt_t opt, void *value, size_t max_len);
Expand Down Expand Up @@ -57,10 +57,10 @@ void netdev2_test_reset(netdev2_test_t *dev)
mutex_unlock(&dev->mutex);
}

static int _send(netdev2_t *netdev, const struct iovec *vector, int count)
static int _send(netdev2_t *netdev, const struct iovec *vector, unsigned count)
{
netdev2_test_t *dev = (netdev2_test_t *)netdev;
int res = count; /* assume everything would be fine */
int res = (int)count; /* assume everything would be fine */

mutex_lock(&dev->mutex);
if (dev->send_cb != NULL) {
Expand All @@ -70,7 +70,7 @@ static int _send(netdev2_t *netdev, const struct iovec *vector, int count)
return res;
}

static int _recv(netdev2_t *netdev, char *buf, int len, void *info)
static int _recv(netdev2_t *netdev, void *buf, size_t len, void *info)
{
netdev2_test_t *dev = (netdev2_test_t *)netdev;
int res = (buf == NULL) ? 0 : len; /* assume everything would be fine */
Expand Down
2 changes: 1 addition & 1 deletion tests/driver_at86rf2xx/recv.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void recv(netdev2_t *dev)
le_uint16_t src_pan, dst_pan;

putchar('\n');
data_len = dev->driver->recv(dev, (char *)buffer, sizeof(buffer), &rx_info);
data_len = dev->driver->recv(dev, buffer, sizeof(buffer), &rx_info);
mhr_len = ieee802154_get_frame_hdr_len(buffer);
if (mhr_len == 0) {
puts("Unexpected MHR for incoming packet");
Expand Down

0 comments on commit d2eebd6

Please sign in to comment.