= GIET-VM / NIC Driver = [[PageOutline]] The [source:soft/giet_vm/giet_drivers/nic_driver.c nic_driver.c] and [source:soft/giet_vm/giet_drivers/nic_driver.h 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 [source:soft/giet_vm/giet_drivers/nic_driver.h here]. == Access Functions == === 1) unsigned int '''_nic_get_channel_register'''( unsigned int channel, unsigned int index ) === This function returns the value contained in a channel register. * '''channel''' : channel index * '''index''' : register index === 2) void '''_nic_set_channel_register'''( unsigned int channel, unsigned int index, unsigned int value ) === This function writes a new value in a channel register. * '''channel''' : channel index * '''index''' : register index * '''value''' : written value === 3) unsigned int '''_nic_get_global_register'''( unsigned int index ) === This function returns the value contained in a global register. * '''index''' : register index === 4) void '''_nic_set_global_register'''( unsigned int index, unsigned int value ) === This function writes a new value in a global register. * '''index''' : register index * '''value''' : written value === 5) 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. === 6) 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. === 7) 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__ == === 8) 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... === 9) 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...