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 */
|
/* netdev2 interface */
|
||||||
static int _init(netdev2_t *netdev);
|
static int _init(netdev2_t *netdev);
|
||||||
static int _send(netdev2_t *netdev, const struct iovec *vector, int n);
|
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)
|
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);
|
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;
|
netdev2_tap_t *dev = (netdev2_tap_t*)netdev2;
|
||||||
|
(void)info;
|
||||||
|
|
||||||
if (!buf) {
|
if (!buf) {
|
||||||
/* no way of figuring out packet size without racey buffering,
|
/* 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;
|
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;
|
enc28j60_t *dev = (enc28j60_t *)netdev;
|
||||||
uint8_t head[6];
|
uint8_t head[6];
|
||||||
size_t size;
|
size_t size;
|
||||||
uint16_t next;
|
uint16_t next;
|
||||||
|
|
||||||
|
(void)info;
|
||||||
mutex_lock(&dev->devlock);
|
mutex_lock(&dev->devlock);
|
||||||
|
|
||||||
/* set read pointer to RX read address */
|
/* set read pointer to RX read address */
|
||||||
|
|||||||
@ -60,7 +60,7 @@ static void _get_mac_addr(netdev2_t *dev, uint8_t* buf);
|
|||||||
|
|
||||||
/* netdev2 interface */
|
/* netdev2 interface */
|
||||||
static int _send(netdev2_t *netdev, const struct iovec *vector, int count);
|
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 int _init(netdev2_t *dev);
|
||||||
static void _isr(netdev2_t *dev);
|
static void _isr(netdev2_t *dev);
|
||||||
int _get(netdev2_t *dev, netopt_t opt, void *value, size_t max_len);
|
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);
|
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_t * dev = (encx24j600_t *) netdev;
|
||||||
encx24j600_frame_hdr_t hdr;
|
encx24j600_frame_hdr_t hdr;
|
||||||
|
|
||||||
|
(void)info;
|
||||||
lock(dev);
|
lock(dev);
|
||||||
|
|
||||||
/* read frame header */
|
/* read frame header */
|
||||||
|
|||||||
@ -32,7 +32,7 @@
|
|||||||
static gnrc_pktsnip_t *_recv(gnrc_netdev2_t *gnrc_netdev2)
|
static gnrc_pktsnip_t *_recv(gnrc_netdev2_t *gnrc_netdev2)
|
||||||
{
|
{
|
||||||
netdev2_t *dev = gnrc_netdev2->dev;
|
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;
|
gnrc_pktsnip_t *pkt = NULL;
|
||||||
|
|
||||||
if (bytes_expected) {
|
if (bytes_expected) {
|
||||||
@ -45,7 +45,7 @@ static gnrc_pktsnip_t *_recv(gnrc_netdev2_t *gnrc_netdev2)
|
|||||||
goto out;
|
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) {
|
if(nread <= 0) {
|
||||||
DEBUG("_recv_ethernet_packet: read error.\n");
|
DEBUG("_recv_ethernet_packet: read error.\n");
|
||||||
goto safe_out;
|
goto safe_out;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user