Ejemplo n.º 1
0
        private Packet MakePacketFromDescriptor(DmaMemory mem, ulong controlBits)
        {
            PacketFifo inDevPkts = rxPacketsInDevice.Acquire();
            Packet     packet    = inDevPkts.Pop();
            int        length    = (int)((controlBits & RxDescriptor.LENGTH_MASK)
                                         >> RxDescriptor.LENGTH_SHIFT);
            uint stat_err = (uint)((controlBits & RxDescriptor.ERR_STAT_MASK)
                                   >> RxDescriptor.ERR_STAT_SHIFT);

            // can't deal with fragments yet
            if ((stat_err & RxErrStatFields.END_OF_PACKET) == 0)
            {
                INucleusCalls.DebugPrintHex(40, 0xd0);
                DebugStub.Print("FRAGMENT\n");
                throw new Exception();
            }

            //DebugStub.Assert((stat_err & RxErrStatFields.END_OF_PACKET) != 0);
            //DebugStub.Assert(packet.GetFragmentVirtualAddress(0) == fragmentVirtAddr);
            packet.FromDeviceFlags = GetRecvPktFlags(stat_err);
            packet.SetFragment(0, mem.BytesRef(0, length));
            rxPacketsInDevice.Release(inDevPkts);

            return(packet);
        }
Ejemplo n.º 2
0
        ///////////////////////////////////////////////////////////////////////
        //
        // Buffer Operations, should only be called when a lock is held
        // this ring buffer.
        //
        private void _LockedPushTsmtBuffer(Packet packet)
        {
            // (ARM only, not x86) PlatformService.CleanAndInvalidateDCache(packetVirtAddr, (UIntPtr)length);
            int length = packet.GetLength();

            ulong controlBits = (ulong)ByteOrder.HostToLittleEndian(length);

            // set necessary command fields
            controlBits |= (TxCmdFields.END_OF_PACKET | TxCmdFields.INSERT_FCS |
                            TxCmdFields.REPORT_STATUS);

            DmaMemory mem = txRingBuffer.PeekHead();

            packet.CopyToBytes(mem.BytesRef());
            txRingBuffer.Push(controlBits);
        }