Nios II Classic Software Developer’s Handbook

ID 683282
Date 5/14/2015
Public
Document Table of Contents

7.7.6.3. Provide the NicheStack Hardware Interface Routines

The NicheStack TCP/IP Stack architecture requires several network hardware interface routines:
  • Initialize hardware
  • Send packet
  • Receive packet
  • Close
  • Dump statistics

    For more information about these routines, refer to "Porting Engineer Provided Functions" in the NicheStack Technical Reference Manual.

The NicheStack TCP/IP Stack system code uses the

Table 37.  SMSC LAN91C111 Hardware Interface Routines
Prototype Function LAN91C111 Function File Notes
n_init() s91_init() smsc91x.c The initialization routine can install an ISR if applicable
pkt_send() s91_pkt_send() smsc91x.c  
Packet receive mechanism s91_isr() smsc91x.c Packet receive includes three key actions:
  • pk_alloc()—Allocate a netbuf structure
  • putq()—Place netbuf structure on rcvdq
  • SignalPktDemux()—Notify the Internet protocol (IP) layer that it can demux the packet
s91_rcv() smsc91x.c
s91_dma_rx_done() smsc_mem.c
n_close() s91_close() smsc91x.c  
n_stats() s91_stats() smsc91x.c  

net structure internally to define its interface to device drivers. The net structure is defined in net.h, in <iniche path/ 31src. . Among other things, the net structure contains the following things:

  • A field for the IP address of the interface
  • A function pointer to a low-level function to initialize the MAC device
  • Function pointers to low-level functions to send packets

Typical NicheStack code refers to type NET, which is defined as *net.