The friendly Operating System for the Internet of Things
Network Device Driver API

This is the second version of a generic low-level network driver interface. More...

Detailed Description

This interface is supposed to be a low-level interface for network drivers.

Example call flow:

  1. packet arrives for device
  2. The driver previously registered an ISR for handling received packets. This ISR then calls netdev->event_callback() with event := NETDEV_EVENT_ISR (from Interrupt Service Routine) which wakes up event handler
  3. event handler calls netdev->driver->isr() (from thread context)
  4. netdev->driver->isr() calls netdev->event_callback() with event := NETDEV_EVENT_RX_COMPLETE
  5. netdev->event_callback() uses netdev->driver->recv() to fetch packet
riot-netdev-rx.svg
RX event example

Files

file  drivers/include/net/netdev/eth.h
 Definitions for netdev common ethernet code.
 
file  drivers/include/net/netdev/ieee802154.h
 Definitions for netdev common IEEE 802.15.4 code.
 
file  drivers/include/net/netdev.h
 Definitions low-level network driver interface.
 

Data Structures

struct  netdev_radio_rx_info
 Received packet status information for most radios. More...
 
struct  netdev
 Structure to hold driver state. More...
 
struct  netdev_driver
 Structure to hold driver interface -> function mapping. More...
 

Typedefs

typedef struct netdev netdev_t
 Forward declaration for netdev struct.
 
typedef void(* netdev_event_cb_t) (netdev_t *dev, netdev_event_t event)
 Event callback for signaling event to upper layers. More...
 
typedef struct netdev_driver netdev_driver_t
 Structure to hold driver interface -> function mapping. More...
 

Enumerations

enum  {
  NETDEV_TYPE_UNKNOWN, NETDEV_TYPE_RAW, NETDEV_TYPE_ETHERNET, NETDEV_TYPE_IEEE802154,
  NETDEV_TYPE_CC110X, NETDEV_TYPE_NRFMIN
}
 
enum  netdev_event_t {
  NETDEV_EVENT_ISR, NETDEV_EVENT_RX_STARTED, NETDEV_EVENT_RX_COMPLETE, NETDEV_EVENT_TX_STARTED,
  NETDEV_EVENT_TX_COMPLETE, NETDEV_EVENT_TX_NOACK, NETDEV_EVENT_TX_MEDIUM_BUSY, NETDEV_EVENT_LINK_UP,
  NETDEV_EVENT_LINK_DOWN
}
 Possible event types that are send from the device driver to the upper layer. More...
 

Typedef Documentation

The send/receive functions expect/return a full ethernet frame (dst mac, src mac, ethertype, payload, no checksum).

typedef void(* netdev_event_cb_t) (netdev_t *dev, netdev_event_t event)
Parameters
[in]typetype of the event

Definition at line 105 of file drivers/include/net/netdev.h.

Enumeration Type Documentation

Enumerator
NETDEV_EVENT_ISR 

driver needs it's ISR handled

NETDEV_EVENT_RX_STARTED 

started to receive a packet

NETDEV_EVENT_RX_COMPLETE 

finished receiving a packet

NETDEV_EVENT_TX_STARTED 

started to transfer a packet

NETDEV_EVENT_TX_COMPLETE 

finished transferring packet

NETDEV_EVENT_TX_NOACK 

ACK requested but not received.

NETDEV_EVENT_TX_MEDIUM_BUSY 

couldn't transfer packet

NETDEV_EVENT_LINK_UP 

link established

NETDEV_EVENT_LINK_DOWN 

link gone

Definition at line 72 of file drivers/include/net/netdev.h.