Skip to content

Commit bd2429f

Browse files
committed
cpu: drivers: adapt devices for netdev2 parameter type change
1 parent e710164 commit bd2429f

File tree

12 files changed

+43
-43
lines changed

12 files changed

+43
-43
lines changed

cpu/cc2538/radio/cc2538_rf_netdev.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535

3636
static int _get(netdev2_t *dev, netopt_t opt, void *value, size_t max_len);
3737
static int _set(netdev2_t *dev, netopt_t opt, void *value, size_t value_len);
38-
static int _send(netdev2_t *netdev, const struct iovec *vector, int count);
39-
static int _recv(netdev2_t *netdev, char *buf, int len, void *info);
38+
static int _send(netdev2_t *netdev, const struct iovec *vector, unsigned count);
39+
static int _recv(netdev2_t *netdev, void *buf, size_t len, void *info);
4040
static void _isr(netdev2_t *netdev);
4141
static int _init(netdev2_t *dev);
4242

@@ -253,7 +253,7 @@ static int _set(netdev2_t *netdev, netopt_t opt, void *value, size_t value_len)
253253
return res;
254254
}
255255

256-
static int _send(netdev2_t *netdev, const struct iovec *vector, int count)
256+
static int _send(netdev2_t *netdev, const struct iovec *vector, unsigned count)
257257
{
258258
int pkt_len = 0;
259259

@@ -268,7 +268,7 @@ static int _send(netdev2_t *netdev, const struct iovec *vector, int count)
268268
start of the FIFO, so we can come back and update it later */
269269
rfcore_write_byte(0);
270270

271-
for (int i = 0; i < count; i++) {
271+
for (unsigned i = 0; i < count; i++) {
272272
pkt_len += vector[i].iov_len;
273273

274274
if (pkt_len > CC2538_RF_MAX_DATA_LEN) {
@@ -289,7 +289,7 @@ static int _send(netdev2_t *netdev, const struct iovec *vector, int count)
289289
return pkt_len;
290290
}
291291

292-
static int _recv(netdev2_t *netdev, char *buf, int len, void *info)
292+
static int _recv(netdev2_t *netdev, void *buf, size_t len, void *info)
293293
{
294294
cc2538_rf_t *dev = (cc2538_rf_t *) netdev;
295295
size_t pkt_len;

cpu/native/netdev2_tap/netdev2_tap.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ netdev2_tap_t netdev2_tap;
6767

6868
/* netdev2 interface */
6969
static int _init(netdev2_t *netdev);
70-
static int _send(netdev2_t *netdev, const struct iovec *vector, int n);
71-
static int _recv(netdev2_t *netdev, char* buf, int n, void *info);
70+
static int _send(netdev2_t *netdev, const struct iovec *vector, unsigned n);
71+
static int _recv(netdev2_t *netdev, void *buf, size_t n, void *info);
7272

7373
static inline void _get_mac_addr(netdev2_t *netdev, uint8_t *dst)
7474
{
@@ -211,7 +211,7 @@ static void _continue_reading(netdev2_tap_t *dev)
211211
_native_in_syscall--;
212212
}
213213

214-
static int _recv(netdev2_t *netdev2, char *buf, int len, void *info)
214+
static int _recv(netdev2_t *netdev2, void *buf, size_t len, void *info)
215215
{
216216
netdev2_tap_t *dev = (netdev2_tap_t*)netdev2;
217217
(void)info;
@@ -284,13 +284,13 @@ static int _recv(netdev2_t *netdev2, char *buf, int len, void *info)
284284
return -1;
285285
}
286286

287-
static int _send(netdev2_t *netdev, const struct iovec *vector, int n)
287+
static int _send(netdev2_t *netdev, const struct iovec *vector, unsigned n)
288288
{
289289
netdev2_tap_t *dev = (netdev2_tap_t*)netdev;
290290
int res = _native_writev(dev->tap_fd, vector, n);
291291
#ifdef MODULE_NETSTATS_L2
292292
size_t bytes = 0;
293-
for (int i = 0; i < n; i++) {
293+
for (unsigned i = 0; i < n; i++) {
294294
bytes += vector->iov_len;
295295
vector++;
296296
}

drivers/at86rf2xx/at86rf2xx_netdev.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040

4141
#define _MAX_MHR_OVERHEAD (25)
4242

43-
static int _send(netdev2_t *netdev, const struct iovec *vector, int count);
44-
static int _recv(netdev2_t *netdev, char *buf, int len, void *info);
43+
static int _send(netdev2_t *netdev, const struct iovec *vector, unsigned count);
44+
static int _recv(netdev2_t *netdev, void *buf, size_t len, void *info);
4545
static int _init(netdev2_t *netdev);
4646
static void _isr(netdev2_t *netdev);
4747
static int _get(netdev2_t *netdev, netopt_t opt, void *val, size_t max_len);
@@ -97,7 +97,7 @@ static int _init(netdev2_t *netdev)
9797
return 0;
9898
}
9999

100-
static int _send(netdev2_t *netdev, const struct iovec *vector, int count)
100+
static int _send(netdev2_t *netdev, const struct iovec *vector, unsigned count)
101101
{
102102
at86rf2xx_t *dev = (at86rf2xx_t *)netdev;
103103
const struct iovec *ptr = vector;
@@ -106,7 +106,7 @@ static int _send(netdev2_t *netdev, const struct iovec *vector, int count)
106106
at86rf2xx_tx_prepare(dev);
107107

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

130-
static int _recv(netdev2_t *netdev, char *buf, int len, void *info)
130+
static int _recv(netdev2_t *netdev, void *buf, size_t len, void *info)
131131
{
132132
at86rf2xx_t *dev = (at86rf2xx_t *)netdev;
133133
uint8_t phr;

drivers/cc110x/cc110x-netdev2.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#define ENABLE_DEBUG (0)
3838
#include "debug.h"
3939

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

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

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

drivers/cc2420/cc2420.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ bool cc2420_cca(cc2420_t *dev)
143143
return gpio_read(dev->params.pin_cca);
144144
}
145145

146-
size_t cc2420_send(cc2420_t *dev, const struct iovec *data, int count)
146+
size_t cc2420_send(cc2420_t *dev, const struct iovec *data, unsigned count)
147147
{
148148
size_t n = cc2420_tx_prepare(dev, data, count);
149149

@@ -154,15 +154,15 @@ size_t cc2420_send(cc2420_t *dev, const struct iovec *data, int count)
154154
return n;
155155
}
156156

157-
size_t cc2420_tx_prepare(cc2420_t *dev, const struct iovec *data, int count)
157+
size_t cc2420_tx_prepare(cc2420_t *dev, const struct iovec *data, unsigned count)
158158
{
159159
size_t pkt_len = 2; /* include the FCS (frame check sequence) */
160160

161161
/* wait for any ongoing transmissions to be finished */
162162
while (cc2420_get_state(dev) & NETOPT_STATE_TX) {}
163163

164164
/* get and check the length of the packet */
165-
for (int i = 0; i < count; i++) {
165+
for (unsigned i = 0; i < count; i++) {
166166
pkt_len += data[i].iov_len;
167167
}
168168
if (pkt_len >= CC2420_PKT_MAXLEN) {

drivers/cc2420/cc2420_netdev.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
#include "debug.h"
4040

4141

42-
static int _send(netdev2_t *netdev, const struct iovec *vector, int count);
43-
static int _recv(netdev2_t *netdev, char *buf, int len, void *info);
42+
static int _send(netdev2_t *netdev, const struct iovec *vector, unsigned count);
43+
static int _recv(netdev2_t *netdev, void *buf, size_t len, void *info);
4444
static int _init(netdev2_t *netdev);
4545
static void _isr(netdev2_t *netdev);
4646
static int _get(netdev2_t *netdev, netopt_t opt, void *val, size_t max_len);
@@ -151,16 +151,16 @@ static void _isr(netdev2_t *netdev)
151151
netdev->event_callback(netdev, NETDEV2_EVENT_RX_COMPLETE);
152152
}
153153

154-
static int _send(netdev2_t *netdev, const struct iovec *vector, int count)
154+
static int _send(netdev2_t *netdev, const struct iovec *vector, unsigned count)
155155
{
156156
cc2420_t *dev = (cc2420_t *)netdev;
157157
return (int)cc2420_send(dev, vector, count);
158158
}
159159

160-
static int _recv(netdev2_t *netdev, char *buf, int len, void *info)
160+
static int _recv(netdev2_t *netdev, void *buf, size_t len, void *info)
161161
{
162162
cc2420_t *dev = (cc2420_t *)netdev;
163-
return (int)cc2420_rx(dev, (uint8_t *)buf, len, info);
163+
return (int)cc2420_rx(dev, buf, len, info);
164164
}
165165

166166
static int _get(netdev2_t *netdev, netopt_t opt, void *val, size_t max_len)

drivers/enc28j60/enc28j60.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ static void on_int(void *arg)
219219
netdev->event_callback(arg, NETDEV2_EVENT_ISR);
220220
}
221221

222-
static int nd_send(netdev2_t *netdev, const struct iovec *data, int count)
222+
static int nd_send(netdev2_t *netdev, const struct iovec *data, unsigned count)
223223
{
224224
enc28j60_t *dev = (enc28j60_t *)netdev;
225225
uint8_t ctrl = 0;
@@ -248,7 +248,7 @@ static int nd_send(netdev2_t *netdev, const struct iovec *data, int count)
248248
return c;
249249
}
250250

251-
static int nd_recv(netdev2_t *netdev, char *buf, int max_len, void *info)
251+
static int nd_recv(netdev2_t *netdev, void *buf, size_t max_len, void *info)
252252
{
253253
enc28j60_t *dev = (enc28j60_t *)netdev;
254254
uint8_t head[6];

drivers/encx24j600/encx24j600.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ static inline int _packets_available(encx24j600_t *dev);
5959
static void _get_mac_addr(netdev2_t *dev, uint8_t* buf);
6060

6161
/* netdev2 interface */
62-
static int _send(netdev2_t *netdev, const struct iovec *vector, int count);
63-
static int _recv(netdev2_t *netdev, char* buf, int len, void *info);
62+
static int _send(netdev2_t *netdev, const struct iovec *vector, unsigned count);
63+
static int _recv(netdev2_t *netdev, void *buf, size_t len, void *info);
6464
static int _init(netdev2_t *dev);
6565
static void _isr(netdev2_t *dev);
6666
static int _get(netdev2_t *dev, netopt_t opt, void *value, size_t max_len);
@@ -303,7 +303,7 @@ static int _init(netdev2_t *encdev)
303303
return 0;
304304
}
305305

306-
static int _send(netdev2_t *netdev, const struct iovec *vector, int count) {
306+
static int _send(netdev2_t *netdev, const struct iovec *vector, unsigned count) {
307307
encx24j600_t * dev = (encx24j600_t *) netdev;
308308
lock(dev);
309309

@@ -358,7 +358,7 @@ static void _get_mac_addr(netdev2_t *encdev, uint8_t* buf)
358358
unlock(dev);
359359
}
360360

361-
static int _recv(netdev2_t *netdev, char* buf, int len, void *info)
361+
static int _recv(netdev2_t *netdev, void *buf, size_t len, void *info)
362362
{
363363
encx24j600_t * dev = (encx24j600_t *) netdev;
364364
encx24j600_frame_hdr_t hdr;

drivers/ethos/ethos.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ void ethos_send_frame(ethos_t *dev, const uint8_t *data, size_t len, unsigned fr
254254
}
255255
}
256256

257-
static int _send(netdev2_t *netdev, const struct iovec *vector, int count)
257+
static int _send(netdev2_t *netdev, const struct iovec *vector, unsigned count)
258258
{
259259
ethos_t * dev = (ethos_t *) netdev;
260260
(void)dev;
@@ -292,7 +292,7 @@ static void _get_mac_addr(netdev2_t *encdev, uint8_t* buf)
292292
memcpy(buf, dev->mac_addr, 6);
293293
}
294294

295-
static int _recv(netdev2_t *netdev, char* buf, int len, void* info)
295+
static int _recv(netdev2_t *netdev, void *buf, size_t len, void* info)
296296
{
297297
(void) info;
298298
ethos_t * dev = (ethos_t *) netdev;
@@ -303,15 +303,15 @@ static int _recv(netdev2_t *netdev, char* buf, int len, void* info)
303303
return -1;
304304
}
305305

306-
len = (int)dev->last_framesize;
306+
len = dev->last_framesize;
307307
dev->last_framesize = 0;
308308

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

314-
return len;
314+
return (int)len;
315315
}
316316
else {
317317
return dev->last_framesize;

drivers/include/cc2420.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ netopt_state_t cc2420_get_state(cc2420_t *dev);
281281
* @return number of bytes that were actually send
282282
* @return 0 on error
283283
*/
284-
size_t cc2420_send(cc2420_t *dev, const struct iovec *data, int count);
284+
size_t cc2420_send(cc2420_t *dev, const struct iovec *data, unsigned count);
285285

286286
/**
287287
* @brief Prepare for sending of data
@@ -293,7 +293,7 @@ size_t cc2420_send(cc2420_t *dev, const struct iovec *data, int count);
293293
* @param[in] data data to prepare (must include IEEE802.15.4 header)
294294
* @param[in] count length of @p data
295295
*/
296-
size_t cc2420_tx_prepare(cc2420_t *dev, const struct iovec *data, int count);
296+
size_t cc2420_tx_prepare(cc2420_t *dev, const struct iovec *data, unsigned count);
297297

298298
/**
299299
* @brief Trigger sending of data previously loaded into transmit buffer

0 commit comments

Comments
 (0)