Changes between Version 13 and Version 14 of nic_driver


Ignore:
Timestamp:
Nov 11, 2014, 9:57:00 AM (10 years ago)
Author:
alain
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • nic_driver

    v13 v14  
    55The [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.
    66
    7 This component is a multi-channels, giga-bit Ethernet network controller. It is an ''external'', non replicated peripheral.
     7This 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)
     8are defined by the NB_NIC_CHANNELS parameter in the ''hard_config.h'' file.
     9For a given channel index, the NIC_TX channel, and the NIC_RX channel use the same MAC address.
    810
    9  * The ''_nic_sync_send()'' and ''_nic_sync_receive()'' functions use a ''physical_memcpy()''  to transfer data between a user buffer (one 4 Kbytes container) and the NIC internal chained buffer. They are blocking until completion of the transfer. One NIC channel must be allocated to the calling task in the mapping.
    10  
    11  * The ''_nic_cma_start_send()'' and ''_nic_cma_start_receive()'' functions use the ''vci_chbuf_dma'' component to transfer a flow of packets between a chained buffer in kernel space and the NIC internal chained buffer. They are non blocking. One NIC channel and two CMA channels (TX  and RX) must be allocated to the calling task in the mapping.
    12 
    13 All these access functions return -1 in case of error (illegal arguments).
    14 
    15 The SEG_NIC_BASE address and the NB_NIC_CHANNELS parameter must be defined in the hard_config.h file.
     11The SEG_NIC_BASE address must be defined in the hard_config.h file.
    1612
    1713The addressable registers map is defined [source:soft/giet_vm/giet_drivers/nic_driver.h here].
    1814
    19 == __Initialization Functions__ ==
     15== __Access Functions__ ==
    2016
    2117 === int '''_nic_global_init'''( unsigned int channels, unsigned int vis, unsigned int bc_enable, unsigned int bypass_enable ) ===
    22 This function initializes the NIC global registers.
     18This function initializes the global registers.
    2319 * '''channels''' : number of active channels
    2420 * '''vis''' : bit vector(one bit per active channel)
     
    2723This function is used only by the boot code, and return always 0.
    2824
    29  === int '''_nic_channel_init'''( unsigned int index,  unsigned int mac4,  unsigned int mac2 ) ===
    30 This function initializes the NIC registers for a given channel.
    31  * '''index''' : channel index
     25 === int '''_nic_channel_start'''( unsigned int channel,  unsigned int mac4,  unsigned int mac2 ) ===
     26This function activates a NIC_TX or NIC_RX channel:
     27 * '''channel''' : channel index
     28 * '''is_rx''' : boolean (RX type if non zero).
    3229 * '''mac4''' : 32 LSB bits of the MAC address.
    3330 * '''mac2''' : 16 MSB bits of the MAC address.
    34 This function is used only by the boot code, and return always 0.
     31It returns always 0.
    3532
    36 == __Blocking functions using a physical_memcpy__ ==
    37 
    38  === int '''_nic_sync_send'''( unsigned int channel,  unsigned long long user_paddr ) ===
    39 This blocking function uses a physical_memcpy() to transfer one container (4 Kbytes) from a single user buffer to the NIC channel allocated to the calling task.
    40  * '''channel''' : NIC channel index
    41  * '''user_paddr''':  user buffer physical base address
    42 Return 0 in case of success. Return -1 if buffer not mapped or not user accessible.
    43 
    44  === int '''_nic_sync_receive'''( unsigned int channel,  unsigned long long user_paddr ) ===
    45 This blocking function uses a physical_memcpy() to transfer one container (4 Kbytes) from the NIC channel allocated to the calling task, to a single user buffer.
    46  * '''channel''' : NIC channel index
    47  * '''user_paddr''':  user buffer physical base address
    48 Return 0 in case of success. Return -1 if buffer not mapped or not user accessible.
    49 
    50 == __Non blocking functions using the chained buffer DMA__ ==
    51 
    52  === int '''_nic_cma_send'''( unsigned int nic_channel,  unsigned int cma_channel,  chbuf_descriptor_t* chbuf ) ===
    53  This non blocking funtion starts a CMA channel to transfer a flow of containers from a NIC_RX chbuf to a kernel chbuf.
    54  * '''nic_channel''' : NIC_RX channel index
    55  * '''cma_channel''' : CMA channel index
    56  * '''chbuf'''       : pointer on chbuf in kernel memory
    57  The NIC channel is supposed to be already initialized.
    58 
    59 Return 0 in case of success. Return -1 if NIC or CMA channel index too large.
    60 
    61 === int '''_nic_cma_receive'''(  unsigned int nic_channel,  unsigned int cma_channel,  chbuf_descriptor_t* chbuf ) ===
    62 This non blocking funtion starts a CMA channel to transfer a flow of containers from a NIC_RX chbuf to a kernel chbuf.
    63  * '''nic_channel''' : NIC_RX channel index
    64  * '''cma_channel''' : CMA channel index
    65  * '''chbuf'''       : pointer on chbuf in kernel memory
    66 The NIC channel is supposed to be already initialized.
    67 
    68 Return 0 in case of success. Return -1 if NIC or CMA channel index too large.
     33=== int '''_nic_channel_stop'''( unsigned int channel, unsigned int is_rx ) ===
     34This function desactivates a NIC_TX or NIC_RX channel.
     35It returns always 0.
    6936
    7037== __ Interrupt Service Routines__ ==