author | William Roberts <williamr@symbian.org> |
Thu, 08 Oct 2009 20:49:04 +0100 | |
changeset 10 | 1cf69c2c2bbd |
parent 2 | d55eb581a87c |
permissions | -rw-r--r-- |
0
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
1 |
/* |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
3 |
* All rights reserved. |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
5 |
* under the terms of the License "Eclipse Public License v1.0" |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
8 |
* |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
9 |
* Initial Contributors: |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
11 |
* |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
12 |
* Contributors: |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
13 |
* |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
14 |
* Description: Register definitions and base classes for Ethernet Virtio. |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
15 |
* |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
16 |
*/ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
17 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
18 |
#ifndef __QEMUETHERNET_ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
19 |
#define __QEMUETHERNET_ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
20 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
21 |
#include <ethernet.h> |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
22 |
#include <system.h> |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
23 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
24 |
#define SVPDBG |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
25 |
#ifdef SVPDBG |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
26 |
#define DP(format...) Kern::Printf(format) |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
27 |
#else |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
28 |
#define DP(format...) |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
29 |
#endif |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
30 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
31 |
#define ETHERNET_PAYLOAD_SIZE 1500 |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
32 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
33 |
#define VIRTIO_CONFIG_S_ACKNOWLEDGE 1 |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
34 |
#define VIRTIO_CONFIG_S_DRIVER 2 |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
35 |
#define VIRTIO_CONFIG_S_DRIVER_OK 4 |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
36 |
#define VIRTIO_CONFIG_S_FAILED 0x80 |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
37 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
38 |
/* This marks a buffer as continuing via the next field. */ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
39 |
#define VRING_DESC_F_NEXT 1 |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
40 |
/* This marks a buffer as write-only (otherwise read-only). */ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
41 |
#define VRING_DESC_F_WRITE 2 |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
42 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
43 |
#define TX_QUEUE 1 |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
44 |
#define RX_QUEUE 0 |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
45 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
46 |
#define VNET_MAC ((volatile TUint8 *)(0xc600c000 + 0x100)) |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
47 |
#define VNET ((volatile TUint32 *)0xc600c000) |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
48 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
49 |
enum { |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
50 |
VIRTIO_ID = 0, |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
51 |
VIRTIO_DEVTYPE = 1, |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
52 |
VIRTIO_HOST_FEATURES = 2, |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
53 |
VIRTIO_GUEST_FEATURES = 3, |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
54 |
VIRTIO_QUEUE_BASE = 4, |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
55 |
VIRTIO_QUEUE_NUM = 5, |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
56 |
VIRTIO_QUEUE_SEL = 6, |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
57 |
VIRTIO_QUEUE_NOTIFY = 7, |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
58 |
VIRTIO_STATUS = 8, |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
59 |
VIRTIO_INT_ENABLE = 9, |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
60 |
VIRTIO_INT_STATUS = 10 |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
61 |
}; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
62 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
63 |
typedef struct |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
64 |
{ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
65 |
#define VIRTIO_NET_HDR_F_NEEDS_CSUM 1 // Use csum_start, csum_offset |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
66 |
TUint8 flags; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
67 |
#define VIRTIO_NET_HDR_GSO_NONE 0 // Not a GSO frame |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
68 |
#define VIRTIO_NET_HDR_GSO_TCPV4 1 // GSO frame, IPv4 TCP (TSO) |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
69 |
#define VIRTIO_NET_HDR_GSO_UDP 3 // GSO frame, IPv4 UDP (UFO) |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
70 |
#define VIRTIO_NET_HDR_GSO_TCPV6 4 // GSO frame, IPv6 TCP |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
71 |
#define VIRTIO_NET_HDR_GSO_ECN 0x80 // TCP has ECN set |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
72 |
TUint8 gso_type; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
73 |
TUint16 hdr_len; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
74 |
TUint16 gso_size; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
75 |
TUint16 csum_start; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
76 |
TUint16 csum_offset; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
77 |
} virtio_net_hdr; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
78 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
79 |
typedef struct |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
80 |
{ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
81 |
TUint64 addr; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
82 |
TUint32 len; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
83 |
TUint16 flags; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
84 |
TUint16 next; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
85 |
} vring_desc; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
86 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
87 |
typedef struct |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
88 |
{ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
89 |
TUint16 flags; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
90 |
TUint16 idx; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
91 |
TUint16 ring[16]; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
92 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
93 |
} vring_avail; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
94 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
95 |
typedef struct |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
96 |
{ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
97 |
TUint16 flags; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
98 |
TUint16 idx; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
99 |
struct { |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
100 |
TUint32 id; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
101 |
TUint32 len; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
102 |
} ring[16]; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
103 |
} vring_used; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
104 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
105 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
106 |
// |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
107 |
// Class to identify the device as ethernet device for Symbian |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
108 |
// |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
109 |
class EthernetDevice : public DEthernet |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
110 |
{ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
111 |
public: |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
112 |
EthernetDevice(); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
113 |
~EthernetDevice(); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
114 |
TInt DoCreate(TInt aUnit, const TDesC8* anInfo); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
115 |
static void Isr(TAny* aPtr); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
116 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
117 |
// |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
118 |
// Functions that we must implement as we are inheriting from abstract base class |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
119 |
// |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
120 |
virtual TInt Start(); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
121 |
virtual void Stop(TStopMode aMode); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
122 |
virtual void GetConfig(TEthernetConfigV01 &aConfig) const; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
123 |
virtual TInt ValidateConfig(const TEthernetConfigV01 &aConfig) const; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
124 |
virtual void CheckConfig(TEthernetConfigV01 &aConfig); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
125 |
virtual TInt Configure(TEthernetConfigV01 &aConfig); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
126 |
virtual void MacConfigure(TEthernetConfigV01 &aConfig); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
127 |
virtual void Caps(TDes8 &aCaps) const; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
128 |
virtual TInt DisableIrqs(); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
129 |
virtual void RestoreIrqs(TInt aIrq); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
130 |
virtual TDfcQue* DfcQ(TInt aUnit); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
131 |
virtual TInt Send(TBuf8<KMaxEthernetPacket+32> &aBuffer); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
132 |
virtual TInt ReceiveFrame(TBuf8<KMaxEthernetPacket+32> &aBuffer, TBool okToUse); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
133 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
134 |
private: |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
135 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
136 |
TEthernetConfigV01 iDefaultConfig; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
137 |
TInt iInterruptId; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
138 |
TDfc iRxDfc; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
139 |
TUint32 iCreated; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
140 |
TUint32 iStarted; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
141 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
142 |
//Virtio structs for transmitting data to QEMU. |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
143 |
volatile vring_desc *iTxDesc; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
144 |
volatile vring_avail *iTxAvail; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
145 |
volatile vring_used *iTxUsed; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
146 |
//Ring size hardcoded in QEMU. |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
147 |
TUint tx_ring_size; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
148 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
149 |
//Virtio structs for receiving data from QEMU. |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
150 |
volatile vring_desc *iRxDesc; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
151 |
volatile vring_avail *iRxAvail; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
152 |
volatile vring_used *iRxUsed; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
153 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
154 |
TUint rx_ring_size; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
155 |
TUint rx_last_used; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
156 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
157 |
//Virtio packet header definitions. |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
158 |
virtio_net_hdr rx_header; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
159 |
virtio_net_hdr tx_header; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
160 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
161 |
//Buffers for Rx/Tx transmission. |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
162 |
TBuf8<KMaxEthernetPacket+32> iTxBuffer; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
163 |
TBuf8<KMaxEthernetPacket+32> iRxBuffer; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
164 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
165 |
static void RxDfc(TAny* aPtr); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
166 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
167 |
//QEMU specific member functions |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
168 |
void AllocRings(); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
169 |
void* AllocAligned(TUint16 size); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
170 |
void AddRx(); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
171 |
void SetMacAddress(void); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
172 |
}; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
173 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
174 |
#endif // __QEMUETHERNET_ |