mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
native/drivers/sys: adapt ethernet netdev2 for info struct
This commit is contained in:
parent
dad883c745
commit
8db42427cb
@ -71,7 +71,7 @@ static void _sigio_child(netdev2_tap_t *dev);
|
||||
/* 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);
|
||||
static int _recv(netdev2_t *netdev, char* buf, int n, void *info);
|
||||
|
||||
static inline void _get_mac_addr(netdev2_t *netdev, uint8_t *dst)
|
||||
{
|
||||
@ -187,9 +187,10 @@ static inline bool _is_addr_multicast(uint8_t *addr)
|
||||
return (addr[0] & 0x01);
|
||||
}
|
||||
|
||||
static int _recv(netdev2_t *netdev2, char *buf, int len)
|
||||
static int _recv(netdev2_t *netdev2, char *buf, int len, void *info)
|
||||
{
|
||||
netdev2_tap_t *dev = (netdev2_tap_t*)netdev2;
|
||||
(void)info;
|
||||
|
||||
if (!buf) {
|
||||
/* no way of figuring out packet size without racey buffering,
|
||||
|
@ -243,13 +243,14 @@ 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)
|
||||
static int nd_recv(netdev2_t *netdev, char *buf, int max_len, void *info)
|
||||
{
|
||||
enc28j60_t *dev = (enc28j60_t *)netdev;
|
||||
uint8_t head[6];
|
||||
size_t size;
|
||||
uint16_t next;
|
||||
|
||||
(void)info;
|
||||
mutex_lock(&dev->devlock);
|
||||
|
||||
/* set read pointer to RX read address */
|
||||
|
@ -60,7 +60,7 @@ 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);
|
||||
static int _recv(netdev2_t *netdev, char* buf, int 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);
|
||||
@ -352,11 +352,12 @@ static void _get_mac_addr(netdev2_t *encdev, uint8_t* buf)
|
||||
unlock(dev);
|
||||
}
|
||||
|
||||
static int _recv(netdev2_t *netdev, char* buf, int len)
|
||||
static int _recv(netdev2_t *netdev, char* buf, int len, void *info)
|
||||
{
|
||||
encx24j600_t * dev = (encx24j600_t *) netdev;
|
||||
encx24j600_frame_hdr_t hdr;
|
||||
|
||||
(void)info;
|
||||
lock(dev);
|
||||
|
||||
/* read frame header */
|
||||
|
@ -32,7 +32,7 @@
|
||||
static gnrc_pktsnip_t *_recv(gnrc_netdev2_t *gnrc_netdev2)
|
||||
{
|
||||
netdev2_t *dev = gnrc_netdev2->dev;
|
||||
int bytes_expected = dev->driver->recv(dev, NULL, 0);
|
||||
int bytes_expected = dev->driver->recv(dev, NULL, 0, NULL);
|
||||
gnrc_pktsnip_t *pkt = NULL;
|
||||
|
||||
if (bytes_expected) {
|
||||
@ -45,7 +45,7 @@ static gnrc_pktsnip_t *_recv(gnrc_netdev2_t *gnrc_netdev2)
|
||||
goto out;
|
||||
}
|
||||
|
||||
int nread = dev->driver->recv(dev, pkt->data, bytes_expected);
|
||||
int nread = dev->driver->recv(dev, pkt->data, bytes_expected, NULL);
|
||||
if(nread <= 0) {
|
||||
DEBUG("_recv_ethernet_packet: read error.\n");
|
||||
goto safe_out;
|
||||
|
Loading…
Reference in New Issue
Block a user