Changeset 437 for soft/giet_vm/giet_drivers/nic_driver.h
- Timestamp:
- Nov 3, 2014, 10:53:00 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_drivers/nic_driver.h
r295 r437 5 5 // Copyright (c) UPMC-LIP6 6 6 /////////////////////////////////////////////////////////////////////////////////// 7 // The nic_driver.c and nic_driver.h files are part ot the GIET-VM nano-kernel. 8 // This driver supports the vci_multi_nic component. 9 // 10 // It can exist only one network controller in the architecture, but this 11 // component supports several channels. 12 // 13 // It can be accessed directly by software with memcpy(), 14 // or it can be accessed through the vci_chbuf_dma component: 15 // 16 // The '_nic_sync_write' and '_nic_sync_read' functions use a memcpy strategy to 17 // implement the transfer between a data buffer (user space) and the NIC 18 // buffer (kernel space). They are blocking until completion of the transfer. 19 // 20 // The _nic_cma_start() and _nic_cma_stop() functions use the VciChbufDma component 21 // to transfer a flow of packets from the NIC RX hard chbuf (two containers) 22 // to an user RX chbuf (two containers), and to transfer another flow of packets 23 // from an user TX chbuf (two containers) to the NIC TX chbuf (two containers). 24 // One NIC channel and two CMA channels must be allocated to the task 25 // in the mapping_info data structure. 26 // 27 // All these access functions return -1 in case of error. 28 // 29 // The SEG_NIC_BASE address must be defined in the hard_config.h file. 30 ////////////////////////////////////////////////////////////////////////////////// 7 31 8 32 #ifndef _GIET_NIC_DRIVERS_H_ 9 33 #define _GIET_NIC_DRIVERS_H_ 10 34 35 #include <giet_config.h> 36 11 37 /////////////////////////////////////////////////////////////////////////////////// 12 // NIC Registers (vci_multi_nic)38 // Global Addressable Registers 13 39 /////////////////////////////////////////////////////////////////////////////////// 14 40 … … 50 76 }; 51 77 52 ///////////////////////////////////////////////////////////////////// 78 ///////////////////////////////////////////////////////////////////////////////////// 79 // Channel Addressable Registers 53 80 // A container descriptor has the following form: 54 // LOW WORD : Container LSB base address 55 // HIGH WORD: Container status (leftmost bit), '1' means full 56 // Base address MSB extension, if needed (right aligned) 57 ////////////////////////////////////////////////////////////////////// 81 // LOW WORD : 32 LSB bits of the container physical base address 82 // HIGH WORD : 16 MSB bits of the container physical base address + status (bit 31) 83 ///////////////////////////////////////////////////////////////////////////////////// 58 84 enum SoclibMultiNicChannelRegisters 59 85 { … … 72 98 }; 73 99 100 101 //////////////////////////////////////////////////////////////////////////////////// 102 // Chained Buffer Descriptor Structure 103 //////////////////////////////////////////////////////////////////////////////////// 104 typedef struct nic_chbuf_s 105 { 106 unsigned long long buf[GIET_CHBUF_NBUFS]; // array of buffer descriptors 107 unsigned int buf_length; // buffer length (bytes) 108 unsigned int nb_buffers; // actual number of buffers 109 } nic_chbuf_t; 110 74 111 /////////////////////////////////////////////////////////////////////////////////// 75 // NIC device access functions (vci_multi_nic)112 // Initialization functions 76 113 /////////////////////////////////////////////////////////////////////////////////// 77 114 78 extern unsigned int _nic_sync_write( const void* buffer, 79 unsigned int length ); 115 extern int _nic_global_init( unsigned int channels, 116 unsigned int vis, 117 unsigned int bc_enable, 118 unsigned int bypass_enable ); 80 119 81 extern unsigned int _nic_sync_read( const void* buffer, 82 unsigned int length ); 120 extern int _nic_channel_init( unsigned int index, 121 unsigned int mac4, 122 unsigned int mac2 ); 83 123 84 extern unsigned int _nic_cma_start(); 124 /////////////////////////////////////////////////////////////////////////////////// 125 // Blocking functions using a physical_memcpy() 126 /////////////////////////////////////////////////////////////////////////////////// 85 127 86 extern unsigned int _nic_cma_stop(); 128 extern int _nic_sync_receive( unsigned int channel, 129 unsigned long long user_paddr ); 130 131 extern int _nic_sync_send( unsigned int channel, 132 unsigned long long user_paddr ); 133 134 /////////////////////////////////////////////////////////////////////////////////// 135 // Non blocking functions using the chained buffer DMA 136 /////////////////////////////////////////////////////////////////////////////////// 137 138 extern int _nic_cma_receive( unsigned int nic_channel, 139 unsigned int cma_channel, 140 nic_chbuf_t* kernel_chbuf ); 141 142 extern int _nic_cma_send( unsigned int nic_channel, 143 unsigned int cma_channel, 144 nic_chbuf_t* kernel_chbuf ); 145 146 /////////////////////////////////////////////////////////////////////////////////// 147 // Interrupt Service Routines 148 /////////////////////////////////////////////////////////////////////////////////// 87 149 88 150 extern void _nic_rx_isr( unsigned int irq_type, … … 94 156 unsigned int channel ); 95 157 96 ///////////////////////////////////////////////////////////////////////////////////97 158 98 159
Note: See TracChangeset
for help on using the changeset viewer.