wiki:nic_driver

Version 14 (modified by alain, 10 years ago) (diff)

--

GIET-VM / NIC Driver

The nic_driver.c and nic_driver.h files define the NIC driver.

This component is a multi-channels, giga-bit Ethernet network controller. It is an external, non replicated peripheral. The number of NIC_RX channels (packet receive) and the number of NIC_TX channels (packet send) are defined by the NB_NIC_CHANNELS parameter in the hard_config.h file. For a given channel index, the NIC_TX channel, and the NIC_RX channel use the same MAC address.

The SEG_NIC_BASE address must be defined in the hard_config.h file.

The addressable registers map is defined here.

Access Functions

int _nic_global_init( unsigned int channels, unsigned int vis, unsigned int bc_enable, unsigned int bypass_enable )

This function initializes the global registers.

  • channels : number of active channels
  • vis : bit vector(one bit per active channel)
  • bc_enable : broadcast packets accepted if non zero
  • bypass_enable : TX -> RX bypass supported if non zero

This function is used only by the boot code, and return always 0.

int _nic_channel_start( unsigned int channel, unsigned int mac4, unsigned int mac2 )

This function activates a NIC_TX or NIC_RX channel:

  • channel : channel index
  • is_rx : boolean (RX type if non zero).
  • mac4 : 32 LSB bits of the MAC address.
  • mac2 : 16 MSB bits of the MAC address.

It returns always 0.

int _nic_channel_stop( unsigned int channel, unsigned int is_rx )

This function desactivates a NIC_TX or NIC_RX channel. It returns always 0.

Interrupt Service Routines

void _nic_rx_isr( unsigned int irq_type, unsigned int irq_id, unsigned int channel )

This interrupt Service Routine handles IRQs from a NIC_RX channel. WARNING : Not fully implemented yet : no IRQ acknowledge...

void _nic_tx_isr( unsigned int irq_type, unsigned int irq_id, unsigned int channel )

This interrupt Service Routine handles IRQs from a NIC_TX channel. WARNING : Not fully implemented yet : no IRQ acknowledge...