package metaxa.os.devices.net;
import java.util.*;
import jx.zero.*;
import jx.zero.debug.*;
import jx.devices.net.NetworkDevice;
import jx.devices.pci.*;
import jx.timer.*;
import jx.buffer.separator.*;
import jx.devices.DeviceConfigurationTemplate;
import jx.devices.DeviceConfiguration;
import jx.buffer.multithread.MultiThreadBufferList;
import jx.buffer.multithread.Buffer;
import jx.buffer.multithread.MultiThreadBufferList2;
import jx.buffer.multithread.Buffer2;
/**
* the class D3C905 is the main class for the network interface driver
* it has methods to handle the initialization (for several different cards with a different way to initialize them)
* of course it does all the interrupt handling stuff and has methods for every kind of interrupt that can occur
* the sending of data is also offered by some methods
* the interfaces this class implements are PCIDevice as the supported NICs are PCI cards
* IRQHandler indicates that the class deals with the interrupt handling of the device
* NetworkDevice is the interface that defines the methods a network card at least has to offer (see description there)
*/
public class D3C905 implements FirstLevelIrqHandler, NetworkDevice, MemoryProducer {
private final static boolean debug = false;
private final static boolean debugSend = false;
private final static boolean debugReceive = false;
private final static boolean debugPacketNotice = false;
private final static boolean debugLargeMemory = false; // message when getting a memory object that is too large
private final static boolean assertions = true;
final static int NIC_PCI_DEVICE_ID_9055 = 0x9055;
final static int NIC_PCI_DEVICE_ID_9056 = 0x9056;
final static int NIC_PCI_DEVICE_ID_9058 = 0x9058;
final static int NIC_PCI_DEVICE_ID_9004 = 0x9004;
final static int NIC_PCI_DEVICE_ID_9005 = 0x9005;
final static int NIC_PCI_DEVICE_ID_9006 = 0x9006;
final static int NIC_PCI_DEVICE_ID_900A = 0x900A;
final static int NIC_PCI_DEVICE_ID_905A = 0x905A;
final static int NIC_PCI_DEVICE_ID_9200 = 0x9200;
final static int NIC_PCI_DEVICE_ID_9800 = 0x9800;
final static int NIC_PCI_DEVICE_ID_9805 = 0x9805;
final static int NIC_IO_PORT_REGISTERED = 0x00000001;
final static int NIC_INTERRUPT_REGISTERED = 0x00000002;
final static int NIC_SHARED_MEMORY_ALLOCATED = 0x00000004;
final static int NIC_TIMER_REGISTERED = 0x00000010;
final static int NIC_VENDOR_ID = 0x10B7;
/* for NICSetReceiveMode defining the various receive modes */
final static int IFF_PROMISC = 0x100; // receive all packets
final static int IFF_ALLMULTI = 0x200; // receive all multicast packets
final static int IFF_MULTICAST = 0x1000; // Supports multicast
/* starting from here follow the helper classes the driver needs in order to fullfill its tasks
for example methods for reading the eeprom or the MII */
/*
private PCIDevInfo PCIInfo;
private PCIBus bus;
*/
private Befehl befehl;
private Eeprom eeprom;
private Register register;
private BitPosition bits;
private Clock clock;
private WaitTimerGlobal waitglobal;
private IRQ irq;
private TimerManager timerManager;
private MemoryManager memMgr;
private CPUManager cpuManager;
private Ports ports;
private NicInformation Adapter;
private Mii mii;
/* handles to the beginning of the ring of download and upload managment objects */
DpdListEntry firstdpd;
UpdListEntry firstupd;
DpdListEntry firsttestdpd;
/* helper object handles for the management of the descriptor lists */
DpdListEntry currentdpd;
UpdListEntry currentupd;
DpdListEntry previousdpd;
UpdListEntry previousupd;
DpdListEntry testhelpdpd;
DpdListEntry previoustestdpd;
int count;
/* Storage needed by the UPDs */
Memory storage;
/* the consumer which consumes our received packets */
NonBlockingMemoryConsumer etherConsumer;
MultiThreadBufferList usableBufs /*, intransmitBufs*/;
int event_interrupt;
int event_snd;
int event_rcv;
/**
* @param pcidevice contains information about the PCI NIC
* @param etherConsumer the consumer of the ethernet packets that arrive at the nic
* @exception a D3C905Exception is thrown if problems with the allocation of the memory objects needed by the descriptors occur
*/
public D3C905(PCIDevice pcidevice, Ports ports, Clock clock, IRQ irq, MemoryManager memMgr, TimerManager timerManager, CPUManager cpuManager, NonBlockingMemoryConsumer etherConsumer, Memory[] bufs) throws D3C905Exception {
this.clock = clock;
this.irq = irq;
this.memMgr = memMgr;
this.timerManager = timerManager;
this.ports = ports;
this.etherConsumer = etherConsumer;
this.cpuManager = cpuManager;
this.usableBufs = new MultiThreadBufferList2(bufs);
this.usableBufs.enableRecording("D3C905-available-queue");
//this.intransmitBufs = new MultiThreadBufferList2();
// event type
event_interrupt = cpuManager.createNewEvent("3C905interrupt");
event_snd = cpuManager.createNewEvent("3C905Snd");
event_rcv = cpuManager.createNewEvent("3C905Rcv");
// additionally the irq is also saved in Adapter
int irqnum = pcidevice.getInterruptLine();
befehl = new Befehl(ports, timerManager);
eeprom = new Eeprom(ports, timerManager);
register = new Register();
bits = new BitPosition();
// for timer handling
// parameter passing with the timers
waitglobal = WaitTimerGlobal.instance();
// the main information class
Adapter = new NicInformation(pcidevice);
mii = new Mii(ports, timerManager);
// register the interrupt-handler
irq.installFirstLevelHandler(irqnum, this);
irq.enableIRQ(irqnum);
/*
* now we construct the lists for sending and reception of data and allocate memory for the buffers
* the first one is the download list
*/
for (count = 0; count < AdapterLimits.NIC_DEFAULT_SEND_COUNT; count++) {
currentdpd = new DpdListEntry(memMgr);
if (count == 0) {
firstdpd = currentdpd;
}
else {
previousdpd.Next(currentdpd);
currentdpd.Previous(previousdpd);
}
previousdpd = currentdpd;
}
// link first and last one
firstdpd.Previous(currentdpd);
currentdpd.Next(firstdpd);
// save the first one in NicInformation
Adapter.HeadDPD = firstdpd;
Adapter.TailDPD = firstdpd;
/*
* create the upload list
*/
for (count = 0; count < AdapterLimits.NIC_DEFAULT_RECEIVE_COUNT; count++) {
currentupd = new UpdListEntry(memMgr);
if (count == 0) {
firstupd = currentupd;
}
else {
previousupd.Next(currentupd);
previousupd.UpNextPointer(currentupd.UPDPhysicalAddress());
currentupd.Previous(previousupd);
}
previousupd = currentupd;
}
Debug.out.println("D3C905: Allocated buffers for upload:"+AdapterLimits.NIC_DEFAULT_RECEIVE_COUNT);
// link first and last one
currentupd.Next(firstupd);
currentupd.UpNextPointer(firstupd.UPDPhysicalAddress());
firstupd.Previous(currentupd);
// save the first one in NicInformation
Adapter.HeadUPD = firstupd;
/*
* allocate the testbuffers - here we just have DPDs, but with a storage attached
*/
for (count = 0; count < NicInformation.MAXIMUM_TEST_BUFFERS; count++) {
testhelpdpd = new DpdListEntry(memMgr);
if (count == 0) {
firsttestdpd = testhelpdpd;
}
else {
previoustestdpd.Next(testhelpdpd);
testhelpdpd.Previous(previoustestdpd);
}
storage = memMgr.alloc(AdapterLimits.ETHERNET_MAXIMUM_FRAME_SIZE);
if (storage == null) {
Debug.out.println("D3C905: can愒 allocate memory for TestDPDs! - Terminating");
throw new D3C905Exception("Coudn愒 allocate memory!");
}
// now store the information about the memory objects in our dpd-ob
没有合适的资源?快使用搜索试试~ 我知道了~
jx-0.1.rar_JXOS_jx
共2805个文件
java:2043个
cvsignore:273个
meta:159个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 187 浏览量
2022-09-24
00:07:43
上传
评论
收藏 2.68MB RAR 举报
温馨提示
jxos,java写的os,本地化编译后,只需要一张软盘的体积,启动非常快
资源推荐
资源详情
资源评论
收起资源包目录
jx-0.1.rar_JXOS_jx (2805个子文件)
00INDEX 534B
ADD_TO_ZIP 225B
Makefile.am 2KB
Makefile.am 596B
Makefile.am 404B
Makefile.am 396B
Makefile.am 265B
Makefile.am 237B
AUTHORS 594B
AUTHORS 153B
AUTHORS 126B
AUTHORS 126B
AUTHORS 80B
AUTHORS 79B
AUTHORS 76B
AUTHORS 76B
AUTHORS 66B
AUTHORS 61B
AUTHORS 57B
AUTHORS 28B
AUTHORS 28B
AUTHORS 28B
AUTHORS 28B
boot.rc.awt 1KB
boot.rc.awt_screenshot 2KB
setupenv.bash 870B
build 374B
load.c 79KB
portal.c 74KB
minilzo.c 64KB
monitor.c 61KB
gc_org.c 60KB
zero_Memory_org.c 52KB
profile.c 37KB
javascheduler.c 34KB
minic.c 28KB
gc_new.c 24KB
gc_move.c 22KB
gc_chunked.c 22KB
malloc.c 21KB
domain.c 20KB
thread.c 20KB
zero_CPUManager.c 20KB
irq.c 19KB
gc_bitmap.c 18KB
gc_pa.c 18KB
zero_FBEmulation.c 17KB
sched_global_rr.c 17KB
zero_DomainManager.c 16KB
gc_compacting.c 16KB
io_apic.c 16KB
smp_detect.c 14KB
serial.c 14KB
gc.c 13KB
vmsupport.c 13KB
multiboot.c 13KB
gc_alloc.c 13KB
zero.c 13KB
zero_SMPCPUManager.c 12KB
gc_stack.c 11KB
gc_impl.c 11KB
exception_handler.c 11KB
zero_object.c 10KB
runq.c 10KB
gc_move_common.c 10KB
zero_Memory_shared.c 10KB
gc_common.c 9KB
serialdbg.c 9KB
zero_Memory_new.c 9KB
lapic.c 9KB
zero_IRQ.c 9KB
zero_LLSchedulerSupport.c 9KB
sched_local_rr.c 9KB
thread_profile.c 8KB
smp_activate.c 8KB
zero_Memory_simple.c 8KB
math.c 8KB
execJAVA.c 8KB
bdt.c 7KB
gc_checkheap.c 7KB
thread_debug.c 7KB
gc_memcpy.c 7KB
runq_inline.c 6KB
gc_thread.c 6KB
memfs.c 5KB
smp.c 5KB
thread_emulation.c 5KB
crc32.c 5KB
zip.c 5KB
zero_HLSchedulerSupport.c 5KB
zero_NetEmulation.c 5KB
sched_local_java.c 4KB
main.c 4KB
zero_Profiler.c 4KB
zero_Naming.c 4KB
zero_Ports.c 4KB
gc_pgc.c 3KB
minic_debug.c 3KB
zero_InterceptorInboundInfo.c 3KB
ekhz.c 3KB
共 2805 条
- 1
- 2
- 3
- 4
- 5
- 6
- 29
资源评论
JaniceLu
- 粉丝: 78
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功