1 | /////////////////////////////////////////////////////////////////////////////////// |
---|
2 | // File : nic_driver.h |
---|
3 | // Date : 01/11/2013 |
---|
4 | // Author : alain greiner |
---|
5 | // Copyright (c) UPMC-LIP6 |
---|
6 | /////////////////////////////////////////////////////////////////////////////////// |
---|
7 | |
---|
8 | #ifndef _GIET_NIC_DRIVERS_H_ |
---|
9 | #define _GIET_NIC_DRIVERS_H_ |
---|
10 | |
---|
11 | /////////////////////////////////////////////////////////////////////////////////// |
---|
12 | // NIC Registers (vci_multi_nic) |
---|
13 | /////////////////////////////////////////////////////////////////////////////////// |
---|
14 | |
---|
15 | enum SoclibMultiNicHyperviseurRegisters { |
---|
16 | NIC_G_VIS = 0, // bitfield : bit N = 0 -> channel N disabled |
---|
17 | NIC_G_ON = 1, // boolean : NIC component activated |
---|
18 | NIC_G_NB_CHAN = 2, // Number of channels present in this NIC (read only) |
---|
19 | NIC_G_BC_ENABLE = 3, // boolean : Enable Broadcast if non zero |
---|
20 | NIC_G_TDM_ENABLE = 4, // boolean : TDM Scheduler if non zero |
---|
21 | NIC_G_TDM_PERIOD = 5, // TDM time slot value |
---|
22 | NIC_G_BYPASS_ENABLE = 6, // boolean : Enable bypass for TX packets |
---|
23 | // alignment |
---|
24 | NIC_G_MAC_4 = 8, // channel mac address 32 LSB bits array[8] |
---|
25 | NIC_G_MAC_2 = 16, // channel mac address 16 MSB bits array[8] |
---|
26 | // alignment |
---|
27 | NIC_G_NPKT_RX_G2S_RECEIVED = 32, // number of packets received on GMII RX port |
---|
28 | NIC_G_NPKT_RX_G2S_DISCARDED = 33, // number of RX packets discarded by RX_G2S FSM |
---|
29 | |
---|
30 | NIC_G_NPKT_RX_DES_SUCCESS = 34, // number of RX packets transmited by RX_DES FSM |
---|
31 | NIC_G_NPKT_RX_DES_TOO_SMALL = 35, // number of discarded too small RX packets (<60B) |
---|
32 | NIC_G_NPKT_RX_DES_TOO_BIG = 36, // number of discarded too big RX packets (>1514B) |
---|
33 | NIC_G_NPKT_RX_DES_MFIFO_FULL = 37, // number of discarded RX packets because fifo full |
---|
34 | NIC_G_NPKT_RX_DES_CRC_FAIL = 38, // number of discarded RX packets because CRC32 failure |
---|
35 | |
---|
36 | NIC_G_NPKT_RX_DISPATCH_RECEIVED = 39, // number of packets received by RX_DISPATCH FSM |
---|
37 | NIC_G_NPKT_RX_DISPATCH_BROADCAST = 40, // number of broadcast RX packets received |
---|
38 | NIC_G_NPKT_RX_DISPATCH_DST_FAIL = 41, // number of discarded RX packets for DST MAC not found |
---|
39 | NIC_G_NPKT_RX_DISPATCH_CH_FULL = 42, // number of discarded RX packets for channel full |
---|
40 | |
---|
41 | NIC_G_NPKT_TX_DISPATCH_RECEIVED = 43, // number of packets received by TX_DISPATCH FSM |
---|
42 | NIC_G_NPKT_TX_DISPATCH_TOO_SMALL = 44, // number of discarded too small TX packets (<60B) |
---|
43 | NIC_G_NPKT_TX_DISPATCH_TOO_BIG = 45, // number of discarded too big TX packets (>1514B) |
---|
44 | NIC_G_NPKT_TX_DISPATCH_SRC_FAIL = 46, // number of discarded TX packets for SRC MAC failed |
---|
45 | NIC_G_NPKT_TX_DISPATCH_BROADCAST = 47, // number of broadcast TX packets received |
---|
46 | NIC_G_NPKT_TX_DISPATCH_BYPASS = 48, // number of bypassed TX->RX packets |
---|
47 | NIC_G_NPKT_TX_DISPATCH_TRANSMIT = 49, // number of transmit TX packets |
---|
48 | |
---|
49 | NIC_CHANNEL_SPAN = 0x2000, |
---|
50 | }; |
---|
51 | |
---|
52 | ///////////////////////////////////////////////////////////////////// |
---|
53 | // 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 | ////////////////////////////////////////////////////////////////////// |
---|
58 | enum SoclibMultiNicChannelRegisters |
---|
59 | { |
---|
60 | NIC_RX_DESC_LO_0 = 0, // RX_0 descriptor low word (Read/Write) |
---|
61 | NIC_RX_DESC_HI_0 = 1, // RX_0 descriptor high word (Read/Write) |
---|
62 | NIC_RX_DESC_LO_1 = 2, // RX_1 descriptor low word (Read/Write) |
---|
63 | NIC_RX_DESC_HI_1 = 3, // RX_1 descriptor high word (Read/Write) |
---|
64 | NIC_TX_DESC_LO_0 = 4, // TX_0 descriptor low word (Read/Write) |
---|
65 | NIC_TX_DESC_HI_0 = 5, // TX_0 descriptor high word (Read/Write) |
---|
66 | NIC_TX_DESC_LO_1 = 6, // TX_1 descriptor low word (Read/Write) |
---|
67 | NIC_TX_DESC_HI_1 = 7, // TX_1 descriptor high word (Read/Write) |
---|
68 | NIC_MAC_4 = 8, // channel mac address 32 LSB bits (Read Only) |
---|
69 | NIC_MAC_2 = 9, // channel mac address 16 LSB bits (Read Only) |
---|
70 | NIC_RX_RUN = 10, // RX packets can be received (write_only) |
---|
71 | NIC_TX_RUN = 11, // TX packets can be transmitted (write_only) |
---|
72 | }; |
---|
73 | |
---|
74 | /////////////////////////////////////////////////////////////////////////////////// |
---|
75 | // NIC device access functions (vci_multi_nic) |
---|
76 | /////////////////////////////////////////////////////////////////////////////////// |
---|
77 | |
---|
78 | extern unsigned int _nic_sync_write( const void* buffer, |
---|
79 | unsigned int length ); |
---|
80 | |
---|
81 | extern unsigned int _nic_sync_read( const void* buffer, |
---|
82 | unsigned int length ); |
---|
83 | |
---|
84 | extern unsigned int _nic_cma_start(); |
---|
85 | |
---|
86 | extern unsigned int _nic_cma_stop(); |
---|
87 | |
---|
88 | extern void _nic_rx_isr( unsigned int irq_type, |
---|
89 | unsigned int irq_id, |
---|
90 | unsigned int channel ); |
---|
91 | |
---|
92 | extern void _nic_tx_isr( unsigned int irq_type, |
---|
93 | unsigned int irq_id, |
---|
94 | unsigned int channel ); |
---|
95 | |
---|
96 | /////////////////////////////////////////////////////////////////////////////////// |
---|
97 | |
---|
98 | |
---|
99 | #endif |
---|
100 | |
---|
101 | // Local Variables: |
---|
102 | // tab-width: 4 |
---|
103 | // c-basic-offset: 4 |
---|
104 | // c-file-offsets:((innamespace . 0)(inline-open . 0)) |
---|
105 | // indent-tabs-mode: nil |
---|
106 | // End: |
---|
107 | // vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 |
---|
108 | |
---|