public override bool InitServer() { System.Diagnostics.Debugger.Log(0, null, "Framebuffer driver started"); /* Parse properties */ foreach(var prop in root) { if (prop.Name == "pmem") pmem = prop.Value as tysos.PhysicalMemoryResource64; else if (prop.Name == "vmem") vmem = prop.Value as tysos.VirtualMemoryResource64; else if (prop.Name == "height") h = (int)prop.Value; else if (prop.Name == "width") w = (int)prop.Value; else if (prop.Name == "bpp") bpp = (int)prop.Value; else if (prop.Name == "pformat") pformat = (int)prop.Value; else if (prop.Name == "stride") str = (int)prop.Value; } if (pmem == null) { System.Diagnostics.Debugger.Log(0, null, "pmem not provided"); return false; } if (vmem == null) { System.Diagnostics.Debugger.Log(0, null, "vmem not provided"); return false; } pmem.Map(vmem); buf = vmem.ToArray(); System.Diagnostics.Debugger.Log(0, null, "Mode: " + w.ToString() + "x" + h.ToString() + "x" + bpp.ToString() + ", stride: " + str.ToString() + ", pformat: " + pformat.ToString() + ", paddr: " + pmem.Addr64.ToString("X") + ", vaddr: " + vmem.Addr64.ToString()); if(bpp != 32) { System.Diagnostics.Debugger.Log(0, null, "BPP " + bpp.ToString() + " not supported"); return false; } for(int y = 0; y < h; y++) { for (int x = 0; x < w; x++) SetPixel(x, y, 0x000000ff); } root.Add(new File.Property { Name = "class", Value = "framebuffer" }); Tags.Add("class"); return true; }
public RingBufferEntry(tysos.VirtualMemoryResource64 vmem, int offset_to_rde, int offset_to_data, int index, bool is_transmit, int len) { length = len; idx = index; is_tx = is_transmit; VirtualMemoryResource64 new_vmem = vmem.Split(vmem.Addr64 + (ulong)offset_to_data, (ulong)length) as VirtualMemoryResource64; d = new_vmem.ToArray(); buf_addr = vmem.MappedTo.Addr64 + (ulong)offset_to_data; InitRDE(vmem.ToArray(), offset_to_rde); }